How do I create this semi-enclosed arrow symbol?
Welcome! You do not need any packages for that.
\documentclass{article}
\newcommand{\RightArrowInBox}{\begingroup
\renewcommand{\arraystretch}{0.6}\begin{array}{@{}c@{}|}\hline
\raisebox{-0.2ex}{$\Rightarrow$}\\ \hline\end{array}\endgroup}
\newcommand{\LeftArrowInBox}{\begingroup
\renewcommand{\arraystretch}{0.6}\begin{array}{@{}c@{}|}\hline
\raisebox{-0.2ex}{$\Leftarrow$}\\ \hline\end{array}\endgroup}
\begin{document}
$\RightArrowInBox~\LeftArrowInBox$
\end{document}
Of course you can modify the padding etc.
A version without cutting corners with major input by barbara beeton.
\documentclass{article}
\newcommand{\RightArrowInBox}{\begingroup
\renewcommand{\arraystretch}{0.6}\begin{array}{@{}c@{\rule[-3pt]{0.4pt}{0.85em}}}\hline
\raisebox{-0.28ex}{$\Rightarrow$}\\ \hline\end{array}\endgroup}
\newcommand{\LeftArrowInBox}{\begingroup
\renewcommand{\arraystretch}{0.6}\begin{array}{@{}c@{\rule[-3pt]{0.4pt}{0.85em}}}\hline
\raisebox{-0.28ex}{$\Leftarrow$}\\ \hline\end{array}\endgroup}
\begin{document}
$\RightArrowInBox~\LeftArrowInBox$
\end{document}
Or with trimclip
.
\documentclass{article}
\usepackage{trimclip}
\newcommand{\RightArrowInBox}{\begingroup
\clipbox{0.5ex 0em 0em 0em}{\fbox{$\Rightarrow\!$}}\endgroup}
\newcommand{\LeftArrowInBox}{\begingroup
\clipbox{0.5ex 0em 0em 0em}{\fbox{$\Rightarrow\!$}}\endgroup}
\begin{document}
$\RightArrowInBox~\LeftArrowInBox$
\end{document}
Here's a solution which places \implies
and \impliedby
into a modified version of \fbox
.
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\@rframeb@x#1{%
\@tempdima\fboxrule
%\advance\@tempdima\fboxsep
\advance\@tempdima\dp\@tempboxa
\hbox{%
\lower\@tempdima\hbox{%
\vbox{%
\hrule\@height\fboxrule
\hbox{%
%\vrule\@width\fboxrule
#1%
\vbox{%
\vskip.7\fboxsep
\box\@tempboxa
\vskip.3\fboxsep}%
#1%
\vrule\@width\fboxrule}%
\hrule\@height\fboxrule}%
}%
}%
}
\DeclareRobustCommand\rfbox[1]{%
\leavevmode
\setbox\@tempboxa\hbox{%
\color@begingroup
\kern.2\fboxsep{#1}\kern.2\fboxsep
\color@endgroup}%
\@rframeb@x\relax}
\makeatother
\newcommand{\boximplies}{%
\mathrel{\:\rfbox{$\Longrightarrow$}\:}%
}
\newcommand{\boximpliedby}{%
\mathrel{\:\rfbox{$\Longleftarrow$}\:}%
}
\begin{document}
\( A \implies B \)
\( A \boximplies B \)
\( A \impliedby B \)
\( A \boximpliedby B \)
\end{document}
Only array
(that's a required package in every distribution):
\documentclass{article}
\usepackage{array}
\newcommand{\bimplies}{\mathrel{\bimpl{c|}{\Rightarrow}}}
\newcommand{\bimpliedby}{\mathrel{\bimpl{|c}{\Leftarrow}}}
\newcommand{\bimpl}[2]{%
\begingroup
\setlength{\arraycolsep}{0pt}%
\renewcommand{\arraystretch}{0}%
\begin{array}{#1}\hline{#2}\vphantom{+}\\\hline\end{array}%
\endgroup
}
\begin{document}
$A\bimplies B\bimpliedby C$
\end{document}