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.

How can I add a source to a figure? I need to add \ref, \cite or just free text. Something like that:

\begin{figure} [ht]
  \centering
  \includegraphics[width=0.95\textwidth]{res/figure.pdf}
    \caption{Caption}
    \source{\ref{},\cite{} or free Text}
  \label{fig:gliederung}
\end{figure}

Should give me:

Result

The source shouldn't appear in \listoffigures.

share|improve this question
2  
Have you tried \caption[Caption]{Caption. Source: here the source of the picture}? –  Daniel Jan 23 '13 at 16:26
add comment

1 Answer 1

up vote 1 down vote accepted

There are many ways to do this. The source could be put inside the caption. LaTeX puts the caption in one line, if it fits there. This can be prevented by \hspace{\linewidth} in the following example. When LaTeX tests the width by putting it in a \hbox, then \hspace is taken into account. LaTeX concludes that the caption does not fit into one line and by setting it in several lines, the line break is executed and the white space right after it (\hspace{\linewidth}) is ignored:

\documentclass{article}

\newcommand*{\captionsource}[2]{%
  \caption[{#1}]{%
    #1%
    \\\hspace{\linewidth}%
    \textbf{Source:} #2%
  }%
}

\begin{document}
\begin{figure} [ht]
  \centering
  \captionsource{Caption}{ref, cite or free Text}
  \label{fig:gliederung}
\end{figure}
\end{document}

Alternatively package caption provides an option singlelinecheck, where the testing for fitting into a line can be disabled, using possible multi-line mode always.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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