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

Changing the section separator in LaTeX?

621 views
Skip to first unread message

Geoffrey Alan Washburn

unread,
Aug 29, 2007, 10:44:11 AM8/29/07
to
Hello everyone, is there an "easy" way to change the separator LaTeX
uses for chapters, (sub)sections, figures, and tables? The default in
LaTeX and most classes is a period ".". I can make some progress by
redefining \the{section,figure,table...}, but the primary problem I am
encountering is that this does not work for figures and tables. As far
as I have been able to discern, the captioning code seems to have
already expanded the use of \the{...} for generating \contentsline{...}
before it even begins processing my document.

José Carlos Santos

unread,
Aug 29, 2007, 1:57:39 PM8/29/07
to
On 29-08-2007 15:44, Geoffrey Alan Washburn wrote:

> Hello everyone, is there an "easy" way to change the separator LaTeX
> uses for chapters, (sub)sections, figures, and tables?

For chapters, sections, and subsections, the titlesec package is perhaps
the best choice for that. For figures and tables use the caption
package.

> The default in
> LaTeX and most classes is a period ".". I can make some progress by
> redefining \the{section,figure,table...},

Don't:

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=the-commands

Best regards,

Jose Carlos Santos

Geoffrey Alan Washburn

unread,
Aug 29, 2007, 3:13:59 PM8/29/07
to José Carlos Santos
José Carlos Santos wrote:
> On 29-08-2007 15:44, Geoffrey Alan Washburn wrote:
>
>> Hello everyone, is there an "easy" way to change the separator LaTeX
>> uses for chapters, (sub)sections, figures, and tables?
>
> For chapters, sections, and subsections, the titlesec package is perhaps
> the best choice for that. For figures and tables use the caption
> package.


I haven't had a chance to fully understand the capabilities of these
packages, but these look like promising solutions. Thanks!


>> The default in LaTeX and most classes is a period ".". I can make
>> some progress by redefining \the{section,figure,table...},
>
> Don't:
>
> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=the-commands

Good point :-) Thanks!

Geoffrey Alan Washburn

unread,
Sep 1, 2007, 1:10:39 PM9/1/07
to
José Carlos Santos wrote:
> On 29-08-2007 15:44, Geoffrey Alan Washburn wrote:
>
>> Hello everyone, is there an "easy" way to change the separator LaTeX
>> uses for chapters, (sub)sections, figures, and tables?
>
> For chapters, sections, and subsections, the titlesec package is perhaps
> the best choice for that.

I've spent some time working with the titlesec and titletoc packages,
and it does not seem possible to use them to change the separator. It
looks like the label in the table of contents is still generated by
LaTeX itself using the originally defined \the{section,subsection,
etc.}, and then passed to the \numberline macro that titletoc defines.

I suppose I could "solve" the problem by writing a script that rewrites
the .toc file, but I would hope that sort of hackery is not necessary.

Alan Munn

unread,
Sep 2, 2007, 8:09:59 PM9/2/07
to
In article <fbc6eg$30ts$1...@netnews.upenn.edu>,

Perhaps people misunderstood your request. I assume you want e.g in
report class the sections to look like 1-1 instead of 1.1, and similarly
Table 1-1 instead of Table 1.1 (or some other character instead of '.'
or '-'?)

If this is correct, then the easiest way is simply to redefine the
relevant bits of code taken directly from the class you're using. For
example, for report class, one could do the following in the preamble of
your document. (If you have equations, they will also need to be
changed.)

\makeatletter
\newcommand\MySep{-} % change to whatever character you want
\renewcommand \thesection {\thechapter\MySep\@arabic\c@section}
\renewcommand\thesubsection {\thesection\MySep\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection
\MySep\@arabic\c@subsubsection}
\renewcommand\theparagraph
{\thesubsubsection\MySep\@arabic\c@paragraph}
\renewcommand\thesubparagraph
{\theparagraph\MySep\@arabic\c@subparagraph}
\renewcommand \thetable
{\ifnum \c@chapter>\z@ \thechapter\MySep\fi \@arabic\c@table}
\renewcommand \thefigure
{\ifnum \c@chapter>\z@ \thechapter\MySep\fi \@arabic\c@figure}
\makeatother

Alan

0 new messages