Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

table caption arrangement

0 views
Skip to first unread message

Mikhail Shevchuk

unread,
Jun 10, 2007, 1:19:47 AM6/10/07
to
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:

\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

Lars Madsen

unread,
Jun 10, 2007, 1:44:37 AM6/10/07
to

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

Mikhail Shevchuk

unread,
Jun 10, 2007, 2:46:59 AM6/10/07
to
Thanks for the reference, Lars, but I still have some problems with
this issue. After pasting the following code:

\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?

Ulrich M. Schwarz

unread,
Jun 10, 2007, 2:26:14 AM6/10/07
to
Mikhail Shevchuk <mikhail....@gmail.com> writes:

> 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)

Mikhail Shevchuk

unread,
Jun 10, 2007, 3:05:49 AM6/10/07
to
On Jun 10, 1:26 pm, brother...@gmx.net (Ulrich M. Schwarz) wrote:
...

> > \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?

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) :-)

Axel Sommerfeldt

unread,
Jun 10, 2007, 4:39:56 AM6/10/07
to
Mikhail Shevchuk <mikhail....@gmail.com> wrote:

> \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

Mikhail Shevchuk

unread,
Jun 10, 2007, 5:38:11 AM6/10/07
to
Axel, this is great, now I can print my diploma note. Thank you all
for your help! :)

0 new messages