# Writing matrices in latex

$A = N\left ( \begin{pmatrix} a\\ . \\ . \\ . \\ b \end{pmatrix} \right )$


I tried the above on an online Tex equation editor, and it works just fine.

However, after putting that into my actual latex document, it looks like this. The matrix format is completely lost.

How can I go about fixing this?

• Did you do \usepackage{amsmath}? – egreg Sep 1 '17 at 14:14
• (off-topic) the dots really don't need to take up so much vertical space. the command \vdots (math mode only) is a more compact form intended for use in matrices. – barbara beeton Sep 1 '17 at 15:30
• Do you really want something that takes up so much vertical space in in-line maths. – Herb Schulz Sep 1 '17 at 16:51
• note that you would have got an error message. If you get an error from TeX then look at the message don't look at the output except possibly for debugging. As you see, after an error the generated pdf is not usually sensible. – David Carlisle Sep 2 '17 at 10:29

Add \usepackage{amsmath} before \begin{document}.