$$ \begin{array}{lcr} & \text{A} & \\[-0.1cm] & | & \\[-0.1cm] \text{C} & \text{B} & \text{D} \\[-0.1cm] & | & \\[-0.1cm] & \text{E} & \\ \end{array} $$ How do I edit the spacing between $\text{C}$ and $\text{B}$ (as well as $\text{B}$ and $\text{D}$)? In $\LaTeX$, one can do it by following this, but it does not work for MathJax. Any ideas on how to edit the array horizontal spacing?
2 Answers
This method feels kinda "hacky," but you could use LaTeX math mode spacing commands like \,
, \:
, \;
, \enspace
, \quad
or \qquad
within the cells of the array. Right click on the diagram below and select Show Math As -> TeX Commands
to see what I mean.
\begin{array}{lcr} & \text{A} & \\[-0.1cm] & | & \\[-0.1cm] \text{C}\quad & \text{B} & \quad\text{D} \\[-0.1cm] & | & \\[-0.1cm] & \text{E} & \\ \end{array}
But of course this would be a burden to do manually for larger arrays.
-
2$\begingroup$ What about in case you want to shorten the spacing? $\endgroup$ Commented Jan 24, 2018 at 18:58
-
1$\begingroup$ @SiddharthVenu there's another spacing command
\!
that creates a negative thin space. But it's pretty thin. You'd have to add a bunch of those to get any dramatic effect. $\endgroup$ Commented Jan 24, 2018 at 18:59 -
$\begingroup$ I guess I will have to use it even though it is clumsy. Thank you! $\endgroup$ Commented Jan 24, 2018 at 19:02
-
1$\begingroup$ Another "clumsy" technique is to create alternating array entries with "phantom" characters with specified horizontal and/or vertical spacing. See How do I create an invisible character? These work for me in MathJax. $\endgroup$– hardmathCommented Jan 25, 2018 at 15:38
An easier way to do this is to use \hspace
as follows:
\begin{array}{lcr}
& \text{A} & \\[-0.1cm]
& | & \\[-0.1cm]
\text{C} \hspace{0.9cm}& \text{B} &\hspace{0.9cm} \text{D} \\[-0.1cm]
& | & \\[-0.1cm]
& \text{E} & \\
\end{array}`
gives
\begin{array}{lcr} & \text{A} & \\[-0.1cm] & | & \\[-0.1cm] \text{C} \hspace{0.9cm}& \text{B} &\hspace{0.9cm} \text{D} \\[-0.1cm] & | & \\[-0.1cm] & \text{E} & \\ \end{array}