# spacing between symbols in math mode

The following code will

\begingroup
\everymath{\displaystyle}
\scriptsize
$XXXXXXX(XXXX(A,B,C),XXXX(D,E,F)) \leftarrow XXXXXX(A,B,C) \wedge XXXXXX(D,E,F) \wedge XXXXX(XX(A,B),XX(D,E)) \wedge XXXXX(XX(B,C),XX(E,F)) \wedge XXXXXX(XXX(A,B,C),XXX(D,E,F)).$
\endgroup


format my rule like this:

I really do not like this because it has the tendency to stretch the expressions to cover a whole line, which is absolutely unnecessary. I just want some natural spacing there even if it did not expand to cover the whole line. Any suggestions?

This look, maybe?

\documentclass{article}
\begin{document}
$\scriptstyle \begin{array}{l@{\quad}r} XXXXXXX(XXXX(A,B,C),XXXX(D,E,F)) &\leftarrow \\ XXXXXX(A,B,C) \quad \wedge \quad XXXXXX(D,E,F) &\wedge\\ XXXXX(XX(A,B),XX(D,E)) & \wedge \\ XXXXX(XX(B,C),XX(E,F)) & \wedge \\ XXXXXX(XXX(A,B,C),XXX(D,E,F)).\\ \end{array}$
\end{document}


If \quad provides too much space for you, try \mkern n mu -- \mkern18mu corresponds to \quad.

Addendum: If you want the end-of-line \rightarrow and \wedge symbols to be separated from the material to the right by the same amount (say, \quad), a single column in the array might be what you're looking for.

\documentclass{article}
\begin{document}
$\scriptstyle\begin{array}{l} XXXXXXX(XXXX(A,B,C),XXXX(D,E,F)) \quad\leftarrow \\ XXXXXX(A,B,C) \quad \wedge \quad XXXXXX(D,E,F) \quad\wedge\\ XXXXX(XX(A,B),XX(D,E)) \quad \wedge \\ XXXXX(XX(B,C),XX(E,F)) \quad \wedge \\ XXXXXX(XXX(A,B,C),XXX(D,E,F)).\\ \end{array}$
\end{document}

• it's not so satisfactory, how do I shrink the space between my expression and "and" symbol on the third and forth line? – user1935724 Aug 27 '14 at 4:56
• @user1935724 - Does the look in the addendum meet your needs? – Mico Aug 27 '14 at 5:07
• @Mcio, I've accepted it. – user1935724 Aug 27 '14 at 5:11

You can make TeX decide for the line breaks:

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum} % just for the example

\newcommand{\lrand}{\mathrel{\land}} % a relation, while \wedge=\land is an operation

\newenvironment{mrule}
{\relpenalty=0 \flushleft$\displaystyle} {$\endflushleft}

\newenvironment{mruleA}
{\relpenalty=0
\quote
\raggedright
$\displaystyle} {$\endquote}

\begin{document}

\lipsum*[2]
\begin{mrule}
XXXXXXX(XXXX(A,B,C),XXXX(D,E,F)) \gets
XXXXXX(A,B,C) \lrand
XXXXXX(D,E,F) \lrand
XXXXX(XX(A,B),XX(D,E)) \lrand
XXXXX(XX(B,C),XX(E,F)) \lrand
XXXXXX(XXX(A,B,C),XXX(D,E,F)).
\end{mrule}
\lipsum*[3]
\begin{mruleA}
XXXXXXX(XXXX(A,B,C),XXXX(D,E,F)) \gets
XXXXXX(A,B,C) \lrand
XXXXXX(D,E,F) \lrand
XXXXX(XX(A,B),XX(D,E)) \lrand
XXXXX(XX(B,C),XX(E,F)) \lrand
XXXXXX(XXX(A,B,C),XXX(D,E,F)).
\end{mruleA}
\lipsum[4]

\end{document}


I'd prefer the second approach, leaving some space on the left (and right). If you want to possibly reach the right margin, change the definition into

\newenvironment{mruleA}
{\relpenalty=0
\list{}{\leftmargin=\leftmargini \rightmargin=0pt}
\raggedright\item\relax$\displaystyle} {$\endlist}


By setting \relpenalty=0 we tell TeX that breaking at relation symbols is OK. Using \lrand instead of \wedge ensures the same spacing around ∧ and ← (note that \gets is the same as \leftarrow, but shorter to type).