2

I'm trying to work with a custom pagestyle. I want to have the chapter name and the section name in the odd page header... but I also need to use a mini page environment (or WANT to use one anyway) and latex is not recognizing a section in the minipage... I tried it with parbox as well and it also won't work. Any ideas other than abandoning the minipage.

\documentclass[12pt]{memoir} 

\usepackage{lipsum}
\makepagestyle{teststyle}
\makeoddhead{teststyle}{}{\leftmark * \rightmark}{\thepage} 
\makeevenhead{teststyle}{\thepage}{ book name}{}
\makepsmarks{teststyle}{%
\createmark{chapter}{both} {nonumber}{ }{. \ }
\createmark{section}{right} {nonumber}{ }{. \ }}

\pagestyle{teststyle}


\begin{document}
\chapter{Name of Chapter}


\noindent\begin{minipage}[t][][b]{0.25\textwidth}
\small This is on the Left
\end{minipage}
\begin{minipage}[b][][t]{.5\textwidth}
\section{Name of Section}
\end{minipage}
\begin{minipage}[t][][b]{0.25\textwidth}
\hfill \small This is on the right
\end{minipage}



\lipsum
\lipsum
\lipsum

\section{Non Minipage Section}
\lipsum
\lipsum


\end{document}
2

Your \section is getting "trapped" inside the minipage, and therefore its marking information doesn't, as it were, get out. Although I wouldn't be surprised by some wizardly solutions, the simplest thing to do is probably to use the \markright command, which is what \rightmark contains in a normal document. In essence, your document is using:

\markboth{<main mark>}{<sub mark>}
\markright{<sub mark>}

where

\leftmark{} 
\rightmark{}

respectively contain the most recent <main mark> and <sub mark> text. Thus, if you want this line ---

\makeoddhead{teststyle}{}{\leftmark{} * \rightmark}{\thepage}% Note the difference the added "{}" makes

--- to work normally, all you need add is:

\markright{Name of Section}%  where "Name of Section" == the section title in the minipage

If you want the \rightmark to be upper-cased as is the default in memoir, then ---

\markright{\MakeUppercase{Name of Section}}

--- should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.