I am using LaTeX and a custom style based on report.cls and I have to
change the arrangement of table caption that should be aligned left.
It has center alignment by default. I guess the following code should
be changed in order to make that possible:
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename\nobreakspace\thetable\nobreakspace--}
\newenvironment{table}
{\@float{table}}
{\end@float}
\newenvironment{table*}
{\@dblfloat{table}}
{\end@dblfloat}
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{10\p@}
\setlength\belowcaptionskip{0\p@}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1 #2}%
% \sbox\@tempboxa{\emph{#1} \emph{#2}}%
\ifdim \wd\@tempboxa >\hsize
#1 #2\par
%\emph{#1} \emph{#2}\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
I've tried to wrap "\sbox\@tempboxa{#1 #2}%" with \begin{flushleft}
\end{flushleft}, but it doesn't work.
I guess there is another way to implement it, do you have any ideas
about it?
--
Mikhail
why don't you just use the caption package, that's a lot easier
--
/daleif (remove RTFSIGNATURE from email address)
LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
\usepackage{caption}
\captionsetup[table]{width=0.9\textwidth,margin=0pt}
The caption is still in the center but should be started at the left
(as far as I understood). I've also checked that caption package was
loaded properly -- setting other options like font works fine.
'width=0.4' works too and 'margin=0.5/textwidth also works. How can
make caption started at the very beginning of the line?
> Hello,
>
> I am using LaTeX and a custom style based on report.cls and I have to
> change the arrangement of table caption that should be aligned left.
> It has center alignment by default. I guess the following code should
> be changed in order to make that possible:
[...]
> \long\def\@makecaption#1#2{%
> \vskip\abovecaptionskip
> \sbox\@tempboxa{#1 #2}%
> % \sbox\@tempboxa{\emph{#1} \emph{#2}}%
> \ifdim \wd\@tempboxa >\hsize
> #1 #2\par
> %\emph{#1} \emph{#2}\par
> \else
> \global \@minipagefalse
> \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
^^^^^^^^^^^^^^^^^^^^^^^^
If I'm not mistaken, this is where your caption is typeset, if it is
one-lined. Removing the first \hfil might do what you want. On the
whole, using the caption package might be easier?
> \fi
> \vskip\belowcaptionskip}
HTH
Ulrich
--
"Krautsalat für alle!"
(The New Rose Hotel)
Great! That works, but now I have the wrong justification of figure
labels (I need figure labels in center)
After applying:
\usepackage{caption}
\captionsetup[figure]{justification=centering}
I get table labels wrong aligned(I need them to be left justified as I
mentioned previously). This is like a circle (I should choose --
figure or table labels) :-)
> \usepackage{caption}
> \captionsetup[table]{width=0.9\textwidth,margin=0pt}
Note: If you specify both - width and margin - only the last one will be
used.
> The caption is still in the center but should be started at the left
\captionsetup[table]{singlelinecheck=off}
should do the trick.
HTH,
Axel