0

I would appreciate help with this.

I'm trying to align a couple of equations but am having some issues. 1. With this code shouldn't the \wedge be properly aligned with the >. This happens for both alignat and align.

My objective would be to align these and have equal spacing between them and the expressions on either side.

%Edit: Add clarification on output

   if        d > d                25
 then        M > eta              26
 with  bla bla A O(bla bla)       27

Thanks in advance

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

  \begin{alignat}{5}
     \label{eq:test}
     \mathrm{iff}  \quad &&\frac{\partial L}{\partial\eta_2} \quad&>&&\quad\displaystyle\frac{\partial L}{\partial M} && \\
     \mathrm{then} \quad &&M                                 \quad&>&&\quad\sigma\eta_2  && \\
     \mathrm{with} \quad &&0 \le \eta_2 \le 1                \quad&\wedge&&\quad \mathrm{O}(\sigma) \le 1 \quad \blacksquare &&
 \end{alignat}

 \begin{align}
     \label{eq:test}
     \mathrm{iff}  \quad &&\frac{\partial L}{\partial\eta_2} \quad&>&\quad\displaystyle\frac{\partial L}{\partial M} && \\
     \mathrm{then} \quad &&M                                 \quad&>&\quad\sigma\eta_2  && \\
     \mathrm{with} \quad &&0 \le \eta_2 \le 1                \quad&\wedge&\quad \mathrm{O}(\sigma) \le 1 \quad \blacksquare &&
 \end{align}  
\end{document}

output

  • Welcome to TeX.SX! You can help us to help you by providing the code for a small compilable document that shows your problem called MWE. Just edit your question and add missing code.- Which alignment do you want to achieve? – Bobyandbob Feb 15 '18 at 17:10
  • "My objective would be to align these and have equal spacing between them and the expressions on either side." So pretty much get the edit on the question. Thanks in advance! – CMichael Feb 15 '18 at 17:40
2

I'm not sure whether such alignments carry any meaning.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}

\newcommand{\pder}[2]{\frac{\partial #1}{\partial #2}}

\begin{document}

\begin{alignat}{2}
\text{iff}  &\quad& \pder{L}{\eta_2}   &>\pder{L}{M}  \\
\text{then} &\quad& M                  &>\sigma\eta_2 \\
\text{with} &\quad& 0 \le \eta_2 \le 1 &\mathrel{\wedge}
   \mathrm{O}(\sigma) \le 1 \quad \blacksquare
\end{alignat}

\end{document}

enter image description here

  • Worked, thanks! I see now there were a lot of issues with using too many alignments in my case. Set as answer. Just a question if you don't mind, isn't the number inside alignat{#} supposed to be, according to the documentation, the number of rl pais? – CMichael Feb 15 '18 at 18:07
  • @CMichael Yes, here we have got two pairs. – egreg Feb 15 '18 at 18:09
  • My bad, was still partially thinking on my example in which I abused the alignments. Thank you so much! – CMichael Feb 15 '18 at 18:15
1

The eqparbox package can help. Is this what you want? (I find the spacing a little weird…)?

\documentclass[11pt]{article}
\usepackage{amssymb}
\usepackage{makebox}
\usepackage{mathtools, nccmath}

\usepackage{eqparbox}

    \newcommand\eqmathbox[2][M]{\eqmakebox[#1]{$\displaystyle{}#2{}$}}

    \begin{document}

\begin{alignat}{5}
     \label{eq:test}
     \mathrm{iff} \quad &&\frac{\partial L}{\partial\eta_2} \quad&\eqmathbox{>}&&\quad\displaystyle\frac{\partial L}{\partial M} && \\
     \mathrm{then} \quad &&M \quad&\eqmathbox{>}&&\quad\sigma\eta_2 && \\
     \mathrm{with} \quad &&0 \le \eta_2 \le 1 \quad&\eqmathbox{\wedge} &&\quad \mathrm{O}(\sigma) \le 1 \quad \blacksquare &&
 \end{alignat}

 \begin{align}
     \label{eq:test}
     \mathrm{iff} \quad &&\frac{\partial L}{\partial\eta_2} \quad& \eqmathbox{>}&\quad\displaystyle\frac{\partial L}{\partial M} && \\
     \mathrm{then} \quad &&M \quad&\eqmathbox{>}&\quad\sigma\eta_2 && \\
     \mathrm{with} \quad &&0 \le \eta_2 \le 1 \quad&\eqmathbox{\wedge}&\quad \mathrm{O}(\sigma) \le 1 \quad \blacksquare &&
 \end{align}

 \end{document}

enter image description here

  • Thanks, did not know such a package existed! If you don't mind, is there also any way to align both sets of symbols using eqmathbox? – CMichael Feb 15 '18 at 18:03
  • @CMichael: Do you mean aligning the symbols in align and in alignat? – Bernard Feb 15 '18 at 18:21
  • Yes, if possible, but perhaps across alignats would be sufficient in my case. I'm trying with a different alignat one with {2} and one with {3} and, thus far, they do not appear to align. – CMichael Feb 15 '18 at 18:24
  • You can group them as a unique alignat{3}, with one of them having one empty column. Hard to say more without having the exact example. The way eqparbox works is that it uses a tag instead of a width, so that all \eqparboxes sharing the same tag have the width of the widest contents. – Bernard Feb 15 '18 at 18:26
1

with align:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}

\begin{document}
 \begin{align}
     \label{eq:test}
 \mathrm{iff}  &&
        \frac{\partial L}{\partial\eta_2}\     > &\ \dfrac{\partial L}{\partial M}  &&\\
 \mathrm{then}  &&
        M\                                     > &\ \sigma\eta_2                    &&\\
 \mathrm{with}  &&0
        \le \eta_2 \le 1\                \wedge  &\ \mathrm{O}(\sigma)\le 1\quad \blacksquare &&
 \end{align}
 \end{document}

enter image description here

  • Thank you. If you don't mind, could you explain the usage of the "&\" I'm finding it but haven't found an explanation on it thus far. – CMichael Feb 15 '18 at 18:10
  • @CMichael, &\ gives space of one letter after &. i used it instead of your &\quad. – Zarko Feb 15 '18 at 18:14
  • the wider spaces to the left of the greater-than signs emphasize the fact that the wedge is \mathbin and not \mathrel. the latter fact is the crux of the problem. – barbara beeton Feb 15 '18 at 18:49
  • Yet it fails to produce even spacing on both sides. There's more on the right than on the left. The description of the amsmath align(at) environments suggests that the & precedes the binary operators to be aligned vertically. That's why I'd prefer the solution provided by egreg. – Kai Feb 18 '18 at 21:45

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.