# Spacing of relation and operation symbols with propositions

LaTeX follows typographic standards and does an elegant job of correctly spacing relation symbols like "=" or "∈" and operation symbols like "+" or "∧". For example, in

$a + b = x + y$

LaTeX adds more space around "=" than around "+", so that the expression is correctly interpreted as "(a+b)=(x+y)" and not as "a+(b=x)+y" – which is meaningless. See § 3.1 of Downes's Short Math Guide.

Consider, though, relations and operations between propositions that involve equalities. For example, we want to say that the equality of a and b implies the equality of x and y. Writing directly

$a = b \Rightarrow x = y$

or

$a = b \mathop{\Rightarrow} x = y$

would yield the wrong spacing, suggesting "a=(b⇒x)=y". A way to fix this could be by somehow adding quotation marks around the propositions, to obtain something like

"a = b" ⇒ "x = y"

but this expression looks cluttered. Of course one can also add/remove spacing by hand – but how much?

An even more complex situation appears with probability formulae, for example if we want to say that the equality of a and b is as likely as that of x and y, or consider the sum of the two:

$P(a = b) = P(x = y)$

$P(a = b) + P(x = y)$

My question is twofold:

– What are the typesetting rules in cases like these?

– How do LaTeX users (who care about correct spacing) approach this problem?

I'd be happy to know about consistent and elegant solutions.

Cheers!

• I suppose this is why amsmath defines \implies, \iff and \impliedby as \DOTSB\;\Longrightarrow\;, \DOTSB\;\Longleftrightarrow\; and \DOTSB\;\Longleftarrow\; respectively. – Circumscribe Jan 31 '19 at 15:33
• I didn't know this, thank you for the great information. Is there a difference between \DOTSB and \dotsb? – pglpm Jan 31 '19 at 17:51
• \DOTSB itself doesn't actually do anything; it is just a marker for amsmath's "magic" \dots (which can look like either \cdots or \ldots, depending on the character following it). See e.g. this answer. – Circumscribe Jan 31 '19 at 18:00
• Thank you for the explanation. I could then define \DOTSB\;=\;, \DOTSB\;\land\; and \DOTSB\;+\; to work in cases like $a=b \land x=y$ and $P(a=b) = P(x=y)$, I suppose. – pglpm Jan 31 '19 at 18:02
• Yup, that'd work! – Circumscribe Jan 31 '19 at 18:04

## My (personal) thoughts on the matter

I don't know of any typographical rules for this, but I think adding additional space around relations or operations between propositions makes a lot of sense because these operate at a different level in some sense. So I would probably add some space around the arrow in $a=b \Rightarrow x=y$, and I might do the same thing for a=b \land x=y (though I probably wouldn't in an inline equation).

I don't believe the same thing applies to probabilities, however, since these are just numbers. I think adding extra space to either P(a=b) + P(x=y)$ or P(a=b) = P(x=y)$ is unnecessary and actually a little inconsistent. You can always add space for the sake of legibility, but I don't see any syntactic reason for it.

## About implies, \impliedby and \iff

The amsmath package (which you are likely already using) actually defines the macros \implies, \iff and \impliedby as versions of \Longrightarrow, \Longleftrightarrow and \Longleftarrow that insert some extra space on either side (though \iff actually also works without amsmath.) You can see them in action here:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$P \implies Q \iff R \impliedby S$
$P \Longrightarrow Q \Longleftrightarrow R \Longleftarrow S$
\end{document}


These commands are defined as \DOTSB\;\Longrightarrow\;, \DOTSB\;\Longleftrightarrow\; and \DOTSB\;\Longleftarrow\; respectively. The important part is \;, which inserts a \thickmuskip and effectively doubles the amount of space around these arrows. \DOTSB doesn't really do anything; it is just a marker that tells amsmath's "magic" \dots that this is a binary operator/relation.

If you think \implies et al. are a little too long by default, you can redefine these with

\renewcommand\implies{\DOTSB\;\Rightarrow\;}
\renewcommand\impliedby{\DOTSB\;\Leftarrow\;}
\renewcommand\iff{\DOTSB\;\Leftrightarrow\;}


and you could similarly define versions of your favourite symbols that add more space with

\newcommand\metasomesymbol{\DOTSB\;<somesymbol>\;}


You can leave out \DOTSB if you don't use \dots and are sure you never will, but including it consistently requires relatively little effort.

The same thing can of course also be accomplished by adding a pair of \; every time (as long as there are no \dots around).

## Suggestion

Since I (personally) think all this extra space would actually be rather unpleasant in inline equations, here is a way to define symbols that only get extra space in display style. I'm using \mathchoice to do this. An explanation of how this works can be found e.g. in the answers to this question.

\documentclass{article}

\usepackage{amsmath}
\newcommand*\mathmeta[1]{\DOTSB\mathchoice{\;#1\;}{#1}{#1}{#1}}

\renewmetasymbol\implies{\Rightarrow}
\renewmetasymbol\impliedby{\Leftarrow}
\renewmetasymbol\iff{\Leftrightarrow}

\usepackage{amssymb}
\newmetasymbol\nimplies{\nRightarrow}
\newmetasymbol\nimpliedby{\nLeftarrow}
\newmetasymbol\niff{\nLeftrightarrow}

\begin{document}

This is an inline equation: $x=y \implies x^2=y^2 \iff y^2=x^2 \impliedby y=x$.

This is a displayed equation:
$x=y \implies x^2=y^2 \iff y^2=x^2 \impliedby y=x.$

Here are a few more symbols: $(x = y \mathmeta{\land} y = z) \implies x = z$, but
$(x = y \mathmeta{\lor} y = z) \nimplies x = z$

\end{document}


• +1 for such a comprehensive answer! – Ruixi Zhang Jan 31 '19 at 19:59
• Fantastic, thank you. I agree on what you say about probabilities. The commands for little shorter implication arrows are great, I'll use those indeed. And I didn't know about \mathchoice, thank you for that too! – pglpm Jan 31 '19 at 20:26