0

I am trying to write a long equation which includes a long matrix. I have tried many solutions (multiline, split) from the other so answers but the problem still exists. Could you help me to find out the problem? Thank you in advance.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

\begin{equation} \begin{multiline} \label{nineth} \begin{bmatrix} \dot{x}\ \dot{y}\ \dot{z}\ \end{bmatrix} = \begin{bmatrix} R_{0}^{0} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{0}) & R^{0}{1} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{1}) & R^{0}{2} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{2}) & R^{0}{3} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{3}) & \ R^{0}{4} \begin{bmatrix} 0\ 0\ 1
\end{bmatrix} x (d^{0}{5}-d^{0}{4}) & \end{bmatrix} \begin{bmatrix} \dot{\theta_{1}} \ \dot{\theta_{2}} \ \dot{\theta_{3}} \ \dot{\theta_{4}} \ \dot{\theta_{5}} \ \end{bmatrix} \end{multiline} \end{equation} \end{document}

As you can see there are 3 terms in the equation, 2nd term should be splitted but the result of the code is wrong in the image. enter image description here

  • Welcome to TeX.SE! multiline does not exist and should be multline, which cannot be nested in an equation. But apart from this I really do not understand how the equation is supposed to look like. – campa Aug 04 '21 at 16:10
  • The secondterm in the image is a one matrix R_{0}{4} ... should be on the same row as well others element of the matrix or the 3rd term should be near to the R{0}_{4} element of the 2nd term. multline did not give any result btw. – Oğuz KAHRAMAN Aug 04 '21 at 16:14
  • Exactly it is 1x5 row vector. Yes everyting what you explained, (-) is also supposed to be (=). – Oğuz KAHRAMAN Aug 04 '21 at 16:30
  • If I understand your setup correctly, the big matrix is supposed to be a 3x5 matrix; is this correct? (The x characters denote multiplication, right?) If my assumption is correct, why not just state that \dot{x}=0, \dot{y}=0, and provide an inline math expression for \dot{z}? – Mico Aug 04 '21 at 16:33
  • Yes it is for cross product. The matrix is as you said 3x5. – Oğuz KAHRAMAN Aug 04 '21 at 16:35
  • See my answer on question http://tex.stackexchange.com/questions/257313/ – Zarko Aug 04 '21 at 16:38
  • Thanks. Please also clarify whether the terms R^0_{...} and d^0_{...} are scalars, vectors, or matrices. – Mico Aug 04 '21 at 16:54
  • @Zarko thank you so much. I was able to write like you. I wish I could vote up. – Oğuz KAHRAMAN Aug 04 '21 at 18:18

2 Answers2

2

I'm not sure that the matrix form is really helpful for your readers; in this case a summation seems much better:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation} \begin{bmatrix} \dot{x} \ \dot{y} \ \dot{z} \end{bmatrix} - \sum_{k=0}^4 R^{0}{k} \begin{bmatrix} 0 \ 0 \ 1 \end{bmatrix} x(d^{0}{5}-d^{0}{k}) \dot{\theta}{k+1} \end{equation}

\end{document}

enter image description here

Alternatively,

\begin{equation}
\begin{bmatrix} \dot{x} \\ \dot{y} \\ \dot{z} \end{bmatrix} -
\begin{bmatrix} S_0 & S_1 & S_2 & S_3 & S_4 \end{bmatrix}
\begin{bmatrix}
  \dot{\theta}_1 \\ \dot{\theta}_2 \\ \dot{\theta}_3 \\ \dot{\theta}_4 \\ \dot{\theta}_5
\end{bmatrix},
\qquad S_k=R^{0}_{k}\begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}x(d^{0}_{5}-d^{0}_{k})
\end{equation}

enter image description here

egreg
  • 1,121,712
1

I propose to use multlined environment (from mathtools) inside the large matrix, and the geometry package to have more decent margins by default.

Unrelated: needless to load inputenc with option [utf8] nowadays (unless you have an old version of LaTeX), nor amsfonts if you load amssymb – the latter does it for you.

\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{bigstrut}
\setlength{\bigstrutjot}{1ex}

\begin{document}

\begin{equation} \label{nineth} \begin{bmatrix} \dot{x}\bigstrut[t]\ \dot{y}\ \dot{z}\bigstrut[b] \end{bmatrix} = \begin{bmatrix} \begin{multlined} R_{0}^{0} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{0}) \quad R^{0}{1} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{1})\quad R^{0}{2} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{2})\[-2ex] R^{0}{3} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{3}) \quad R^{0}{4} \begin{bmatrix} 0\ 0\ 1 \end{bmatrix} x (d^{0}{5}-d^{0}{4}) \end{multlined} \end{bmatrix} \begin{bmatrix} \dot{\theta_{1}}\bigstrut[t] \[0.5ex] \dot{\theta_{2}} \[0.5ex] \dot{\theta_{3}} \[0.5ex] \dot{\theta_{4}} \[0.5ex] \dot{\theta_{5}}\bigstrut[b] \end{bmatrix} \end{equation}

\end{document}

enter image description here

Bernard
  • 271,350
  • Thank you so much but it is not like I wanted. I have found the answer here link – Oğuz KAHRAMAN Aug 04 '21 at 18:20
  • 2
    I only wanted to show that multline can be nested if you load mathtools and use multlined in the right place. This being said, I don't understand what you wanted. – Bernard Aug 04 '21 at 18:44