Thanks, Julien,
that all makes. One last question about LaTeX packages -- if I put
\newcommand{\frontmattersection}[1]{\...@chapter{#1}}
into my cls file, I need to change \RequirePackage{setspace} to
\RequirePackage{setspace,tocindbib},
right? And if I do that, do I still need to put
AddToPreamble
\usepackage{tocbibind}
EndPreamble
in my layout or is that covered by the RequirePackage statement in my cls
file?
Will
On Tue, Jun 1, 2010 at 4:12 PM, Julien Rioux <[email protected]>wrote:
> On 01/06/2010 3:55 PM, Will wrote:
>
>> I discovered in the tocbibind documentation that the t...@chapter command
>> was
>> exactly what I wanted for my front matter sections. I tried making
>> a FrontMatterSection style in my layout file, but when I try to run LaTeX
>> with LyX I get the following error (though the TeX source in LyX looks
>> like
>> what I want, eg \...@chapter{acknowledgements}):
>>
>> Undefined Control Sequence
>>
>> \toc
>>
>> @chapter{Acknowledgements}
>>
>> The control sequence at the end of the top line
>>
>> of your error message was never \def'ed.
>>
>>
>> Is there a quick fix to this? Do I need to define \...@chaptersomewhere?
>> I can see \usepackage{tocbibind} in my TeX source so it should be
>> defined.
>>
>
> Hi Will,
>
> You have come a long way. Well done.
>
> The use of @ in a LaTeX macro (such as in \...@chapter) is restricted to
> within packages, or in the document when sandwiched between \makeatletter
> and \makeatother. Otherwise, what LaTeX "sees" is a \toc macro, followed by
> the @ character which is not allowed to be part of a macro's name.
>
> Generally speaking, package designers use @ in a macro's name to mark it as
> internal. Such macros are not meant to be used in the document and could
> have side effects.
>
> Warnings aside, a workaround is to define your own macro without the @
> character... maybe \frontmattersection ?
>
> AddToPreamble
> \usepackage{tocbibind}
> \newcommand{\frontmattersection}[1]{\...@chapter{#1}}
> EndPreamble
>
> Style FrontMatterSection
> ...
> LatexName frontmattersection
> End
>
> The reason this would work is that LyX takes care of sandwiching your
> preamble commands between \makeatletter and \makeatother.
>
> By the way, such definitions might be better suited for your .cls file
> anyway.
>
> Cheers,
> Julien
>