5

My example is as following:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}

In our next class, we will test
\begin{alignat*}{1}
H_{0}: & \beta_{2}>0\\
 & \beta_{3}+\beta_{4}\ge 0
\shortintertext{versus}
H_{1}: & \beta_{2}\le 0\\
 & \beta_{3}<0
\end{alignat*}

\end{document}

Yielding

enter image description here

For me the "versus" is too far to the left. I would like it to be closer to the H_0 and H_1. What are my options for controlling? I would prefer not to hard code a length but to use a flexible solution (in case I change inequality and make much longer). Perhaps it could be best to not use \shortintertext and instead make it a row?

  • I would make this a row, and in your case, put it between the two systems of inequalities horizontally. – Mariano Suárez-Álvarez Sep 19 '14 at 19:27
  • Strictly speaking there is no error, if you realize that you place text inside \shortintertext placed in the same position, aligned to the left would have a normal paragraph. Therefore it is correct, but it may not be what you want. – Aradnix Sep 19 '14 at 19:27
  • Options for controlling? See What commands are there for horizontal spacing? – Werner Sep 19 '14 at 19:46
  • Either begin the content of \shortintertext with \hspace*{\parindent} or write before the equation: \noindent In our class, we will test. – Bernard Sep 19 '14 at 19:47
  • @Bernard None of the two solutions make any sense, though. The first one depicts that a new paragraph starts at versus. The second one depicts that the whole thing doesn't start with a new paragraph, and FWIW, OP wants it to start a new paragraph. – yo' Sep 19 '14 at 19:52
5

You can insert \hspace{<some length of your choice>} before "versus". In the example below, this length is set at 3cm. You may obviously alter this choice to suit your taste.

Three additional comments/suggestions: (i) mathtools loads amsmath by default -- no need to load amsmath separately; (ii) the environment {alignat*}[1] is equivalent to align*; the spacing around : following H_0 and H_1 isn't great -- I suggest you use \colon instead of :. (For a longer discussion of the third subject, I suggest you consult the posting Equation alignment creating unwanted space.)

enter image description here

\documentclass{article}
\usepackage{mathtools} % mathtools loads amsmath
\begin{document}
In our next class, we will test
\begin{align*}
  H_{0}\colon & \beta_{2}>0\\
              & \beta_{3}+\beta_{4}\ge 0
\shortintertext{\hspace{3cm}versus}
  H_{1}\colon & \beta_{2}\le 0\\
              & \beta_{3}<0
\end{align*}
\end{document}
  • Thank you especially for your extra comments. I am learning a lot and appreciate the explaining. – Xu Wang Sep 21 '14 at 16:03
5

You have two basic options: Either you treat versus as a standard paragraph text, and then it's position is completely correct (just try it with couple standard paragraphs before and after and you'll see it doesn't stand out at all).

Or you treat it as a part of the display equation, but then it shouldn't get a line on its own:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}

In our next class, we will test
\begin{align*}
    H_{0} :{}
    & \beta_{2}>0 \\
    & \beta_{3}+\beta_{4}\ge 0
\\[\medskipamount]
    \text{versus}\quad
    H_{1} :{}
    & \beta_{2}\le 0 \\
    & \beta_{3}<0
\end{align*}

\end{document}
  • If "versus" is supposed to be on the same line as H_1, shouldn't "In our next class, we will test" be on the same line as H_0? – Mico Sep 19 '14 at 20:02
  • @Mico If I wrote Let us have \begin{align} f(1) &= blabla, \\ f(2) &= blabla, \\ \text{and}\quad f(3) &= blabla. \end{align}, would you consider the position of the and improper? I think this is fine, versus -- like and fall into the preposition/conjuction category, and positioning it there is IMHO fine, and it has nothing to do with the introductory text up there. – yo' Sep 19 '14 at 20:14
  • My first choice would be keep "versus" on a line by itself and not shift it to the right. Mindful of the saying "there's no arguing about taste," I don't think any particular choice of where to place a right-shifted "versus" can be said to be correct unequivocally. – Mico Sep 19 '14 at 20:19
  • @Mico The problem is that (in my opinion) text should not "float around", it should be anchored somewhere: to the equation or to the paragraph. I can't think of more places where to anchor it to. Having it in the middle of nowhere just seems wrong. – yo' Sep 19 '14 at 20:52
  • Interesting idea. I did not consider this. I do like this possibility because I do not have to choose arbitrary number like 3 in hspace above. But I don't like "versus" with H_1 because to me "versus" belongs as much to H_0 as it does to H_1. The only way I know to express this is to put in the middle, even though I accept your critique that it means it is in the middle of nowhere. In any case, thank you for your idea! – Xu Wang Sep 21 '14 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.