2

I have a TOC that produces output as:

     Contents

One.........................1
   Falling..................1
Two........................10
   Rising..................10

Is it possible for the TOC to produce output as:

Falling.....................1
Rising.....................10
                             etc.

The Chapter Subheadings are produced from the following code:

\RedeclareSectionCommand[
font=\fontsize{45}{40}\selectfont\mdseries\mathilde
font=\fontsize{20}{15}
]{section}

\setkomafont{section}{\fontsize{35}{30}\selectfont\fontspec{mathilde}}

This is an MWE of the problem:

 \documentclass[12pt,english,british,twoside,openany,headings=small]{scrbook}
    \usepackage{ms_mystyles} \usepackage{fontspec} \setmainfont{Palatino}

\renewcommand{\sectionmark}[1]{ \markright{#1}{} }

\RedeclareSectionCommand[ font=\fontsize{45}{40}\selectfont\mdseries\mathilde font=\fontsize{20}{15} ]{section}

\setkomafont{section}{\fontsize{35}{30}\selectfont\fontspec{mathilde}}
     \begin{document}
        \pagenumbering{gobble}% Remove page numbers (and reset to 1)
            \tableofcontents
            \addchap{Tryout}
            \addsec{Simple Heading}
        \mainmatter
        \addchap{ONE}
        \addsec{Falling}
        \input{Some text}
            \end{document}
  • 1
    may be there is better ways but you can do it by adding \renewcommand*\chaptertocdepth{5} \makeatletter \renewcommand*\scr@tso@section@indent{0pt} \makeatother – touhami Aug 30 '16 at 20:18
  • Thank you - this seems to work just fine, except that the page numbers in the 'frontmatter' e.g. Preface, are not added resulting in the following: Preface....................... - no page number visible? Any ideas? – Mike Aug 30 '16 at 20:36
  • 2
    this is because of \pagenumbering{gobble} in your code. Edit there is no page number. – touhami Aug 30 '16 at 20:43
  • I already commented this line of code out - and your answer confirmed I had done the right thing. Thanks! – Mike Aug 30 '16 at 20:49
4

With KOMA-Script version 3.20 or newer you can use

\RedeclareSectionCommand[tocindent=0pt]{section}
\RedeclareSectionCommand[tocstyle=gobble]{chapter}

enter image description here

Code:

\documentclass{scrbook}[2016/05/10]% needs version 3.20 or newer

\RedeclareSectionCommand[tocindent=0pt]{section}
\RedeclareSectionCommand[tocstyle=gobble]{chapter}

\begin{document}
\frontmatter
\tableofcontents
\addchap{Tryout}
\addsec{Simple Heading}
\KOMAScriptVersion
\mainmatter
\addchap{ONE}
\addsec{Falling}
\end{document}

Another possibility is

\RedeclareSectionCommand[tocindent=0pt]{section}
\renewcommand*\addchaptertocentry[2]{}

That works also with KOMA-Script versions older than 3.20.

Note that \RedeclareSectionCommand[font=<fontsettings>]{section} does the same as \setkomafont{section}{<fontsettings>}. The last usage wins.

| improve this answer | |
  • esdd - why the option [2016/05/10]? Does this option call the 3.20 version of {scrapbook}? – Mike Aug 31 '16 at 19:34
  • @Mike With \documentclass{scrbook}[2016/05/10] you will get a warning if an older version of scrbook is used to compile the file. Note that option tocstyle=gobble was introduced in version 3.20. – esdd Sep 1 '16 at 12:13

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.