1

I have a set of equations inside a subequations environment. Update: I use a macro to generate long subsubscripts in \rm.

\newcommand{\foobar}{\rm foobar}
\begin{subequations}
\begin{alignat}{5}
t_{p_{\foobar}} &=& &\big\vert \big\{e \in E^\prime \vert& &\mathcal{P}_{\foobar}(e)       &&\wedge&      &\mathcal{H}_{\foobar}(e) \big\} \big\vert\\
f_{p_{\foobar}} &=& &\big\vert \big\{e \in E^\prime \vert& &\mathcal{P}_{\foobar}(e)       &&\wedge& \lnot&\mathcal{H}_{\foobar}(e) \big\} \big\vert\\
f_{n_{\foobar}} &=& &\big\vert \big\{e \in E^\prime \vert& \lnot &\mathcal{P}_{\foobar}(e) &&\wedge&      &\mathcal{H}_{\foobar}(e) \big\} \big\vert\\
t_{n_{\foobar}} &=& &\big\vert \big\{e \in E^\prime \vert& \lnot &\mathcal{P}_{\foobar}(e) &&\wedge& \lnot&\mathcal{H}_{\foobar}(e) \big\} \big\vert
\end{alignat}
\end{subequations}

These equations have a lot of unnecessary space between columns. Using gather along with alignedat, they are aligned the way I want them - without any additional horizontal space. However, this leads to the equations being assigned only a single equation number. When I use alignat instead, latex adds additional space between columns - which I don't want. How can I achieve correct alignment and correct numbering?

  • 1
    It's not recommended to use commands such as \rm in formulas; the correct way is \newcommand{\foobar}{\mathrm{foobar}} that doesn't even require braces like in \mathcal{P}_\foobar, although braces don't harm. – egreg May 19 '11 at 16:22
1

You could use align and \phantoms to get the desired alignment:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{subequations}
\label{eq:Classification}
  \begin{align}
  t_{p_{x}} &= \big\vert \big\{e \in E^\prime \mid\phantom{\lnot}\mathcal{P}_{x}(e)\wedge
    \phantom{\lnot}\mathcal{H}_{x}(e) \big\} \big\vert\\
  f_{p_{x}} &= \big\vert \big\{e \in E^\prime \mid\phantom{\lnot}\mathcal{P}_{x}(e)  \wedge
    \lnot\mathcal{H}_{x}(e) \big\} \big\vert\\
  f_{n_{x}} &= \big\vert \big\{e \in E^\prime \mid\lnot \mathcal{P}_{x}(e) \wedge
    \phantom{\lnot}\mathcal{H}_{x}(e) \big\} \big\vert\\
  t_{n_{x}} &=\big\vert \big\{e \in E^\prime \mid\lnot \mathcal{P}_{x}(e) \wedge 
    \lnot\mathcal{H}_{x}(e) \big\} \big\vert
  \end{align}
\end{subequations}

\end{document}

Note that I also used \mid to get some space between the set generic elements and their defining condition.

| improve this answer | |
2

Please post minimal examples. I cannot see this in the following example

\documentclass[a4paper]{memoir}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\begin{gather}
\begin{alignedat}{5}
t_{p_{x}} &=& &\big\vert \big\{e \in E^\prime \vert&  
&\mathcal{P}_{x}(e)       &&\wedge&      &\mathcal{H}_{x}(e) \big\} \big\vert\\
f_{p_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& &\mathcal{P}_{x}(e)       &&\wedge& \lnot&\mathcal{H}_{x}(e) \big\} \big\vert\\
f_{n_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& \lnot  &\mathcal{P}_{x}(e) &&\wedge&      &\mathcal{H}_{x}(e) \big\} \big\vert\\
t_{n_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& \lnot &\mathcal{P}_{x}(e) &&\wedge& \lnot&\mathcal{H}_{x}(e) \big\} \big\vert
\end{alignedat}
\end{gather}
\end{subequations}
\begin{subequations}
\begin{alignat}{5}
t_{p_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& &\mathcal{P}_{x}(e)       &&\wedge&      &\mathcal{H}_{x}(e) \big\} \big\vert\\
f_{p_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& &\mathcal{P}_{x}(e)       &&\wedge& \lnot&\mathcal{H}_{x}(e) \big\} \big\vert\\
f_{n_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& \lnot &\mathcal{P}_{x}(e) &&\wedge&      &\mathcal{H}_{x}(e) \big\} \big\vert\\
t_{n_{x}} &=& &\big\vert \big\{e \in E^\prime \vert& \lnot &\mathcal{P}_{x}(e) &&\wedge& \lnot&\mathcal{H}_{x}(e) \big\} \big\vert
\end{alignat}
\end{subequations}
\end{document}
| improve this answer | |
  • You are right. To "minimize" my example, I removed the \foobar indices that seem to cause the problem in the first place. I have edited my question to show the actual problem. – Jannik Jochem May 19 '11 at 13:56
  • @jannik I still see no problems if pasted into my example above – daleif May 19 '11 at 14:11
  • Okay - then there is some weird cross-interaction of a package in my thesis. Since Gonzalo's solution fixes my problem I won't do the full bisection search to determine what exactly causes the problem. But thank you for your help. – Jannik Jochem May 19 '11 at 14:44

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.