3

I have an appendix which goes 3 lines on a second page, so I would like to recover some "lost" space by the "Appendix" text on the top to keep it on one page.

I tried using \vspace{some negative value} or the titlesec package between \appendix and \chapter, but nothing moved...

My appendices looks like this :

\appendix
\chapter{Some code}
\label{cwalg}
\begin{lstlisting}
...
\end{lstlisting}
2
  • 1
    Does this answer help you? tex.stackexchange.com/a/17338/31058
    – Ludovic C.
    Sep 19, 2013 at 12:25
  • I tried doing this when adding the big code part to the preamble of the document : \appendix \vspace*{-3} \chapter{Some code} but it doesn't work unfortunately. Am I wrong somewhere ? Sep 19, 2013 at 13:12

2 Answers 2

2

Just before the \chapter for the appendix add some changes to the spacing using titlesec's \titlespacing* (in the example I changed the default 50pt and used -20pt instead); the change will have effect only if you also use \titleformat, so I used the default definition:

\documentclass{report}
\usepackage{titlesec}

\begin{document}

\chapter{A regular chapter}
\appendix
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{-20pt}{40pt}
\chapter{An appendix}

\end{document}
0
1

Alternatively, define a new \@makechapterhead for Appendix right before the chapter for the appendix. One may change the distance via \\[xx]

\documentclass{report}

\begin{document}

\chapter{A First Chapter}
\chapter{A Second Chapter}

\makeatletter
\def\@makechapterhead#1{ \null
\begin{flushleft} 
\huge\bfseries APPENDIX \thechapter\\
   #1
\end{flushleft}
\nobreak
}
\makeatletter
\appendix

\chapter{An appendix}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .