Graphics, Figures & TablesFigure in a caption of a figure... is it possible?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Giaco_O
Posts: 2
Joined: Sat Nov 14, 2020 1:21 pm

Figure in a caption of a figure... is it possible?

Post by Giaco_O »

Hello everyone,

is there a way to insert a figure in the caption of a figure?

It is not easy to do, but there must be a way...

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Figure in a caption of a figure... is it possible?

Post by Ijon Tichy »

Not a figure, because a figure environment is a floating environment an a float inside the \caption of a float does not make any sense. But you can use an image, e.g., \includegraphics.

If you need more specific help, please show us a Infominimal working example and explain, what you are trying to do.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Giaco_O
Posts: 2
Joined: Sat Nov 14, 2020 1:21 pm

Figure in a caption of a figure... is it possible?

Post by Giaco_O »

Ijon Tichy wrote:Not a figure, because a figure environment is a floating environment an a float inside the \caption of a float does not make any sense. But you can use an image, e.g., \includegraphics.

If you need more specific help, please show us a Infominimal working example and explain, what you are trying to do.
Thank you for your answer.

Yes, not a figure but an \includegraphics.

Is there a way to insert an \includegraphics in a caption? This is an example.

Code: Select all

\begin{figure}[t]
	\centering
	\includegraphics[width=1\columnwidth,page=1]{the_main_figure.pdf}
	\caption{
	the figure is of type \includegraphics[scale=0.1]{a_second_figure.pdf}
	}
\end{figure}
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Figure in a caption of a figure... is it possible?

Post by Ijon Tichy »

Giaco_O wrote:This is an example.

Code: Select all

\begin{figure}[t]
	\centering
	\includegraphics[width=1\columnwidth,page=1]{the_main_figure.pdf}
	\caption{
	the figure is of type \includegraphics[scale=0.1]{a_second_figure.pdf}
	}
\end{figure}
But unfortunately not a complete/workable one: → Infominimal working example

This one does work using an up-to-date LaTeX and graphicx version:
\documentclass{article}

\usepackage{graphicx}

\begin{document}
    \begin{figure}
    	\centering
    	\includegraphics[width=1\columnwidth,page=1]{example-image-a}
    	\caption{%
          the figure is of type \includegraphics[scale=0.1]{example-image}
    	}
    \end{figure}
\end{document}
and results in:
screenshot from minimalworkingexample.pdf
screenshot from minimalworkingexample.pdf
test_20201116_100843.png (17.79 KiB) Viewed 1606 times
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply