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.

My appendix consits of a chapter which tells the TOC that an appendix exists. All other headings in my appendix are sections.

Now I want that a section header looks like:

Appendix A. Some Text

Appendix B. Some Text

Appendix C. Some Text

But the following line

\renewcommand{\thesection}{\Alph{section}}

which can be found on most of the appendix articles won't work.

My minimal example looks like the following:

\documentclass[a4paper,12pt,headsepline,smallheadings,parident, numbers=noenddot, appendixprefix=true]{scrreprt}
\usepackage{appendix}
...

\begin{document}
\chapter{Chapter1}
\section{Section1}
\section{Section2}

%Appendix
\appendix
\renewcommand\thesection{\appendixname\ \Alph{section}}
\pagestyle{empty}

%for linking the appendix to toc without pagenumber
\phantomsection
\hypertarget{link.appendix}{}
\addchap*{Anhang}
\addtocontents{toc}{\protect\usekomafont{chapterentry}%
  \protect\hyperlink{link.appendix}{Anhang}}

\refstepcounter{chapter}
\newpage

%other try ...
%\renewcommand{\thesection}{\Alph{section}}

\section*{Class diagram} \label{class-diagram}
\section*{List of UI-Elementen} \label{list-ui-elements}
\section*{CD}
\end{document}
share|improve this question
    
okay, I use section and no its displayed as I wanted. But it's is shown in the toc, how does it use my "layout" and doesn't show up in the toc? –  mybecks Jan 30 '12 at 13:18
    
thank you, it works like charm :D –  mybecks Jan 30 '12 at 13:58
add comment

1 Answer

up vote 4 down vote accepted

First of all you are using the starred version of \section with a label. This version doesn't provide any anchors for the label so your labeling false. A simple example shows this behavior.

\documentclass{article} 
\begin{document} 
\section*{Class diagram} \label{class-diagram}
\ref{class-diagramm}
\end{document}

The redefinition of \thesection doesn't influence the command \section* because \section* print only formated text with a predefined skip above and below.

Nevertheless you can do the following. Use \section instead of \section*. The benefits

  • you can work with the redefinition of \thesection,
  • you can use the label and
  • you get the correct headings.

With the current settings the section will be shown up in the toc. Avoiding this you can set the counter tocdepth to zero after the command `appendix.

\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
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.