Typing a document with package titlesec, pagestyles can easily mark first and last section title in the page header. But How to display all section marks that appears in the page to the page's header? TKS!
HERE is MWE:
\documentclass[a4paper]{book}
\usepackage[pagestyles]{titlesec}
\newpagestyle{mapage}{%
\setheadrule{1pt}
\sethead[\color{red}\bfseries\toptitlemarks\sectiontitle--\bottitlemarks\sectiontitle][][\thepage/page header]
{\thepage/page header}{}{\color{red}\bfseries\toptitlemarks\sectiontitle--\bottitlemarks\sectiontitle}%odd head
\setfoot[][][]%even foot
{}{\thepage}{}
}
\usepackage{blindtext,multicol,xcolor}
\begin{document}
\pagestyle{mapage}
\begin{multicols}{3}
\section{AA}
\blindtext
\section{BB}
\blindtext
\section{CC}
\blindtext
\section{DD}
\blindtext
\section{EE}
\blindtext
\section{FF}
\section{GG}
\section{HH}
\blindtext
\section{II}
\section{JJ}
\section{KK}
\section{LL}
\end{multicols}
\begin{multicols}{3}
\section{MM}
\section{NN}
\section{OO}
\blindtext
\section{PP}
\section{QQ}
\section{RR}
\section{SS}
\section{TT}
\section{UU}
\blindtext
\section{VV}
\section{WW}
\section{XX}
\end{multicols}
\end{document}



\fancypagestyle{bodystyle}{\fancyhf{}\fancyhead……}as in this example. But the error info shows that! Illegal parameter number in definition of \temp@a.andYou meant to type ## instead of #, right?How to avoid this error? Thanks again for your help! – Marcus Sep 30 '22 at 15:43