2

I am using the array environment to create a multiple row bracket expression, as folows:

\documentclass{article}

\begin{document}

\begin{equation}
\left\{ \begin{array}{lll}
C(\tau_{k,i})=0.5Q_e\ddot{q}_t^T\ddot{q}_t + 0.5R_e \theta^T \theta & when & t\neq t_v\\
\\
C(\tau_{k,i})=0.5Q_e\ddot{q}_t^T\ddot{q}_t + 0.5R_e \theta^T \theta +    P_{viapoint} & when & t=t_v\\
\\
\quad\quad P_{viapoint}=10^{10}(q_{t}-q_{viapoint})^T(q_{t}-q_{viapoint})

\end{array}\right.  
\label{cost2}
\end{equation}

\end{document}

which results in something like this:

enter image description here

However, the vertical spacing between the equations is much greater that the line spacing in the text, and is eating too much space on the paper. Is there a way to reduce the vertical spacing?

  • Consider using the cases environment (part of the amsmath package) for this task. – John Wickerson Jul 19 '13 at 15:58
  • Regarding the line spacing: I wonder if you've changed some setting earlier in your document, such as issuing \renewcommand\arraystretch{1.2}. Could you post a minimal working example please? – John Wickerson Jul 19 '13 at 16:01
  • You have used \\ \\ so have a blank row between each row of text which is why the spacing is so bad. – David Carlisle Jul 19 '13 at 16:39
5

The array (and tabular) environment sets struts in rows. The size of the struts can be reduced by using smaller values than 1 or \arraystretch:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\left\{
\renewcommand*{\arraystretch}{.5}
\begin{array}{lll}
C(\tau_{k,i})=0.5Q_e\ddot{q}_t^T\ddot{q}_t + 0.5R_e \theta^T \theta
& \text{when} &
t\neq t_v\\
\\
C(\tau_{k,i})=0.5Q_e\ddot{q}_t^T\ddot{q}_t + 0.5R_e \theta^T \theta +
P_{\text{viapoint}} & \text{when} & t=t_v\\
\\
\quad\quad P_{\text{viapoint}}
=10^{10}(q_{t}-q_{\text{viapoint}})^T(q_{t}-q_{\text{viapoint}})
\end{array}\right.
\end{equation}
\end{document}

Result

You can also take a look at AmSLaTeX (package amsmath) that provides many environments for aligned/non-aligned equations and cases structures.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.