例如
\def\if@nch@mpty#1{\def\temp@a{#1}\ifx\temp@a\@empty}
\def\f@nch@def#1#2{\if@nch@mpty{#2}\f@nch@gbl\def#1{\leavevmode}\else
\f@nch@gbl\def#1{#2\strut}\fi}
Latex中@符号是什么意思
默认情况下,在 TeX 文档中,命令(也称为macro) 只能使用字母命名[a-zA-Z]
但不是诸如此类的符号@
.
这是为什么?因为每个角色都有一个类别代码 (or catcode,简称),并且仅默认情况下[a-zA-Z]
有允许在宏中使用它的catcode 11。但是,令人惊讶的是,TeX 允许您更改角色的目录代码!所以一开始的时候cls
/sty
文件,LaTeX 设置目录代码@
catcode 11。然后,它将其重置回默认值。
LaTeX 还包含两个命令\makeatletter
and \makeatother
轻松更改catcode@
.
例如:
\makeatletter
% This is ok define new command with at character.
\def\command@with@at@character{%
Command With At Character.%
}
% And you can use it in the pair makeatletter/makeatother
\command@with@at@character
\makeatother
% But you CANNOT use the macro here!!! TeX will try to call \command
% but not \command@with@at@character, because `@` now does not have
% right catcode.
% \command@with@at@character
See \makeatletter 和 \makeatother 做什么?以获得更多信息。
关于宏\catcode
(可以帮助您更改角色的catcode),您可以从以下位置获取更多信息here.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)