Hendrik Vogt 提供了一个\longnot
宏来缓解与
\boldmath 与 \not 的相互作用\longnot
。这似乎工作正常,但当我尝试在模式下自动使用而不是通常\not
使用时,我遇到了障碍\bm
。
这看起来很简单:
\let\not\longnot%
或者
\def\not{\longnot}%
但这些导致
TeX 容量超出,抱歉 [grouping levels=255]
MWE 的结果是:
自动化时,最后\subseteq
红色的部分应该使用\longnot
而不是\not
。
代码:
\documentclass{article}
\usepackage[paperwidth=7cm]{geometry}
\usepackage{parskip}% Eliminate the need for \noindent
\usepackage{bm,xcolor}
% https://tex.stackexchange.com/questions/98433/interaction-of-boldmath-and-not
\newcommand*\longnot{%
\mathrel{%
\mkern-0.75mu
\raisebox{-0.8pt}{$\not$}%
\mkern1.5mu
\raisebox{0.8pt}{$\not$}%
\mkern-0.75mu
}
}
\newcommand{\ColorRed}[1]{%
%\let\not\longnot% Why can I NOT use one of these???
%\def\not{\longnot}%
\textcolor{red}{\bm{#1}}%
}%
\begin{document}
$\bm{A\not\subseteq B}$ versus $\bm{A\longnot\subseteq B}$
\par\smallskip
with color: \textcolor{red}{$\bm{R \longnot\subseteq T,\ x \longnot\le y$}}
Replace \verb|\not| with \verb|\longnot| when in \verb|\bm| mode:
$A \not\subseteq B$,
\ColorRed{$A \not\subseteq B$},
$A \not\subseteq B$.
\end{document}
答案1
在 的定义中将和 都替换为,然后将 全部\let\orignot\not
替换为\not
\orignot
\longnot
\let\not\longnot
\documentclass{article}
\usepackage[paperwidth=7cm]{geometry}
\usepackage{parskip}% Eliminate the need for \noindent
\usepackage{bm,xcolor}
% http://tex.stackexchange.com/questions/98433/interaction-of-boldmath-and-not
\let\orignot\not
\newcommand*\longnot{%
\mathrel{%
\mkern-0.75mu
\raisebox{-0.8pt}{$\orignot$}%
\mkern1.5mu
\raisebox{0.8pt}{$\orignot$}%
\mkern-0.75mu
}
}
\newcommand{\ColorRed}[1]{%
%\let\not\longnot% Why can I NOT use one of these???
%\def\not{\longnot}%
\textcolor{red}{\bm{#1}}%
}%
\begin{document}
$\bm{A\not\subseteq B}$ versus $\bm{A\longnot\subseteq B}$
\par\smallskip
with color: \textcolor{red}{$\bm{R \longnot\subseteq T,\ x \longnot\le y$}}
Replace \verb|\not| with \verb|\longnot| when in \verb|\bm| mode:
$A \not\subseteq B$,
\ColorRed{$A \not\subseteq B$},
$A \not\subseteq B$.
\end{document}