8

I use Lyx 2.1, class document : report. I created a general introduction as unnumbered chapter, but at the table of Contents, the introduction does not exist. enter image description here

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
GoldRay
  • 425

2 Answers2

7

There is no formal LyX way to insert general content into the Table of Contents (ToC) other than using an ERT (the (La)TeX way). As such, you should insert an ERT containing

\addcontentsline{toc}{chapter}{General Introduction}

immediately after you've inserted the chapter. For alignment purposes (of the numbers in the ToC), you could also use

\addcontentsline{toc}{chapter}{\numberline{}General Introduction}

One could modify the LaTeX preamble to always insert an unnumbered chapter into the ToC by adding the following:

\usepackage{xparse}% http://ctan.org/pkg/xparse
\let\oldchapter\chapter
\RenewDocumentCommand{\chapter}{s o m}{%
  \IfBooleanTF{#1}
    {\oldchapter*{#3}% \chapter*
     \IfNoValueTF{#2}
      {\addcontentsline{toc}{chapter}{\numberline{}#3}}%  \chapter*{...}
      {\addcontentsline{toc}{chapter}{\numberline{}#2}}}% \chapter*[..]{...}
    {\IfNoValueTF{#2}%
      {\oldchapter{#3}}%      \chapter{...}
      {\oldchapter[#2]{#3}}}% \chapter[..]{...}
}

However, you may not be interested in this generic redefinition.

Werner
  • 603,163
0

After struggling with adding lines to the LaTeX preamble, I came across another question about how to go about it in Latex, and the same method works in Lyx. You need to add the latex command right after the chapter title - press ctl+L and then write the command \addcontentsline{toc}{chapter}{General Introduction}. Worked better for me.

I know it is an old question, but it might be useful for others who visit.

sha
  • 101