[OS X TeX] aligning section titles of different levels below each other
Sergei Mariev
sergei.mariev at lrz.uni-muenchen.de
Wed Feb 14 05:46:29 EST 2007
Dear all,
about a year ago I asked a question on how to change the distance
between the section number and the section title, and received many
useful replies. I am posting the reply from Bruno Voisin at the very
end of my email here (thanks again!) as it summarizes the answers in
the best way .
However, my problem is slightly different now. I am trying to achieve
the following: suppose you have two different levels of sections one
immediately following the other on the next line, like this:
A. <some space, let's say .5em> TITLE A
I. <same space as above, i.e. .5em> TITLE B
Now, the "A." and "I." in my example have different widths, the space
after them is the same, so the TITLE A and the TITLE B would not
align exactly one below each other. And that is what I am trying to
achieve.
A solution to this would be to place "A." and "I." in a box of fixed
length. But I am unable to do so.
This code works:
\makeatletter
\renewcommand{\@seccntformat}[1]{\fbox{\csname the#1\endcsname}\hspace
{0.5em}}
\makeatother
But obviously does not bring much, just demonstrates I am fiddling
with the right stuff.
And this code, i.e. \makebox instead of \fbox does not work for me at
all:
\makeatletter
\renewcommand{\@seccntformat}[1]{\makebox[1cm][l]{\csname the#1
\endcsname}\hspace{0.5em}}
\makeatother
Could someone suggest a solution how to make the section titles begin
exactly at the same distance from the margin no matter how much space
the section number takes?
Kind regards,
Sergei Mariev
PS: Here is the quote on how to change space between the section
number and section title:
______________
Le 31 mai 06 ˆ 12:31, Sergei Mariev a Žcrit :
> I have defined some sectioning commands with the macro
> @startsection. However, there seems to be no way to configure the
> distance between the section number and the section title, i.e. the
> amount of white space between the number and the beginning of the
> section title. Is it possible to configure that parameter as well
> [or have I overlooked something so obvious???? sorry in this case!]?
>
This is exactly the kind of topic covered in The LaTeX Companion.
You've got to redefine \@seccntformat, defined by default in /Library/
teTeX/share/texmf.tetex/tex/latex/base/latex.ltx (= the source of the
LaTeX format) as
\def\@seccntformat#1{\csname the#1\endcsname\quad}
so that there is one \quad of space (also called an enspace) between
the number and the title. Put in the preamble of your document the
redefinition:
\makeatletter
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname\hspace
{myspace}}
\makeatother
to replace the \quad by a \hspace of width "myspace".
For example, to produce section titles of the form "1.1.
Introduction", with a normal space between the number and the title,
you would write
\makeatletter
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname. }
\makeatother
and for producing section titles of the form "1.1 -- Introduction"
you would write
\makeatletter
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname\ -- }
\makeatother
The LaTeX Companion (1st edn) includes the example code
\makeatletter
\renewcommand{\@seccntformat}[1]{\fbox{\csname the#1\endcsname}\hspace
{0.5em}}
\makeatother
to produce a boxed section number separated by half an emspace from
the title.
Hope this helps,
Bruno Voisin
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the MacOSX-TeX
mailing list