When I use only the titleps
package, the following code works and puts the document title in the header.
\documentclass{article}
\usepackage{titling}
\usepackage{geometry}
\usepackage{titleps}
\usepackage{duckuments}
\title{A friendly duck}
\author{Duck}
\date{\today}
\newpagestyle{myFancy}[\normalsize\bfseries]{
\setheadrule{0.4pt}%
\sethead[\thetitle][][]%
{\thetitle}{}{}%
}
\pagestyle{myFancy}
\begin{document}
\maketitle
\duckument
\end{document}
But when I combine the titleps
package with the titlesec
package using the command \usepackage[pagestyles]{titlesec}
, the output is not as expected. It puts 'section no' in one header and 'subsection no' in another.
\documentclass{article}
\usepackage{titling}
\usepackage{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{duckuments}
\title{A friendly duck}
\author{Duck}
\date{\today}
\newpagestyle{myFancy}[\normalsize\bfseries]{
\setheadrule{0.4pt}%
\sethead[\thetitle][][]%
{\thetitle}{}{}%
}
\pagestyle{myFancy}
\begin{document}
\maketitle
\duckument
\end{document}
2nd page
3rd page
It can be solved by directly inserting the title in the \newpagestyle
command like this:
\newpagestyle{myFancy}[\normalsize\bfseries]{
\setheadrule{0.4pt}%
\sethead[A friendly duck][][]%
{A friendly duck}{}{}%
}
But it would be great to have a solution using something like \thetitle
.
titling
andtitlesec
are defining\thetitle
, and therefore they aren’t fully compatible.\thetitle
equivalent in thetitlesec
package?titlesec
deals with sectioning titles, not cover titles.