setkomafont 大写,运行稳定

setkomafont 大写,运行稳定

我知道这\setkomafont是为了处理切换字体但有时我不想切换字体,而是想切换到大写。我还没有找到可靠的方法来实现这一点。这会导致:

\documentclass{scrartcl}
\setkomafont{title}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\begin{document}
\maketitle
\end{document}

但这有效:

\documentclass{scrartcl}
\setkomafont{section}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\begin{document}
\maketitle
\section{Something}
\end{document}

但这会破坏:

\documentclass{scrartcl}
\setkomafont{disposition}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\begin{document}
\maketitle
\section{something}
\end{document}

现在,这是真的诡异的:

\begin{filecontents}{\jobname.bib}
@Book{sen70,
  author =   {Amartya Sen},
  title =    {Collective choice and social welfare},
  publisher =    {Holden-Day},
  year =     1970}
\end{filecontents}
\documentclass{scrartcl}
\setkomafont{section}{\normalfont\uppercase}
\author{A. Author}
\title{The title}
\bibliographystyle{plain}
\begin{document}
\maketitle

\section{Something}
\cite{sen70}
\bibliography{\jobname}
\end{document}

现在,这个有点儿标题大写是可行的。但是没有工作方式是将“参考文献”设置为小写。但它设置为normalfont...

我知道这\uppercase不像字体切换命令,但是有没有一种可靠的方法可以实现我想要的功能?

我想我可以创建一个虚拟字体,用大写字母代替 lc 字母,但是必须是一种更好的方法……

答案1

我认为没有更好的方法。字体是最好的解决方案。\uppercase常见问题解答中描述了 & friends 的一些问题:https://texfaq.org/FAQ-casechange。在您的示例中,还存在其他问题,您不知道在代码中的哪个位置执行大写命令,并且您可以有各种参数。

答案2

您可以添加一个层\section并重新定义\author

\makeatletter
\def\author#1{\gdef\@author{\MakeUppercase{#1}}}
\let\scr@section\section
\def\section{\@ifstar\seamus@sections\seamus@section}
\def\seamus@sections#1{\scr@section*{\MakeUppercase{#1}}}
\def\seamus@section{\@dblarg{\seamus@section@}}
\def\seamus@section@[#1]#2{%
  \scr@section[\MakeUppercase{#1}]{\MakeUppercase{#2}}}
\makeatother

终止传递给with 的source2e.pdf第六个参数所宣传的方法不适用于\@startsection\MakeUppercasescrartcl

相关内容