测试没有问, 请提供 mwe
\documentclass{article}
\usepackage{codehigh}
\usepackage[margin=1cm]{geometry}
\begin{document}
\makeatletter
\begin{demohigh}
%\makeatletter
\def\@cmd[#1]#2{\textcolor{red}{#1} and (#2)}
\def\cmd{
\@ifnextchar[{\@cmd}{\@cmd[default]}
}
\cmd{aaa}\par
\cmd[bbb]{aaa}\par
\def\@cmd[#1]#2{\c@md{} and \textcolor{red}{#1} and (#2)}
\def\cmd#1{
\def\c@md{#1}\@ifnextchar[{\@cmd}{\@cmd[default]}
}
\cmd{aaa}{ccc}\par
\cmd{aaa}[bbb]{ccc}
%\makeatother
\end{demohigh}
\makeatother
\end{document}
编译环境
win11 + texlive2022 + xelatex && pdflatex
问 如何利用 codehigh 宏包的 demohigh 环境插入自定义宏的抄录代码