# How to delimit when writing with $$something$$?

I'm writing a mathematical (linear optimization) problem in Latex and I'm having trouble delimiting all the lines (I'm using $$something$$) so that the formulation looks balanced.

which I've written like:

$$\text{Minimize} \quad V_m(w,lh)=T(wl_{(bottom)}+2lh_{(sides)}+2wh) \quad \text{(tavoitefunktio)}$$<br>
$$\text{subject to} \quad \begin{cases} lwh=V \\ h=H\\ l \geq 0\\ w \geq 0\\ \end{cases} \text{(rajoitteet)}$$<br>
$$\text{suunnittelumuuttujat} \: w,l \text{ ja } h.$$.


What should I do to get every line (Minimize, subject to, suunnittelumuuttujat) to start from the same position?

• You shouldn't use , see tex.stackexchange.com/questions/503/why-is-preferable-to. And check the documentation of amsmath for multiline math environments. – Ulrike Fischer Aug 10 '16 at 12:50 • Of course Ulrike means the multline (no "i") environment ;) – Stefan Pinnow Aug 10 '16 at 12:57 • @StefanPinnow - Actually, I think Ulrike was making a generic reference to amsmath's multiline math environments -- one of which, it so happens, is called multline. :-) – Mico Aug 10 '16 at 13:10 • @Mico, of course. Missed the "s" in environments ;) Sorry for the confusion. – Stefan Pinnow Aug 10 '16 at 19:24 ## 3 Answers I would do it with an alignat environment. Incidentally, asking for a new line in the cases environment is done with a double backslash, not a single one. Also, the indices in the first row are text, hence they should be introduced by the \text command, otherwise you have math italic (not even text italic), with math spacing between letters. \documentclass[a4paper,11pt]{article} \usepackage{mathtools}% \begin{document} \begin{alignat*}{2} & \textrm{Minimize} & & V_m(w,lh)=T(wl_\textrm{(bottom)}+2lh_\textrm{(sides)}+2wh) \quad \textrm{(tavoitefunktio)}\\[1ex] & \textrm{subject to} \quad & & \begin{cases} lwh=V \\ h=H\\ l \geq 0\\ w \geq 0 \end{cases} \text{(rajoitteet)}\\ & \rlap{uunnittelumuuttujat :  w,l  ja  h .} \end{alignat*} \end{document}  • I wouldn't use \text for the indices, as \text follows the surrounding text font. I would use \mathrm. – Ulrike Fischer Aug 10 '16 at 15:42 • @Ulrike Fischer: That's right.But is the spacing in mathrm the same as in \textrm? I never knew. – Bernard Aug 10 '16 at 15:59 • the space should be the same in both \mathrm and \textrm, but you can avoid that by using \textnormal (see Command for text in math mode that does not become italicized inside theorem statements) – barbara beeton Aug 10 '16 at 17:45 • \textrm also does the job. – Bernard Aug 10 '16 at 17:46 Since it looks like you're loading the amsmath package (based on the use of the cases environment and the \text macro), I suggest you use a gather* environment and a couple of \intertext directives to structure the material. To pretty-print the material to the right of the curly brace, I further suggest you use an array environment instead of a cases environment. \documentclass{article} \usepackage{amsmath,array} \begin{document} Minimize \begin{gather*} V_m(w,lh)=T\bigl(wl_{\textrm{(bottom)}}+2lh_{\textrm{(sides)}}+2wh\bigr) \quad \text{(tavoitefunktio)}\\ \intertext{subject to} \left\{ \begin{array}{r @{} >{{}}c<{{}} @{} l} lwh & = & V \\ h & = & H\\ l &\geq& 0\\ w &\geq& 0\\ \end{array} \right. \quad\text{(rajoitteet)}\\ \intertext{and} \text{suunnittelumuuttujat} \quad w,l \text{ ja } h. \end{gather*} \end{document}  Use the align environment \begin{align} & \text{Minimize} \quad V_m(w,lh)=T(wl_\textrm{(bottom)}+2lh_\textrm{(sides)} \quad \text{(tavoitefunktio)} &\text{subject to} \quad \begin{cases} lwh=V \ h=H\ l \geq 0\ w \geq 0\ \end{cases} \text{(rajoitteet)}
&\text{suunnittelumuuttujat} : w,l \text{ ja } h.
\end{align}


If you want to remove the equation numbers use the align* environment. Note that the lines are aligned to the &, so you can play with that if you want.

Cheers

• True. Already corrected. – D G Aug 11 '16 at 10:59