2

I am using LyX.

My document uses Part*, Section*, Subsection*, Subsubsection* sections, and babel with \usepackage[english,frenchle]{babel}. With the memoir document template, only Subsection* and Subsubsection* appear in the TOC, not the Section* nor Part*. With the LyXBook template, none at all, just the "Table of Contents" title. My document was built with a huge use of awks, sed helpers, from a LbreOffice document. Though it compiles to produce a pdf, I may have broken something ?

EDIT : Below my MWE that fails with LyXBook - only parts appear in the TOC (but works with memoir).

What may have I broken ? Or what I could try to add in the preambul to make it work ?

EDIT: I suppressed the stars in the sections. Actually, they appear in the TOC and still I can suppress the numbering. As this MWE is from scratch, I did not break anything except a misuse of the stars in sections declarations (in the new MWE below, I have suppressed the stars).

So the remaining question is: can I have a more complete TOC, including Section and Subsection?

#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass LyXBook--Default
\use_default_options true
\begin_removed_modules
Endnote
\end_removed_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 1
\tocdepth 1
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents

\end_inset


\end_layout

\begin_layout Part
pppppp
\end_layout

\begin_layout Section
ssssssss
\end_layout

\begin_layout Standard
gergerg ertert
\end_layout

\begin_layout Subsection
xxxxxxxxxxxxx
\end_layout

\begin_layout Subsubsection
cccccccccc
\end_layout

\begin_layout Standard
fgergergerg rgterg
\end_layout

\end_body
\end_document
  • 2
    Welcome to TeX.SX! The starred versions of part, chapter, section etc. do not appear in the ToC by default, so you must have done something to make them (subsection* and subsubsection*) appear in the first place. If you can reduce your code to a minimal example that actually demonstrates the problem, it would be a lot easier to give advice (for me at least). – Torbjørn T. May 1 '14 at 17:24
  • Here it is here – lalebarde May 1 '14 at 22:48
  • 1
    @lalebarde I cannot compile your example because I don't have the document class and LyX layout required. However, you are mixing starred and non-starred sectioning commands. You have \part*{} and \section*{}, but \subsubsection{}. As I said above, the starred versions don't appear in the ToC, so the first thing you can try is to change the parts and sections from their starred versions to their non-starred counterparts. – Torbjørn T. May 2 '14 at 5:08
  • 1
    Your code has \secnumdepth 1 \tocdepth 1 so only sectional units up to evel 1 will be numbered and show in the ToC. If you want subsubsections to show in the ToC you need to set \tocdepth to 3. This is done in LaTeX using \setcounter{tocdepth}{3} in the preamble; if you also want numbering up to that level, you'll need \setcounter{secnumdepth}{3}. – Gonzalo Medina May 2 '14 at 12:32
  • 1
    As a follow-up to Gonzalo's comment: In LyX you set tocdepth and secnumdepth in Document --> Settings --> Numbering & ToC. By the way, where can this LyXbook template be downloaded? – Torbjørn T. May 2 '14 at 13:58
1

Finally, the solution is, following Torbjørn T & Gonzalo Medina advices:

  • Sections with a star like Section* permits to not put a section title in the TOC. So, one have to use the unstar section version.
  • Configure in Document --> Settings --> Numbering & ToC: tocdepth which specifies the lowest section level to put in the TOC, and secnumdepth which specifies the lowest section level to number.

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.