为什么我会收到错误消息
! Improper alphabetic constant.
<to be read again>
\reserved@d
l.30 ...m operatorname{A} = $\bm{\operatorname{A}}
$
使用此输入
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T3,T1]{fontenc}
\usepackage[english]{babel}
\usepackage[noenc]{tipa}
\usepackage{tipx}
\usepackage[geometry,weather,misc,clock]{ifsym}
\usepackage{pifont}
\usepackage{eurosym}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage{wasysym}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage{array}
\usepackage{hhline}
\usepackage{calc}
%
\usepackage{bm}
%
\usepackage{stmaryrd}
\newcommand \catname [1] {\mathcal{#1}}
%
\begin{document}
Test mathbf A = $\mathbf A$, catname{A} = $\catname{A}$, bm catname{A} = $\bm{\catname{A}}$
Test mathbf A = $\mathbf A$, operatorname{A} = $\operatorname{A}$, bm operatorname{A} = $\bm{\operatorname{A}}$
Test mathbf A = $\mathbf A$, operatorname{A} = $\operatorname{A}$, bm operatorname{A} = $\bm{\operatorname{A}}$
\end{document}
我正在尝试做的是让自己变得勇敢直立。
施穆埃尔(西摩 J.)梅斯
答案1
答案2
与往常一样,bm
如果感到困惑,额外的{}
小组可以提供帮助,这里有一个更简单的例子
\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
%$\bm{\operatorname{A}}$
$\bm{{\operatorname{A}}}$
\end{document}
但可能 bm 应该\operatorname
自动确保安全。
为了处理这种情况,可以对 bm 进行扩展并插入正确的\mathop
间距,方法是:
\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\makeatletter
\let\bm@end\relax
\begingroup
\catcode`\'=\active
\@firstofone{\endgroup
\def\bm@general#1#2#3#4#5{%
\begingroup
\let\bm\@firstofone
\let\hm\@firstofone
\global\let\bm@command\@empty
\let\@let@token\@empty
\let\protect\@empty
\let\@typeset@protect\@empty
\def\bm@mathchoice{\bm@m@thchoice#1}%
\def\bm@group{\bm@gr@up#1}%
\let\bm@table#2%
\let\left\holdinginserts
\let\right\left
\let\mskip\mkern
\let\hskip\kern
\let\bm@prime\copy
\def'{\bm@prime\prime\relax}%
\long\def\@ifnextchar##1##2##3##4{%
\if##1##4%
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{##2##4}{##3{##4}}}%
\def\@ifstar{\@ifnextchar*}%
\def\GenericWarning##1##2{%
\unvcopy{\GenericWarning{##1}{##2}}}%
\def\GenericError##1##2##3##4{%
\unvcopy{\GenericError{##1}{##2}{##3}{##4}}}%
\let\DN@\copy
\let\FN@\copy
\let\next@\copy
\global\let\bm@first\@empty
\ifx\uproot@\undefined\else
\def\root##1\of##2{{\root##1\of{##2}}}%
\fi
\def\mathaccentV##1{\mathaccent"\accentclass@}%
\let\@ifnext\@ifnextchar
\let\measure@lhs\copy
\let \rel@break\copy
\let \bin@break\copy
\let \after@open\copy
\let \after@close\copy
\let\ifmmode\iftrue
\let\install@mathalphabet\def
\let\getanddefine@fonts\@gobbletwo
#3%
\def\select@group##1##2##3##4{{%
\protect##1{##4}}}%
\def\use@mathgroup##1##2##3{{%
\protect\use@mathgroup##1{##2}{##3}}}%
\bm@expand#5\@empty\bm@end
\endgroup
#4}%
}
\outer\def\bm@end{\@@end}
\makeatother
\begin{document}
$a$
$x\bm{\operatorname{A}}y$
\end{document}