请参阅附件 mwe。我们如何选择性地保护字符或单词免受的影响\MakeLowercase{}
?
\documentclass{article}%
\def\thestring{A Pacific hurricane is a mature tropical cyclone that develops within the northeastern and central {P}acific {O}cean}
\begin{document}
\noindent\thestring.\\
{\noindent}The expedition leader explained that \MakeLowercase{\thestring}.
\end{document}
答案1
\text_lowercase:n
您可以使用的功能expl3
:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\Lower}{m}
{
\group_begin:
\tl_put_right:Nn \l_text_case_exclude_arg_tl { \K }
\text_lowercase:n { #1 }
\group_end:
}
\NewDocumentCommand{\K}{m}{#1}
\ExplSyntaxOff
\newcommand\teststring{A Pacific hurricane is a mature tropical cyclone that
develops within the northeastern and central \K{Pacific Ocean}}
\begin{document}
\teststring.
The expedition leader explained that \Lower{\teststring}.
\end{document}
它本身除了传递参数外不做任何其他事情,但它只有在完成其工作\K
后才会这样做;添加到排除命令列表中,就可以了。\text_lowercase:n
\K
手术
\tl_put_right:Nn \l_text_case_exclude_arg_tl { \K }
也可以一劳永逸地完成:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\Lower}{m}
{
\text_lowercase:n { #1 }
}
\NewDocumentCommand{\K}{m}{#1}
\tl_put_right:Nn \l_text_case_exclude_arg_tl { \K }
\ExplSyntaxOff
您也可以使用K{P}acific \K{O}cean
。