0

I want to write a document of the book class. I removed the word "Chapter" from every chapter title. To add a roman chapter number I used titlesec. But since I installed a new Linux distro (Mint 17.3 -> Mint 18.3) it seems to not work anymore. I use TeXStudio with the standard configuration (compiler: pdflatex).

In the minimal working example you can see that the chapter numbering still works for the header and the ToC, but not for the chapter title itself.

\documentclass[11pt,a4paper]{book}

\usepackage                             {dsfont}
\usepackage                             {emptypage}
\usepackage                             {fancyhdr}
\usepackage                             {geometry}
\usepackage[latin1]                     {inputenc}
\usepackage                             {lipsum}
\usepackage                             {lmodern}
\usepackage                             {subfig}
\usepackage                             {titlesec}
\usepackage[nottoc,chapter,numbib]      {tocbibind}
\usepackage[subfigure]                  {tocloft}
\usepackage                             {ucs}

% % % Title configuration % % %

\renewcommand{\thechapter}{\Roman{chapter}}
\setcounter{secnumdepth}{1}
\titleformat{\chapter}[hang]
    {\Huge\bfseries}{\thechapter.\ }{0pt}{}
\titleformat{\section}[hang] 
    {\Large\bfseries}{\thesection\ }{0pt}{}
\titlespacing*{\chapter}{0pt}{-15pt}{10pt}
\titlespacing*{\section}{0pt}{10pt}{5pt}

% % % more changes % % %

\parindent0pt
\geometry{top=20mm, outer=10mm, inner=20mm, bottom=20mm}

% % % Header % % %

\fancypagestyle{plain}{
    \fancyhf{}
    \fancyhead[RE,LO]{\nouppercase{\leftmark}}
    \fancyhead[RO,LE]{\textbf{\thepage}}
}
\setlength{\headheight}{14pt}
\pagestyle{plain}
\renewcommand{\chaptermark}[1]{ \markboth{\thechapter.\ #1}{} }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%Contents
\setcounter{tocdepth}{1}
\setlength{\cftchapnumwidth}{3em}
\setlength{\cftsecnumwidth}{3em}
\tableofcontents
\newpage

\chapter{Chapter name}
\section{Section name}
\lipsum[1-40]
\end{document}
  • Welcome! Try replacing \newpage with \mainmatter. – cfr Mar 9 '18 at 0:28
  • No problem here. Chapter title is I. Chapter name. – Sigur Mar 9 '18 at 0:28
  • if your document is in latin1 don't load ucs package (actually in general I'd avoid using ucs and just using the standard [utf8] option to inputenc even if your documemt is utf-8 encoded) but specifying latin1 then loading ucs looks wrong – David Carlisle Mar 9 '18 at 0:39
  • OK so for you it looks correct? Then it is probably a compiler issue. But how do I solve it? – Moritz Mar 9 '18 at 9:37
1

It seems like this is a well known bug. Solutions can be found here:

https://bugs.launchpad.net/ubuntu/+source/texlive-extra/+bug/1574052

EDIT:

The bug appeared in Version 2.10.1 of the titlesec package and was fixed a few days later. The texlive-package (from 2015) in the ubuntu 16.04 repository contains the titlesec-package with this version number. The solution is to add the following ppa, which contains the texlive-package from 2017 which contains the titlesec-package with the bugfix (version 2.10.2).

sudo add-apt-repository ppa:jonathonf/texlive-2017
sudo apt-get update
  • This bug was fixed days after it was introduced. That is one of the reasons not to install TeX Live with apt but directly from upstream. – Johannes_B Mar 9 '18 at 12:54
  • 3
    @Moritz Nope. The real solution is, upgrade. I cannot believe this short-lived version (just a few days, almost two years ago) is still being distributed. Please, complain to Ubuntu/Mint. The real "bug" is there. Sorry, but I've downvoted this answer, because it's the wrong answer. – Javier Bezos Mar 9 '18 at 15:51
  • Yes, you are right. I was too unprecise. I will correct that. – Moritz Mar 10 '18 at 11:22
  • @Johannes_B No. People should not be installing stuff manually. That's just a nightmare to maintain. That's how you end up having to format every year, like in windows. Just help fix bugs in released versions by notifying the maintainers and contributing what they need. APT/proper package management is one of the best features of linux, and we should use it better and promote it more, not less. – Ivan Perez Sep 16 '18 at 18:24

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.