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.


\makeoddhead{teststyle}{}{\leftmark * \rightmark}{\thepage} 
\makeevenhead{teststyle}{\thepage}{ book name}{}
\createmark{chapter}{both} {nonumber}{ }{. \ }
\createmark{section}{right} {nonumber}{ }{. \ }}


\chapter{Name of Chapter}

\small This is on the Left
\section{Name of Section}
\hfill \small This is on the right


\section{Non Minipage Section}


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>}



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.