1

For my PhD thesis I have started using LaTeX a while ago. I am using Overleaf. I have learned a lot already, but I am not successful in trying to get the appendices to look a certain way.

  • How can I have the section number (Appendix A.1) on the first line, and the title (Title) on the next?
  • I have added the word Appendix to the numbering. How can I fix the overlap between the number and the title in the ToC?

In the chapters the text in the headings is all caps, but not in the appendices.

  • How do I change the text in the heading to all caps?

.

\documentclass[10pt,twoside,openright]{book}
\usepackage{geometry}
\geometry{
    vmarginratio=7:5,
    hmarginratio=1:1,
    papersize={170mm,240mm},
    total={130mm,190mm}
}

\usepackage[T1]{fontenc}

% package voor de laatste versie van het standaard lettertype
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}

\pagestyle{headings}


\begin{document}

\frontmatter

\tableofcontents

\mainmatter
\chapter{Introduction}
\lipsum[1-4]
\section{This is how we do it}
\lipsum[1-4]

\chapter{Results}
\lipsum[1-5]


\appendix
\renewcommand{\thesection}{Appendix \Alph{chapter}.\arabic{section}}
\renewcommand\chaptermark[1]{\markboth{\appendixname~\thechapter}{}}


\chapter{Appendices for Chapter 1}

Here we present two subappendices that correctly show the Appendix A thumb mark.

\cleardoublepage

\section{Title}
\thispagestyle{plain}
\lipsum[1-8]

\cleardoublepage

\section{Another title}
\thispagestyle{plain}
\lipsum[1-8]

\end{document}
  • Welcome to TeX.SE. – Mico Jan 27 at 0:06
2

You asked three questions.

How can I have the section number (Appendix A.1) on the first line, and the title (Title) on the next?

I would actually like to discourage you from inserting a line break between the sectioning header ("Appendix A.1") and the associated section text. Given that the section numbers and section headers are typeset on the same line everywhere else in the document, your readers might find it strange (if not outright distracting) to come across a line break between the (now augmented) section "number" and the section title itself.

The suggestions below show how to insert the prefix "Appendix" before the section number.

I have added the word Appendix to the numbering. How can I fix the overlap between the number and the title in the ToC?

I suggest that you delete (or comment out) the instruction

\renewcommand{\thesection}{Appendix \Alph{chapter}.\arabic{section}}

and that you insert the following code immediately after the \appendix instruction:

\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\quad}%     default
   {\csname #1@cntformat\endcsname}}%  enable individual control
\newcommand\section@cntformat{\appendixname~\thesection\quad}
\makeatother

This solution not only takes care of the overlap issue in the table of contents, it also makes creating cross-references to the appendix sections straightforward. Note that this solution does not insert the string \appendixname in the title of contents entries; this is deliberate, since readers should be able to figure out easily that the section entries belong to Appendix A (or some other numbered appendix).

In the chapters the text in the headings is all caps, but not in the appendices. How do I change the text in the heading to all caps?

I suggest you change

\renewcommand\chaptermark[1]{\markboth{\appendixname~\thechapter}{}}

to

\renewcommand\chaptermark[1]{\markboth{\MakeUppercase{\appendixname}~\thechapter}{}}

A final comment: Latin Modern Sans is frequently not regarded as sans serif font suitable to large amounts of running text. To load a Helvetica clone, just insert the instruction

\usepackage{helvet}

before running \renewcommand{\familydefault}{\sfdefault}.

enter image description here

\documentclass[10pt,twoside,openright]{book}
\usepackage{geometry}
\geometry{
    vmarginratio=7:5,
    hmarginratio=1:1,
    papersize={170mm,240mm},
    total={130mm,190mm}
}

\usepackage[T1]{fontenc}

\usepackage[dutch]{babel} % ?

% package voor de laatste versie van het standaard lettertype
\usepackage{lmodern}
\usepackage{helvet}  % LM Sans isn't a very good font for running text
\renewcommand{\familydefault}{\sfdefault}

\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}

\pagestyle{headings}

\begin{document}

\frontmatter
\tableofcontents

\bigskip\noindent % just for this example
A cross-reference to appendix section \ref{sec:app:1}.


\mainmatter
\chapter{Introduction}
\lipsum[1-4]
\section{This is how we do it}
\lipsum[1-4]

\chapter{Results}
\lipsum[1-5]

\appendix
%\renewcommand{\thesection}{Appendix \Alph{chapter}.\arabic{section}}
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\quad}%     default
   {\csname #1@cntformat\endcsname}}%  enable individual control
\newcommand\section@cntformat{\appendixname~\thesection\quad}
\makeatother

\renewcommand\chaptermark[1]{\markboth{\MakeUppercase{\appendixname}~\thechapter}{}}


\chapter{Appendices for Chapter 1}
Here we present two appendix sections which correctly show the ``Appendix~A'' thumb mark.

\cleardoublepage
\section{Title} \label{sec:app:1}
\thispagestyle{plain}
\lipsum[1-8]

\cleardoublepage
\section{Another title}
\thispagestyle{plain}
\lipsum[1-8]

\end{document}

Addendum to address the OP's follow-up question, about creating a line break between the appendix section number and the associated sectioning header. To achieve this objective, I suggest you (a) load the titlesec package in the preamble, (b) remove the code block

\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\quad}%     default
   {\csname #1@cntformat\endcsname}}%  enable individual control
\newcommand\section@cntformat{\appendixname~\thesection\quad}
\makeatother

and (c) insert the following instruction after \appendix:

\titleformat{\section}[display]{\normalfont\Large\bfseries}{%
   \appendixname~\thesection}{0pt}{}
  • Thank you. Your suggestions nicely resolve the overlap issue and the all caps in the page heading. I would still like to split the title over two line, because some of my appendices have long titles that I would like to have all on one line under the 'Appendix A.1' heading. Can you help me with the code to do that? I do appreciate your suggestion about using Helvet instead of Latin Modern Sans, and I will consider it. However, I do not like the look of the Helvetica font and I will try to find another suitable font instead. Any suggestions are welcome. – Esther Jan 28 at 11:41
  • @Esther - About sans-serif fonts (other than either Helvetica or CM/LM Sans): Are you free to use LuaLaTeX or XeLaTeX? If so, you could use any and all sans serif text fonts that are installed on your computer, simply by loading the fontspec package and issuing a \setmainfont directive with a suitably chosen argument. – Mico Jan 28 at 15:19
  • @Esther - I posted an addendum to address your follow-up question. – Mico Jan 28 at 15:34
  • Mico, thank you for the addendum. It does exactly what I was looking for. – Esther Jan 28 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.