Re: [問題] newcommand

看板LaTeX (論文排版)作者 (←這人是超級笨蛋)時間13年前 (2012/09/20 07:53), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《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
文章代碼(AID): #1GMbi6SH (LaTeX)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
文章代碼(AID): #1GMbi6SH (LaTeX)