6

I would like to produce the following alignment with \begin{align*}...\end{align*}.

   -0,1 <  E  < 0,1 
    6,3 <  S  < 6,4 
6,3-0,1 < S+E < 6,4+0,1
    6,2 <  I  < 6,5

I can't figure out where to place the & signs. Thanks for your help.

7

With array:

\documentclass{article}
\usepackage{amsmath,array}

\begin{document}

\begin{equation*}
\renewcommand{\arraystretch}{1.2} % like in cases
\setlength{\arraycolsep}{0pt} % use math spacings
\begin{array}{ r<{{}} c >{{}}l }
   -0{,}1   < &  E  & < 0{,}1 \\
    6{,}3   < &  S  & < 6{,}4 \\
6{,}3-0{,}1 < & S+E & < 6{,}4+0{,}1 \\
    6{,}2   < &  I  & < 6{,}5
\end{array}
\end{equation*}

\end{document}

enter image description here

7

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}



alignat:
\begin{alignat}{2}
   -0,1 &< E &&< 0,1 \\
    6,3 &< S &&< 6,4 \\
6,3-0,1 &<S+E&&< 6,4+0,1 \\
   -0,1 &< I &&< 6,5  
\end{alignat}
\end{document}
  • I'm curious: why does it need &&? – muxoveji May 23 at 10:47
  • 1
    @muxoveji all ams alignments alternate between right and left alignment as if \begin{array}{rlrlrlrlrlrlrlrlrlrl} and you have no new entries to the left of the second < so that column is empty. (put x in between the & to see what I mean.) – David Carlisle May 23 at 10:54
  • That makes sense! Thanks a lot for the explanation! – muxoveji May 23 at 10:55
5

align family environments, by nature, produce right/left alignments of successive columns. Thus they are not easily adapted to achieve the center-alignment of the middle column that was requested.

Also, in order to not treat the comma as punctuation, one can either enclose each comma in its own braces {,} (yuck!), or use the \cmac macro provided to use active commas to fix the problem...Just make sure you don't use commas in another context while \cmac is active.

With tabstackengine...

\documentclass{article}
\usepackage{tabstackengine}
\let\svcm,
{
\catcode`,=\active %
\gdef,{{\svcm}}
}
\newcommand\cmac{\catcode`,=\active }
\TABstackMath
\begin{document}
\[
  \TABbinary
  \cmac
  \setstacktabulargap{0pt}
  \tabularCenterstack{rcl}{
   -0,1 <& E &< 0,1 \\
    6,3 <& S &< 6,4 \\
6,3-0,1 <&S+E&< 6,4+0,1 \\
    6,2 <& I &< 6,5}
\]
\end{document}

enter image description here

If one wants more vertical spacing between the lines, simply add \setstackgap{L}{1.2\baselineskip} to the mix:

enter image description here

2

Another solution with the eqparbox package:

\documentclass{article}
\usepackage{amsmath}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[#1]{$\displaystyle#2$}}

\begin{document}

\begin{align*}
   -0{,}1 &< \eqmathbox{E} < 0{,}1 \\
    6{,}3 &< \eqmathbox{S} < 6{,}4 \\
6{,}3-0{,}1 & <\eqmathbox{S+E} < 6{,}4+0{,}1 \\
    6{,}2 & < \eqmathbox{I} < 6{,}5
\end{align*}

\end{document} 

enter image description here

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.