5

I am defining some text in a align, but no matter how i place the & symbol to create the alignment i get a space between the first chars.

\begin{align*}
H_0:& \text{Something.}\\
H_1:& \text{Something.}\\
\end{align*}

Basically i dont want a space between H_0, but rather after the colon.

enter image description here

3
  • What do you want to get? Should it be a colon like in normal text? See here for some discussion about colons in math-mode!
    – LaRiFaRi
    Sep 16, 2014 at 12:21
  • 1
    It looks like you are using equation alignment commands to align something that is not an equation. I suggest using a simple tabular and putting $H_0$, $H_1$ inside it. Sep 16, 2014 at 13:30
  • @FedericoPoloni, very good point!
    – JavaCake
    Sep 16, 2014 at 14:10

1 Answer 1

8

The problem you are running in to is that the : is treated as a relational operator and thus with white space around it. The white space after a relational operator disappears if followed by the &-command of the align environment. You will see this problem a lot on this page when seeing equation which are aligned to the right of their =-sign. In order to protect the white space, you would have to type H_0:{}&\text{} or H_0&:\text{} here.

However, it seems as if you do not want to have a relational operator here. There are three possible ways: The relational operator :, the "maps to" symbol \colon or the 'normal' text colon \text{:}. The following shows the differences:

\begin{align*}
&H_0:x\\
&H_0\colon x\\
&H_0\text{: }x
\end{align*} 

enter image description here

You can see the different spacings here. And you may have noticed that the text-colon needs to be followed by a white-space, as there is no space between normal symbols (not operators) in math-mode.


In the following, I will show an MWE with two possible solutions of your desired alignment. I will use the two cases I believe you would like to have.

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}

\begin{document}    
\begin{align*}
    H_0\text{: } &\text{Something.}\\
    H_1\text{: } &\text{Something.}
\end{align*}
% or identically
%\begin{align*}
%   H_0&\text{: Something.}\\
%   H_1&\text{: Something.}
%\end{align*}   
\end{document}

enter image description here

\begin{align*}
    H_0\colon &\text{Something.}\\
    H_1\colon &\text{Something.}
\end{align*}
% or identically
%\begin{align*}
%    H_0&\colon \text{Something.}\\
%    H_1&\colon \text{Something.}
%\end{align*}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .