TeXnik - Tips TeX and LaTeX


Welcome to the TeXnik website (under construction)

Reference on subfigure
TUG logo

Main page

Index
UK FAQ
Documentation
Software
CTAN
Search CTAN:

Statistics

Google c.t.t.

Google d.c.t.t.

 


 


Write into the optional argument for the caption for example
\subfigure[A wonderful caption\label{sub1}]{...}
Now you are able to put refs in your text at any place with
... this belongs to fig.\ref{sub1} ...
for "sub1" you can write any other text.

sub3.gif

It is not possible to have an environment as argument for subfigure. If you need for example a verbatim or a lstlisting environment, then write into the preamble:
\usepackage{subfigure}
\newbox\subfigbox
\makeatletter
\newenvironment{subfloat}%
{\def\caption##1{\gdef\subcapsave{\relax##1}}%
  \let\subcapsave\@empty%
  \setbox\subfigbox\hbox%
  \bgroup}%
{\egroup%
  \subfigure[\subcapsave]{\box\subfigbox}}%
\makeatother
and in the the text for example:
\begin{figure}
  \centering%
  \begin{subfloat}%
    \rule{4cm}{3cm}
    \caption{\label{fig:label1}caption 1}%
  \end{subfloat}%
  \hspace{1.5cm}%
  \begin{subfloat}%
	  \begin{minipage}{0.3\linewidth}
	  \begin{verbatim}
blah fasel
bluuber laber
fasel laber quassel
	  \end{verbatim}
   	  \end{minipage}
    \caption{\label{fig:label2}caption 2}%
  \end{subfloat}%
  \caption{caption}
  \label{fig:label}
\end{figure}

local time: Sat Aug 24 02:53:28 CEST 2019 ; file is: 56.5636342592593 days old
contact webmaster _at_ TeXnik.de