# Using titleps with unnumbered sections

When I use unnumbered sections, my titleps headers seem to inherit the section name and numbering from the previous section:

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{titleps}
\newpagestyle{fancy}{
\setfoot{}{\thepage}{}
}
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}

\section{First section}
\lipsum[1-4]
\clearpage

\section{Second section}
\lipsum[5-8]
\clearpage

\section*{Unnumbered section}
\lipsum[9-12]

\end{document}


In the example, the first two sections get the proper headers, but the third section gets the same header as the second. This also seems to happen to my bibliography (I'm using biblatex). How can I get the name of starred sections and bibliographies in the header?

• You can set \sectionmark{Unnumbered section} after that \section* command. May 19, 2015 at 22:48

The entire titlesec module discourages the use of starred version of sectional units. As such, their usage seems may cause unexpected/unwanted results anyway. In this case, however, you're better off issuing a manual \sectionmark{<title>} to update the display in the headers. The process can be automated with the help of xparse:

\documentclass{article}

\usepackage{titleps,xparse}
\newpagestyle{fancy}{
\setfoot{}{\thepage}{}
}
\pagestyle{fancy}
\let\oldsection\section
\makeatletter
\RenewDocumentCommand{\section}{s o m}{%
\IfBooleanTF{#1}
{{% \section*
\oldsection*{#3}% \section*[.]{..}
\sectionmark{#3}%
}}{% \section
\IfNoValueTF{#2}
{\oldsection{#3}}% \section{..}
{\oldsection[#2]{#3}}% \section[.]{..}
}%
}
\makeatother
\usepackage{lipsum}

\begin{document}

\section{Numbered section}
\lipsum[1-3]
\clearpage

\section*{Unnumbered section}
\lipsum[4-6]

\end{document}