Include multiple appendixes in a book. (Using KOMA Script v2.)


I have isolated the problem and created a minimal example to demonstrate the issue:

The only difference (according to gVim's diff tool) between good.lyx and bad.lyx are the following lines:

\begin_layout Subsection

\begin_layout Standard

Loading good.lyx into LyX works as expected: a PDF can be created. Loading bad.lyx into LyX does not work as expected. The following error results:

Missing number, treated as zero.


A number should have been here; I inserted '0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)


  • Why does typing one more subsection cause an error?
  • How can the error be resolved so that any number of sections and subsections can be added to the appendix?

Thank you!

  • I don't like files being stored externally on file hosting services which open browser windows with promotionial content when I try to open your files to debug.
    – Stefan Kottwitz
    Dec 8, 2010 at 2:35
  • @Stefan: Sorry about that; it was the first free file sharing host I found. Dec 8, 2010 at 3:39
  • not a big problem :-) there may be free and opensource pastebin services too. But the best is always to reduce to a handy example. ;-) LyX files are also just in text format and could be posted.
    – Stefan Kottwitz
    Dec 8, 2010 at 13:04
  • @Stefan: Will find a pastebin for next time; I just cannot bear to paste huge code snippets. (Now if there was a way to "fold" or close the snippet, that would be altogether different.) Dec 8, 2010 at 14:30
  • I would like to see a code folding feature, unfortunately it has been declined: meta.stackexchange.com/questions/5199/…
    – Stefan Kottwitz
    Dec 8, 2010 at 15:24

1 Answer 1


What does this harmless subsection command? It starts a new page! And this page has a different page style. The first page has page style plain because it's the beginning of a chapter, but the next page has scrheadings style. There we may search the problem.

It is in your preamble:

\rehead{\textsc{\ChapterTitle \ChapterNumberIfNeededEven}}
\lohead{\textsc{\ChapterNumberIfNeededOdd \ChapterTitle}}
  \ifnum 0<\thechapter{} $ \star $ \chaptername{} \thechapter{} \fi
  \ifnum 0<\thechapter{} \chaptername{} \thechapter{} $ \star $ \fi

Don't compare a number 0 with \thechapter - in your appendix \thechapter is "A" ! Instead, something like

 \ifnum\value{chapter}=0 ...

could work.

On a plain chapter starting page that error could not occur.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .