titlesec does not render section numbers

Bug #1574052 reported by Shen Yichen on 2016-04-23
84
This bug affects 17 people
Affects Status Importance Assigned to Milestone
texlive-extra (Ubuntu)
Low
Unassigned
Nominated for Xenial by Connor Imes

Bug Description

The titlesec package does not work properly after distribution upgrade to 16.04LTS.

Steps to reproduce:
1) Create a tex document and include titlesec
2) Create some sections headers via \section{Some section}
3) Run pdflatex/lualatex/xelatex

What should happen
The section should be created with the corresponding number: 1 Some Section

What happens
Only the text is present: Some Section

If the section header format is changed via \titleformat, the entire formatting disappears from the final pdf.

Might be related to https://groups.google.com/forum/#!topic/comp.text.tex/MBd3-o2Dzx8

Ubuntu Version: 16.04 LTS
texlive-latex-extra Version: 2015.20160320-1

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in texlive-extra (Ubuntu):
status: New → Confirmed
Davide Alberelli (dadexix86) wrote :

This is really annoying.

Anyobody knows how to correct this problem (it is corrected in the new TexLive version), as a workround while we wait for the developers?

Shen Yichen (2007-yichen) wrote :

One workaround that worked for me was to manually download the titlesec package from CTAN: https://www.ctan.org/pkg/titlesec?lang=en.

Then, either change the \usepackage to point to where you placed the new titlesec.sty, or just unpack the entire package right next to the tex file. It should overwrite the default system titlesec package.

Davide Alberelli (dadexix86) wrote :

What worked for me, is to unpack it directly in the system directory, since I use it in many different places.

Another work-around is given on tex.sx at http://tex.stackexchange.com/a/300259/1913 (cu’n{pasted below)

You can cure the bug by adding

\usepackage{etoolbox}

\makeatletter
\patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}{}{}
\patchcmd{\ttlh@hang}{\noindent}{}{}{}
\makeatother

after \usepackage{titlesec}.

The issue affects titlesec version 2.10.1 but was corrected in version 2.10.2 (released 2016/03/21)

Connor Imes (ckimes) wrote :

Yakkety has a newer version so presumably it is fixed there - can anybody confirm?
Still outstanding in Xenial though.

Changed in texlive-extra (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
Harris Anggara (harrisanggara) wrote :

i'm using ubuntu 16.04 with ppa:lyx-devel/release
they still provide titlesec 2.10.1, and yes this bug affects me too.

workaround:
installing tittlesec 2.10.2 on /usr/share/texlive/texmf-dist/tex/latex/ fix the problem.

claus (claus2) wrote :

Hi,

I'm also affected. As I work on a collaborative document where I cannot just change the basic document to make workarounds this bug is really a show stopper for me.
Could a maintainer please
 * change importance to medium or more?
 * give some information on why the newer version of titlesec cannot be packaged? I read "The issue has been solved with titlesec version 2.10.2 (released 2016/03/21)" at http://tex.stackexchange.com/questions/299969/titlesec-loss-of-section-numbering-with-the-new-update-2016-03-15?
Thanks for your help!

Connor Imes (ckimes) wrote :

Nominated for Xenial since this is presumably fixed in Yakkety. I understand your frustration, claus. I also would very much like this fixed in Xenial, but I still believe (to my own dismay) that the Low importance is appropriate per the triage guidelines - see https://wiki.ubuntu.com/Bugs/Importance.

To get this fixed in Xenial, somebody needs to go through the process for a SRU - https://wiki.ubuntu.com/StableReleaseUpdates

You can also add the following after \usepackage{titlesec} to only apply the patch when you're on the specific version of titlesec (which is what I did on a shared project). Remove the \makeatletter and \makeatother and change \usepackage to \RequirePackage when you're adding it to your classfile right after \RequirePackage{titlesec}.

\@ifpackagelater{titlesec}{2016/03/21}{%
 % Package titlesec is on version 2.10.2 or higher, nothing to do %
}{%
 % Check if package titlesec is on version 2.10.1 %
 \@ifpackagelater{titlesec}{2016/03/15}{%
  % Package titlesec on version 2.10.1, patch accordingly %
  \usepackage{etoolbox}%
  \makeatletter
  \patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}{}{}%
  \patchcmd{\ttlh@hang}{\noindent}{}{}{}%
  \makeatother
 }{%
  % Package titlsecon is on version 2.10.0 or lower, nothing to do %
 }%
}

Michael Shulman (shulman) wrote :

Niels, thanks for that conditional patch code! But don't you need the \makeatletter *before* the \@ifpackagelater?

Hi Michael, that is perfectly possible, I have actually adopted it in a class-file, so I have not tested it with the \makeatletter and \makeatother commands myself. I tried to (apparently incorrectly) adapt the code to the use-case of Frédéric. Please try for yourself what works, thank you for your observation.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers