1

I'm writing a book in a scrreprt format. And, for the spacing and underlining the sections, I'm using the soul package. However, it throws an error in tableofcontents and bibliography. I'm clueless how to rectify this problem.

Here is the sample code:

...

\documentclass[a4paper, 12pt, headsepline, twoside, openright, parskip,fleqn]{scrreprt}

\usepackage{filecontents}
\begin{filecontents}{xyz.bib}
    @article{two,
        title={Die neuen Vierventil-Ottomotoren fur die mittlere Braureihe von Mercedes-Benz (Germany)},
        author={Abthoff, Von J and Huttebraucker, D and Zahn, W and Bockel, H},
        journal={Mtz},
        volume={53},
        pages={496--508},
        year={1992}
    }
    @inproceedings{three,
        title={Strategies for NOx reduction in heavy duty engines},
        author={Al-Sened, A and Karimi, E},
        booktitle={Proceedings of the 23rd CIMAC Congress},
        year={2001}
    }
    
    @misc{four,
        title={Deutsche Stiftung Weltbevölkerung},
        author={Bundesministerium für Wirtschaft und Arbeit},
        year={2003/04},
        publisher={NOAA}
    }
    
\end{filecontents}

\usepackage{soul}
\usepackage{soulutf8}
\usepackage{anyfontsize}
\usepackage{titlesec}
\titleformat{\chapter}
{\normalfont\fontsize{14}{16.8}\bfseries}
{\ul{\thechapter\enspace}}
{0em}
{\ul}
\setul{0.3pt}{1.5pt}
\titleformat{\section}
{\normalfont\fontsize{12}{15}\bfseries}
{\ul{\thesection\enspace}}
{0em}
{\ul}
\titleformat{\subsection}
{\normalfont\fontsize{12}{15}\bfseries}
{\ul{\thesubsection\enspace}}
{0em}
{\ul}
\titleformat{\subsubsection}
{\normalfont\fontsize{12}{15}\bfseries}
{\ul{\thesubsubsection\enspace}}
{0em}
{\ul}


\usepackage{fontspec}

\usepackage{unicode-math}
\setmainfont{Arial}
\setsansfont{Arial}

\setmathfont{GFSNeohellenicMath.otf}%equation font in arial font
\setmathfont[range=up]{Arial}
\setmathfont[range=it]{Arial Italic}
\setmathfont[range=bfup]{Arial Bold}
\setmathfont[range=bfit]{Arial Bold Italic}

\usepackage[numbers]{natbib}
\bibliographystyle{IEEEtranN} 
\bibpunct{/}{/}{;}{n}{}{,}
\renewcommand{\bibnumfmt}[1]{/#1/}
\begin{document}
\tableofcontents

\chapter{Thermodynamics}
\section{Heat}
Propagation of turbulent flames \cite{two} in spark-ignition engines is considered from the viewpoint of the different possible regimes \cite{three} of premixed turbulent combustion.\cite{four} Nondimensional parameters defining known combustion regimes are reviewed, 

    \medskip
    
    \bibliography{xyz}

\end{document}

...

7
  • are you using lualatex? – Ulrike Fischer Jun 22 '20 at 11:43
  • Yes. Should I use something else? This is because there are some packages and function that works only on lualatex. – Bdr Jun 22 '20 at 12:09
  • with lualatex you could use the lua-ul package instead of soul (this needs a current tex system). – Ulrike Fischer Jun 22 '20 at 12:11
  • Why would you underline section titles to begin with? – egreg Jun 22 '20 at 12:45
  • This is the format that I want to produce. That's why. – Bdr Jun 22 '20 at 12:48
0

It turns out that soul doesn't like \@mkboth at all.

If you don't need headers, the solution is to locally neutralize the command.

Beware that scrreprt doesn't really like titlesec. And also that underlining (especially so tight) is not typographycally very sound.

\begin{filecontents}{\jobname.bib}
    @article{two,
        title={Die neuen Vierventil-Ottomotoren fur die mittlere Braureihe von Mercedes-Benz (Germany)},
        author={Abthoff, Von J and Huttebraucker, D and Zahn, W and Bockel, H},
        journal={Mtz},
        volume={53},
        pages={496--508},
        year={1992}
    }
    @inproceedings{three,
        title={Strategies for NOx reduction in heavy duty engines},
        author={Al-Sened, A and Karimi, E},
        booktitle={Proceedings of the 23rd CIMAC Congress},
        year={2001}
    }
    
    @misc{four,
        title={Deutsche Stiftung Weltbevölkerung},
        author={Bundesministerium für Wirtschaft und Arbeit},
        year={2003/04},
        publisher={NOAA}
    }
    
\end{filecontents}

\documentclass[a4paper, 12pt, headsepline, twoside, openright, parskip,fleqn]{scrreprt}

\usepackage{soulutf8}
\usepackage{anyfontsize}
\usepackage{titlesec}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage[numbers]{natbib}

\setul{0.3pt}{1.5pt}

\makeatletter
\newcommand{\ulex}[1]{%
  \let\@mkboth\@gobbletwo % neutralize \@mkboth in unnumbered chapters
  \expanded{\noexpand\ul{#1}}}
\makeatother

\titleformat{name=\chapter}
  {\normalfont\fontsize{14}{16.8}\bfseries}
  {\ul{\thechapter\enspace}}
  {0em}
  {\ul}
\titleformat{name=\chapter,numberless}
  {\normalfont\fontsize{14}{16.8}\bfseries}
  {}
  {0em}
  {\ulex}
\titleformat{\section}
  {\normalfont\fontsize{12}{15}\bfseries}
  {\ul{\thesection\enspace}}
  {0em}
  {\ul}
\titleformat{\subsection}
  {\normalfont\fontsize{12}{15}\bfseries}
  {\ul{\thesubsection\enspace}}
  {0em}
  {\ul}
\titleformat{\subsubsection}
  {\normalfont\fontsize{12}{15}\bfseries}
  {\ul{\thesubsubsection\enspace}}
  {0em}
  {\ul}

\setmainfont{Arial}
\setsansfont{Arial}

\setmathfont{GFSNeohellenicMath.otf}%equation font in arial font
\setmathfont[range=up]{Arial}
\setmathfont[range=it]{Arial Italic}
\setmathfont[range=bfup]{Arial Bold}
\setmathfont[range=bfit]{Arial Bold Italic}

\bibliographystyle{IEEEtranN} 
\bibpunct{/}{/}{;}{n}{}{,}
\renewcommand{\bibnumfmt}[1]{/#1/}

\begin{document}

\tableofcontents

\chapter{Thermodynamics}
\section{Heat}
Propagation of turbulent flames \cite{two} in spark-ignition engines is considered from the viewpoint of the different possible regimes \cite{three} of premixed turbulent combustion.\cite{four} Nondimensional parameters defining known combustion regimes are reviewed, 

    \medskip
    
    \bibliography{xyz}

\end{document}
1
  • Thank you! It works. – Bdr Jun 22 '20 at 19:08

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.