Either one uses \refstepcounter{section}
directly each time or \fakesection
command that does \refstepcounter{section}
or redefines \section
to do effectively nothing apart from \refstepcounter{section}
.
In my point of view, it's better to redefine \section
to provide the possibility of using the same code later on when section titles and toc entries are needed.
I've done this here by appending the redefinition code to the \appendix
command, i.e. it's redefined only after \appendix
has been used.
Why \refstepcounter
and not just \stepcounter
?
Assume, that the (non-existent) appendix section should be referenced by a \label
command → this would only work with \refstepcounter{section}
and not with \stepcounter
only!
\documentclass{article}
\usepackage{graphicx}
\usepackage{xpatch}
\makeatletter
\let\latex@@section\section
\xapptocmd{\appendix}{%
\renewcommand{\section}[2][]{%
\refstepcounter{section}%
}
\renewcommand{\thefigure}{\thesection.\arabic{figure}}
}{}{}
\makeatother
\begin{document}
\tableofcontents
\section{A real section}
\clearpage
\appendix
\section{A dummy section}
\begin{figure}
\includegraphics[scale=2]{beeduck}
\caption{ A figure in a dummy section}
\end{figure}
\end{document}
\stepcounter{section}
. This will increase the relevant section number, but do you want to have the section titles in theToC
anyway? – user31729 Jan 9 '16 at 13:03\refstepcounter{section}
– user31729 Jan 9 '16 at 13:13