# Headings in appendix \section*

I'm using this and this approaches to get my appendix sections as I want, so a MWE of my code would look like:

\documentclass{article}
\begin{document}
\tableofcontents
\clearpage
\section{abc}
def
\section{ghi}
jkl

\appendix
\clearpage
\section*{Ap: ETC}
\renewcommand{\thesubsection}{A.\arabic{subsection}}
App. content.

\subsection{First A.}
F. A. content.
\subsection{Second A.}
S. A. content.

\end{document}


The problem is that this makes the appendices pages heading to be the previous non-appendix section's one. One option may be to use \pagestyle{myheadings} and \markboth but, is there any more automatic solution?

• Jan 13, 2014 at 9:37

If you have only one section in the appendix, it's better to define a command that does everything needed.

\documentclass{article}

\newcommand{\appsection}[1]{%
\clearpage
\appendix
\section*{#1}%
\markboth{#1}{#1}%
\renewcommand{\thesubsection}{A.\arabic{subsection}}%
}

\begin{document}

\tableofcontents

\clearpage

\section{abc}
def

\section{ghi}
jkl

\appsection{Ap: ETC}

App. content.

\subsection{First A.}
F. A. content.
\subsection{Second A.}
S. A. content.

\end{document}


This might be easily changed if there's more than one section in the appendix. Say

\newcommand{\startappendix}{%
\clearpage\appendix
\setcounter{section}{0}%
\renewcommand{\thesection}{\Alph{section}}%
}

\newcommand{\appsection}[1]{%
\refstepcounter{section}%
\section*{#1}%
\markboth{#1}{#1}%
}


so that you can say

\startappendix

\appsection{First}
...

\appsection{Second}
...

• For a \section* in the article class, shouldn't one use \markboth (to ensure correct headings with the twoside option)? Jan 13, 2014 at 10:00
• @lockstep The example doesn't say twoside, but in that case \markboth{#1}{} should be used. Jan 13, 2014 at 10:01
• I'd have thought that \markboth{#1}{#1} would yield correct results for both oneside and twoside. Did I overlook something? Jan 13, 2014 at 10:04
• After checking this question I would suggest, to fake the heading properly, to change #1 with \MakeUppercase{#1}. Or even with 2 arguments: #1 for "Ap: " and \MakeUppercase{#2} for "Etc", if it is "Etc" and not "ETC". Jan 14, 2014 at 11:16
• @Andrestand This is assuming you like all uppercase headers. ;-) I don't. But, if you need they are that way, of course add \MakeUppercase. Jan 14, 2014 at 11:30