2

Hendrik Vogt has provided a \longnot macro to alleviate the issues related to Interaction of \boldmath and \not. This seems to work fine, but I run into a snag when I try to automatically use \longnot instead of the usual \not when I am in \bm mode.

This seemed like a very simple:

\let\not\longnot%

or

\def\not{\longnot}%

but these results in

TeX capacity exceeded, sorry [grouping levels=255]

The MWE as is yields:

enter image description here

When automated, the last \subseteq in red should be using the \longnot instead of \not.

Code:

\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}

Peter Grill
  • 223,288
  • For the TeX capacity error: put \let\orignot\not and replace both \not by \orignot in the definition of \longnot, and after that all put \let\not\longnot ? – yo' Feb 23 '13 at 01:15
  • yes, as @tohecz says and -50 for trying to implicate bm in your infinite loop:-) – David Carlisle Feb 23 '13 at 01:17
  • 1
    Damm!! I had a feeling it was going to be embarrassing, but certainly did not think it was going to be this much of a rookie mistake. @DavidCarlisle: Based on that comment I think I know who I should be blaming for my BM issues. :-) – Peter Grill Feb 23 '13 at 01:19
  • You should add some \begingroup and \endgroup in your \ColorRed so that the redefinition of \not becomes local. – Hendrik Vogt Feb 23 '13 at 10:33

1 Answers1

5

Put \let\orignot\not and replace both \not by \orignot in the definition of \longnot, and after that all, put \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}
yo'
  • 51,322