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.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI 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.
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}
\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}
\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 '19 at 10:54
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}
If one wants more vertical spacing between the lines, simply add \setstackgap{L}{1.2\baselineskip}
to the mix:
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}