I got the problems with TOC, by the way. When I start to put TOC in my book, after that in every pages header appear word "CONTENTS" with capitalize font. I don't know how to edit or custom it. I try to finding documentation and FAQ at Lyx.com but they explanation not enough to solving my problem. I just getting stuck after while. What should I do for solve this problem? if could I want rename these header by chapter name like "BAB I".

Thanks in advance.

FYI: I use document class: book.

Here my problem, appear words CONTENT in header:

appear words CONTENT in header http://www.zakariyasoewardi.co.uk/sandbox/img/Lyx-error-1.jpg appear words CONTENT in header http://www.zakariyasoewardi.co.uk/sandbox/img/Lyx-error-2.jpg

| improve this question | | | | |
  • I assume BAB II is a Chapter*? What would you want your headers to look like other than displaying CONTENTS? – Werner Mar 30 '14 at 18:55
  • No, BAB II is a Part*. I want custom header by chapter name like "BAB I". Depending on where the pages are still in a chapter. – agnanzakariya Mar 30 '14 at 18:57
  • Can you show us a complete document with this behaviour, please! Make it something short that only has that table of contents and then some new chapter where you don't get the header you expect. – pst Mar 30 '14 at 19:31
  • sorry @pst I think I've enough clear to explain my issue. – agnanzakariya Mar 31 '14 at 0:20

The reason for CONTENTS in the header stems from the \tableofcontents macro in the book document class/book.cls:


The above is executed when you Insert > List / TOC > Table of Contents in LyX. Note how the ToC is inserted as a \chapter*, with both the left and right marks being set in Uppercase as \contentsname (which defaults to Contents, by the way).

By default, numbered parts (\part) clear the headings, while unnumbered parts (\part*) don't. That's exactly why you see the header continuing without change from the ToC.

To adjust the headers automatically with the use of your sectional unit, switch from Part* to Chapter and use an appropriate package to adjust (in the Document > Settings... > LaTeX Preamble) the formatting to suit your needs. Alternatively, you can insert an ERT containing

\markboth{BAB I}{BAB I}

manually after a Part* to update the header accordingly.

| improve this answer | | | | |
  • 1
    For more specific detail about automation, you need to supply us with a minimal working example (MWE) that you exported from LyX showing at least the ToC and a single Part*. – Werner Mar 31 '14 at 6:53
  • Thanks, for temporary it's answer my problem. I appreciate for that. – agnanzakariya May 12 '14 at 6:42
  • I've had a similar issue with \chapter* for un-numbered chapters - this doesn't set the marks either. After reading this answer, I made this command \def\chapternotnumbered#1{\chapter*{#1}\markboth{#1}{#1}} which seems to work ok although I wouldn't be surprised if I later find I've broken something else with it :D – jhabbott Dec 4 '15 at 6:34

I don't use Lyx, but as you say you're using \part* instead of \chapter* this is probably the cause your header isn't updated correctly. The text in the headers is defined in the commands \leftmark and \rightmark, which in a book by default use the last known chapter and section title respectively.

Since the table of contents inserts a chapter header, and after that only part* commands are issued, the last known chapter title remains Contents, which is converted to CONTENTS by \leftmark. Parts are intended to group sets of chapters together, usually with only a small description that's not filed under a new chapter, and so I think it is better to use chapter commands if that is what you write.

If you don't like the way the chapter titles are typeset it is better to alter that configuration, than to misuse other commands. With TeX you should write what you mean in a document, and not use another command that seems to provide a better looking result straight away (that's more the MS Word philosophy ;) ).

| improve this answer | | | | |
  • Honestly, I'm getting confuse with these problem. But I got reference in some forum, where they use 'fancyhdr' so they can edit '\leftmark' and '\rightmark' manually. Should I use that too? how that's work, I'm using Lyx with GUI and I don't understand with script except ERT a little. – agnanzakariya Mar 31 '14 at 0:13
  • I don't know how to do it with LyX, but if you really want to stick with using parts as chapters I suppose you could redefine \leftmark to use the part title. To get a \parttitle/\partmark command see for example this answer. fancyhdr is mostly used (as the name suggests) to design the headers, and still should use \leftmark to get the chapter title, unless you redefine it manually. – hugovdberg Mar 31 '14 at 10:32

Taking a lead from Werners answer,

"Alternatively, you can insert an ERT containing

\markboth{BAB I}{BAB I}

manually after a Part* to update the header accordingly."

I just used \markboth{}{} to get rid of the "CONTENTS" on the top left of my book. I used it right after where I inserted my TOC. Worked like magic!!

Thanks everyone ...

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.