-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
The order of \addcontentsline
, \@vstypeptitle
, \poemtitlemark
in \@vsptitle
can result in wrong page number in the table of contents and a wrong page header.
\documentclass[12pt]{article}
\usepackage{verse}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\leftmark} %% poem title automatically here
\fancyhead[R]{p.~\thepage}
\renewcommand{\poemtitlemark}[1]{\markboth{#1}{#1}}
\newcounter{mypoemline}
\makeatletter
\newcommand*{\dummypoem}[1][4]{%
\setcounter{mypoemline}{0}%
\@whilenum \value{mypoemline}<#1 \do{This is is dummy
poem\\\stepcounter{mypoemline}}
}
\makeatother
\begin{document}
\tableofcontents
\newpage
\begin{verse}
\poemtitle{Invictus}
by William Ernest Henley
Out of the night that covers me, \\
\vin Black as the pit from pole to pole, \\
I thank whatever gods may be \\
\vin For my unconquerable soul. \\!
\ldots
\dummypoem[25]
\poemtitle{Test}
\dummypoem
\end{verse}
\end{document}
results in
I suggest to change the definition into
\def\@vsptitle[#1]#2{%
\@nameuse{phantomsection}%
\@vstypeptitle{#2}%
\addcontentsline{toc}{\poemtoc}{#1}%
\poemtitlemark{#1}%
\@afterheading
}
With this the page number in the table of contents and the page header of the third page is correct.
Metadata
Metadata
Assignees
Labels
No labels