Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!lll-winken!ames!orion.arc.nasa.gov!ogawa From: ogawa@orion.arc.nasa.gov (Arthur Ogawa) Newsgroups: comp.text.tex Subject: Re: LaTex \caption command Message-ID: <1991Mar5.064457.20867@news.arc.nasa.gov> Date: 5 Mar 91 06:44:57 GMT References: <1991Mar4.224724.2116@macc.wisc.edu> Sender: usenet@news.arc.nasa.gov (USENET Administration) Organization: NASA Ames Research Center, Moffett Field, CA Lines: 78 Bcc: ogawa In article <1991Mar4.224724.2116@macc.wisc.edu> bruggink@vms.macc.wisc.edu writes: | |The \caption command generates *both* table and figure captions; I want |table captions to be in a different font and format than figure captions, |and I want to continue using "\caption" so that the auto-numbering of |tables and figures is preserved. | |Can anyone suggest a way to do this within a .STY file?? The bad news is that I couldn't figure a way to do this purely within a STY file. The good news is that only a slight modification (backward compatible) to LaTeX is needed to accomplish our goal. A comment: The poster correctly chooses to continue to use the same markup for the caption no matter whether it lies within a figure or table. This is a choice in favor of descriptive markup---the correct choice IMHO. ************* cut here---beginning of Bruggink.sty ********** % Bruggink.sty---provide for independent formatting for float captions. % The following is a re-definition of the \@caption macro which lets % you format your figure captions differently from your table captions, etc. % Your .sty file must provide for a meaning for, e.g., \@makefigurecaption, % etc. If you do not, the default \@makecaption will be used. \long\def\@caption#1[#2]#3{\par\addcontentsline{\csname ext@#1\endcsname}{#1}{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}\begingroup \@parboxrestore \normalsize \expandafter\let\expandafter\@tempa\csname @make#1caption\endcsname \ifx\@tempa\relax\let\@tempa\@makecaption\fi \@tempa{\csname fnum@#1\endcsname}{\ignorespaces #3}\par \endgroup} % % Here is the content of a .sty file containing definitions using the above hook. % % The following is the same as the \@makecaption in book.sty: \long\def\@makefigurecaption#1#2{% \vskip 10pt \setbox\@tempboxa\hbox{#1: #2}% \ifdim \wd\@tempboxa >\hsize #1: #2\par \else \hbox to\hsize{\hfil\box\@tempboxa\hfil}% \fi} % % The following is slightly different from the \@makecaption in book.sty: \long\def\@maketablecaption#1#2{% \vskip 10pt \setbox\@tempboxa\hbox{#1. #2}% \ifdim \wd\@tempboxa >\hsize #1. #2\par \else \hbox to\hsize{\hfil\box\@tempboxa\hfil} % \fi} ************* cut here---end of Bruggink.sty ********** And here is a document instance to test the above .sty. Note that this .sty is tested here with book.sty; it should work equally well with article.sty ************* cut here---beginning of Bruggink.tex ********** % Bruggink.tex---illustrate how to use Bruggink.sty \documentstyle{book} \documentstyle{bruggink} \begin{document} \begin{figure}[h] Content of figure \caption{Figure caption}% \end{figure} \begin{table}[h] Content of table \caption{Table caption}% \end{table} \end{document} ************* cut here---end of Bruggink.tex ********** Hope this helps, Art Ogawa TeX Consultants