[OS X TeX] memoir question

Bruno Voisin bvoisin at mac.com
Sat Nov 27 22:48:18 CET 2004


Le 27 nov. 04, à 21:56, Herb Schulz a écrit :

> On 11/27/04 8:39 AM, "Gerben Wierda" <Gerben.Wierda at rna.nl> wrote:
>
>>> \makeatletter
>>> \renewcommand\appendix{\par
>>>   \setcounter{chapter}{0}%
>>>   \setcounter{section}{0}%
>>>   \gdef\@chapapp{\appendixname}%
>>>   \gdef\thechapter{\appendixname\space\@Alph\c at chapter}}
>>> \makeatother
>>
>> This works for the heading. However, the table of contents is all
>> screwed up ("Appendix A" and "Option Games" are printed on top of each
>> other) and the header now says "Appendix Appendix A".
>
> \makeatletter
> \renewcommand\appendix{\par
>    \setcounter{chapter}{0}%
>    \setcounter{section}{0}%
>    \gdef\@chapapp{\appendixname}%
>    \gdef\thechapter{}}
> \makeatother
>
> is just like Bruno's version except it blanks out \thechapter. Sigh...

I've just had a look at memoir.cls (which I don't use). What about 
leaving \thechapter alone (mine was a silly idea anyway, since 
\thechapter is supposed to be the printed output of a counter), and 
redefining \printchaptername instead, by putting in the preamble:

\makeatletter
\renewcommand\appendix{\par
   \setcounter{chapter}{0}%
   \setcounter{section}{0}%
   \gdef\@chapapp{\appendixname}%
   \gdef\thechapter{\@Alph\c at chapter}%
   \renewcommand{\chapnamefont}{\normalfont\Large\bfseries}%
   \renewcommand{\printchaptername}{\chapnamefont \@chapapp}%
   \renewcommand{\chapternamenum}{\space}}
\makeatother

If that still doesn't work, you may also try redefining 
\printchapternum (but that would be less `clean'):

\renewcommand\appendix{\par
   \setcounter{chapter}{0}%
   \setcounter{section}{0}%
   \gdef\@chapapp{\appendixname}%
   \gdef\thechapter{\@Alph\c at chapter}%
   \renewcommand{\printchapternum}{\chapnumfont 
\appendixname\space\thechapter\quad}}
\makeatother

I looked at what the [article] option does, its sets \artopt to true. 
This switch, in particular implies the declaration 
\chapterstyle{article} which means the command 
\makechapterstyle{article} is run, namely:

\makechapterstyle{article}{%
   \renewcommand{\chapterheadstart}{\vspace{\beforechapskip}}
   \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
   \setlength{\afterchapskip}{2.3ex \@plus .2ex}
   \renewcommand{\printchaptername}{}
   \renewcommand{\chapternamenum}{}
   \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries}
   \renewcommand{\chapnumfont}{\normalfont\Large\bfseries}
   \renewcommand{\printchapternum}{\chapnumfont \thechapter\quad}
   \renewcommand{\afterchapternum}{}
}

That's I think where you have to look for the various settings that the 
[article] option influences, and compare with the default:

\newcommand{\@chs at def@ult}{%
   \def\chapterheadstart{\vspace*{\beforechapskip}}
   \def\printchaptername{\chapnamefont \@chapapp}
   \def\chapternamenum{\space}
   \def\printchapternum{\chapnumfont \thechapter}
   \def\afterchapternum{\par\nobreak\vskip \midchapskip}
   \def\printchapternonum{}
   \def\printchaptertitle##1{\chaptitlefont ##1}
   \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}
}

knowing that chapter (actually section with the [article] option) 
headings are produced by:

\def\@makechapterhead#1{%
   \chapterheadstart%  \vspace*{50\p@}%
   {\parindent \z@ \raggedright \normalfont
    \ifnum \c at secnumdepth >\m at ne
      \if at mainmatter
        \printchaptername \chapternamenum \printchapternum
        \afterchapternum % \par\nobreak \vskip 20\p@
      \else
        \printchapternonum
      \fi
    \else
      \printchapternonum
    \fi
    \interlinepenalty\@M
    \printchaptertitle{#1} % \Huge \bfseries #1
    \afterchaptertitle % \par\nobreak \vskip 40\p@
   }}

Hope this works (this time),

Bruno
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list