TeXnik - Tips TeX and LaTeX


Welcome to the TeXnik website (under construction)

Captions
TUG logo

Main page

Index
UK FAQ
Documentation
Software
CTAN
Search CTAN:

Statistics

Google c.t.t.

Google d.c.t.t.

 


 


captions apart from floats |  caption beside figure/table |  captions in non-Floats |  Captions not listed in LOF/LOT |  caption over/under floats |  caption-layout  |  Caption width |  Center last Line | 
float beside caption | 
Left aligned Captions |  Linespacing |  List of Figures/Tables - no entry | 
Mathsymbol in caption | 
Problems | 
space over/under captions |  spacing | 
Vertical spacing  | 
Width of the caption | 
Packages
capt-of
captcont
caption
ccaption
figcaps
ftcap
hangcaption
hvfloat
multicap
nonfloat
sidecap
smallcap
topcapt


Captions not listed in LOF/LOT

Captions apart from Floats
If you need your floats on own pages only with a caption like "Figure #" and additionally a list of corresponding captions, try the following (needs endfloat.sty):

write in preamble:

\usepackage{endfloat}
\let\Caption\caption
\renewcommand\caption[1]{%
    \Caption[#1]{}%
}
and insert your listoffigures in your text as usual. With this trick you can not use the short caption option like
\caption[short for toc]{long for caption}

Left aligned Captions
Write in preamble:

\makeatletter
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1: #2}%
  \ifdim \wd\@tempboxa >\hsize
    #1: #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\makeatother

Center last Line
It's no problem to center the caption, but this doesnn't happens for the last line, which is still left aligned. Write in preamble:

\usepackage{ccaption}
\captionstyle{\centerlastline}

Linespacing in Captions
Documentwide spacing is not important for captions. If you want to change the linespacing in captions too, write in preamble:

\usepackage{setspace}
\let\myCaption\caption
\renewcommand\caption[1]{%
  \doublespacing
  \myCaption{#1}
}

Caption over/under floats
Sometimes the captions for tables are above and for figures under the float. This gives a bad layout, because the values for \abovecapatinskip and \belowcaptionskip are not the same. In this case you can change the values for the tables with a caption over the float. Write in latex preamble:

\makeatletter
\newcommand{\@ldtable}{}
\let\@ldtable\table
\renewcommand{\table}{%
                 \setlength{\@tempdima}{\abovecaptionskip}%
                 \setlength{\abovecaptionskip}{\belowcaptionskip}%
                 \setlength{\belowcaptionskip}{\@tempdima}%
                 \@ldtable}
\makeatother 


Vertical space over/under captions

\setlength{\abovecaptionskip}{0.5cm}   % 0.5cm as an example
\setlength{\belowcaptionskip}{0.5cm}   % 0.5cm as an example


captionlayout

can be changed easy with the package caption, available at CTAN for download.
Example:

\usepackage[it]{caption}    % captionfontattribut italic
\renewcommand\captionmargin{1cm}  % new left and rightmargin
other packages are
  • hangcaption for captions with hanging indentations. download

    With package ccaption.sty (double c!) you can change the captionlayout, too. F.ex.:

    \usepackage{ccaption} % that is double c
    \captionnamefont{\bfseries}
    \captiontitlefont{\bfseries} 


    caption (Problems)

    in the floating figure or table environment the captionstyle works not with special commands (e.g.math-symbols). Choose one of the following possibilities to shun an error:

  • write \protect before your latex command (e.g.: $\protect\overrightarrow{arrow}$)
  • or define an own caption in the latex preamble
    \newcommand\myCaption[1]{\small\refstepcounter{figure}%
       \centering\figurename\ \thefigure :\ #1}
    in the float (!) choose paragraphstyle standard instead of captionstyle and write
    \myCaption{...the captiontext ...}
    myCaption is only needful for captions with special math-symbols or special commands. counting of figure is continuing.
  • local time: Fri Apr 19 00:49:16 CEST 2024 ; file is: 1756.11751157407 days old
    contact webmaster _at_ TeXnik.de