Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

% http://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}
share|improve this question
    
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 ? –  tohecz Feb 23 '13 at 1:15
    
yes, as @tohecz says and -50 for trying to implicate bm in your infinite loop:-) –  David Carlisle Feb 23 '13 at 1: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 1: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 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.