How do I define a right arrow with bar in LaTeX?
The stmaryrd
font has \mapsfromchar
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}
\newcommand{\Rightarrowbar}{\Rightarrow\mapsfromchar}
\newcommand{\Leftarrowbar}{\mapstochar\Leftarrow}
\begin{document}
$a\Rightarrowbar b$
$a\Leftarrowbar b$
\end{document}
If stmaryrd
is not an option for you, it's possible to reflect \mapstochar
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\newcommand{\fakedmapsfromchar}{%
\mathrel{\mathpalette\reflectmathchar\mapstochar}%
}
\makeatletter
\newcommand{\reflectmathchar}[2]{%
\reflectbox{$\m@th#1#2$}%
}
\makeatother
\newcommand{\Rightarrowbar}{\Rightarrow\fakedmapsfromchar}
\newcommand{\Leftarrowbar}{\mapstochar\Leftarrow}
\begin{document}
$a\Rightarrowbar b$
$a\Leftarrowbar b$
\end{document}
Something like this?
\documentclass{article}
\usepackage{mathtools}
\newcommand{\myRightarrow}{\mathrel{{\Longrightarrow}\!\vcenter{\hbox{$\scriptscriptstyle|$}}}}
\begin{document}
$ A \myRightarrow B$
\end{document}
Edit:
If you want the final bar to have the same width as the \Rightarrow, you can use two consecutive |
with some kerning between them:
\newcommand{\myvarRightarrow}{\mathrel{{ =⇒ }\!\vcenter{\hbox{$ \scriptscriptstyle|\mkern-5.4mu|$}}}}
One can always build a symbol by himself (thanks to samcarter, this is a scalable version):
\documentclass[margin=1mm]{standalone}
\usepackage{graphicx}
\usepackage{amssymb}
\newcommand{\yoursymbol}{\mathbin{\Rightarrow\hspace{-0.45em}\vcenter{\hbox{\scalebox{0.8}{$\shortmid$}}}}}
\begin{document}
$1\yoursymbol2$ {\Huge $1\yoursymbol2$}
\end{document}
Caution: This doesn't work in subscript. I'm trying to find some solution...