\documentclass[zihao=-4,a4paper,twoside]{ctexart}
\usepackage{etoolbox,geometry}
\ExplSyntaxOn
\keys_define:nn { mylib }
{
purpose .str_gset:N = \g_mylib_purpose_str,
purpose .default:n = schoolart
}
\NewDocumentCommand \Setup { m } { \keys_set:nn {mylib} {#1} }
\NewDocumentCommand \hello { } {
Purpose~is~\g_mylib_purpose_str
}
\AtEndPreamble{%
\str_case:nn {\g_mylib_purpose_str}
{
{ schoolart }
{
\geometry{
a4paper,
left = 0in
}
\pagestyle{plain}
}
}
}
\ExplSyntaxOff
\Setup{purpose = schoolart}
\begin{document}
123
\hello
\end{document}
查看更多