1

This is the mwe showing the issue.

% !TeX program = lualatex
\documentclass[9pt, twoside]{extbook}
\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

% fancyhdr -----------------------------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}% resets head style
\fancyfoot{}% resets foot style

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}}
%
\fancyfoot[RE]{\fontsize{8}{9}\selectfont\leftmark\relax}
\fancyfoot[LO]{\fontsize{8}{9}\selectfont\rightmark\relax}
\fancyfoot[LE,RO]{\thepage\relax}
%
\renewcommand{\headrulewidth}{0pt}% head rule
\renewcommand{\footrulewidth}{0.4pt}% foot rule

% titlesec styles -----------------------------------------
\usepackage[compact,    % makes whitespace between \par and titles more compact
            newlinetospace, % replaces every \\ or \\* in titles with a space running heads and TOC entries
            clearempty, % clears page numbers in the empty pages
            ]{titlesec}

% title styles here ---------------------------------

\assignpagestyle{\chapter}{empty}

\begin{document}

\tableofcontents

\chapter{Pythagorean beans and\\Everlasting Dumbbells}
\section{For the King}
    \lipsum[2-5]

\subsection{Quasi-Monte Carlo Casino}
    \lipsum[2-9]

\subsubsection{Commentary}
    \lipsum[3]
\end{document}

(see the line break in \chapter and the entries in the toc and footer).


I'm in need of splitting the chapter titles in two lines. So I used a \\ in \chapter{}.

In order to fix the line break in toc and foot -the chapter title is being marked on the foot- I've set newlinetospace as option of titlesec.

From titlesec package

newlinetospace (Package option)-2.6 Replaces every occurrence of \\ or \\*" in titles by a space in running heads and TOC entries. This way, you do not have to repeat the title just to remove a formatting command.

The issue I'm having is that the option it is not working for me. I tried to put the fancyhdr commands processing the footer after the titlesec lines in the preamble without success, thinking fancyhdr did override titlesec. Also tried to change \fancyfoot[...]{...} commands to \fancyhead[...]{...} thinking newlinetospace only works on heads. (?) No success either. That option doesn't work even if i disable the fancyhdr package completely. And is not affecting the toc entry either as it should.

Any ideas on why this is happening?

Ps: I'm loading other packages at the current state of development, though I don't think they should be causing any conflicts.

Load order:

\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage{leading}
    \leading{12pt}
\usepackage{fancyhdr}
\usepackage{indentfirst}
    \setlength{\parindent}{12pt}
    \setlength{\parskip}{7pt}
\usepackage{etoolbox}
    %<spacing between equations commands>
\usepackage{mathtools}% loads amsmath as well
\usepackage{amssymb, tabu}
\usepackage{siunitx}% international units
\usepackage{esvect}% format vectors
\usepackage{mathdots}
\usepackage[no-math]{fontspec}
\usepackage[compact, newlinetospace, clearempty]{titlesec}
\usepackage[math-style=ISO, bold-style=ISO, nabla=upright, partial=upright]{unicode-math}
    \setmathfont{xits-math.otf}
0

1 Answer 1

1

You should also use the pagestyles option to titlesec. Here's an example.

\documentclass[9pt, twoside]{extbook}

\usepackage{fontspec}

\usepackage[
  compact,
  newlinetospace,
  clearempty,
  pagestyles,
]{titlesec}

\usepackage{lipsum}

\newpagestyle{main}[\small]{
  \settitlemarks{chapter,section,subsection}
  \sethead{}{}{}
  \setfoot[\ifthesubsection{\subsectiontitle}{\sectiontitle}][][\thepage]
          {\thepage}{}{\chaptertitle}
  \footrule
}
\pagestyle{main}

\assignpagestyle{\chapter}{empty}

\begin{document}

\tableofcontents

\chapter{Pythagorean beans and\\Everlasting Dumbbells}
\section{For the King}
    \lipsum[2-12]

\subsection{Quasi-Monte Carlo Casino}
    \lipsum[2-15]

\subsubsection{Commentary}
    \lipsum[3-6]

\end{document}

Note that luainputenc should not be used except that with legacy documents.

You must log in to answer this question.

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