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.

Can anyone tell me how, in the minimal example pasted below, I can achieve that the dot after Appendix in the header disappears? I understand that it is there because I simply made the number of the appendix invisible.

\documentclass[10pt, a4paper]{report}

\usepackage[T1]{fontenc}
\usepackage[titletoc]{appendix}
\usepackage{fancyhdr}
\usepackage{blindtext}

\pagestyle{fancy} 

\begin{document}

\tableofcontents

\begin{appendices}
   {\def\thechapter{}\chapter{This and that}}
   \blindtext
   \newpage
   \blindtext
\end{appendices}

\end{document}

EDIT by ldpw: Maybe it would be even better if the dot was not removed but if it was put directly behind Appendix (that is, without the blank space between appendix and the dot):

APPENDIX . THIS AND THAT --> APPENDIX. THIS AND THAT

share|improve this question
add comment

1 Answer

Change also the definition of \chaptermark:

\begin{appendices}
\makeatletter
\def\chaptermark#1{\markboth{\MakeUppercase{\@chapapp. \  #1}}{}}
\def\thechapter{}
\makeatother
\chapter{This and that}
\blindtext
\newpage
\blindtext
\end{appendices}

The heading is controlled by \chaptermark, which is responsible to issue a suitable \markboth or \markright command. The usual definition of \chaptermark given by fancyhdr is

\def\chaptermark#1{%
  \markboth{%
    \MakeUppercase{%
      \ifnum\c@secnumdepth>\m@ne
        \@chapapp\ \thechapter. \ %
      \fi
      ##1%
    }}{}%
}

where \@chapapp becomes \chaptername or \appendixname, depending on where it's issued. So you see the source of the space before the period, which is there for separating the name (Chapter or Appendix) from the number.

Your case seems to be a common one: you have only one appendix, so you don't want it appears as "Appendix A". Locally redefining \thechapter removes the "A", but not the space in the heading, so we redefine also \chaptermark.

It's not necessary to enclose those redefinitions inside a group, because the surrounding appendices environment will restore the normal definitions at its end (and they actually shouldn't be needed any more, so also without the appendices environment the group isn't necessary).

share|improve this answer
    
Hi egreg! That works fine. Thanks! Can you maybe give a few explanations on your code so that the next time I have a similar problem I can solve it myself? That would be great. –  lpdbw Jul 21 '12 at 9:00
    
Why markboth and not leftmark? –  lpdbw Jul 21 '12 at 9:46
    
@lpdbw That's how fancyhdr does. With only the report definition and oneside printing, probably \markright instead of \markboth should be used. –  egreg Jul 21 '12 at 9:53
    
AH, OK ... Then I seem to have misunderstood the explanations in en.wikibooks.org/wiki/LaTeX/… –  lpdbw Jul 21 '12 at 10:04
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.