[plug] LyX/LaTeX questions

Greg Gamble gregg at maths.uwa.edu.au
Wed Nov 3 16:17:04 WST 1999


According to Christian:
> Greg Gamble wrote:
> 
> > There's almost certainly a package that will do this ... but after a
> > (very) quick perusal of the docs on my teTeX system I didn't see it
> > ... here's some code that will do the trick:
> 
> Wow, thanks! :))  I've been searching through all the packages I could
> find documented on CTAN and couldn't find anything that looked like it
> would do it...
> 
> I've actually switched over and are now using the appendix packages so
> I'm using \appendices instead of the normal \appendix. Therefore I
> changed the references to \appendix in your code to \appendices and held
> my breath and it worked perfectly!  Thanks so much!
> 
> Ok, so I lied -- not quite perfectly...  Two problems:
> 
> Firstly, I'm passing the 'titletoc' option to the appendix package which
> puts a line in my TOC saying "List of Appendices" just before it lists
> the appendices here.  The problem is that this line is being given a
> number (as if it's a real page) and it's also, since I've added your
> code, it is giving it a negative number (-78 instead of 78 which is the
> last page of the body before the appendices begin).  Any ideas on how to
> fix this?

Hmm! ... I have found the appendix package, and have discovered
that it indeed breaks my code ... so I'll have to look a little
closer to see what it does ... and see if I can find a variant
that will work with it.

> The second problem is that my bibliography is getting numbered as if
> it's part of the last appendix (it comes after the last appendix).  I'm
> not even quite sure what the best way to fix this is... should a
> bibliography come before appendices? (I don't think so since the thesis
> layout instructions imply not and because I refer to stuff in the
> bibliography in my appendices).  Maybe I should start numbering again? 
> Or possibly just ditch numbering all together?  (After all, LaTeX
> doesn't seem to include the bibliography in the TOC for some reason...) 
Without using the appendix package the following preamble code:

\makeatletter
\let\normalappendix\appendix
\let\normal at chapter\@chapter
\let\normal at schapter\@schapter
\newif\ifappendix
\def\appextra{\ifappendix \setcounter{page}{1} \fi}
\newenvironment{appendices}
    {\normalappendix\appendixtrue
     \renewcommand{\thepage}{\thechapter-\@arabic\c at page}}
    {\appendixfalse\clearpage
     \renewcommand{\thepage}{\@arabic\c at page}
     \setcounter{page}{1}}
\def\@chapter[#1]#2{\normal at chapter[#1]{#2}\appextra}
\def\@schapter#1{\normal at schapter{#1}\appextra}
\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname
        \addcontentsline{toc}{chapter}{\bibname}
        \@mkboth{\bibname}{\bibname}}%
      \list{\@biblabel{\@arabic\c at enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib at code
            \usecounter{enumiv}%
            \let\p at enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c at enumiv}}%
      \sloppy\clubpenalty4000\widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex at warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother

does a better job than the previous code, and I have included a
revision of the bibliography environment that adds the
bibliography into the table of contents. However, the page
number won't make much sense since the numbering restarts from 1.

Now you put the appendix \chapter s in an appendices environment
like for the appendix package i.e.

\begin{appendices}
\chapter{...}
...
\chapter{...}
\end{appendices}

I'll try to login later with some more ideas ...

> > As Adrian Blockley pointed out a line break (\\) will do the job ...
> > but if you don't want that line break to appear in your Table of
> > Contents, use the optional argument e.g.
> > 
> > \section[A long header with no line break]{A long header with\\a line break} > 
> Ok, thanks... only problem with this is I'm using LyX so I'm not sure
> exactly how to get around it.

Not having used LyX, I don't understand the interaction
LyX/LaTeX. How does it work?

  Regards,
  Greg Gamble <gregg at maths.uwa.edu.au>



More information about the plug mailing list