4

I am writing a document which needs to have tables and figures.

Normally for formatting the caption of figures/tables I use

\renewcommand{\@makecaption}

But it affects both tables and figures captions.

Is there any way to define different formatting for captions, e.g. bold captions for tables and italic captions for figures? I'd like to do this without using packages.

migrated from stackoverflow.com Oct 6 '11 at 12:04

This question came from our site for professional and enthusiast programmers.

  • 3
    Why is using a package not an option for you? – Paŭlo Ebermann Oct 6 '11 at 11:58
  • @Paŭlo Ebermann, there is no reason not using packages, i just want to find out if there is any private command or direct method for that! thanks anyway! – amrzar Oct 6 '11 at 12:15
6

Using the caption package is more friendly, as it allows for setting captions for figures and tables differently out of the box.

If you really don't want to use packages (I can't see why), then

\newcommand{\@maketablecaption}{...}
\newcommand{\@makefigurecaption}{...}
\toks@=\expandafter{\table}
\edef\table{\let\noexpand\@makecaption\noexpand\@maketablecaption\the\toks@}
\toks@=\expandafter{\figure}
\edef\figure{\let\noexpand\@makecaption\noexpand\@makefigurecaption\the\toks@}

where \@maketablecaption and \@makefigurecaption are defined as it suits you.

  • this is exactly what i was looking for! Thanks – amrzar Oct 6 '11 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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