3

I have the following problem. I need an equation which contains arrays and which should be on different lines because too long for one line.

This is the code:

\begin{equation}
\begin{split}
-\frac{r_{uv}^\perp\left(r_{uv}^\perp\right)^T}{||p_v-p_u||}T(\Psi_u)^T=\\
&
\frac{\left[
\begin{array}{cc}
r_{uv_y}^2 & -r_{uv_x}r_{uv_y}\\
-r_{uv_x}r_{uv_y} & r_{uv_x}^2
\end{array}
\right]}{||p_v-p_u||}
\left[
\begin{array}{cc}
\cos(\Psi_u) & \sin(\Psi_u)\\
-\sin(\Psi_u)  &  \cos(\Psi_u) 
\end{array}
\right]
= 
&
\begin{array}{cc}
-r_{uv_y}^2c_{\Psi_u}-r_{uv_x}r_{uv_y}s_{\Psi_u} & r_{uv_y}^2s_{\Psi_u}+r_{uv_x}r_{uv_y}c_{\Psi_u}\\
r_{uv_x}r_{uv_y}c_{\Psi_u}+r_{uv_x}^2s_{\Psi_u} & r_{uv_x}r_{uv_y}s_{\Psi_u}-r_{uv_x}^2c_{\Psi_u}
\end{array}
\end{split}
\end{equation}

The error I get is the following:

! Extra alignment tab has been changed to \cr.
<template> }$\hfill \endtemplate
l.753 \end{split}
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.

I think the error comes from the thing that for the array I need a \\ character and inside a \split envitonment it can't work.

Can you help me with this? Thanks a lot.

EDIT:

My hardcoded solution for now is the following. But I know it is not the best. I created an equation* (\begin{equation*}) which is without reference number and another one with the reference number (\begin{equation}).

\begin{equation*}
-\frac{r_{uv}^\perp\left(r_{uv}^\perp\right)^T}{||p_v-p_u||}T(\Psi_u)^T=
\frac{\left[
\begin{array}{cc}
r_{uv_y}^2 & -r_{uv_x}r_{uv_y}\\
-r_{uv_x}r_{uv_y} & r_{uv_x}^2
\end{array}
\right]}{||p_v-p_u||}
\left[
\begin{array}{cc}
\cos(\Psi_u) & \sin(\Psi_u)\\
-\sin(\Psi_u)  &  \cos(\Psi_u) 
\end{array}
\right]
= 
\end{equation*}
\begin{equation}
\left[
\begin{array}{cc}
-r_{uv_y}^2c_{\Psi_u}-r_{uv_x}r_{uv_y}s_{\Psi_u} & r_{uv_y}^2s_{\Psi_u}+r_{uv_x}r_{uv_y}c_{\Psi_u}\\
r_{uv_x}r_{uv_y}c_{\Psi_u}+r_{uv_x}^2s_{\Psi_u} & r_{uv_x}r_{uv_y}s_{\Psi_u}-r_{uv_x}^2c_{\Psi_u}
\end{array}
\right]
\end{equation}
0
4

(You're missing several \\ (double backslash) directives, at the end of each array environment as well as between rows 2 and 3 of the multi-line equation. Once that's fixed, you'll find that split and array environments are entirely compatible with each other.)

I suggest you use bmatrix ("matrix with square brackets") environments instead of the "plain" array environments. The typeset result will be much more compact-looking, which is probably something you want.

The amsmath package provides the macro \lVert and \rVert; use them, rather than ||. In the example code below, I set up a macro called \norm that makes use of \lVert and \rVert.

enter image description here

\documentclass{article}
\usepackage{mathtools} % loads 'amsmath' automatically
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}
\begin{equation}
\begin{split}
&{-}\frac{r_{uv}^\perp(r_{uv}^\perp)^T}{\norm{p_v-p_u}}\,T(\Psi_u)^T\\
&\qquad=
\frac{\begin{bmatrix}
r_{uv_y}^2 & -r_{uv_x}r_{uv_y}\\
-r_{uv_x}r_{uv_y} & r_{uv_x}^2
\end{bmatrix}}{\norm{p_v-p_u}}
\begin{bmatrix*}[r]
\cos(\Psi_u) & \sin(\Psi_u)\\
-\sin(\Psi_u)  &  \cos(\Psi_u)\\
\end{bmatrix*} \\
&\qquad=
\begin{bmatrix}
-r_{uv_y}^2c_{\Psi_u}-r_{uv_x}r_{uv_y}s_{\Psi_u} & r_{uv_y}^2s_{\Psi_u}+r_{uv_x}r_{uv_y}c_{\Psi_u}\\
r_{uv_x}r_{uv_y}c_{\Psi_u}+r_{uv_x}^2s_{\Psi_u} & r_{uv_x}r_{uv_y}s_{\Psi_u}-r_{uv_x}^2c_{\Psi_u}
\end{bmatrix}
\end{split}
\end{equation}

\end{document}
1
  • It works perfectly thanks for the time you spent for me. – desmond13 Apr 21 '15 at 16:48

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.