# tilesec error with babel

\documentclass[ukenglish,10pt,a4paper,openany]{book}
\usepackage{babel}
\usepackage[pagestyles]{titlesec}
\titleformat{\chapter}{\normalfont\Large}{\thechapter}{12mm}{}[\titlerule]
\titlespacing*{\chapter}{0pt}{6mm}{1cm}
\titleformat{\section}{\normalfont\large}{\thesection}{8mm}{}
\titlespacing*{\section}{0pt}{5mm}{5mm}
\newpagestyle{main}{
{\thesection)}{\sectiontitle}{\thepage}} % odd
\begin{document}\pagestyle{main}
\chapter{C1}
\section{S1}
\end{document}


generates the

"The <format> argument cannot contain horizontal material such as text, \noindent, \makebox, etc."


error message at the \chapter{C1} command and I don't see why. What am I missing?

This was a bug introduced in the 2019-10-01 update of the LaTeX kernel. In this update a handful of commands were made robust, and some packages (such as babel in this case) try to redefine these commands. If these redefinitions do not take the new robustness into account, bad things may happen.

The current problem arises because babel redefines \markboth (without taking into account that it's now robust) and then it mistakenly typesets the current language in section headings. titlesec doesn't like that and raises the error you see.

The issue can be narrowed down to:

\documentclass{article}
\usepackage{babel}
\usepackage{titleps}
\newpagestyle{main}{}
\begin{document}
\pagestyle{main}
\section{a}
\end{document}


The bug has already been fixed. If you're experiencing this problem you need to update babel.

• Thanks Phelye, that seems to work just fine! I look forward to an update of babel. – Paul Walker Oct 15 '19 at 2:38
• @PaulWalker babel is now updated on CTAN. I've just updated my TeXLive and everything is working now. – Phelype Oleinik Oct 16 '19 at 12:25
• Yes, looks like all is working for me too. Thanks for your help. – Paul Walker Oct 16 '19 at 14:55

I tried setting the English language and it worked. Try to set encoding options too.

\documentclass[english,10pt,a4paper,openany]{book}
%--------------------------------------
%encoding
%--------------------------------------
\usepackage[utf8]{inputenc} %Allow to input letters of national alphabets directly from the keyboard.
\usepackage[T1]{fontenc} %choose a font encoding which has to support specific characters for Spanish language

\usepackage{babel}
\usepackage[pagestyles]{titlesec}
\titleformat{\chapter}{\normalfont\Large}{\thechapter}{12mm}{}[\titlerule]
\titlespacing*{\chapter}{0pt}{6mm}{1cm}
\titleformat{\section}{\normalfont\large}{\thesection}{8mm}{}
\titlespacing*{\section}{0pt}{5mm}{5mm}
\newpagestyle{main}{
{\thesection)}{\sectiontitle}{\thepage}} % odd
\begin{document}\pagestyle{main}
\chapter{C1}
\section{S1}
\end{document}

• Welcome to TeX.SX! Does it really? The error is the same for me... – Phelype Oleinik Oct 15 '19 at 1:26
• Tried just english and still got the same error. – Paul Walker Oct 15 '19 at 1:30
• You can see my result: imgur.com/vJlrxyy – Rogelio Prieto Oct 15 '19 at 1:38
• Try set encoding options: %-------------------------------------- %encoding %-------------------------------------- \usepackage[utf8]{inputenc} %Allow to input letters of national alphabets directly from the keyboard. \usepackage[T1]{fontenc} %choose a font encoding which has to support specific characters for Spanish language – Rogelio Prieto Oct 15 '19 at 1:40
• @PaulWalker The issue is due to the 2019-10-01 update of the LaTeX kernel. Rogelio is probably using an older version. As I said, completely unrelated to language or encoding. – Phelype Oleinik Oct 15 '19 at 2:10