# Why is LyX not allowing numbered chapters in my book?

LyX v2.0.6 on Linux. Document class is book (extra font sizes).

Scenario

I have a master document including two child documents (so far), both of which are the same document class as the master. The first child has some non-numbered chapters (chapter*). The second child document begins with Part I, after which I want to begin numbered chapters.

I begin a new paragraph (hit Return) and select Chapter from the style drop-down. I get a big bold "Chapter 1". So far, so good.

Problem

Almost anything I do after that makes the Chapter heading disappear.

For example, I pasted in text for the first paragraph of the chapter but it appeared in Chapter style. Changing it to Standard made the chapter heading disappear. Then I inserted another line above the paragraph and changed that to a chapter. Then, when I press the down arrow to continue editing my text, the heading disappears again.

My question

How can I have a book that consists of Parts with numbered chapters in LyX?

Update

The chapters stay if they have a non-empty name. I don't really want to name them, but it seems I can use a hard space (ctrl+space). Am I thereby Doing It Wrong, or is this an appropriate workaround for the situation?

• There's no problem using entirely empty chapter names in book so I assume this is a LyX issue. I think LyX allows you to enter code directly but I've never used it so don't know the details. But \chapter{} will do what you want.
– cfr
May 10, 2014 at 22:57
• Either the LyX developers hasn't taken this into consideration, or it is a bug. Either way, if it isn't fixed in LyX 2.1 I'd file a bug report at lyx.org/trac/wiki/BugTrackerHome Your workaround is better than writing \chapter{} in an ERT (Ctrl + L), as the chapters show up in the Outline view. May 11, 2014 at 6:24
• @TorbjørnT. and @scav thanks for pointing this out. I believe that the general recommendation is the ctrl+space work around. Is that a bad idea from a LaTeX perspective? Is there any case where \chapter{~} would be rendered differently than \chapter? This is not just a book + chapter issue, right? I believe it is the same with any numbered section. May 11, 2014 at 9:17
• @scottkosty I guess it's the same with any numbered section, but I haven't tested. They do render differently though, just try \documentclass[openany]{book} \begin{document} \chapter{} Lorem ipsum \chapter{~} Lorem ipsum \end{document}. Notice there is more whitespace before Lorem ipsum in the second case. Screenshot: imgur.com/UeIqBpX. (scav: This would be a reason for preferring ERTs. It didn't occur to me when I wrote my previous comment.) May 11, 2014 at 9:40
• @TorbjørnT. thanks for the clear example. I see what you mean. May 11, 2014 at 10:41

The best workaround seems to be adding an empty ERT box (Ctrl + L) or LyX Note in the chapter title. This will create the LaTeX code \chapter{} for the chapter heading:

The reason adding a hard space/non breaking space (Ctrl + Space) is not ideal, is that for the standard classes where the chapter title is set on a separate line (below Chapter N), this will generate additional vertical space compared to the above, demonstrated by this minimal LaTeX example. ~ is a non breaking space.

\documentclass[openany]{book}
\begin{document}
\chapter{}
Lorem ipsum
\chapter{~}
Lorem ipsum
\end{document}


Note different space in output:

In classes like scrbook (book (KOMA-script) in LyX) this spacing isn't an issue, as the chapter titles are set similar to \section in the standard classes.