2

I am trying to assign numbers to my equations in an optimization problem, however Latex keeps giving one number for the single problem. I have checked multiple sources for any advice, but I have yet to find one satisfactory.

The model is as follows:

\begin{equation} 

\begin{aligned}

& \underset{k=1, t\epsilon T, p\epsilon P}{\text{Max}}
& &\sum_{p\epsilon P}(a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t  \\

& \text{subject to} 
& & f\sum_{ p\epsilon P}x_{p,t}+y_t=B_t , & \forall t \\

&&& k\geq m_k , & \forall k \\

&&& p_i\geq g_{pi,pj} , & \forall i \vee j && j \neq i \\

&&& \sum_{p\epsilon P}\sum_{t\epsilon T} (a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t \geq B_F \\

\end{aligned}

\end{equation}

I synthesize that the problem is due to me using only one equation format, but I've tried with several, but that only gave me errors.

Thanks in advance.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – CarLaTeX Sep 21 '17 at 15:04
3

Do you mean to use the align environment instead of the aligned environment? aligned creates only one equation number for the whole environment. align creates a separate equation number for each new line in the environment.

If you want to omit numbering on specific equations, you can do so with the \nonumber command.enter image description here

Try this code instead:

\documentclass{article}
    \usepackage{amsmath,amssymb,amsfonts,amsthm}
\title{Equation Numbering}
\begin{document}
\maketitle


  \begin{align}
    & \underset{k=1, t\epsilon T, p\epsilon P}{\text{Max}}
    & &\sum_{p\epsilon P}(a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t  \\
%
    & \text{subject to} 
    & & f\sum_{ p\epsilon P}x_{p,t}+y_t=B_t , & \forall t \\
%
    &&& k\geq m_k , & \forall k \nonumber \\
%
    &&& p_i\geq g_{pi,pj} , & \forall i \vee j && j \neq i \nonumber \\
%
    &&& \sum_{p\epsilon P}\sum_{t\epsilon T}
    (a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t \geq B_F
  \end{align}
\end{document}
| improve this answer | |
2

Here is a solution with alignat:

    \documentclass{article}
    \usepackage{mathtools}
\DeclareMathOperator{\Max}{Max}

\begin{document}

\begin{alignat}{3}
   & \underset{\substack{k=1, t ∈ T, \\ p ∈ P}}{\Max}\,
  \mathrlap{∑_{p ∈ P}(a_{p,k,t}x_{p,t})+∑_{t=1}^{T}{(1+r)}^{T-t}y_t} \\
   & \text{subject to}
   & \quad & f∑_{ p ∈ P}x_{p,t}+y_t=B_t , & & \quad ∀ t \\
   & & & k\geq m_k , & & ∀ k \\
   & & & p_i\geq g_{pi,pj} , & & ∀ i ∨ j ,\quad j ≠ i \\
   & & & ∑_{p ∈ P}∑_{t ∈ T} (a_{p,k,t}x_{p,t}) + \mathrlap{∑_{t=1}^{T}{(1+r)}^{T-t}y_t \geq B_F }
\end{alignat}

\end{document} 

enter image description here

| improve this answer | |

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.