Text FormattingGiving source URL in Figure environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Giving source URL in Figure environment

Post by latexforever »

Hello,

We usually write

Code: Select all

\begin{figure}
\includegraphics[...]
\caption{A caption}
\label{fig:label1}
\end{figure}
when putting a figure in a .tex document. It results in a ``caption'' field, displayed under or at the top of the figure.

I would now like to put another field under / (at the top of) the figure: the URL source of it.
How can I do this? Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Giving source URL in Figure environment

Post by localghost »

Generally you can put everything into a figure environment what you want. For justification to the left of the contents it may be better to add a box like the following code shows.

Code: Select all

\begin{figure}[!ht]
  \centering
  \parbox{0.75\linewidth}{%
    Any Text that you want above \ldots\\[\smallskipamount]
    \rule{\linewidth}{0.75\linewidth}\\[\smallskipamount]
    \ldots or below the image.
  }
  \caption{A caption}\label{fig:label1}
\end{figure}
The \parbox can be replaced with a minipage environment. In the special case of a URL you can use the hyperref package to generate an according link in the output.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Giving source URL in Figure environment

Post by latexforever »

Thanks for your example. I learnt something. However, I would want to define a field like caption and label.

For example, I would like to be able to write

Code: Select all

\begin{figure}[f]
  \centering
  \parbox{0.75\linewidth}{%
    Any Text that you want above \ldots\\[\smallskipamount]
    \rule{\linewidth}{0.75\linewidth}\\[\smallskipamount]
    \ldots or below the image.
  }
  \caption{A caption}\label{fig:label1}
\provenanceurl{http://www.foo.com/bar.jpg}
\end{figure}
,
this url being displayed, e.g. under the picture.

Is it possible to do this easily?
Post Reply