0

I would like to have the printed title of my sections be in italic, with the numbering in Roman format (not Roman numerals, though). Yet, using the memoir commands for section formatting, the \itshape in the setsecheadstyle appears to be overriding the rest of the format.

MWE:

\documentclass{memoir}
\setsecnumformat{\rmfamily\csname the#1\endcsname\quad}
\renewcommand{\thesection}{\rmfamily § \arabic{section}}
\setsecheadstyle{\itshape}
\begin{document}
    \section{A Test}
\end{document}
4
  • 2
    You need to enclose the section number in a group with the declaration \upshape, the opposite of \itshape. Does \renewcommand{\thesection}{{\upshape § \arabic{section}}} work for you? (Not sure if you need the additional \rmfamily in this definition.)
    – marquinho
    Jun 27 at 23:32
  • @marquinho brilliant! If you make it into an answer I'm happy to accept
    – tex_user_7
    Jun 27 at 23:51
  • Great! Will do.
    – marquinho
    Jun 28 at 7:13
  • You don't want to \renewcommand{\thesection} that way. That's really a problem when you do cross-references.
    – egreg
    Jun 28 at 8:11
2

You don't want to add formatting commands in the definition of \thesection, because you'll get in troubles when cross-referencing.

\documentclass{memoir}

\setsecnumformat{\textnormal{§ \csname the#1\endcsname\quad}}

\renewcommand{\thesection}{\arabic{section}}
\setsecheadstyle{\itshape}

\makeevenhead{headings}{\rightmark}{}{\thepage}
\makeoddhead{headings}{\rightmark}{}{\thepage}
\createmark{section}{both}{shownumber}{\upshape § }{\quad\itshape}

\begin{document}

\section{A Test}

\end{document}

This is possibly a simplification and you may want to differentiate headers in left and right pages, but shows the main parts where to act.

enter image description here

1
  • (This is better, and more sensible, than my answer below!)
    – marquinho
    Jun 28 at 8:35
1

To typeset text in the upright shape, the opposite of italicization, you can put it it in a group (delimited by braces) with the explicit declaration \upshape. The corresponding commands are \textit and \textup. Here's a short reference of text styles and their relations.

Your MWE becomes:

\documentclass{memoir}
\setsecnumformat{\rmfamily\csname the#1\endcsname\quad}
\renewcommand{\thesection}{{\rmfamily\upshape § \arabic{section}}}
\setsecheadstyle{\itshape}
\begin{document}
    \section{A Test}
\end{document}

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.