Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

in-line tikz picture in figure caption

1,416 views
Skip to first unread message

Zarko F. Cucej

unread,
Feb 24, 2012, 7:43:54 AM2/24/12
to
Hi!,
I like to put some symbols from picture draw with TikZ into caption, i.e.:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{figure}\centering
\tikz\node[draw,circle] {T};
\caption{some text \tikz\node[draw,circle] {T};: token.}
\end{figure}
\end{document}


Trying this, I receive error:
Use of \tikz@picture doesn't much its definition
....

anyone solution?

regards, Zarko

Lars Madsen

unread,
Feb 24, 2012, 7:47:14 AM2/24/12
to
use protection

\protect\tikz\protect\node


--

/daleif (remove RTFSIGNATURE from email address)

Memoir and mh bundle maintainer
LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.minimalbeispiel.de/mini-en.html

Zarko F. Cucej

unread,
Feb 24, 2012, 9:34:38 AM2/24/12
to
On 24.2.2012 13:47, Lars Madsen wrote:
> Zarko F. Cucej wrote, On 2012-02-24 13:43:
>> Hi!,
>> I like to put some symbols from picture draw with TikZ into caption,
>> i.e.:
>>
>> \documentclass{article}
>> \usepackage{tikz}
>> \usetikzlibrary{shapes.geometric}
>>
>> \begin{document}
>> \begin{figure}\centering
>> \tikz\node[draw,circle] {T};
>> \caption{some text \tikz\node[draw,circle] {T};: token.}
>> \end{figure}
>> \end{document}
>>
>>
>> Trying this, I receive error:
>> Use of \tikz@picture doesn't much its definition
>> ....
>>
>> anyone solution?
>>
>> regards, Zarko
>
> use protection
>
> \protect\tikz\protect\node
>
>

thank you very much! this work! I try with one \protect before tikz, but
this wasn't help ...

regards, Zarko

Lars Madsen

unread,
Feb 24, 2012, 9:38:25 AM2/24/12
to
me too, so I tried two ... ;-)

Herbert Schulz

unread,
Feb 24, 2012, 10:09:41 AM2/24/12
to
Howdy,

While using \protect (for both the \tikz and \node commands will work
you could also do

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\DeclareRobustCommand{\myfig}{\tikz\node[draw,circle] {T};}

\begin{document}
\begin{figure}\centering
\myfig
\caption{some text \myfig: token.}
\end{figure}
\end{document}

--
Good Luck,
Herb Schulz

0 new messages