# center text and equation

how can I center the first equation Max $Z = 0.15x_{1} + 0.12x_{2} + 0.1x_{3} + 0.05x_{4} + 0.08x_{5}$ and the text "s.a" with the other equations below ?

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[spanish,es-tabla]{babel} % espanol
\decimalpoint
\usepackage[utf8]{inputenc}
\usepackage{graphicx} % graficos

\usepackage{amsmath}

\begin{document}
Luego el modelo matemático queda planteado como se muestra a continuación:\\

Max $Z = 0.15x_{1} + 0.12x_{2} + 0.1x_{3} + 0.05x_{4} + 0.08x_{5}$

s.a

$$x_{1} + x_{2} + x_{3} + x_{4} + x_{5} \leq 1.000.000 \label{eqn:p1-r1}$$
$$x_{1} + x_{2} \leq 0.3(x_{1} + x_{2} + x_{3} + x_{4} + x_{5}) \label{eqn:p1-r2}$$
$$x_{4} \geq x_{5} \label{eqn:p1-r3}$$
$$x_{3} + x_{4} \leq 0.5(x_{1} + x_{2} + x_{3} + x_{4} + x_{5}) \label{eqn:p1-r4}$$
$$x_{4} \geq 0.25(x_{1} + x_{2} + x_{3} + x_{4} + x_{5}) \label{eqn:p1-r5}$$

\begin{itemize}
\item Resuelva el problema mediante el software de optimización OPL –CPLEX, y entregue la Solución y Valor
Optimo.\\
\end{itemize}

\end{document}

• Welcome to TeX SX! Could you post a full compilable code? Nov 23, 2018 at 19:55
• @EmiliOrtega please add a compilable MWE. Though not THE way to typeset these type of equation. You can do it by using display-math style. Replace $...$ by $...$. Nov 23, 2018 at 19:55
• I added compilable code right now! @Raaja I didn't get what you meant by "display-math" Nov 23, 2018 at 20:37
• since you're using amsmath, you might use the gather environment (with \\  to separate lines) instead of entering each line as a separate equation. and don't leave a blank line before any single or multi-line equation block. the blank line will not prevent a page break (which is not desirable in such a location), and the use of a multi-line environment like gather will allow better control over page breaks between lines. Nov 23, 2018 at 22:59

Method 1: Not-so-correct way is to use display-math style as in:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[spanish,es-tabla]{babel} % espanol
\decimalpoint
\usepackage[utf8]{inputenc}
\usepackage{graphicx} % graficos

\usepackage{amsmath}

\begin{document}
Luego el modelo matemático queda planteado como se muestra a continuación:\\

$\max Z = 0.15x_{1} + 0.12x_{2} + 0.1x_{3} + 0.05x_{4} + 0.08x_{5}$

s.a

$$x_{1} + x_{2} + x_{3} + x_{4} + x_{5} \leq 1.000.000 \label{eqn:p1-r1}$$
$$x_{1} + x_{2} \leq 0.3(x_{1} + x_{2} + x_{3} + x_{4} + x_{5}) \label{eqn:p1-r2}$$
$$x_{4} \geq x_{5} \label{eqn:p1-r3}$$
$$x_{3} + x_{4} \leq 0.5(x_{1} + x_{2} + x_{3} + x_{4} + x_{5}) \label{eqn:p1-r4}$$
$$x_{4} \geq 0.25(x_{1} + x_{2} + x_{3} + x_{4} + x_{5}) \label{eqn:p1-r5}$$

\begin{itemize}
\item Resuelva el problema mediante el software de optimización OPL –CPLEX, y entregue la Solución y Valor
Optimo.\\
\end{itemize}

\end{document}


with which you will get:

Method 2: The (IMO) current way:

\documentclass{article}
\usepackage{amsmath}
%https://tex.stackexchange.com/questions/368570/typesetting-an-optimisation-problem
\begin{document}
\begin{subequations}
\begin{alignat}{2}