I need to create something like a dictionary. In short, two columns and different header on each page. I'm trying to do this with two packages, multicol and fancyhdr. Unfortunately headers don't work correctly inside multicol section. In this short example the last header (T3) just disappeared, but without multicol everything works fine.
Code: Select all
\documentclass{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\newcommand{\TheTitle}{}
\newcommand{\Title}{\renewcommand{\TheTitle}}
\chead{\small\normalfont\TheTitle}
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}
\Title{T1}
\lipsum[1-6]
\Title{T2}
\lipsum[1-6]
\Title{T3}
\lipsum[1-3]
\end{multicols}
\end{document}
Thanks for any help.
UPDATE
I've just found some solution on stackexchange. Works quite good for me. Maybe it's also useful for someone else.
Code: Select all
\documentclass{book}
\usepackage{multicol}
\usepackage{fancyhdr}
\fancyhead[L]{\textsf{\rightmark}}
\fancyhead[R]{\textsf{\leftmark}}
\fancyfoot[C]{\textbf{\textsf{\thepage}}}
\fancyhead[L]{\textsf{\rightmark}}
\fancyhead[R]{\textsf{\leftmark}}
\fancyfoot[C]{\textbf{\textsf{\thepage}}}
\renewcommand{\headrulewidth}{1.4pt}
\renewcommand{\footrulewidth}{1.4pt}
\newcommand{\dict}[3]{
\markboth{#1}{#1}
\par\noindent\vspace{0\baselineskip}
\textbf{\textsf{#1}} \textit{-#2 -} #3}
\pagestyle{fancy}
\usepackage{lipsum}
\begin{document}
\section*{M}
\begin{multicols}{2}
\dict{main}{n}{\lipsum[3]}
\dict{material}{n}{\lipsum[2]}
\dict{mathematic}{n}{\lipsum[2]}
\dict{more}{n}{\lipsum[3]}
\end{multicols}
\section*{Z}
\begin{multicols}{2}
\dict{zebra}{n}{\lipsum[1]}
\dict{zero}{n}{\lipsum[3]}
\dict{zinfandel}{n}{\lipsum[2]}
\end{multicols}
\end{document}