4

I have equation on two lines with a label (number of equation). However, the lines are aligned to the right and I would rather have then left-aligned. I have tried align* and gather*, but I haven't got the desired results. Also in these cases, I have been unable to see the label, which I very much want to include.

\begin{equation} \label{eq:adj_BH}
\begin{split}
    q_{(K)} = \frac{N}{K} p_{(K)},\\ 
    q_{(i)} = min(\frac{N}{i} p_{(i)}, q_{(i + 1)} ) \, for \, i \in \{1, 2, \ldots, K-1\},
\end{split}
\end{equation}

I would be grateful for any suggestions to fix this issue :)

4
  • 1
    How should it know where to align when you don't tell it to? use &=
    – daleif
    Commented Dec 21, 2023 at 14:31
  • 1
    use & before the = but also it is usually better to use aligned rather than split unless you really need the features of split. Commented Dec 21, 2023 at 14:33
  • 1
    also use \min not min and \text{ for } never use math italic for words. Commented Dec 21, 2023 at 14:34
  • Thank you so much! This fixed the problem :) Also, good point to add \min, not min
    – saml
    Commented Dec 21, 2023 at 14:35

2 Answers 2

5

I can think of two fixes.

  • The minimalist approach: Keep the OP's basic split-based structure, but provide alignment points, use text mode where appropriate, replace min with \min, and enlarge the "outer" parentheses in row 2.

  • Switch from the split setup to a cases-enviroment setup.

Both fixes are implemented below.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'split' and 'cases' environments and '\text' macro
\usepackage{xcolor}  % for '\textcolor' command
\begin{document}

\textcolor{red}{OP's code}
\begin{equation} \label{eq:adj_BH}
\begin{split}
    q_{(K)} = \frac{N}{K} p_{(K)}\,,\\ 
    q_{(i)} = min(\frac{N}{i} p_{(i)}, q_{(i + 1)} ) 
       \, for \, i \in \{1, 2, \ldots, K-1\}
\end{split}
\end{equation}

\bigskip
\textcolor{red}{Solution 1: minimalist fixes}
\begin{equation} \label{eq:adj_BH}
\begin{split}
    q_{(K)} &= \frac{N}{K} \, p_{(K)}\,,\\ 
    q_{(i)} &= \min\Bigl(\frac{N}{i}\,p_{(i)}, q_{(i + 1)} \Bigr) 
       \text{ for $i \in \{1, 2, \ldots, K-1\}$}
\end{split}
\end{equation}

\bigskip
\textcolor{red}{Solution 2: Switch to a \texttt{cases} environment}
\begin{equation} \label{eq:adj_BH}
q_{(i)} = 
\begin{cases}
  \min\bigl((N/i)p_{(i)}, q_{(i + 1)} \bigr) &\text{for $i<K$}\,, \\
  (N/K)p_{(K)} &\text{for $i=K$}
\end{cases}
\end{equation}
\end{document}
1
  • Thank you, this is great! I like a lot the suggestion of using cases environment as well
    – saml
    Commented Dec 21, 2023 at 17:22
4

You should use aligned, rather than split (which is semantically not apt to the job). Alternatively, assign two different numbers.

I'd opt for \tfrac, because \frac{N}{K} is too prominent.

Note \min, the use of \text and \dots instead of \ldots.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Two equations with a single number for both
\begin{equation} \label{eq:adj_BH}
\begin{aligned}
    q_{(K)} &= \tfrac{N}{K} p_{(K)},\\ 
    q_{(i)} &= \min\bigl(\tfrac{N}{i} p_{(i)}, q_{(i + 1)} \bigr)
               \quad\text{for } i \in \{1, 2, \dots, K-1\},
\end{aligned}
\end{equation}
But one can also think to assign different, albeit linked numbers
\begin{subequations}\label{eq:adj_BH-again}
\begin{align}
    q_{(K)} &= \tfrac{N}{K} p_{(K)},\\ 
    q_{(i)} &= \min\bigl(\tfrac{N}{i} p_{(i)}, q_{(i + 1)} \bigr)
               \quad\text{for } i \in \{1, 2, \dots, K-1\},
\end{align}
\end{subequations}
and we can refer to either equation~\eqref{eq:adj_BH}
or to equations~\eqref{eq:adj_BH-again}.

\end{document}

enter image description here

1
  • 1
    Thank you! The subequations with linked numbers look very useful
    – saml
    Commented Dec 21, 2023 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .