答案1
欢迎!您不需要任何软件包。
\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}
当然,您可以修改填充等。
此版本未做任何改动,主要由芭芭拉·比顿 (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}
或者用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}
答案2
这是一个将\implies
和\impliedby
放入的修改版本的解决方案\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}
答案3
仅限array
(这是每个发行版中必需的包):
\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}
答案4
试试这两个符号的叠加。可惜没有左右大方块,所以需要旋转。
\usepackage{graphicx}
\usepackage{amssymb}
\newcommand\RightArrowInBox{%
\rotatebox[origin=c]{90}{\ooalign{%
\hfil$\Downarrow$\hfil\cr\noalign{\kern0.4pt}%
\hfil$\bigsqcup$\hfil\cr}}}
\newcommand\LeftArrowInBox{%
\rotatebox[origin=c]{-90}{\ooalign{%
\hfil$\Downarrow$\hfil\cr\noalign{\kern0.4pt}%
\hfil$\bigsqcup$\hfil\cr}}}
其他符号集合,如基本的 LaTeX 或在使用方块或箭头stmaryrd
插入时工作得更好,因为比 的版本小。\displaystyle
\scriptstyle
\bigsqcup
amssymb