I've been inspired by this question to add sources to captions. Basically, to define a source in a comment a new command can be created,
\newcommand{\source}[1]{\caption*{\hfill Source: {#1}} }
And it would be sufficient to add a \source{Book}
to the figure
environment to have a source within the figure, without it appearing in the \listoffigures
.
Unfortunately, whenever I do this the following result is obtained:
The \caption*
command is not well-received by LaTeX and what's inside is still somehow read and intended as a caption. Apart from the horrible artifact of "Figure 1.2: *" in the text, in the list of figures this is still recorded, with a list going like
- Figure 1.1: Resistivity etc etc
- Figure 1.2: *
- Figure 1.3: Meaningful caption
- Figure 1.4: *
And so on.
Additional info: I'm using TeXstudio 2.10.8 with a base of MikTeX 2.9.4196 on Windows 10.
MWE:
\documentclass[12pt,a4paper]{report}
\usepackage{graphicx} %for figures
\newcommand{\source}[1]{\caption*{\hfill Source: {#1}} } %command definition for sources in figures
\begin{document}
\listoffigures
\chapter{On how my caption went wrong}
Well hello there.
\begin{figure}
\centering
% \includegraphics[width=0.7\linewidth]{whatevs}
\caption{Look at me I'm a caption}
\label{fig:preeetty_figure}
\source{Interesting book}
\end{figure}
\end{document}
Does anybody know why this is happening? Thanks in advance!
Best Answer
A
figure
environment can contain normal text as well, not just graphics and captions. As such, a simple way of achieving what you want isComplete code: