How can I get this format of an optimization problem?











up vote
3
down vote

favorite












enter image description here



How can I reproduce this format of an optimization problem?
Ive been trying to use align but then I can produce the P only on the right side (using tag). With alignat I couldn't produce the P at all.



This is what I tried:



documentclass[•]{article}
usepackage{amsmath}


begin{document}
begin{align*}
& minlimits_{x in X} && f(x) tag{P} \
& text{subject to} && g(x) leq epsilon nonumber
end{align*}

end{document}









share|improve this question
























  • Hello, I edited it but I dont know how to get the (P) to the other side
    – StefanWK
    Dec 1 at 16:43















up vote
3
down vote

favorite












enter image description here



How can I reproduce this format of an optimization problem?
Ive been trying to use align but then I can produce the P only on the right side (using tag). With alignat I couldn't produce the P at all.



This is what I tried:



documentclass[•]{article}
usepackage{amsmath}


begin{document}
begin{align*}
& minlimits_{x in X} && f(x) tag{P} \
& text{subject to} && g(x) leq epsilon nonumber
end{align*}

end{document}









share|improve this question
























  • Hello, I edited it but I dont know how to get the (P) to the other side
    – StefanWK
    Dec 1 at 16:43













up vote
3
down vote

favorite









up vote
3
down vote

favorite











enter image description here



How can I reproduce this format of an optimization problem?
Ive been trying to use align but then I can produce the P only on the right side (using tag). With alignat I couldn't produce the P at all.



This is what I tried:



documentclass[•]{article}
usepackage{amsmath}


begin{document}
begin{align*}
& minlimits_{x in X} && f(x) tag{P} \
& text{subject to} && g(x) leq epsilon nonumber
end{align*}

end{document}









share|improve this question















enter image description here



How can I reproduce this format of an optimization problem?
Ive been trying to use align but then I can produce the P only on the right side (using tag). With alignat I couldn't produce the P at all.



This is what I tried:



documentclass[•]{article}
usepackage{amsmath}


begin{document}
begin{align*}
& minlimits_{x in X} && f(x) tag{P} \
& text{subject to} && g(x) leq epsilon nonumber
end{align*}

end{document}






math-mode align






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 1 at 17:48









Werner

435k619541642




435k619541642










asked Dec 1 at 16:20









StefanWK

184




184












  • Hello, I edited it but I dont know how to get the (P) to the other side
    – StefanWK
    Dec 1 at 16:43


















  • Hello, I edited it but I dont know how to get the (P) to the other side
    – StefanWK
    Dec 1 at 16:43
















Hello, I edited it but I dont know how to get the (P) to the other side
– StefanWK
Dec 1 at 16:43




Hello, I edited it but I dont know how to get the (P) to the other side
– StefanWK
Dec 1 at 16:43










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










Is this what you want?



enter image description here



documentclass{article}
usepackage{amsmath}

begin{document}
begin{equation}
begin{aligned}
min_{x in X} f(x) &= sum_{j=1}^{n} f_j(x_j) \
text{s.t. } g_i(x) &= sum_{j=1}^{n} g_{ij}(x_j)leq b_i, i=1,dots,m, \
xin X &= X_1times X_2times dots times X_n.
end{aligned}
tag{P}
end{equation}
end{document}





share|improve this answer























  • I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
    – StefanWK
    Dec 1 at 17:25










  • Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
    – Andreas Rejbrand
    Dec 1 at 23:32












  • @AndreasRejbrand, fixed. Thanks.
    – Sigur
    Dec 2 at 15:12


















up vote
5
down vote













You may want to switch between numbering equations on the left/right and use a gather to centre content - the alignment in your post seems non-uniform. To achieve some form of alignment around =, I've used boxes via eqmakebox[<tag>][<align>]{<stuff>}. This sets <stuff> in a box of maximum width across the same <tag> using the appropriate <align>ment; left and right in my case.



enter image description here



documentclass{article}

usepackage[leqno]{amsmath}
usepackage{eqparbox}

% https://tex.stackexchange.com/q/193535/5764
makeatletter
newcommand{leqnomode}{tagsleft@true}
newcommand{reqnomode}{tagsleft@false}
makeatother

begin{document}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

leqnomode

begin{gather}
eqmakebox[LHS][r]{$min f(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n f_j(x_j)$} tag{P} \
eqmakebox[LHS][r]{$textup{s.t.} g_i(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n g_{ij}(x_j) leq b_i, i = 1,dots,m,$} nonumber \
x in X = X_1 times X_2 times dots times X_n, nonumber
end{gather}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

end{document}





share|improve this answer





















  • great post, thank you!
    – StefanWK
    Dec 1 at 17:25











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462714%2fhow-can-i-get-this-format-of-an-optimization-problem%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










Is this what you want?



enter image description here



documentclass{article}
usepackage{amsmath}

begin{document}
begin{equation}
begin{aligned}
min_{x in X} f(x) &= sum_{j=1}^{n} f_j(x_j) \
text{s.t. } g_i(x) &= sum_{j=1}^{n} g_{ij}(x_j)leq b_i, i=1,dots,m, \
xin X &= X_1times X_2times dots times X_n.
end{aligned}
tag{P}
end{equation}
end{document}





share|improve this answer























  • I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
    – StefanWK
    Dec 1 at 17:25










  • Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
    – Andreas Rejbrand
    Dec 1 at 23:32












  • @AndreasRejbrand, fixed. Thanks.
    – Sigur
    Dec 2 at 15:12















up vote
4
down vote



accepted










Is this what you want?



enter image description here



documentclass{article}
usepackage{amsmath}

begin{document}
begin{equation}
begin{aligned}
min_{x in X} f(x) &= sum_{j=1}^{n} f_j(x_j) \
text{s.t. } g_i(x) &= sum_{j=1}^{n} g_{ij}(x_j)leq b_i, i=1,dots,m, \
xin X &= X_1times X_2times dots times X_n.
end{aligned}
tag{P}
end{equation}
end{document}





share|improve this answer























  • I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
    – StefanWK
    Dec 1 at 17:25










  • Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
    – Andreas Rejbrand
    Dec 1 at 23:32












  • @AndreasRejbrand, fixed. Thanks.
    – Sigur
    Dec 2 at 15:12













up vote
4
down vote



accepted







up vote
4
down vote



accepted






Is this what you want?



enter image description here



documentclass{article}
usepackage{amsmath}

begin{document}
begin{equation}
begin{aligned}
min_{x in X} f(x) &= sum_{j=1}^{n} f_j(x_j) \
text{s.t. } g_i(x) &= sum_{j=1}^{n} g_{ij}(x_j)leq b_i, i=1,dots,m, \
xin X &= X_1times X_2times dots times X_n.
end{aligned}
tag{P}
end{equation}
end{document}





share|improve this answer














Is this what you want?



enter image description here



documentclass{article}
usepackage{amsmath}

begin{document}
begin{equation}
begin{aligned}
min_{x in X} f(x) &= sum_{j=1}^{n} f_j(x_j) \
text{s.t. } g_i(x) &= sum_{j=1}^{n} g_{ij}(x_j)leq b_i, i=1,dots,m, \
xin X &= X_1times X_2times dots times X_n.
end{aligned}
tag{P}
end{equation}
end{document}






share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 2 at 15:11

























answered Dec 1 at 16:51









Sigur

23.7k355136




23.7k355136












  • I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
    – StefanWK
    Dec 1 at 17:25










  • Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
    – Andreas Rejbrand
    Dec 1 at 23:32












  • @AndreasRejbrand, fixed. Thanks.
    – Sigur
    Dec 2 at 15:12


















  • I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
    – StefanWK
    Dec 1 at 17:25










  • Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
    – Andreas Rejbrand
    Dec 1 at 23:32












  • @AndreasRejbrand, fixed. Thanks.
    – Sigur
    Dec 2 at 15:12
















I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
– StefanWK
Dec 1 at 17:25




I originally wanted the (P) on the left of the equations, but that looks quite nice as well thanks
– StefanWK
Dec 1 at 17:25












Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
– Andreas Rejbrand
Dec 1 at 23:32






Please don't use JPG for non-photographic images! :) (That's what causing the strange clouds of pixels surrounding the text!)
– Andreas Rejbrand
Dec 1 at 23:32














@AndreasRejbrand, fixed. Thanks.
– Sigur
Dec 2 at 15:12




@AndreasRejbrand, fixed. Thanks.
– Sigur
Dec 2 at 15:12










up vote
5
down vote













You may want to switch between numbering equations on the left/right and use a gather to centre content - the alignment in your post seems non-uniform. To achieve some form of alignment around =, I've used boxes via eqmakebox[<tag>][<align>]{<stuff>}. This sets <stuff> in a box of maximum width across the same <tag> using the appropriate <align>ment; left and right in my case.



enter image description here



documentclass{article}

usepackage[leqno]{amsmath}
usepackage{eqparbox}

% https://tex.stackexchange.com/q/193535/5764
makeatletter
newcommand{leqnomode}{tagsleft@true}
newcommand{reqnomode}{tagsleft@false}
makeatother

begin{document}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

leqnomode

begin{gather}
eqmakebox[LHS][r]{$min f(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n f_j(x_j)$} tag{P} \
eqmakebox[LHS][r]{$textup{s.t.} g_i(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n g_{ij}(x_j) leq b_i, i = 1,dots,m,$} nonumber \
x in X = X_1 times X_2 times dots times X_n, nonumber
end{gather}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

end{document}





share|improve this answer





















  • great post, thank you!
    – StefanWK
    Dec 1 at 17:25















up vote
5
down vote













You may want to switch between numbering equations on the left/right and use a gather to centre content - the alignment in your post seems non-uniform. To achieve some form of alignment around =, I've used boxes via eqmakebox[<tag>][<align>]{<stuff>}. This sets <stuff> in a box of maximum width across the same <tag> using the appropriate <align>ment; left and right in my case.



enter image description here



documentclass{article}

usepackage[leqno]{amsmath}
usepackage{eqparbox}

% https://tex.stackexchange.com/q/193535/5764
makeatletter
newcommand{leqnomode}{tagsleft@true}
newcommand{reqnomode}{tagsleft@false}
makeatother

begin{document}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

leqnomode

begin{gather}
eqmakebox[LHS][r]{$min f(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n f_j(x_j)$} tag{P} \
eqmakebox[LHS][r]{$textup{s.t.} g_i(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n g_{ij}(x_j) leq b_i, i = 1,dots,m,$} nonumber \
x in X = X_1 times X_2 times dots times X_n, nonumber
end{gather}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

end{document}





share|improve this answer





















  • great post, thank you!
    – StefanWK
    Dec 1 at 17:25













up vote
5
down vote










up vote
5
down vote









You may want to switch between numbering equations on the left/right and use a gather to centre content - the alignment in your post seems non-uniform. To achieve some form of alignment around =, I've used boxes via eqmakebox[<tag>][<align>]{<stuff>}. This sets <stuff> in a box of maximum width across the same <tag> using the appropriate <align>ment; left and right in my case.



enter image description here



documentclass{article}

usepackage[leqno]{amsmath}
usepackage{eqparbox}

% https://tex.stackexchange.com/q/193535/5764
makeatletter
newcommand{leqnomode}{tagsleft@true}
newcommand{reqnomode}{tagsleft@false}
makeatother

begin{document}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

leqnomode

begin{gather}
eqmakebox[LHS][r]{$min f(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n f_j(x_j)$} tag{P} \
eqmakebox[LHS][r]{$textup{s.t.} g_i(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n g_{ij}(x_j) leq b_i, i = 1,dots,m,$} nonumber \
x in X = X_1 times X_2 times dots times X_n, nonumber
end{gather}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

end{document}





share|improve this answer












You may want to switch between numbering equations on the left/right and use a gather to centre content - the alignment in your post seems non-uniform. To achieve some form of alignment around =, I've used boxes via eqmakebox[<tag>][<align>]{<stuff>}. This sets <stuff> in a box of maximum width across the same <tag> using the appropriate <align>ment; left and right in my case.



enter image description here



documentclass{article}

usepackage[leqno]{amsmath}
usepackage{eqparbox}

% https://tex.stackexchange.com/q/193535/5764
makeatletter
newcommand{leqnomode}{tagsleft@true}
newcommand{reqnomode}{tagsleft@false}
makeatother

begin{document}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

leqnomode

begin{gather}
eqmakebox[LHS][r]{$min f(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n f_j(x_j)$} tag{P} \
eqmakebox[LHS][r]{$textup{s.t.} g_i(x)$}
eqmakebox[RHS][l]{$displaystyle {}= sum_{j = 1}^n g_{ij}(x_j) leq b_i, i = 1,dots,m,$} nonumber \
x in X = X_1 times X_2 times dots times X_n, nonumber
end{gather}

reqnomode

begin{align}
f(x) &= ax^2 + bx + c \
g(x) &= dx^2 + ex + f
end{align}

end{document}






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 1 at 17:00









Werner

435k619541642




435k619541642












  • great post, thank you!
    – StefanWK
    Dec 1 at 17:25


















  • great post, thank you!
    – StefanWK
    Dec 1 at 17:25
















great post, thank you!
– StefanWK
Dec 1 at 17:25




great post, thank you!
– StefanWK
Dec 1 at 17:25


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462714%2fhow-can-i-get-this-format-of-an-optimization-problem%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Quarter-circle Tiles

build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

Mont Emei