26

I am writing a paper in the "article" document class.

When it proceeds to my appendix, I would like the two sections to have titles to appear as "Appendix A. Some notation" and "Appendix B. Some more notation". So I trited

\appendix                                     
\section{Some notation}
\section{Some more notation}

However, I got "A Some notation" and "B Some more notation" as titles. How can I fix this problem?

I read through old relevant threads, but the answers do not seem to work well.

Jie Wei
  • 889
  • Please edit your post to provide a complete, small document people can copy-paste-compile. That is a lot more useful than a mere fragment. In what way didn't they work well? What specifically did you try? – cfr Feb 04 '15 at 13:42

1 Answers1

35

The title option and the appendices environment of the appendix package can do that:

\documentclass{article}

\usepackage[title]{appendix}

\begin{document}

\section{title 1}
\section{title 2}

\begin{appendices}
\section{Some Notation}

\section{Some More Notation}
\end{appendices}

\end{document}

enter image description here

Bernard
  • 271,350
  • 1
    what if I want a period (as OP)? [Appendix A. Some notation] instead of [Appendix A Some notation]? – Seub Oct 16 '19 at 23:37
  • 3
    You can add this, just after begin{appendices}: \makeatletter \def\@seccntformat{\appendixname\ % \csname thesection\endcsname. \quad} \makeatother. – Bernard Oct 17 '19 at 00:49
  • 1
    Sorry, can you clarify, maybe in your answer or something? It doesn't quite work when I paste, I must do something wrong. Should there be a % there? – Seub Oct 17 '19 at 02:40
  • 1
    @Seub: Indeed, in my code there is a % at the end of the line (to prevent some spurious space or any other side effects), and I didn't notice that in comments, line breaks disappeared. – Bernard Oct 17 '19 at 09:43
  • 4
    This solution works only for article document class and doesn't work for other document classes. – Abdelhak Elfengour Mar 25 '21 at 14:02
  • 1
    @AbdelhakElfengour: You should ask a question with a compilable code. There are various possibilities to solve this problem. – Bernard Mar 25 '21 at 14:19