1

Problem:

I got a section and subsection in a document. These could either be in upper- or lowercase. The subsequent keyword should always be in lowercase.

Minimal Working Example (MWE):

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage{color}
\makeatletter
\protected\def\colsection{green}
\protected\def\colsubsection{blue}
\protected\def\colzz{red}
%
\setsecindent{0pt}
\setbeforesecskip{-8mm plus -1mm minus -1mm}
\setaftersecskip{1.411mm plus 0.2mm minus 0.2mm}
\setsecnumformat{\csname the#1\endcsname\hspace*{0.5em}}
\setsecheadstyle{\rmfamily\mdseries\fontsize{14}{14}\selectfont\raggedright\color{\colsection}\zz}
%
\setsubsecindent{0pt}
\setbeforesubsecskip{-24pt plus -3pt minus -2pt}
\setaftersubsecskip{4pt plus 0pt}
\setsubsecheadstyle{\sffamily\bfseries\boldmath\fontsize{9.5}{14}\selectfont\raggedright\color{\colsubsection}\zzz}
%

\protected\def\zz#1{\makeatletter\catcode`\<\active\scantokens{#1}}
\protected\def\zzz#1{\makeatletter\catcode`\<\active \scantokens{\MakeUppercase{#1}}}
{\catcode`\<\active\protected\gdef<#1>{\texttt{\string <#1>}}}

\makeatother

\begin{document}

\section{Headline <keyword>}

\subsection{Headline <keyword>}

\end{document}

Output:

enter image description here

Desired output:

Keywords should always be in lowercase.

  • I deleted my comment: it will work for the sections themselves but look at the page head… – clemens May 7 '17 at 13:24

Your Answer

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

Browse other questions tagged or ask your own question.