4

I would like to have in my TOC the following

I First Chapter
I.1 First section
I.2 second section II Second Chapter
II.1 First section
II.2 second section

Contributions

Contribution I: title of the first paper % May this be an external included pdf
Contribution II: title of the first paper

In my following MWE I changed the name of chapter in the contribution part and I put the contribution title in the TOC as an option but instead of e.g. "contribution I: its title" I have "I contribution I: its title".

\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\RequirePackage{etoolbox}
\RequirePackage{xparse}

\RequirePackage{scrhack} % 

\RequirePackage[markcase=used]{scrlayer-scrpage}
\addtokomafont{pagenumber}{\oldstylenums}
%\providepairofpagestyles{thesisSimple}{%
    \clearpairofpagestyles%
    \automark[chapter]{chapter} %\automark[right side]{left side}
    \ihead{\headmark}% Inner header
    \ohead[\pagemark]{\pagemark}% Outer header


%vll
\setkomafont{pagehead}{\bfseries}  
\renewcommand\thechapter{\Roman{chapter}}
\usepackage[Conny]{fncychap} %
\ChNameAsIs  
\ChTitleAsIs  

\makeatletter
\def\@makechapterhead#1{%
\vspace*{-20\p@}
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter  
        \DOCH
      \fi
    \fi
    \interlinepenalty\@M
     \if@mainmatter % 
      \DOTI{#1}%
    \else%
      \DOTIS{#1}%
    \fi
  }}
\def\@makeschapterhead#1{% 
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \DOTIS{#1}
    \vskip -20\p@ 
  }}
\makeatother
%========================

\usepackage{hyperref}

\usepackage[autostyle=true]{csquotes} 
\usepackage{lipsum}     
\begin{document}

\tableofcontents

\chapter{First chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1]

\chapter{Sec. chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\addtocontents{toc}{\bigskip \textbf{\large   Contributions}\par} 
\setcounter{chapter}{0}
\renewcommand{\chaptername}{Contribution}

\chapter[Contribution I: Paper title]{First paper's title}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\chapter[Contribution II: Paper title]{Second contribution}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]
\end{document}

PS: I tried in vain the methods given in answers of this question

1 Answer 1

3

Here is a suggestion using the KOMA-Script class scrbook but without package fncychap:

\documentclass[10pt,a4paper]{scrbook}[2017/09/07]% needs version 3.24 or newer
\usepackage[utf8]{inputenc}

\usepackage[markcase=used]{scrlayer-scrpage}
\addtokomafont{pagenumber}{\oldstylenums}
\clearpairofpagestyles%
\automark[chapter]{chapter}
\ihead{\headmark}
\ohead*{\pagemark}
\setkomafont{pagehead}{\bfseries}
\renewcommand\thechapter{\Roman{chapter}}

\KOMAoptions{chapterprefix,numbers=noenddot,egregdoesnotlikesansseriftitles}
\renewcommand\raggedchapter{\centering}
\newlength{\ChapterRuleWidth}\setlength{\ChapterRuleWidth}{2pt}
\RedeclareSectionCommand[
  beforeskip=-1sp,
  expandtopt,
  innerskip=.5\baselineskip,
  afterskip=60pt,
  font=\normalfont\Huge,
  prefixfont=\bfseries
]{chapter}

\newcaptionname{english}{\contributionname}{Contribution}
\DeclareNewSectionCommand[
  style=chapter,
  level=\chapternumdepth,
  toclevel=\chaptertocdepth,
  tocbeforeskip=1em plus 1pt,
  tocindent=0pt,
  tocnumwidth=1.5em,
  tocdynnumwidth,
  tocentryformat=\usekomafont{chapterentry},
  tocentrynumberformat=\contributiontocnumber,
  tocentrypagenumberformat=\usekomafont{chapterentry},
  toclinefill=\hfill
]{contribution}
\renewcommand\thecontribution{\Roman{contribution}}
\newcommand*\contributiontocnumber[1]{\contributionname\ #1:\hfill}
\renewcommand*\contributionformat{\contributionname\nobreakspace\thecontribution\autodot}
\renewcommand*\contributionmarkformat{\contributionname\ \thecontribution\autodot\enskip}
\automark*[contribution]{contribution}

\makeatletter
\renewcommand\chapterlineswithprefixformat[3]{%
  \IfArgIsEmpty{#2}{}{{%
    \normalsize\rule{\linewidth}{3\ChapterRuleWidth}\\*[-.5\baselineskip]%
    \rule{\linewidth}{\ChapterRuleWidth}\par\nobreak
    }#2}%
  {\normalsize\rule{\linewidth}{\ChapterRuleWidth}\par\nobreak}
  #3
  \IfArgIsEmpty{#2}{\vskip -20pt}{}%
}
\makeatother

\newcounter{defaulttocdepth}

\newcommand\StartContributions{%
  \cleardoublepage
  \RedeclareSectionCommand[counterwithin=contribution]{section}%
  \addxcontentsline{toc}{part}{Contributions}%
  \addtocontents{toc}{\protect\value{tocdepth}=\contributionnumdepth}%
}
\setkomafont{partentrypagenumber}{\nullfont}
\newcommand\EndContributions{%
  \RedeclareSectionCommand[counterwithin=chapter]{section}%
  \addtocontents{toc}{\protect\value{tocdepth}=\the\value{tocdepth}}%
}

\usepackage{hyperref}
\usepackage{lipsum}% only for dummy text
\begin{document}
\tableofcontents

\chapter{First chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1]

\chapter{Sec. chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\StartContributions
\contribution{First paper's title}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]
\contribution{Second contribution}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]
\EndContributions

\chapter{Test}
\section{Test}
\lipsum
\end{document}

Note that the code above needs at least KOMA-Script version 3.24. Update: If you use KOMA-Script version 3.39 or newer replace the deprecated option egregdoesnotlikesansseriftitles by the new class option sfdefaults=false.

If you want/have to use one of the versions 3.21, 3.22 or 3.23 add

beforeskip=-1sp,
innerskip=.5\baselineskip,
afterskip=60pt,
font=\normalfont\Huge,
prefixfont=\bfseries,
pagestyle=plain,

to the options of \DeclareNewSectionFormat[...]{contribution}.

Result:

enter image description here

enter image description here


But it is also possible to use package tocbasic with another class to get the desired result:

Add

\usepackage{tocbasic}
\newcommand*\Contribution{%
  \renewcommand*{\chaptername}{Contribution}%
  \setcounter{chapter}{0}%
  \addtocontents{toc}{%
    \bigskip \noindent\textbf{\large Contributions}\protect\par
    \DeclareTOCStyleEntry
      [entrynumberformat=\nullfont,numwidth=0pt,pagenumberformat=\textbf]
      {tocline}{chapter}%
    \protect\value{tocdepth}=0%
  }%
  \renewcommand\chaptermarkformat{}%
}

to the preamble and use \Contribution to the document body. This should also work with your special class mentioned in a comment. Assuming that there is no switch back to normal chapters needed, I did not define an command for the end of the contributions like in my first example. But the example corrects the header entries, too.

enter image description here

enter image description here

Code:

\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\RequirePackage{etoolbox}
\RequirePackage{xparse}

\RequirePackage{scrhack} % 

\RequirePackage[markcase=used]{scrlayer-scrpage}
\addtokomafont{pagenumber}{\oldstylenums}
%\providepairofpagestyles{thesisSimple}{%
    \clearpairofpagestyles%
    \automark[chapter]{chapter} %\automark[right side]{left side}
    \ihead{\headmark}% Inner header
    \ohead[\pagemark]{\pagemark}% Outer header


%vll
\setkomafont{pagehead}{\bfseries}  
\renewcommand\thechapter{\Roman{chapter}}
\usepackage[Conny]{fncychap} %
\ChNameAsIs  
\ChTitleAsIs  

\makeatletter
\def\@makechapterhead#1{%
\vspace*{-20\p@}
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter  
        \DOCH
      \fi
    \fi
    \interlinepenalty\@M
     \if@mainmatter % 
      \DOTI{#1}%
    \else%
      \DOTIS{#1}%
    \fi
  }}
\def\@makeschapterhead#1{% 
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \DOTIS{#1}
    \vskip -20\p@ 
  }}
\makeatother
%========================

\usepackage{tocbasic}
\newcommand*\Contribution{%
  \renewcommand*{\chaptername}{Contribution}%
  \setcounter{chapter}{0}%
  \addtocontents{toc}{%
    \bigskip \noindent\textbf{\large Contributions}\protect\par
    \DeclareTOCStyleEntry
      [entrynumberformat=\nullfont,numwidth=0pt,pagenumberformat=\textbf]
      {tocline}{chapter}%
    \protect\value{tocdepth}=0%
  }%
  \renewcommand\chaptermarkformat{}%
}

\usepackage[hypertexnames=false]{hyperref}
\usepackage[english]{babel}
\usepackage[autostyle=true]{csquotes} 
\usepackage{lipsum}
\begin{document}

\tableofcontents

\chapter{First chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1]

\chapter{Sec. chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\Contribution

\chapter[Contribution I: Paper title]{First paper's title}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\chapter[Contribution II: Paper title]{Second contribution}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]
\end{document}

Update (appendix after contributions)

In a comment OP asks for changeing back to the normal entry format for appendix chapters.

Then I would use

\usepackage{tocbasic}
\newcommand*\Contribution{%
  \renewcommand*{\chaptername}{Contribution}%
  \setcounter{chapter}{0}%
  \addtocontents{toc}{%
    \bigskip \noindent\textbf{\large Contributions}\protect\par
    \DeclareTOCStyleEntry
      [entrynumberformat=\nullfont,numwidth=0pt]
      {tocline}{chapter}%
    \protect\value{tocdepth}=0%
  }%
  \renewcommand\chaptermarkformat{}%
}
\xapptocmd\appendix{%
  \addtocontents{toc}{%
    \defaultchaptertocstyle
    \protect\value{tocdepth}=\the\value{tocdepth}%
  }%
  \let\chaptermarkformat\defaultchaptermarkformat
}
\newcommand*\defaultchaptertocstyle{%
  \DeclareTOCStyleEntry[entrynumberformat=\bfseries,numwidth=1.5em,pagenumberformat=\textbf]
    {tocline}{chapter}%
}
\AtBeginDocument{%
  \let\defaultchaptermarkformat\chaptermarkformat
  \defaultchaptertocstyle
}

enter image description here

Code:

\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\RequirePackage{xparse}% loads etoolbox

\RequirePackage{scrhack} % 

\RequirePackage[markcase=used]{scrlayer-scrpage}
\addtokomafont{pagenumber}{\oldstylenums}
%\providepairofpagestyles{thesisSimple}{%
    \clearpairofpagestyles%
    \automark[chapter]{chapter} %\automark[right side]{left side}
    \ihead{\headmark}% Inner header
    \ohead[\pagemark]{\pagemark}% Outer header


%vll
\setkomafont{pagehead}{\bfseries}  
\renewcommand\thechapter{\Roman{chapter}}
\usepackage[Conny]{fncychap} %
\ChNameAsIs  
\ChTitleAsIs  

\makeatletter
\def\@makechapterhead#1{%
\vspace*{-20\p@}
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter  
        \DOCH
      \fi
    \fi
    \interlinepenalty\@M
     \if@mainmatter % 
      \DOTI{#1}%
    \else%
      \DOTIS{#1}%
    \fi
  }}
\def\@makeschapterhead#1{% 
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \DOTIS{#1}
    \vskip -20\p@ 
  }}
\makeatother
%========================

\usepackage{tocbasic}
\newcommand*\Contribution{%
  \renewcommand*{\chaptername}{Contribution}%
  \setcounter{chapter}{0}%
  \addtocontents{toc}{%
    \bigskip \noindent\textbf{\large Contributions}\protect\par
    \DeclareTOCStyleEntry
      [entrynumberformat=\nullfont,numwidth=0pt]
      {tocline}{chapter}%
    \protect\value{tocdepth}=0%
  }%
  \renewcommand\chaptermarkformat{}%
}
\xapptocmd\appendix{%
  \addtocontents{toc}{%
    \defaultchaptertocstyle
    \protect\value{tocdepth}=\the\value{tocdepth}%
  }%
  \let\chaptermarkformat\defaultchaptermarkformat
}
\newcommand*\defaultchaptertocstyle{%
  \DeclareTOCStyleEntry[entrynumberformat=\bfseries,numwidth=1.5em,pagenumberformat=\textbf]
    {tocline}{chapter}%
}
\AtBeginDocument{%
  \let\defaultchaptermarkformat\chaptermarkformat
  \defaultchaptertocstyle
}

\usepackage[hypertexnames=false]{hyperref}
\usepackage[english]{babel}
\usepackage[autostyle=true]{csquotes} 
\usepackage{lipsum}
\begin{document}

\tableofcontents

\chapter{First chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1]

\chapter{Sec. chapter}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\Contribution

\chapter[Contribution I: Paper title]{First paper's title}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\chapter[Contribution II: Paper title]{Second contribution}
\lipsum[1]
\section{First section}
\lipsum[1]
\section{Sec. section}
\lipsum[1-4]

\appendix
\chapter{First appendix}
\section{An appendix section}
\lipsum
\section {Second appendix section}
\lipsum
\end{document}
7
  • This did not work for me. I am using MastersDoctoralThesis.sty class Dec 6, 2017 at 15:02
  • 1
    @LlavDem See my updated answer. You can use tocbasic with another class, too.
    – esdd
    Dec 6, 2017 at 16:44
  • Thanks for your edit, it's now almost looking like what I wanted; it works fine with MastersDoctoralThesis class as you mentioned. Is it difficult to define "\EndContributions" ? I have appendices and they are no longer proceded by a letter :( Dec 6, 2017 at 19:36
  • After the defined contribution I have: \chapter*{Conclusion} \phantomsection\addchaptertocentry{Conclusion}\markboth{Conclusion}{Conclusion} and then \appendix and \chapter{Appendix} with its sections. Now I have problem only in the appendix where A. Appendix title is replaced by Appendix title Dec 6, 2017 at 20:57
  • 1
    See my the third version in my updated answer. If there are more issues with changes to your original example, then please ask a follow up question with a new MWE.
    – esdd
    Dec 7, 2017 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .