Re: TOC and Appendices: problem redefining \l@section
- From: Luci Ellis <luci@xxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 22:05:05 +0100
On 28/2/08 8:13 AM, in article ce9.47c65efd.847de@xxxxxxxxxxx, "Ulrich M.
Schwarz" <brotherelf@xxxxxxx> wrote:
On Wed, 27 Feb 2008 21:42:43 +0100, Luci Ellis wrote:
[...]
In principle, it should be possible to redefine \l@section within the
redefinition of \appendix, like this: \def\l@section#1#2{
\setlength{\parskip}{6pt}\selectfont%
\@dottedtocline{1}{0cm}{\myLabelWidth}{\appendixname~#1}{#2}}
But whenever I try this or the Latex-style "\renewcommand" equivalent, I
get an error message like this:
?
! Illegal parameter number in definition of \resetAppTOC.
So you're redefining \l@section within another macro. The thing to
remember here is that #1 is a parameter of the outermost macro, ##1 is
the parameter of the next-inner macro, ####1 one level deeper yet and so
on. So, TeX is getting confused because it wants to replace the #1 in
\l@section#1 with the first parameter to \resetAppTOC, which doesn't have
any. Replacing with ##1 and ##2 should fix that.
HTH
Ulrich
Dear Ulrich,
Thank you, this was helpful in that it removed the error (the #1 ##1
distinction was something I never understood before). Unfortunately it
doesn't actually redefine the TOC entry. I thought I needed to put the
redefinition of \l@section inside an \addtocontents but when I try that, it
falls over completely and the TOC entries all bunch together without any
spacing at all.
Similarly, if I define the \l@section originally as
\newcommand{\startsectoc}{}
\renewcommand{\@dotsep}{0.7}
\newlength{\myLabelWidth}
\setlength{\myLabelWidth}{1cm}%
\renewcommand*\l@section[2]{
\setlength{\parskip}{6pt}\selectfont%
\@dottedtocline{1}{0cm}{\myLabelWidth}{\startsectoc #1}{#2}}
And then try to redefine \startsectoc inside the redefinition of \appendix,
nothing happens if I don't put it inside \addtocontents{toc}, and errors
happen if I do.
Using \addtocontents seems to be necessary for any change to the TOC that
the Appendices require. My class file also has the following line in the
redefinition of \appendix, to make room for the word "Appendix", if only I
could make it show.
\addtocontents{toc}{\addtolength{\myLabelWidth}{1.2cm}}
But actually changing the TOC label to "Appendix A" _without_ also changing
\thesection seems infeasible. If I could tell people to change their text to
remove the "Appendix" text before cross-references in the text, none of this
would matter. But they're not going to write "Section~\ref{sec.this}" but
only "\ref{app.that}".
Best regards,
Luci
.
- References:
- TOC and Appendices: problem redefining \l@section
- From: Luci Ellis
- Re: TOC and Appendices: problem redefining \l@section
- From: Ulrich M. Schwarz
- TOC and Appendices: problem redefining \l@section
- Prev by Date: Re: The Problems of TeX
- Next by Date: Re: Distinction between macros and lengths
- Previous by thread: Re: TOC and Appendices: problem redefining \l@section
- Next by thread: itemize, firstline
- Index(es):
Relevant Pages
|