
我想定義一個新命令,其中可以接受參數,然後(無論輸入中字母的大小寫)將除第一個字母之外的所有字母設為小寫
\documentclass{book}
\ExplSyntaxOn
\NewDocumentCommand{\LowerCase}{m}
{
\group_begin:
\cs_set_protected:Npx \\ { \exp_not:o \\ }
\text_lowercase:n {#1}
\group_end:
}
\ExplSyntaxOff
\begin{document}
\LowerCase{TestinG}
\end{document}
答案1
來自 LaTeX 2022-11-01:
\documentclass{book}
\begin{document}
\MakeTitlecase{TestinG}
\end{document}
看ltnews36.pdf
了解更多。
答案2
已經有:
\documentclass{book}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\TitleCase}{m}
{
\text_titlecase:n {#1}
}
\ExplSyntaxOff
\begin{document}
\TitleCase{TestinG}
\end{document}