# tikzpicture within figure caption [duplicate]

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

-

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

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

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}

-