# figure/table caption formatting without packages

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.comOct 6 '11 at 12:04

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

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

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