作者uranusjr (←这人是超级笨蛋)
看板LaTeX
标题Re: [问题] newcommand
时间Thu Sep 20 07:53:39 2012
※ 引述《mydas (不是一朝一夕)》之铭言:
: 想请教一个newcommand 的error
: 我现在定义了两个指令
: \newcommand{\company}[2]{\def\@arg1 \def\@arg2}
: \newcommand{\print}[]{\@arg1, \@arg2}
: 第二个指令会印出引数1,2, 不过一直出现错误
: 错误码是
: ! Use of \@ doesn't match its definition.
: 不知道是否有人能帮忙解决这个问题 谢谢
http://www.faqs.org/faqs/tex-faq/#b
6) In LaTeX, I put some definitions in my document, but I get the error
``Use of \@ doesn't match its definition'' or ``You can't use
\spacefactor in vertical (or math) mode.'' What's wrong?
Definitions should be be in a style file, and if you move them there,
you should have no problem.
If you don't want to do that, you need to include \makeatletter
before the definitions to allow the ``internal'' LaTeX commands to
be accessed. These commands are normally protected from change by
having @ in them. Since @ is not a letter, it is normally not
allowed as part of a multi-letter command name. To access internal
commands you need to tell LaTeX to pretend that @ is a letter.
This happens automatically when LaTeX reads a style file, but in
your main document you need to surround the offending commands with
\makeatletter ... \makeatother.
--
╱ ̄ ̄ ̄╲
▏
◢█◣ ▏
︻█︻█ ▏
成龙表示: 是喔...
′/ ‵ ▏
╰╯ █╱
ψQSWEET ◥︶█◤
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.32.81.146