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 am trying to have a document with TOC:

1 Introduction

2 blabla

3 Conclusion

Bibliography

Appendix 1

I want the Bibliography to start with title "Bibliography" but I do not want the Appendix 1 to start with title "Appendix 1". I just want to include some PDF pages without a title preceeding them. I, however, want both Bibliography and Appendix 1 to have headings specifying whether the page is a part of bibliography or Appendix 1.

Test document is as follows:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{appendix}

\let\stdsection\section
\renewcommand\section{\newpage\stdsection} 

\begin{document}
\tableofcontents
\clearpage

\pagestyle{fancy}
\fancyhead{}
\fancyhead[L]{\leftmark}
\section{Úvod}
blabla


\section{Závěr}
bleble

\newpage

\renewcommand{\refname}{Bibliography}
\begin{thebibliography}{9}
bli
\end{thebibliography}
\appendix
\renewcommand{\appendixtocname}{Appendix 1}
\renewcommand{\appendixpagename}{Appendix 1}
\noappendicestocpagenum
\addappheadtotoc
\renewcommand{\refname}{Appendix 1}
\newpage
bla
\includepdf[scale=0.85,pages={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16},pagecommand={\thispagestyle{fancy},\fancyfoot{}}]{original.pdf}
\end{document}

The bibliography looks right: enter image description here I would like the heading of page 5 to be "Appendix 1" (see the command \renewcommand{\refname}{Appendix} before includepdf), but it is "Bibliography" like this: enter image description here

I do not understand why \renewcommand works for the first time but not for the second.

Alternative way to achieve what I want would be to start a section without it being printed in the actual document but only in the TOC - I have not managed to google how to do that.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Because you're using the babel package, you can't use the "standard LaTeX" method of setting

\newnewcommand{\refname}{blabla}

Instead, given that you've specified czech as the language when loading babel, you should include the following command in the preamble:

\addto{\captionsczech}{\renewcommand{\refname}{blabla}}

(where, of course, "blabla" should be replaced with whatever text string may be appropriate).

Separately, you write that

I do not understand why \renewcommand works for the first time but not for the second.

Actually, it doesn't work the first time either! It just doesn't do anything, given that you're using babel. But, as the default name of the bibliography section is already Bibliography, the error doesn't become apparent.

share|improve this answer
    
Hm, that (\addto{\captionsczech}{\renewcommand{\refname}{blabla}}) does not help. \renewcommand works for the first time, the default Czech name for "Bibliography" is "Reference". Have you tried to compile the document? If so, maybe there is something specific to my setup (it is Texlive 2011 on Ubuntu 12.04 as fat as I can tell, and I am using pdflatex). –  sup Jun 14 '12 at 14:57
    
I updated the question with screenshots of the actual rendering. –  sup Jun 14 '12 at 15:07
    
@sup: Thanks for the additional information. The problem you're running into, when you issue the second \renewcommand\refname instruction, is that this instruction won't affect the header line until you actually issue a section-level command, as would be generated by a \begin{thebibliography}{99} macro. Without this additional command, the header line info remains determined by the most recent section-level command, at which time the header info was "Bibliography". The remedy is simple: Instead of the new \renewcommand{\refname}, type \fancyhead[L]{\MakeUppercase{\appendixtocname}}. –  Mico Jun 14 '12 at 15:33
    
I had to put in a \newpage after \end{thebibliography} but with that it works, so thanks! –  sup Jun 14 '12 at 16:40
    
@sup: I'm glad you were able to work out that you needed an additional \newpage command before issuing the instruction \fancyhead[L]{\MakeUppercase{\appendixtocname}}. –  Mico Jun 14 '12 at 17:09
add comment

I suggest to define some new page styles:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{appendix}

\setlength{\headheight}{14.5pt}

\fancypagestyle{normal}{
  \fancyhead{}
  \fancyhead[L]{\leftmark}
}
\fancypagestyle{appendix}{
  \fancyhead{}
  \fancyhead[L]{Appendix 1}
}

\let\stdsection\section
\renewcommand\section{\newpage\stdsection} 

\begin{document}
\tableofcontents
\clearpage

\pagestyle{normal}




\section{Úvod}
blabla


\section{Závěr}
bleble

\newpage

\renewcommand{\refname}{Bibliography}
\begin{thebibliography}{9}
bli
\end{thebibliography}

\newpage
\appendix
\renewcommand{\appendixtocname}{Appendix 1}
\renewcommand{\appendixpagename}{Appendix 1}
\noappendicestocpagenum
\addappheadtotoc
\renewcommand{\refname}{Appendix 1}

\pagestyle{appendix}

bla

\shorthandoff{-}
\includepdf[pages=-,pagecommand={\thispagestyle{appendix}},scale=0.85]{original.pdf}
\end{document}

Notice the \shorhandoff command necessary to be able to use pages=-, and the \setlength{\headheight}{14.5pt} for adjusting the head height.

share|improve this answer
    
Thanks for the \shorhandoff, I felt stupid to list all the pages to include but it kept giving back errors when using dash. (I actually use \setlength but I excluded it from the example file, but thanks anyway.) I guess your solution would work too, but the above one is working already, thanks for replying anyway. –  sup Jun 14 '12 at 16:44
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.