How can I get this format of an optimization problem?
up vote
3
down vote
favorite
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
add a comment |
up vote
3
down vote
favorite
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
Hello, I edited it but I dont know how to get the (P) to the other side
– StefanWK
Dec 1 at 16:43
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
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
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
math-mode align
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
Is this what you want?
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}
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
add a comment |
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; l
eft and r
ight in my case.
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}
great post, thank you!
– StefanWK
Dec 1 at 17:25
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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?
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}
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
add a comment |
up vote
4
down vote
accepted
Is this what you want?
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}
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
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Is this what you want?
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}
Is this what you want?
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}
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
add a comment |
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
add a comment |
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; l
eft and r
ight in my case.
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}
great post, thank you!
– StefanWK
Dec 1 at 17:25
add a comment |
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; l
eft and r
ight in my case.
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}
great post, thank you!
– StefanWK
Dec 1 at 17:25
add a comment |
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; l
eft and r
ight in my case.
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}
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; l
eft and r
ight in my case.
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}
answered Dec 1 at 17:00
Werner
435k619541642
435k619541642
great post, thank you!
– StefanWK
Dec 1 at 17:25
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Hello, I edited it but I dont know how to get the (P) to the other side
– StefanWK
Dec 1 at 16:43