0

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}

enter image description here

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

enter image description here

3rd page

enter image description here

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.

4
  • 1
    Both titling and titlesec are defining \thetitle, and therefore they aren’t fully compatible. Jan 20, 2022 at 6:48
  • @JavierBezos Is there any \thetitle equivalent in the titlesec package?
    – Imran
    Jan 20, 2022 at 7:50
  • Nope, I’m sorry. titlesec deals with sectioning titles, not cover titles. Jan 24, 2022 at 16:53
  • Github issue: github.com/jbezos/titlesec/issues/46#issue-1085144823
    – Imran
    Oct 11, 2023 at 4:45

0

You must log in to answer this question.

Browse other questions tagged .