1

I am beginner at latex, and I am wondering how should I make the math formula centered. What I want is as shown on the picture. Also what is the best way of making spaces when writing math code? I am reffering to the spaces between min and f(x). Thanks in advanceenter image description here

My code looks like this, but there are a few problems 1) P should be in the middle of these lines and on the left of both. 2) spaces between min s.t, are there any other ways than writing a lot of \:

\begin{align} 
(P)\:\: minf(x)\\ 
s.t\:\:g(x,s)\leq 0\:\:\forall s\in\Omega 
\end{align}
  • Without code hard to tell... – DG' Apr 27 '19 at 9:53
  • Welcome. Please add a minimal working example. – Bobyandbob Apr 27 '19 at 9:58
  • Welcome to TeX.SE. There are many ways to typeset an equation displayed on a line by itself, usually (but not necessarily) centered on the line. The same goes for multi-line equations. Does the posting What are the differences between $$, [, align, equation and displaymath? offer some useful pointers? – Mico Apr 27 '19 at 9:58
  • 1
    I would suggest you start by look at the documentation for the amsmath package. Try some of their code, and if you get stuck, make your question more specific. – Andrew Swann Apr 27 '19 at 10:01
2

it may help you:

enter image description here

\documentclass{article}
\usepackage{amsmath}

\usepackage{lipsum} % for dummy text

\begin{document}
\lipsum[11]
\begin{gather*}
(P) \qquad\begin{aligned}
        \min    &\quad   f(x)        \\
\mathrm{s.t}    &\quad   g(x,s)\leq 0\:\:\forall s\in\Omega
          \end{aligned}
\end{gather*}
\lipsum[12]
\end{document}
| 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.