Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

Has anyone an idea how to use tikzpicture WITHIN a figure caption? What I want is, plot a blue circle withing a figure caption, like:

\begin{figure}[ht]
%...
\caption{CaptionText \begin{tikzpicture} \draw[thick, color=blue, fill=blue] plot[mark=*, mark options={scale=1.3}] (0,0); \end{tikzpicture} CaptionText.}
\end{figure}

Within regular text, this works fine with

RegularText \begin{tikzpicture} \draw[thick, color=blue, fill=blue] plot[mark=*, mark options={scale=1.3}] (0,0); \end{tikzpicture} RegularText
share|improve this question

marked as duplicate by Jubobs, lockstep, Claudio Fiandrino, mafp, egreg May 21 '13 at 9:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Welcome to TeX.SX! You may have a look on our starter guide. –  Jubobs May 21 '13 at 8:53

1 Answer 1

As Jubobs pointed out, this question has already been answered: Using TikZ inside a figure caption. For your situation, I got it to work by adding \protect to the tikz commands:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{figure}[h]
-- This is a figure --
\caption{Figure within caption {\protect\tikz \protect\draw[thick, color=blue, fill=blue] plot[mark=*, mark options={scale=1.3}] (0,0);} }
\end{figure}

\end{document}
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.