1
\documentclass[11pt,a4paper]{article}
\usepackage{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}

\begin{document}
  \begin{alignat*}{2}
    \text{minimize }   & \sum_{i=1}^m c_i x_i + \sum_{j=1}^n d_j t_j\  \\
    \text{subject to } & \sum_{i=1}^m a_{ij} + e_j t_j \geq g_j &,\ & 1\leq j\leq n\\
                       & f_i x_i + \sum_{j=1}^n b_{ij}t_j \geq h_i\ &,\ & 1\leq i\leq m\\
                       & x\geq 0,\ t_j\geq 0\ &,\ & 1\leq j\leq n,\ 1\leq i\leq m
  \end{alignat*}
\end{document}

Is recommended as a solution to generate the following linear program:

enter image description here

Unfortunately it is not exactly adjusted to be just under the heading there.

Can someone recommend a solution to left adjust this? I tried \left and changing that little number inside of \begin{alignat*}{} but it did not work...

Also there is a huge gap between the linear program (i.e. the code above) and whatever else you type outside of the code.

Example:

    {\bfseries Linear Program}

    Hello world:

     \begin{alignat*}{2}
     \text{minimize }   & \sum_{i=1}^m c_i x_i + \sum_{j=1}^n d_j t_j\  \\
     \text{subject to } & \sum_{i=1}^m a_{ij} + e_j t_j \geq g_j &,\ & 1\leq j\leq n\\
     & f_i x_i + \sum_{j=1}^n b_{ij}t_j \geq h_i\ &,\ & 1\leq i\leq m\\
     & x\geq 0,\ t_j\geq 0\ &,\ & 1\leq j\leq n,\ 1\leq i\leq m
     \end{alignat*}
This is a linear program

enter image description here

^Huge space cannot be removed by any means.

Can anyone fix that as well?

3
  • it is not clear (to me) what should be left adjusted? Your MWE doesn't contain Linear programming, where it should be? – Zarko Oct 26 '15 at 4:43
  • @Zarko Oh just align that piece of code to the left, instead of centered as it is now – Fraïssé Oct 26 '15 at 4:45
  • Don't leave blank line above alignat* – user11232 Oct 26 '15 at 5:07
1

Something like this?

enter image description here

Instead alignat I use `flalign˙:

\documentclass{article}
    \usepackage{mathtools}
    \usepackage{showframe}

\begin{document}
\textbf{Linear Program}
     \begin{flalign*}
\text{minimize }   & \sum_{i=1}^m c_i x_i 
                        + \sum_{j=1}^n d_j t_j\     &    \\
\text{subject to } & \sum_{i=1}^m a_{ij} 
                        + e_j t_j \geq g_j\ ,\quad 
                          1\leq j\leq n             &   \\
     & f_i x_i + \sum_{j=1}^n b_{ij}t_j \geq h_i\ ,\quad 
                        1\leq i\leq m\\
     & x\geq 0,\ t_j\geq 0\ ,\quad
       1\leq j\leq n,\ 1\leq i\leq m
     \end{flalign*}
\end{document}

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.