## 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
1. $$D=(\left[ \begin{array} {ccc |ccc} 2. a_1,_1 & \ldots & a_1,_n & & & \\ 3. \vdots & \ddots & \vdots & & \Theta &\\ 4. a_n,_1 & \ldots & a_n,_n & & & \\ 5. \hline 6. & & & & b_1,_1 & \ldots & b_1,_n \\ 7. & &\Theta & & \vdots & \ddots & \vdots \\ 8. & & & & b_n,_1 & \ldots & b_n,_n & & & 9. \right 10. \end{array} 11.$$
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: 8954
Joined: Mon Mar 10, 2008 9:44 pm
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:

1. \documentclass{article}
2. \begin{document}
3. $4. D=\left[ \begin{array} {ccc |cccc} 5. a_1,_1 & \ldots & a_1,_n & & & \\ 6. \vdots & \ddots & \vdots & & \Theta &\\ 7. a_n,_1 & \ldots & a_n,_n & & & \\ 8. \hline 9. & & & & b_1,_1 & \ldots & b_1,_n \\ 10. & &\Theta & & \vdots & \ddots & \vdots \\ 11. & & & & b_n,_1 & \ldots & b_n,_n 12. \end{array}\right] 13.$
14. \end{document}

matrix.png (2.83 KiB) Viewed 15899 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 15863 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: 8954
Joined: Mon Mar 10, 2008 9:44 pm
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.

1. $$f(x) = 2. \left \{ 3. \begin{array} {rl} 4. sin (\frac {1}{x}) & \mbox {dla} \ x \neq 0\\ 5. 0 & \mbox{dla } \ x \in \mathbb{R} \backslash \{0\}. 6. \end{array} 7. \right.$$
8. \\
9. $$det\begin{pmatrix} 10. a_1,_1 & 0 & 0 & \ldots & 0 \\ 11. a_2,_1 & a_2,_2 & 0 & \ldots & 0\\ 12. a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\ 13. \vdots & \vdots & \vdots & \ddots & \vdots & \\ 14. a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m 15. \end{pmatrix}= \prod _{i=1}^n a_{i,i}$$\
16. $17. D=\left[ \begin{array} {ccc |cccc} 18. a_1,_1 & \ldots & a_1,_n & & & \\ 19. \vdots & \ddots & \vdots & & & \Theta\\ 20. a_n,_1 & \ldots & a_n,_n & & & \\ 21. \hline 22. & & & & b_1,_1 & \ldots & b_1,_n \\ 23. & \Theta & & \vdots & \ddots & \vdots \\ 24. & & & & b_n,_1 & \ldots & b_n,_n 25. \end{array}\right] 26.$
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: 3795
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).

1. \documentclass[a4paper]{article}
2.
3. \usepackage[utf8]{inputenc}
4. \usepackage{amsmath}
5. \usepackage{amssymb}
6. \begin{document}
7.
8. $f(x) = 9. \left \{ 10. \begin{array} {rl} 11. \sin (\frac {1}{x}) & \mbox {dla} \ x \neq 0\\ 12. 0 & \mbox{dla } \ x \in \mathbb{R} \backslash \{0\}. 13. \end{array} 14. \right.$
15.
16. $f(x) = \begin{cases} 17. \sin (\frac {1}{x}) & \text {dla} \ x \neq 0\\ 18. 0 & \text{dla } \ x \in \mathbb{R} \backslash \{0\}. 19. \end{cases} 20.$
21.
22.
23. \begin{align*}
24. \prod _{i=1}^n a_{i,i}&=
25. \det \begin{pmatrix}
26. a_1,_1 & 0 & 0 & \ldots & 0 \\
27. a_2,_1 & a_2,_2 & 0 & \ldots & 0\\
28. a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\
29. \vdots & \vdots & \vdots & \ddots & \vdots & \\
30. a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m
31. \end{pmatrix} \\
32. D &=\hphantom{\det}\left[ \begin{array} {ccc |cccc}
33. a_1,_1 & \ldots & a_1,_n & & & \\
34. \vdots & \ddots & \vdots & & & \Theta\\
35. a_n,_1 & \ldots & a_n,_n & & & \\
36. \hline
37. & & & & b_1,_1 & \ldots & b_1,_n \\
38. & \Theta & & \vdots & \ddots & \vdots \\
39. & & & & b_n,_1 & \ldots & b_n,_n
40. \end{array}\right]
41. \end{align*}
42.
43. \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: 3795
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.

1. \documentclass[a4paper]{article}
2.
3. \usepackage[utf8]{inputenc}
4. \usepackage{amsmath}
5. \usepackage{amssymb}
6. \usepackage{showframe}
7. \usepackage{geometry}
8. %\geometry{margin=1cm}%Just for showing, these are bad margins!
9. \begin{document}
10.
11. $f(x) = 12. \left \{ 13. \begin{array} {rl} 14. \sin (\frac {1}{x}) & \mbox {dla} \ x \neq 0\\ 15. 0 & \mbox{dla } \ x \in \mathbb{R} \backslash \{0\}. 16. \end{array} 17. \right.$
18.
19. $f(x) = \begin{cases} 20. \sin (\frac {1}{x}) & \text {dla} \ x \neq 0\\ 21. 0 & \text{dla } \ x \in \mathbb{R} \backslash \{0\}. 22. \end{cases} 23.$
24.
25.
26. $27. %\small 28. \footnotesize 29. \det \begin{pmatrix} 30. a_1,_1 & 0 & 0 & \ldots & 0 \\ 31. a_2,_1 & a_2,_2 & 0 & \ldots & 0\\ 32. a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\ 33. \vdots & \vdots & \vdots & \ddots & \vdots & \\ 34. a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m 35. \end{pmatrix} = \prod _{i=1}^n a_{i,i} 36. \quad 37. D =\left[ \begin{array} {ccc |cccc} 38. a_1,_1 & \ldots & a_1,_n & & & \\ 39. \vdots & \ddots & \vdots & & & \Theta\\ 40. a_n,_1 & \ldots & a_n,_n & & & \\ 41. \hline 42. & & & & b_1,_1 & \ldots & b_1,_n \\ 43. & \Theta & & \vdots & \ddots & \vdots \\ 44. & & & & b_n,_1 & \ldots & b_n,_n 45. \end{array}\right] 46.$
47.
48. $49. \det \begin{pmatrix} 50. a_1,_1 & 0 & 0 & \ldots & 0 \\ 51. a_2,_1 & a_2,_2 & 0 & \ldots & 0\\ 52. a_3._1 & a_3,_2 & a_3,_3 & \ldots & 0\\ 53. \vdots & \vdots & \vdots & \ddots & \vdots & \\ 54. a_n-_1,_1 & \ldots & a_n-_1,_n-_1 & \ldots & a_n,_m 55. \end{pmatrix} = \prod _{i=1}^n a_{i,i} 56. \quad 57. D =\left[ \begin{array} {ccc |cccc} 58. a_1,_1 & \ldots & a_1,_n & & & \\ 59. \vdots & \ddots & \vdots & & & \Theta\\ 60. a_n,_1 & \ldots & a_n,_n & & & \\ 61. \hline 62. & & & & b_1,_1 & \ldots & b_1,_n \\ 63. & \Theta & & \vdots & \ddots & \vdots \\ 64. & & & & b_n,_1 & \ldots & b_n,_n 65. \end{array}\right] 66.$
67.
68. \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.

1. \documentclass{article}
2.
3. \usepackage{graphicx}
4. \usepackage[intlimits]{amsmath}
5. \usepackage{amsthm}
6. \usepackage{amsfonts}
7. \usepackage{amssymb}
8. \usepackage{epsfig}
9. \usepackage{array}
10. \usepackage{subfigure}
11. \usepackage{multirow}
12. \usepackage{subfigure}
13. \usepackage[]{algorithm2e}
15. \oddsidemargin = +.25in
16. \textwidth = 460pt
17. \begin{document}
18. \begin{equation*}
19. \begin{split}
20. 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);\\
21. & \overline{r} (2,2) + \lambda \left( p(2, 2, 1) * J^2 (2) + p(2,2,2) * J^2 (2) \right) \right] \\
22. \end{split}
23. \end{equation*}
24.
25. \begin{multline*}
26. 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] \\
27. \end{multline*}
28.
29. \end{document}

Stefan Kottwitz
Posts: 8954
Joined: Mon Mar 10, 2008 9:44 pm
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.

1. \begin{equation*}
2. \begin{split}
3. 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.;\\
4. & \left.\overline{r} (2,2) + \lambda \left( p(2, 2, 1) * J^2 (2) + p(2,2,2) * J^2 (2) \right) \right] \\
5. \end{split}
6. \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