latex - 如何在词汇表 newcommand 中定义嵌套调用
问题描述
使用词汇表包,我实现了一个组合词汇表和首字母缩写词列表,如此处所述。这工作正常:
\newcommand{\agls}[4]{
\newglossaryentry{#1}{
text={#2},
long={#3},
name={\glsentrylong{#1} (\glsentrytext{#1})},
first={\glsentryname{#1}},
firstplural={\glsentrylong{#1}\glspluralsuffix (\glsentryname{#1}\glspluralsuffix )},
description={#4}
}
}
\agls{a:bim}{BIM}{Building Information Modeling}{3D Something}
我很快注意到我的大部分词汇表描述都以See \cref{sec:myLabel}
. 这就是为什么我试图像这样修改它:
\newcommand{\agls}[5][]{
\newglossaryentry{#2}{
text={#3},
long={#4},
name={\glsentrylong{#2} (\glsentrytext{#2})},
first={\glsentryname{#2}},
firstplural={\glsentrylong{#2}\glspluralsuffix (\glsentryname{#2}\glspluralsuffix )},
description={#5. See \cref{#1}}
}
}
\agls[subsec:bim]{a:bim}{BIM}{Building Information Modeling}{3D Something}
(如果省略了可选参数,请不要介意损坏的引用,我稍后会用 修复这个问题\ifthenelse
)
但是,这会导致错误:
Argument of \@cref@stack@top has an extra }. \glsXpageXglsnumberformat{}{17}}}
Paragraph ended before \@cref@stack@top was complete. \glsXpageXglsnumberformat{}{17}}}
我似乎乳胶被几个右大括号弄糊涂了。我已经尝试将调用移动到单独的命令,但它没有改变任何东西:
\newcommand{\lref}[1][]{See \cref{#1}}
... description={#5. \lref[#1]} ...
我怎样才能解决这个问题?
更新:我刚刚注意到我也可以使用
\newcommand{\see}[1]{Siehe \cref{#1}}
\agls{a:bim}{BIM}{Building Information Modeling}{3D Something \see{subsec:bim}}
......这可能是我暂时要做的。如果有一个简单的修复程序,仍然会受到赞赏。
解决方案
推荐阅读
- magento2 - Magento 2 - 管理订单网格,日期过滤器不过滤正确的订单
- c# - 如何从 TwinCat 读取包含结构数组的结构到 C#
- ruby-on-rails - Rails 从一个表单创建多行
- c++ - 如何让 CMake find_library 为构建类型找到正确的库
- java - 如何在android java中的imageview上绘制多个点
- drupal - 如何获取drupal视图更改钩子中的总行数?
- java - 线程没有同时运行以读取文件
- reactjs - React Hooks 和 React-Redux 连接:让它们一起工作的最佳实践是什么?
- javascript - 如何使用自定义文件名在 Javascript 中创建分号分隔的 CSV?
- r - 取三个包含 NA 的变量的平均值,以使用 dplyr 创建新变量