2

I have a question about how to align multiple symbols for a set of inequalities to make it look clean. This is what I have at the moment:

\begin{align*}
|f(x)-f(a)| &< f(a) \\
-f(a) < f(x) - f(a) &< f(a) \\
-f(a) + f(a) < f(x) &< f(a) + f(a) \\
0 < f(x) &< 2f(a) \\
\implies f(x) &> 0.
\end{align*}

Which only aligns the right inequality signs with each other: enter image description here

What I would like to accomplish is similar to the result one might get when using the alignat environment. Ideally, I would like to essentially create 3 columns with the inequality signs acting as separators - but I would like the middle column to be center justified.

Also note that the top row only has one inequality sign - I would like that to be aligned with all the signs on the right. How might I go about accomplishing this?

  • Related/duplicate: Align two inequalities – Werner Mar 22 '17 at 10:23
  • Is there a reason why you don't just use alignat? – Skillmon Mar 22 '17 at 10:26
  • It doesn't center the middle column... Was wondering if there is a clean way to do that. – CoffeeDonut Mar 22 '17 at 10:27
4

Like this?

enter image description here

With use ow array it is simple:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[\setlength\arraycolsep{1pt}
    \begin{array}{rcccl}
                & ~ & f(x)-f(a)|  & < & f(a) \\
-f(a)           & < & f(x) - f(a) & < & f(a) \\
-f(a) + f(a)    & < & f(x)        & < & f(a) + f(a) \\
0               & < & f(x)        & < & 2f(a) \\
                & ~ &\implies f(x)& > & 0
    \end{array}
\]
\end{document}
  • Well, it is certainly prettier than what I have. Thanks for the help! – CoffeeDonut Mar 22 '17 at 10:31
3

A solution with alignat and the eqparbox package. I took the opportunity do define an \eqmathbox command: its optional argument is a tag (M by default), and its mandatory argument is in mathmode, display style. All \eqmathboxes sharing the same tag will have their contents centred in a box of width the largest contents width. I also defined an \abs command, which adds an implicit pair of \left\lvert … \right\rvert around its argument in its starred version.

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs\lvert\rvert
\usepackage{eqparbox}
\newcommand\eqmathbox[2][M]{\eqmakebox[#1]{$\displaystyle#2$}}

\begin{document}

\begin{alignat*}{2}
              & \phantom{{}<{}} & \eqmathbox{\abs{ f(x)-f(a)}} & < f(a) \\
  -f(a) & < & \eqmathbox{f(x)-f(a)} & < f(a) \\%
  -f(a) + f(a) & < & \eqmathbox{f(x)} & < f(a) + f(a) \\
  0 & < & \eqmathbox{f(x)} & < 2f(a) \\
               & & \implies f(x) & > 0
\end{alignat*}

\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.