[Tex/LaTex] How to disregard automatic spacing between characters in math mode

kerningmath-modespacing

I realize this is a bit of an odd request.

I'd like to typeset some characters in math mode (such as 1 \land \lnot 2 \lor 3), and have them appear equally spaced, rather than with automatic spacing. By default, this code produces

You can see the \lnot is right up next to the 2. And when multiple numbers are together they're close to each other as well. How can I make these spaced evenly so there's no distinction between characters?

Best Answer

That's not good style. The automatic spacing should be the right amount. But if you really want it: One way to do this would be to put everything in its own math mode:

\documentclass{article}

\begin{document}

$ 1 \land \lnot 2 \lor 3 $  % for comparision

$1$ $\land$ $\lnot$ $2$ $\lor$ $3$

\end{document}

Result

(I put the numbers also in math mode to ensure that always the correct math font is used. By default this doesn't make any difference, though.)


To have the $s added automatically you can use a loop which reads every number, character or macro one by one. Simply group a number with multiple digits together:

\documentclass{article}

\makeatletter
\newcommand\equspacedmath[1]{%
  \mbox{% to ensure text mode
    \@tfor\L:=#1\do{%
        $\L$\space
    }%
  }%
}
\makeatother

\begin{document}

\equspacedmath{1 \land \lnot 2 \lor 3}

\equspacedmath{1 \land \lnot {23} \lor 4}

$ \equspacedmath{1 \land \lnot 2 \lor 3} $

\[ \equspacedmath{1 \land \lnot {23} \lor 4} \]

\end{document}