![自包含宏内的不同行为](https://linux22.com/image/407621/%E8%87%AA%E5%8C%85%E5%90%AB%E5%AE%8F%E5%86%85%E7%9A%84%E4%B8%8D%E5%90%8C%E8%A1%8C%E4%B8%BA.png)
答案1
答案2
这定义了三个级别,但支持任意多个级别。
\documentclass{article}
\usepackage[T1]{fontenc}
\newcommand{\uw}[1]{%
\addtocounter{uw}{1}%
\csname uw\romannumeral\value{uw}\endcsname{#1}%
\addtocounter{uw}{-1}%
}
\newcounter{uw}
\newcommand{\uwi}[1]{``#1''}
\newcommand{\uwii}[1]{`#1'}
\newcommand{\uwiii}[1]{<<#1>>}
\begin{document}
\uw{abc}
\uw{abc \uw{def} ghi}
\uw{abc \uw{def \uw{ghi} lmn} pqr}
\end{document}