9

I am looking for a symbol that looks like: []-->

So far I came up with $\Box\rightarrow$. The problem with this is, that the arrow is too far away from the box:

enter image description here

How could I achieve this so that the box is not so far away from the arrow?

Update: Solution below.

Additionally I also needed a might counterfactual:

\newcommand{\counterfactualmight}{\ensuremath{%
\mathord{\Diamond}\kern-1.5pt
\raise0.5pt\hbox{$\mathord{\rightarrow}$}}}

enter image description here

Update 2: Better Solution From http://www.ctan.org/pkg/comprehensive

%..
\usepackage{txfonts}
\usepackage{pxfonts}
%..
\begin{enumerate}
 \item A conditional: X $\rightarrow$ Y
 \item A strict conditional: X $\strictif$ Y
 \item A would-counterfactual conditional: X $\boxright$ Y
 \item A might-counterfactual conditional: X $\Diamondright$ Y
\end{enumerate}

enter image description here

  • You might find this useful in relation to Mico's answer below. tex.stackexchange.com/questions/38982/… – Daniel Harbour Oct 19 '13 at 11:08
  • I'm glad that the basic method for the \counterfactual macro also works for your \mightcounterfactual symbol. :-) – Mico Oct 19 '13 at 11:19
  • i know that some very similar symbols were added to unicode, so try the stix or xits fonts. (i am not able to check these from my present location, sorry.) – barbara beeton Oct 19 '13 at 15:33
7

A combination of \kern, \raise, \hbox, and \mathord (the final one to change the status of \rightarrow to "ordinary") should do the trick of aligning \Box and \rightarrow:

enter image description here

\documentclass{article}
\usepackage{amssymb}
\newcommand{\counterfactual}{\ensuremath{%
  \Box\kern-1.5pt
  \raise1pt\hbox{$\mathord{\rightarrow}$}}}
\begin{document}
$\Box\rightarrow$ vs.\ \counterfactual
\end{document}

Addendum: I don't know if you intend to use the \counterfactual macro in text or math mode. (That was also, by the way, why I used \ensuremath to encase the macro's contents.) If you intend to use it in math mode, it may be a good idea to give it "mathrel" (relational operator) status, e.g., by defining it as

\newcommand{\counterfactual}{\ensuremath{%
  \mathrel{\Box\kern-1.5pt\raise1pt\hbox{$\mathord{\rightarrow}$}}}}

That way, the spacing in expressions such as $A \counterfactual B$ will be correct without need for further fiddling.

  • 1
    Could you maybe add something about \mathrel here? The spacing in $P \mathrel{\counterfactual} Q$ is (closer to) that of $P \rightarrow Q$ than that of $P \counterfactual Q$ is. – Daniel Harbour Oct 19 '13 at 11:15
  • 1
    @DanielHarbour - Thanks for this. I've inserted an addendum to address the use of giving the new macro "mathrel" status if it's going to be used in math mode. – Mico Oct 19 '13 at 11:26
10

There's no need to guess or measure things, other than the amount of back up. The arrow should be at the same height as plain arrows. So we can use the fact that \mathop applied to a single object centers it with respect to the math axis.

\documentclass{article}
\usepackage{amssymb}
\newcommand{\counterfactual}{%
  \mathrel{\mathop\Box}\mathrel{\mkern-2.5mu}\rightarrow
}
\newcommand{\mightcounterfactual}{%
  \mathrel{\mathop\Diamond}\mathrel{\mkern-2.8mu}\rightarrow
}

\begin{document}
$A\counterfactual B$

$A\mightcounterfactual B$

$\counterfactual_{\counterfactual}
 \mightcounterfactual_{\mightcounterfactual}$
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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