Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I want to built a matrix like the picture: enter image description here Have a trial:

\begin{displaymath}
 \left( \begin{array}{ccc}
 b_{11} & \ldots & b_{1j} & \ldots & b_{1j} \\
 b_{21} & \ldots & x_{22} & \ldots & b_{1j}\\
 \vdots & \ldots & \vdots & \ddots & \ddots\\
 b_{n1} & \ldots & x_{nj} & \ldots & b_{ns}
 \end{array} \right)
\end{displaymath}

However, it didn't work. Can someone help me? Thanks!

share|improve this question

marked as duplicate by Kevin C, m0nhawk, Jesse, Stefan Kottwitz Dec 9 '13 at 7:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I'd use bmatrix and/or pmatrix from the amsmath package (see p.10 of the link) for what you're doing. –  Kevin C Dec 9 '13 at 5:05
    
Also, it always helps if you could post a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Kevin C Dec 9 '13 at 5:09
2  
There are five columns in your array, however, you only provided three columns (\begin{array}{ccc}). This is the key. –  Ch'en Meng Dec 9 '13 at 5:12
    
BTW, \ldots is better than \cdots when \ldots is following and followed by two comma marks. In your situation, \cdots is better. –  Ch'en Meng Dec 9 '13 at 5:13

2 Answers 2

up vote 4 down vote accepted

There are five columns in your array, however, you only provided three columns (\begin{array}{ccc}). Put five cs in the braces may solve your problem.

To typeset matrix in math mode, I strongly recommend you using matrix (and also bmatrix, pmatrix, vmatrix and Vmatrix) provided by the package amsmath.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
    \big[ \alpha_1,\,\alpha_2,\,\ldots,\,\alpha_n \big]
    \begin{bmatrix}
        b_{11} & \cdots & b_{1j} & \cdots & b_{1j} \\
        b_{21} & \cdots & x_{22} & \cdots & b_{1j}\\
        \vdots & \ddots & \vdots & \ddots & \vdots\\
        b_{n1} & \cdots & x_{nj} & \cdots & b_{ns}
    \end{bmatrix}
    =
    \big[ c_1,\,c_2,\,\ldots,\,c_s \big]
\]
\end{document}

See its output:

enter image description here

share|improve this answer

You have 5 columns, so also five elements should be in an argument of array:

\documentclass{article}

\begin{document}

\begin{displaymath}
 %\left( \begin{array}{ccc}
\left( \begin{array}{ccccc}
 b_{11} & \ldots & b_{1j} & \ldots & b_{1j} \\
 b_{21} & \ldots & x_{22} & \ldots & b_{1j}\\
 \vdots & \ldots & \vdots & \ddots & \ddots\\
 b_{n1} & \ldots & x_{nj} & \ldots & b_{ns}
 \end{array} \right)
\end{displaymath}

Or rather

\[
\left[
 \begin{array}{ccccc}
 b_{11} & \ldots & b_{1j} & \ldots & b_{1j} \\
 b_{21} & \ldots & x_{22} & \ldots & b_{1j}\\
 \multicolumn{5}{c}{\dotfill}\\
 b_{n1} & \ldots & x_{nj} & \ldots & b_{ns}
 \end{array} 
\right]
\]

\end{document}

enter image description here

Here every c means a centered column (l - left, r - right).

share|improve this answer

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