TikZ-Pgf – Minipage Footnote Inside TikZ Node Solutions

footnotesminipagetikz-pgf

I have a minipage, and inside of it I have a footnote and a tikZ picture. Now my problem is, that the footnote text goes inside the last node of my tikZ picture. That is not what I want – and it's very weird actually.

Code and output

\documentclass{article}

\usepackage{tikz,lipsum}

\begin{document}

\begin{minipage}{\textwidth}
\lipsum[1]\footnote{a footnote}% I cannot use \footnotemark etc
    \begin{tikzpicture}[overlay, remember picture]% I need these two options
        \draw[ultra thick, black] (0,0) -- node[sloped,below,text width=12cm,text centered]
{\lipsum[4]} (11,-3);% the text has to have a maximal width
    \end{tikzpicture}
\end{minipage}

\end{document}

Screenshot

First workaround

When I remove the text width = 12cm completely, the footnote moves back under the end of the text:

Screenshot after workaround

But I need the text to have a maximal width. So this is not very satisfying. Any ideas?

Best Answer

where we learn tikz uses minipage internally:-)

this saves and restores the footnotes to stop tikz seeing it, so the footnote comes in the right place, the rotated tikz picture overprints but I guess someone who knows tikz can fix that...

enter image description here

\documentclass{article}

\usepackage{tikz,lipsum}

\begin{document}

\begin{minipage}{\textwidth}
\lipsum[1]\footnote{a footnote}% I cannot use \footnotemark etc
    \setbox0\box\csname@mpfootins\endcsname
    \begin{tikzpicture}[overlay, remember picture]% I need these two options
        \draw[ultra thick, black] (0,0) -- node[sloped,below,text width=12cm,text centered]
{\lipsum[4]} (11,-3);% the text has to have a maximal width
    \end{tikzpicture}\global\setbox\csname@mpfootins\endcsname\box0
\end{minipage}

\end{document}