[Tugindia] how to flushleft figure caption

Ragu ragu at ttiindia.com
Thu Apr 3 13:48:23 CEST 2003


Dear User,

Check the following macros for your purpose to keep the single line caption center to your figure and multiline caption to flushleft. 

But for some publishers, they need to have the last line center to the figure and the rest of the lines fluesh left. Please check which format your publishe likes ...


################## --begin --S.Ragu

\def\HD#1#2{\vrule height #1pt depth #2pt width 0pt\relax}

\newcommand\listfigurename{List of Figures}
\newcommand\figurename{Figure}
\newcounter{figure}
\def\thefigure{\arabic{figure}}
\def\fps at figure{tbp}
\def\ftype at figure{1}
\def\ext at figure{lof}
\def\fnum at figure{{\figurename\enskip\thefigure.}}

\newenvironment{figure}
               {\let\@makecaption\@makefigurecaption\def\pushme{\relax}%
                \def\CCC{\def\pushme{\hfil}}\@float{figure}}
               {\end at float}
\newenvironment{figure*}
               {\let\@makecaption\@makefigurecaption\def\pushme{\relax}%
                \def\CCC{\def\pushme{\hfil}}\@dblfloat{figure}}
               {\end at dblfloat}

\long\def\@makefigurecaption#1#2{\fontsize{9}{11}\selectfont
     \setbox\@tempboxa=\hbox{\HD{18}{0}{#1}\hskip0.9em{#2}}%
     \ifdim \wd\@tempboxa >\hsize
       \noindent\HD{18}{0}{#1}\hskip0.6em\raggedright
       {#2}\HD{0}{4}\vspace*{-4pt}\endgraf
     \else
       \noindent\null\hfill\HD{12}{0}{#1}\hskip0.9em
         {#2}\hfill\HD{0}{4}\vspace*{-4pt}
     \fi
}

################## --end --S.Ragu


With Warm Regards
S.Ragu



More information about the Tugindia mailing list