> 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
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!
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.
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