2

Due to my research topic, I would like to write my PhD dissertation in LaTeX. One of my friend, who defended his thesis last year, sent me his his code (.tex file) - he has already set up all the formats that our doctoral school has requested. When it was used last year (May/June), there was no problem. However, when I wanted to use it now, it listed several errors. I already asked a question about the problems yesterday (didn’t delete it, but asked a new question instead of editing it), and thanks to a received comment and further reading, I was able to fix the errors. The latest problem is with formatting chapter titles. I can’t figure out why I can’t apply the changes I want to the numbered chapters. Let me show you my problem throughout screenshots.

If I use a scrrept class, the formatting of chapter titles will be as desired, but the formatting of sections and subsections will be incorrect - several errors will shown. Based on a comment I received yesterday, the combined use of scrrept and titlesec should be avoided, so I switched to report.

If I use a scrrept class, the formatting of chapter titles will be as desired, but the formatting of sections and subsections will be incorrect - several errors will shown. Based on a comment I received yesterday, the combined use of scrrept and titlesec should be avoided, so I switched to report.

In the case of report, the section and subsection titles are perfectly formatted, but the chapter title does not appear as desired. I tried to find the solution, but it didn't work, even though I tried all the possibilities offered in forums/user manuals.

In the case of report, the section and subsection titles are perfectly formatted, but the chapter title does not appear as desired. I tried to find the solution, but it didn't work, even though I tried all the possibilities offered in forums/user manuals.

However, for an unnumbered chapter title, formatting works perfectly.

However, for an unnumbered chapter title, formatting works perfectly.

My friend used the scrreprt, because this document class omits the word “Chapter” by default. It worked for him a year ago, but it no longer worked for me. I’m not an expert, so I’m sorry if the error would be obvious, but I just can’t figure it out on my own.

The simple version of the code I'm using right now:

\documentclass[12pt,a4paper,numbers=enddot,listof=totoc]{scrreprt}

\usepackage[magyar]{babel}
\usepackage{newtxmath,newtxtext}

\frenchspacing
\linespread{1.3}

\usepackage[top=2.5cm, bottom=2.5cm, outer=2.5 cm, inner=3.5cm]{geometry}
\usepackage[font=large]{caption}
\captionsetup{labelsep=colon}
\captionsetup{labelfont=bf}
\counterwithout{figure}{chapter}
\counterwithout{equation}{section}
\counterwithout{table}{chapter}

%\makeatletter
%\newcommand{\addcolonandeatperiod}{\@ifnextchar.{:\@gobble}\relax}
%\makeatother

% without titlesec and indentfirst
\renewcommand*{\chapterformat}{\thechapter\autodot\enskip\hspace{1em}}
\RedeclareSectionCommand[
  font=\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
%  afterindent=true
  afterindent=true,
  tocentryformat=\bfseries,
  tocpagenumberformat=\bfseries% <- if the page number should be bold, too
]{chapter}
\RedeclareSectionCommand[
  font=\fontsize{14}{14}\itshape,
  indent=6pt,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true
]{section}
\RedeclareSectionCommand[
  font=\normalsize\bfseries,
  indent=12pt,
  beforeskip=18pt plus 4pt minus 2pt,
  afterskip=18pt plus 4pt minus 2pt,
  afterindent=true
]{subsection}

%\usepackage[titles]{tocloft}
%\renewcommand{\contentsname}{Table of contents}
%\renewcommand{\cftchapfont}{\normalfont\bfseries}% titles in bold
%\renewcommand{\cftchappagefont}{\normalfont\bfseries}% page numbers in bold
%\renewcommand{\cftdotsep}{1}
%%\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftsecdotsep}}% dot leaders in bold

\setkomafont{disposition}{\normalfont}

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\newpage

\listoftables
\begingroup
\let\clearpage\relax
\listoffigures
\endgroup
\newpage

\addchap{Köszönetnyilvánítás}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\newpage

\pagenumbering{arabic}    

\chapter{Főszöveg}    

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

\section{Fejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\subsection{Alfejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc.    

 \begin{table}[h]
    \centering
    \caption{\textbf{Mintatábla}}
    \label{mintatabla}
    \begin{tabular}{ll}
        11 & 12 \\
        21 & 22 
    \end{tabular}
\end{table}

\end{document}

I'm using TeXstudio 2.12.22 (git 2.12.22) and PDFLaTeX.

I would appreciate any kind of help, comments, ideas! Thank you!

With the tocloft package:

(Táblázatok jegyzéke - List of Tables; Ábrák jegyzéke - List of Figures)

tocloft

Without the tocloft:

(Táblázatok jegyzéke - List of Tables; Ábrák jegyzéke - List of Figures)

with your update

1 Answer 1

1

Do not use package titlesec together with a KOMA-Script class. They are incompatible.

Suggestion without titlesec and indentfirst:

\documentclass[12pt,a4paper,numbers=enddot]{scrreprt}
%\usepackage[utf8]{inputenc}% only needed with older TeX-distributions
\usepackage[T1]{fontenc}
\usepackage[magyar]{babel}
\usepackage{newtxmath,newtxtext}

\frenchspacing
\linespread{1.3}

\usepackage[top=2.5cm, bottom=2.5cm, outer=2.5 cm, inner=3.5cm]{geometry}
\usepackage[font=large]{caption}
\captionsetup{labelsep=colon}
\captionsetup{labelfont=bf}
\counterwithout{figure}{chapter}
\counterwithout{equation}{section}
\counterwithout{table}{chapter}

%\makeatletter
%\newcommand{\addcolonandeatperiod}{\@ifnextchar.{:\@gobble}\relax}
%\makeatother

\renewcommand*{\chapterformat}{\thechapter\autodot\enskip\hspace{1em}}
\RedeclareSectionCommand[
  font=\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true,
  tocentryformat=\bfseries,
  tocpagenumberformat=\bfseries% <- if the page number should be bold, too
]{chapter}
\RedeclareSectionCommand[
  font=\fontsize{14}{14}\itshape,
  indent=6pt,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true
]{section}
\RedeclareSectionCommand[
  font=\normalsize\bfseries,
  indent=12pt,
  beforeskip=18pt plus 4pt minus 2pt,
  afterskip=18pt plus 4pt minus 2pt,
  afterindent=true
]{subsection}

\setkomafont{disposition}{\normalfont}

\begin{document}
\pagenumbering{Roman}
\tableofcontents

\addchap{Köszönet}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\cleardoubleoddpage% <- changed
\pagenumbering{arabic}
\chapter{Főszöveg}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend.

\section{Fejezet}
Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc.

\subsection{Alfejezet}
Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 
\end{document}

enter image description here

ToC:

enter image description here


Update

You can use

\AfterTOCHead[lof]{\def\autodot{}}
\AfterTOCHead[lot]{\def\autodot{}}

to remove the second dot for figure and table entries.

\documentclass[12pt,a4paper,numbers=enddot,listof=totoc]{scrreprt}
\AfterTOCHead[lof]{\def\autodot{}}% <- added
\AfterTOCHead[lot]{\def\autodot{}}% <- added
\usepackage[magyar]{babel}
\usepackage{newtxmath,newtxtext}

\frenchspacing
\linespread{1.3}

\usepackage[top=2.5cm, bottom=2.5cm, outer=2.5 cm, inner=3.5cm]{geometry}
\usepackage[font=large]{caption}
\captionsetup{labelsep=colon}
\captionsetup{labelfont=bf}
\counterwithout{figure}{chapter}
\counterwithout{equation}{section}
\counterwithout{table}{chapter}

%\makeatletter
%\newcommand{\addcolonandeatperiod}{\@ifnextchar.{:\@gobble}\relax}
%\makeatother

% without titlesec and indentfirst
\renewcommand*{\chapterformat}{\thechapter\autodot\enskip\hspace{1em}}
\RedeclareSectionCommand[
  font=\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
%  afterindent=true
  afterindent=true,
  tocentryformat=\bfseries,
  tocpagenumberformat=\bfseries% <- if the page number should be bold, too
]{chapter}
\RedeclareSectionCommand[
  font=\fontsize{14}{14}\itshape,
  indent=6pt,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true
]{section}
\RedeclareSectionCommand[
  font=\normalsize\bfseries,
  indent=12pt,
  beforeskip=18pt plus 4pt minus 2pt,
  afterskip=18pt plus 4pt minus 2pt,
  afterindent=true
]{subsection}

%\usepackage[titles]{tocloft}
%\renewcommand{\contentsname}{Table of contents}
%\renewcommand{\cftchapfont}{\normalfont\bfseries}% titles in bold
%\renewcommand{\cftchappagefont}{\normalfont\bfseries}% page numbers in bold
%\renewcommand{\cftdotsep}{1}
%%\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftsecdotsep}}% dot leaders in bold

\setkomafont{disposition}{\normalfont}

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\newpage
\listoftables

\begingroup
\let\clearpage\relax
\listoffigures
\endgroup
\newpage

\addchap{Köszönetnyilvánítás}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\newpage

\pagenumbering{arabic}    

\chapter{Főszöveg}    

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

\section{Fejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\subsection{Alfejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc.    

 \begin{table}[h]
    \centering
    \caption{\textbf{Mintatábla}}
    \label{mintatabla}
    \begin{tabular}{ll}
        11 & 12 \\
        21 & 22 
    \end{tabular}
\end{table}

\end{document}

enter image description here

6
  • Thank you for your kind help! After using your solution, my table of contents is written in normal font, although the chapter titles should be in bold. If not a big problem, could you tell me what is causing this and how this can be changed? Jun 29, 2020 at 10:55
  • After some reading, with the help of \usepackage[titles]{tocloft} I succesfully solved it (right now, it seems okay)! Once again, thank you for your suggestion, I did not expect so much help! Jun 29, 2020 at 17:04
  • 1
    See my updated answer. I have added tocentryformat and tocpagenumberformat to the chapter settings. Do not use package tocloft together with a KOMA-Script class.
    – esdd
    Jun 30, 2020 at 14:29
  • Again, thank you for your kind! However, I would have another question that I just noticed: the doctoral school requires that the list of tables and figures used in the dissertation be included after the table of contents (and the table of contents also includes this list). The code I got solved this with the tocbibind package. Based on a comment you wrote (for another question) I was able to resolve this in a scrrept compatible way without tocbibind. Jul 1, 2020 at 0:08
  • 1
    The additional dot is inserted by the magyar option of babel. I do not know how to disable this magyar feature. But you can disable the autodot for the LoF and LoT entries using \AfterTOCHead[lof]{\def\autodot{}} and \AfterTOCHead[lot]{\def\autodot{}}.
    – esdd
    Jul 1, 2020 at 8:15

You must log in to answer this question.

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