问题:
我得到了文档中的一个部分和子部分。这些部分可以是大写或小写。后续关键字应始终为小写。
最小工作示例(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}
输出:
期望输出:
关键字应始终使用小写。