# How to make a new command for inserting an inline matrix? [duplicate]

I know I will be doing many calculations with the basis vectors (1,0) and (0,1) so I'm trying to define a command so I can write this vector inline. However, I'm getting the following error: "LaTeX Error: Missing \begin{document}."

Here is my code:

\documentclass[11pt]{article} %
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{psfrag}
\usepackage{amsmath,amssymb}
\usepackage{enumerate}
\usepackage{amsthm}
\usepackage{scrextend}
\usepackage{float}

\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}

\newcommand{\basis0}{\bigl[ \begin{smallmatrix}1\\0\\ \end{smallmatrix}\bigr]}
\newcommand{\basis1}{\bigl[ \begin{smallmatrix}0\\1\\ \end{smallmatrix}\bigr]}
\begin{document}

The vectors $|0\rangle = \basis0$ and $|1\rangle = \basis1$ are useful for...

\end{document}


numbers in names of \newcommand are not allowed. in your names replace for example 1 with A and 2 with B:

\documentclass[11pt]{article} %
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{psfrag}
\usepackage{amsmath,amssymb}
\usepackage{enumerate}
\usepackage{amsthm}
\usepackage{scrextend}
\usepackage{float}

\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}

\newcommand{\basisA}{\bigl[ \begin{smallmatrix}1\\0\\ \end{smallmatrix}\bigr]}
\newcommand{\basisB}{\bigl[ \begin{smallmatrix}0\\1\\ \end{smallmatrix}\bigr]}

\begin{document}
The vectors $|0\rangle = \basisA$ and $|1\rangle = \basisB$ are useful for...
\end{document}


and you will obtain desired result: