%% %% The LaTeX Companion, 3ed %% %% Example 2-2-18 on page I-49 in "Conditional heading layouts". %% %% Copyright (C) 2022 Frank Mittelbach %% %% It may be distributed and/or modified under the conditions %% of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% %% See https://www.latex-project.org/lppl.txt for details. %% \documentclass{tlc3exa} \pagestyle{empty} \setcounter{page}{6} \setlength\textwidth{135.0pt} % For the book example: \setlength\textheight{8\baselineskip} \sloppy %StartShownPreambleCommands \usepackage{titlesec} \titleformat{name=\section}[block] {\normalfont\bfseries}{\thesection.}{6pt}{\filright} \titleformat{name=\section,numberless=true}[block] {\normalfont}{---}{12pt}{\itshape\filcenter} %StopShownPreambleCommands \begin{document} \section{A Head} Some text to fill the page. Some text to fill the page. \section*{Another} Some text to fill this line. \end{document}