3

I need about the same thing as Rob28... egreg's answer is perfect so far of course, but in addition, some of my titles are long and I have to split them at other places than the ones LaTeX chooses.

I find no way to have those three needs satisfied together at the same time: \MakeUppercase and \filcenter and have the title line cut where I want using \\

\documentclass[letterpaper,12pt]{book}
\usepackage{titlesec}

\titleformat{\chapter}[display]
    {\normalfont\Large\rmfamily\filcenter}
    {\MakeUppercase{\chaptertitlename} \thechapter}
    {1pc}
    {\MakeUppercase}

\begin{document}

\chapter[Palaeographical Profile]{Palaeographical\\% I need this line to be split here
        Profile}

\end{document}
1
  • 1
    Try \protect\\ or \endgraf instead of \\ .
    – cabohah
    Commented Feb 18 at 16:07

2 Answers 2

2

IMHO things like these are easier using a configurable class like scrbook:

\documentclass[letterpaper,12pt,chapterprefix]{scrbook}

\let\raggedchapter\centering
\renewcommand*{\chapterlineswithprefixformat}[3]{%
  \MakeUppercase{#2#3}%
}

\setkomafont{chapter}{\normalfont\Large}

\begin{document}

\chapter[Palaeographical Profile]{Palaeographical\\
        Profile}

\end{document}

enter image description here

However, with standard class and titlesec it should work, if you'd use \protect\\ instead of \\:

\documentclass[letterpaper,12pt]{book}
\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\Large\rmfamily\filcenter}
  {\MakeUppercase{\chaptertitlename} \thechapter}
  {1pc}
  {\MakeUppercase}

\begin{document}

\chapter[Palaeographical Profile]{Palaeographical\protect\\% I need this line to be split here
        Profile}

\end{document}
\documentclass[letterpaper,12pt,chapterprefix]{scrbook}

\let\raggedchapter\centering
\renewcommand*{\chapterlineswithprefixformat}[3]{%
  \MakeUppercase{#2#3}%
}

\setkomafont{chapter}{\normalfont\Large}

\begin{document}

\chapter[Palaeographical Profile]{Palaeographical\\
        Profile}

\end{document}

enter image description here

BTW: For uppercase printing of words letterspacing would be recommended. You can use, e.g., microtype to achieve it.

1
  • \protect did the trick, thank you! And I do appreciate your packages recommandations, especially microtype... it makes perfect sense in my work of re-doing an eighty years old technical book which I want to look as much as possible like the original --hence the uppercase
    – Olivier
    Commented Feb 18 at 17:18
2

I suggest not using \\ but a different command for that situation so you can use it in different ways.

\documentclass[letterpaper,12pt]{book}
\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\Large\rmfamily\filcenter}
  {\MakeUppercase{\chaptertitlename} \thechapter}
  {1pc}
  {\SafeMakeUppercase}

\ExplSyntaxOn
\NewDocumentCommand{\titlebreak}{}{\unskip\space\ignorespaces}
\NewDocumentCommand{\SafeMakeUppercase}{m}
 {
  \group_begin:
  \seq_set_split:Nnn \l_tmpa_seq { \titlebreak } { #1 }
  \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq { \MakeUppercase{##1} }
  \seq_use:Nn \l_tmpb_seq { \\ }
  \group_end:
 }
\ExplSyntaxOff


\begin{document}

\tableofcontents

\chapter{Palaeographical \titlebreak Profile}

\end{document}

enter image description here

The table of contents

enter image description here

You must log in to answer this question.

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