## LaTeX forum ⇒ Math & Science ⇒ ! Extra alignment tab has been changed to \cr. Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
mlodyotak
Posts: 4
Joined: Mon Dec 23, 2013 10:19 pm

### ! Extra alignment tab has been changed to \cr.

what is problem with that
$$D=(\left[ \begin{array} {ccc |ccc}a_1,_1 & \ldots & a_1,_n & & & \\\vdots & \ddots & \vdots & & \Theta &\\a_n,_1 & \ldots & a_n,_n & & & \\\hline& & & & b_1,_1 & \ldots & b_1,_n \\& &\Theta & & \vdots & \ddots & \vdots \\& & & & b_n,_1 & \ldots & b_n,_n & & &\right\end{array}$$
Last edited by Stefan Kottwitz on Tue Dec 24, 2013 2:04 am, edited 1 time in total.
Reason: quote changed to code markup

Tags:

Stefan Kottwitz
Posts: 8708
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Hi mlodyotak,

welcome to the forum!

You defined 6 columns by \begin{array} {ccc |ccc}, but you used more. Just count the column separator symbols (ampersand &), there are more than 6 in the last array line. Reduce those unneeded symbols. Btw. don't use $$...$$, this is TeX syntax and not recommendable for LaTeX documents, resulting in wrong vertical spacing. Use $...$ instead. Here's a compilable version of it, also the \right corrected:

\documentclass{article}\begin{document}$D=\left[ \begin{array} {ccc |cccc}a_1,_1 & \ldots & a_1,_n & & & \\\vdots & \ddots & \vdots & & \Theta &\\a_n,_1 & \ldots & a_n,_n & & & \\\hline& & & & b_1,_1 & \ldots & b_1,_n \\& &\Theta & & \vdots & \ddots & \vdots \\& & & & b_n,_1 & \ldots & b_n,_n\end{array}\right]$\end{document}

matrix.png (2.83 KiB) Viewed 14931 times

Stefan

mlodyotak
Posts: 4
Joined: Mon Dec 23, 2013 10:19 pm
I'm very thankfull for that but i have another question how to get Theata on middle of this table maybe u have any idea?? Ok nevermind i solve the problem but i need to do something like that:

output.jpg (21.54 KiB) Viewed 14895 times
Last edited by Stefan Kottwitz on Tue Dec 24, 2013 3:04 pm, edited 1 time in total.
Reason: external image uploaded to forum

Stefan Kottwitz
Posts: 8708
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
So I guess it's solved? I would move the Theta to the column with the \ddot.

Stefan

mlodyotak
Posts: 4
Joined: Mon Dec 23, 2013 10:19 pm
i need to do this ex and i have no idea how to posit this two big matrix's how can i sole it this is my latex code. Sorry of my bbcode but i'm rly bad in such a thinks, and my english is not very good as you can see.

$$f(x) =\left \{\begin{array} {rl}sin (\frac {1}{x}) & \mbox {dla} \ x \neq 0\\0 & \mbox{dla } \ x \in \mathbb{R} \backslash \{0\}.\end{array}\right.$$\\$$det\begin{pmatrix}a_1,_1 & 0 & 0 & \ldots & 0 \\a_2,_1 & a_2,_2 & 0 & \ldots & 0\\a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\\vdots & \vdots & \vdots & \ddots & \vdots & \\a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m\end{pmatrix}= \prod _{i=1}^n a_{i,i}$$\       $D=\left[ \begin{array} {ccc |cccc} a_1,_1 & \ldots & a_1,_n & & & \\ \vdots & \ddots & \vdots & & & \Theta\\ a_n,_1 & \ldots & a_n,_n & & & \\ \hline & & & & b_1,_1 & \ldots & b_1,_n \\ & \Theta & & \vdots & \ddots & \vdots \\ & & & & b_n,_1 & \ldots & b_n,_n \end{array}\right]$
Last edited by cgnieder on Thu Dec 26, 2013 3:03 pm, edited 1 time in total.
Reason: corrected code markup

Johannes_B
Site Moderator
Posts: 3644
Joined: Thu Nov 01, 2012 4:08 pm
I am not quite sure what you want to know, maybe have a look at the following. There are some improvements (cases, commands defined by amsmath for operators ,e.g. \sin,\det).

\documentclass[a4paper]{article} \usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{amssymb}\begin{document} $f(x) =\left \{\begin{array} {rl}\sin (\frac {1}{x}) & \mbox {dla} \ x \neq 0\\0 & \mbox{dla } \ x \in \mathbb{R} \backslash \{0\}.\end{array}\right.$ $f(x) = \begin{cases}\sin (\frac {1}{x}) & \text {dla} \ x \neq 0\\0 & \text{dla } \ x \in \mathbb{R} \backslash \{0\}.\end{cases}$  \begin{align*}  \prod _{i=1}^n a_{i,i}&=  \det \begin{pmatrix}a_1,_1 & 0 & 0 & \ldots & 0 \\a_2,_1 & a_2,_2 & 0 & \ldots & 0\\a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\\vdots & \vdots & \vdots & \ddots & \vdots & \\a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m\end{pmatrix}  \\D &=\hphantom{\det}\left[ \begin{array} {ccc |cccc}a_1,_1 & \ldots & a_1,_n & & & \\\vdots & \ddots & \vdots & & & \Theta\\a_n,_1 & \ldots & a_n,_n & & & \\\hline& & & & b_1,_1 & \ldots & b_1,_n \\& \Theta & & \vdots & \ddots & \vdots \\& & & & b_n,_1 & \ldots & b_n,_n\end{array}\right]\end{align*} \end{document}

Maybe you can find some help at GUST or CSTUG. TeX user groups around the world.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

mlodyotak
Posts: 4
Joined: Mon Dec 23, 2013 10:19 pm
it's a ex. what i need to do exactly how this is written in pdf and i don't know how to do in this same lane this two big matrixes

Johannes_B
Site Moderator
Posts: 3644
Joined: Thu Nov 01, 2012 4:08 pm
Those matrices, as you say yourself, are very big and simply too big for one line. You could change the font size in the math environment, but this would be an inconsistency.

Another possibility would be to change the printable area (this is shown by showframe) using geometry. Click on »Open in Writelatex« just above the following code and uncomment the \geometry line.

\documentclass[a4paper]{article} \usepackage[utf8]{inputenc}\usepackage{amsmath}\usepackage{amssymb}\usepackage{showframe}\usepackage{geometry}%\geometry{margin=1cm}%Just for showing, these are bad margins!\begin{document} $f(x) =\left \{\begin{array} {rl}\sin (\frac {1}{x}) & \mbox {dla} \ x \neq 0\\0 & \mbox{dla } \ x \in \mathbb{R} \backslash \{0\}.\end{array}\right.$ $f(x) = \begin{cases}\sin (\frac {1}{x}) & \text {dla} \ x \neq 0\\0 & \text{dla } \ x \in \mathbb{R} \backslash \{0\}.\end{cases}$  $%\small\footnotesize \det \begin{pmatrix}a_1,_1 & 0 & 0 & \ldots & 0 \\a_2,_1 & a_2,_2 & 0 & \ldots & 0\\a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\\vdots & \vdots & \vdots & \ddots & \vdots & \\a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m\end{pmatrix} = \prod _{i=1}^n a_{i,i}\quad D =\left[ \begin{array} {ccc |cccc}a_1,_1 & \ldots & a_1,_n & & & \\\vdots & \ddots & \vdots & & & \Theta\\a_n,_1 & \ldots & a_n,_n & & & \\\hline& & & & b_1,_1 & \ldots & b_1,_n \\& \Theta & & \vdots & \ddots & \vdots \\& & & & b_n,_1 & \ldots & b_n,_n\end{array}\right]$ $\det \begin{pmatrix}a_1,_1 & 0 & 0 & \ldots & 0 \\a_2,_1 & a_2,_2 & 0 & \ldots & 0\\a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\\vdots & \vdots & \vdots & \ddots & \vdots & \\a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m\end{pmatrix} = \prod _{i=1}^n a_{i,i}\quad D =\left[ \begin{array} {ccc |cccc}a_1,_1 & \ldots & a_1,_n & & & \\\vdots & \ddots & \vdots & & & \Theta\\a_n,_1 & \ldots & a_n,_n & & & \\\hline& & & & b_1,_1 & \ldots & b_1,_n \\& \Theta & & \vdots & \ddots & \vdots \\& & & & b_n,_1 & \ldots & b_n,_n\end{array}\right]$ \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

symolon
Posts: 2
Joined: Wed Oct 18, 2017 9:15 pm
Hey all, I'm getting a similar error while trying to split an equation between 2 lines. I know the error usually means there's an extra column somewhere but I'm not creating a table and I can't see the problem. I've tried two versions of the code below, the first gives me an error that there's an extra } or missing \right. The second version gives the extra alignment tab changed to \cr. It may have to do with the semicolon, but I'm not sure. I'd appreciate any help you can provide.

\documentclass{article} \usepackage{graphicx}\usepackage[intlimits]{amsmath}\usepackage{amsthm}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{epsfig}\usepackage{array}\usepackage{subfigure}\usepackage{multirow}\usepackage{subfigure}\usepackage[]{algorithm2e}\headsep = .25in\oddsidemargin = +.25in \textwidth = 460pt\begin{document}\begin{equation*}\begin{split}J^3 (2) &\leftarrow \max_{a \in A} \left[\overline{r} (2,1) + \lambda \left( p(2, 1, 1) * J^2 (2) + p(2,1,2) * J^2 (2) \right);\\& \overline{r} (2,2) + \lambda \left( p(2, 2, 1) * J^2 (2) + p(2,2,2) * J^2 (2) \right) \right] \\\end{split}\end{equation*} \begin{multline*}J^3 (2) \leftarrow \max_{a \in A} \left[\overline{r} (2,1) + \lambda \left( p(2, 1, 1) * J^2 (2) + p(2,1,2) * J^2 (2) \right); \overline{r} (2,2) + \lambda \left( p(2, 2, 1) * J^2 (2) + p(2,2,2) * J^2 (2) \right) \right] \\\end{multline*} \end{document}

Stefan Kottwitz
Posts: 8708
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Hi symolon,

welcome to the forum!

You cannot use a dynamic \left and \right delimiter pair over several lines, standard amsmath formula environments cannot handle it. You can "close" then temporarily and open again by \right. and \left. that are invisible delimiters.

\begin{equation*}\begin{split}J^3 (2) &\leftarrow \max_{a \in A} \left[\overline{r} (2,1) + \lambda \left( p(2, 1, 1) * J^2 (2) + p(2,1,2) * J^2 (2) \right)\right.;\\& \left.\overline{r} (2,2) + \lambda \left( p(2, 2, 1) * J^2 (2) + p(2,2,2) * J^2 (2) \right) \right] \\\end{split}\end{equation*}

Luckily your formula parts are of the same size, otherwise one would need to tweak the delimiter heights when the line height is different.

Stefan