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.

How can I put a crossmark on an expression inside a math mode using latex like below? enter image description here

share|improve this question
    
you may choose to use \nrightarrow instead, which produces this: i.stack.imgur.com/b7NXd.png –  Far Zin Mar 19 at 20:53
    
@FarZin : \nrightarrow produces a left slash. I would like to put a crossmark on the arrow. –  Neel Mar 19 at 20:59

5 Answers 5

Maybe this is overkill, but you can build the operator with \times overlaid on \longrightarrow with

\documentclass[]{article}

\def\longxrightarrow{\mathrel{%
    \mathchoice{\LongXRightArrow}{\LongXRightArrow}{\scriptsize\LongXRightArrow}{\tiny\LongXRightArrow}%
}}
\def\LongXRightArrow{{%
    \setbox0\hbox{\ensuremath{\longrightarrow}}%
    \rlap{\hbox to \wd0{\ensuremath{\hss\times\hss}}}\box0
}}



\begin{document}

$   a^b  \longxrightarrow c^d $

\end{document}

to appear as

longxrightarrow

share|improve this answer

\nrightarrow + mirrored \nrightarrow

Maybe the cross is a little small, at least the size and position of the cross comes from a font designer, because the example overlays \nrightarrow with a mirrored version of it:

\documentclass{article}

\usepackage{amssymb}
\usepackage{graphicx}

\makeatletter
\newcommand*{\crossrightarrow}{%
  \mathrel{%
    \mathpalette\@crossrightarrow{}%
  }%
}
\newcommand*{\@crossrightarrow}[2]{%
  % #1: math style
  % #2: unused
  \sbox0{$#1\nrightarrow\m@th$}%
  \sbox2{$#1\vcenter{}$}%
  \sbox2{\raisebox{\ht2}{\scalebox{1}[-1]{\raisebox{-\ht2}{\copy0}}}}%
  \ht2=\ht0 %
  \dp2=\dp2 %
  \rlap{\unhcopy2}%
  \copy0 %
}
\makeatother

\begin{document}
\[
  a^b \crossrightarrow a^c
\]
\end{document}

Result

\rightarrow + \setminus + mirrored \setminus

A variant with a larger cross (for my taste it is too large):

\documentclass{article}

\usepackage{graphicx}

\makeatletter
\newcommand*{\crossrightarrow}{%
  \mathrel{%
    \mathpalette\@crossrightarrow{}%
  }%
}
\newcommand*{\@crossrightarrow}[2]{%
  \sbox0{$#1\rightarrow\m@th$}%
  \sbox2{$#1\setminus\m@th$}%
  \copy0 %
  \kern-\wd0 %
  \hbox to \wd0{%
    \hspace{0pt plus 1fil}%
    \rlap{\scalebox{-1}[1]{\copy2}}%
    \copy2 %
    \hspace{0pt plus 1.5fil}%                                           
    % the factor for `fil' controls the horizontal position of the cross
  }%
}
\makeatother

\begin{document}
\[
  a^b \crossrightarrow a^c
\]
\end{document}

Result

Remarks:

  • \mathpalette is used to get an adoption of the symbol to the four math styles.
share|improve this answer

A simpler way to overlap \times to a long right arrow:

\documentclass{article}

\makeatletter
\newcommand{\longxarrow}[1]{%
  \mathrel{\vphantom{\to}\mathpalette\longx@rrow{#1}}% arrows are bigger than \times
}
\newcommand{\longx@rrow}[2]{%
  \ooalign{\hidewidth$#1\times\m@th$\hidewidth\cr$#1#2\m@th$\cr}%
}
\makeatother

\newcommand{\longxrightarrow}{\longxarrow{\longrightarrow}}
\newcommand{\longxleftarrow}{\longxarrow{\longleftarrow}}

\begin{document}

$A\longxrightarrow B_{\longxrightarrow}$

$A\longxleftarrow B_{\longxleftarrow}$

\end{document}

enter image description here

share|improve this answer

One illustration that we can enter math mode with TikZ or we could typeset the formulae completely in it using a couple of nodes.

\documentclass[a4paper]{article}
\usepackage{tikz}\pagestyle{empty}
\usetikzlibrary{arrows.meta}
\def\halfwidthx{3ex}
\def\halfwidthy{1ex}
\tikzset{mystyle/.style={red,xshift=0.4*\halfwidthx}}
\begin{document}
$a^b
\begin{tikzpicture}
\draw[green,-{Stealth[blue]},line width=.15ex] (0,0)--(2*\halfwidthx,0);
\draw[mystyle] (0,1ex)--(\halfwidthx,-\halfwidthy);
\draw[mystyle] (0,-1ex)--(\halfwidthx,\halfwidthy);
\end{tikzpicture}
c^d$
\end{document}

enter image description here

share|improve this answer
\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\usepackage{xcolor}
\begin{document}
$a^b 
  \mathrel{\stackengine{-1.3pt}{$\rightarrow$}%
    {\color{red}\scalebox{1.6}{$\times$}\kern3pt}{O}{c}{F}{T}{L}} 
a^c$
\end{document}

enter image description here

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.