Computer · Electronics&Communication

Instant LaTeX command for small figure and table caption.

In some conference, the conference format requires that the font size of the Figure caption or table caption are needed to be smaller than the other text in the paper. However, the font size of the caption cannot locally adjust directly using \font command. So this instant code is needed in order to achieve this requirement.

% Different font in captions
\newcommand{\captionfonts}{\small}

\makeatletter % Allow the use of @ in command names
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{{\captionfonts #1: #2}}%
\ifdim \wd\@tempboxa >\hsize
{\captionfonts #1: #2\par}
\else
\hbox to\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother % Cancel the effect of \makeatletter

Just copy above code the the header of the Tex file (before the \begin{document}) and that’s it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s