Latex 命令反射
我有以下用例:表格有一个节、小节或小节标题,例如:
\section*{Table name}
\begin{tabular*} ...
\end{tabular*}
因为表格可以出现在节、小节等中。我想我可以将表页眉和页脚定义为宏,并另外传递表格标题的类型(节,小节,子小节,段落...)所以这需要我有类似的东西:
\#1*{Table name}
\begin{tabular*} ...
\end{tabular*}
其中#1是传递的宏参数。有没有机会实现某事。像这样?
非常感谢,
奥瓦内斯
I have the following use case: A table have a section, subsection or subsubsection heading like:
\section*{Table name}
\begin{tabular*} ...
\end{tabular*}
Because the table can appear in section, subsection etc. I thought I could define the table header and footer as macros and additionally pass the type of table heading (section, subsection, subsubsection, paragraph ...) So this requires me to have something like:
\#1*{Table name}
\begin{tabular*} ...
\end{tabular*}
where #1 is the macro parameter passed. Is there any chance to achieve smth. like this?
Many thanks,
Ovanes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,你已经差不多明白了。 (尽管您使用节标题而不是表格标题有什么原因吗?)
并将其用作
如果省略方括号中的可选参数,则默认使用
\section
。请记住,(La)TeX 使用宏扩展,因此您在输入中传递的任何标记流都可以用作宏定义中的替换文本。 (对“特殊字符”有一定的限制,如
%
等。)Sure, you've almost got it. (Although is there a reason you're using section headings rather than table captions?)
and use it as
If you omit the optional argument in square brackets,
\section
is used by default.Remember (La)TeX works with macro expansion, so any stream of tokens you pass it in the input can be used as the replacement text in the macro definition. (With certain restrictions with "special characters" like
%
and so on.)