Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!jarthur!usc!cs.utexas.edu!helios!diamond!jdm5548 From: dhosek@sif.claremont.edu (Hosek, Donald A.) Newsgroups: comp.text.tex Subject: Re: LaTeX figure \caption question Message-ID: <8240@jarthur.Claremont.EDU> Date: 31 Aug 90 02:16:57 GMT References: Sender: news@jarthur.Claremont.EDU Reply-To: dhosek@sif.claremont.edu Distribution: comp Organization: Harvey Mudd College Lines: 76 In article <7865@helios.TAMU.EDU>, jdm5548@diamond.tamu.edu (James Darrell McCauley) writes... ->In article , ->bjr@clarity.Princeton.EDU (Brian J. Reiser) writes: ->|> Is there any simple way to modify the formatting of latex figure ->|> captions? I have some longish captions (approx 3-4 sentences) that ->|> are associated with some graphs included in the document as figures. ->|> The default formatting for \caption is apparently the normal text ->|> size, and if the text is longer than one line, it is in a paragraph ->|> the same width as the text. I would like to have the captions printed ->|> slightly smaller, and in a width indented from the width of the text. ->|> At the suggestion of a colleague, I tried defining my own version of ->\caption: ->|> \newcommand{\figcaption}[1]{\begin{center} ->|> \parbox[t]{5in}{\caption{\protect\small #1}} ->|> \end{center}} ->.... ->|> Does anyone have a better suggestion? ->Is this better? The words "Figure 11" are the same size as the text: ->\newcommand{\figcaption}[1]{\begin{center} -> \addtocounter{figure}{1} -> \parbox[t]{5in}{\protect\small -> Figure \thefigure : #1} -> \end{center}} Sigh. Suppose he wanted a list of figures too? OK, the correct way for changing the formatting of a caption: LaTeX defines \caption so that the actual printing of the caption text is handled by the \@makecaption macro. For example, article.sty defines \@makecaption to center the caption if it is one line or less and to typeset it as a paragraph otherwise with the definition: % \@makecaption{NUMBER}{TEXT} : Macro to make a figure or table caption. % NUMBER : Figure or table number--e.g., 'Figure 3.2' % TEXT : The caption text. % Macro should be called inside a \parbox of right width, with \normalsize. % changed 25 Jun 86 to fix according to Howard Trickey: % instead of \unhbox\@tempboxa\par we do #1: #2\par \long\def\@makecaption#1#2{ \vskip 10pt \setbox\@tempboxa\hbox{#1: #2} \ifdim \wd\@tempboxa >\hsize % IF longer than one line: #1: #2\par % THEN set as ordinary paragraph. \else % ELSE center. \hbox to\hsize{\hfil\box\@tempboxa\hfil} \fi} The following code (placed in mycaption.sty, say) will produce centered nine-point captions in 10pt text (the caption size will increase with the text size as \small grows). \long\def\@makecaption#1#2{ \begin{center} \small #1: #2\par \end{center}} Note that the \vskip was removed since the center environment carries its own space around with it. -dh --- Don Hosek TeX, LaTeX, and Metafont support, consulting dhosek@ymir.claremont.edu installation and production work. dhosek@ymir.bitnet Free Estimates. uunet!jarthur!ymir Phone: 714-625-0147 finger dhosek@ymir.claremont.edu for more info