Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to have my appendices labelled 'Appendix A', 'Appendix B', etc. However, when I use appendices in LaTeX (specifically llncs document class, downloadable at ftp://ftp.springer.de/pub/tex/latex/llncs/latex2e/llncs2e.zip), I instead get ''A Appendix', 'B Appendix' and so on. Is there any way to change that?

More specifically, this is my minimal working example:

\documentclass[envcountsame]{llncs}

\begin{document}
\appendix
\section{Appendix: Foo Bar} %I want this to appear as 'Appendix A: Foo Bar'
\end{document}
share|improve this question
    
Just as a note: not everyone will have llncs installed. It would be better to make this a compilable example (using the article class, for example). The solution that works for article will likely work for llncs. That said, intentionally deviating from the style of a journal doesn't exactly make the publisher giggle with joy; the style exists for a reason. –  Sean Allred Feb 17 at 3:39
    
I use llncs as a general format, but I understand what you mean. Changing my minimum working example to reflect this. –  Koz Ross Feb 17 at 3:43
    
I my opinion, it is better to use a chapter as appendix and rename \chaptername. Then use sections as the several parts of appendix -- I also agree with Sean Allred's statement about llncs. –  Christian Hupfer Feb 17 at 3:44
    
I withdraw my statement about appendix as chapter -- it is not necessary. –  Christian Hupfer Feb 17 at 4:08
    
@SeanAllred You're wrong. llncs class is quite unique, so what works for article might not work for llncs. –  karlkoeller Feb 17 at 6:33
show 2 more comments

1 Answer

Here's a solution that uses only low-level LaTeX macros. (Copy the material starting with \makeatletter and ending with \makeatother to your document's preamble.) The example below employs the llncs document class, but works equally well with the article document class.

The trick, such as it is, consists of telling LaTeX to prefix the String "Appendix" to the section "number" when in a section header but not when cross-references to, say, "appendices A, B, and D" are needed.

If you want the appendix section header to read just "Appendix [some letter]" without a descriptive string, you can do so by typing \section{} or \section{\null} -- after having executed \appendix, naturally.

enter image description here

\documentclass{llncs}

\makeatletter
%% The "\@seccntformat" command is an auxiliary command
%% (see pp. 26f. of 'The LaTeX Companion,' 2nd. ed.)
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\quad}  % default
   {\csname #1@cntformat\endcsname}% enable individual control
}
\let\oldappendix\appendix %% save current definition of \appendix
\renewcommand\appendix{%
    \oldappendix
    \newcommand{\section@cntformat}{\appendixname~\thesection\quad}
}
\makeatother
\usepackage{cleveref} % just for this example
\begin{document}

\section{Hello}

As we will show in \cref{app:a,app:b,app:d}, \dots

\appendix %% appendices 
\section{Postfix 1} \label{app:a}
\section{Postfix 2} \label{app:b}
\section{Postfix 3} \label{app:c}
\section{Postfix 4} \label{app:d}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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