Text FormattingAppendix produces two Headings

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Felparkerad
Posts: 4
Joined: Sat Mar 31, 2012 5:04 pm

Appendix produces two Headings

Post by Felparkerad »

When I attempt to create an appendix in a report class document I follow this structure.

http://en.wikibooks.org/wiki/LaTeX/Docu ... Appendices

However, when I do this latex produces two headings, both saying the very same thing. Even when I use it in a separate file it still gives the same result. Here's the code of the second file.

Code: Select all

\documentclass{report}
\begin{document}
 \appendix
\chapter{Appendix A}
\end{document}
How do I prevent this from happening? If I use just \appendix without creating a new chapter nothing in particular happens and it won't be in my ToC.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Appendix produces two Headings

Post by localghost »

The \appendix command usually affects two background settings.
  1. The \chaptername macro is redefined to "Appendix".
  2. The \thechapter macro is reformatted to \Alph{chapter}.
I would specify what the reader can find in a the certain appendix.

Code: Select all

\documentclass{report}

\begin{document}
  \appendix
  \chapter{Tables}
\end{document}
For customization you may take a look at the appendix package.


Thorsten
Felparkerad
Posts: 4
Joined: Sat Mar 31, 2012 5:04 pm

Re: Appendix produces two Headings

Post by Felparkerad »

That will do. Thank you.
Bolzano82
Posts: 5
Joined: Tue Apr 17, 2012 5:46 pm

Re: Appendix produces two Headings

Post by Bolzano82 »

I have the exact same problem, but I do not want to use the \chapter-command as the appendix is quite short. I want my appendix to be called 'Appendix' in the table of contents.

After going back and forth I have come up with a very, very crude fix, and that is to
first define an \appendix and declare \chapter{Appendix}, so my table of contents comes up the way I want it, then proceed to cover up the chapter with e.g a solid white box and force the content up with a negative distance.

I know this fix is quite pathetic, but I only need to do this for one document, and I think this would work exactly the way I want it.

If anyone has any better suggestions to how I can do this, please share!
I will let you know if I manage to hack something together. :D
Bolzano82
Posts: 5
Joined: Tue Apr 17, 2012 5:46 pm

Appendix produces two Headings

Post by Bolzano82 »

I did it. I drew a white box that covered the title. To see the box change the textcolor to 'red'.

By playing around with the box and the negative vspace you can choose which title to cover.

Minimal working example:

Code: Select all

\documentclass{report}
\usepackage{color}
\begin{document}
\appendix
\chapter{Appendix A}

\vspace{-2.5cm}
\newsavebox{\mysquare}
\savebox{\mysquare}{\textcolor{white}{\rule{8cm}{2cm}}}
\usebox{\mysquare}

\end{document}
Last edited by Stefan Kottwitz on Tue Apr 17, 2012 8:33 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Appendix produces two Headings

Post by Stefan Kottwitz »

That's a funny way. :D

If you don't want to have a chapter heading, don't use \chapter. If something depends on it, do it another way, such as manually resetting the section counter, or using \addtocontents or \addcontentsline to put the entry into the table of contents.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Appendix produces two Headings

Post by localghost »

Bolzano82 wrote:I did it. I drew a white box that covered the title. To see the box change the textcolor to 'red'.

By playing around with the box and the negative vspace you can choose which title to cover. […]
There is a less complicated solution.

Code: Select all

\documentclass[11pt]{report}
\usepackage[T1]{fontenc}

\begin{document}
  \tableofcontents

  \appendix
  \setcounter{secnumdepth}{-1}
  \chapter{Appendix A}
\end{document}
The \appendix switch might not be necessary.
Post Reply