我有一个包含两个简单宏的设置:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfkeys}
\begin{document}
\newcommand\mycmda[1]{
\pgfkeys{/demo/mycmda, default, #1}
\typeout{mycmda}
hello
}
\newcommand\mycmdb[1]{
\pgfkeys{/demo/mycmdb, default, #1}
\typeout{mycmdb}
world
}
\pgfkeys{
/demo/.is family,
/demo/mycmda/.is family,
/demo/mycmdb/.is family
}
\pgfkeys{
/demo/mycmda,
foo/.estore in = \foo
}
\pgfkeys{
/demo/mycmdb,
bar/.estore in = \bar
}
\pgfkeys{
/demo/mycmda,
default/.style = {
foo = abc
}
}
\pgfkeys{
/demo/mycmdb,
default/.style = {
bar = xyz
}
}
% \mycmdb{bar=hello} % this works
\mycmdb{bar=\mycmda{foo=asdf}} % this errors
\end{document}
当我尝试执行以下操作时出现问题:
\mycmdb{bar=\mycmda{foo=asdf}}
它给出了这个错误:
! TeX capacity exceeded, sorry [input stack size=5000].
\pgfkeys@possiblespace #1-> \pgfkeys
{/demo/mycmda, default, #1} \typeout {m...
l.52 \mycmdb{bar=\mycmda{foo=asdf}}
我试图完成的是评估该表达式,bar=\mycmda{foo=asdf}
使其变为bar=hello
本质上。但是它却错误地说Use of \\mycmdb doesn't match its definition.
。
如果我这样做,效果很好:
\mycmdb{bar=hello}
想知道如何使用这些“嵌套表达式”来实现。