1

The following matrix is not displaying all elements in each row on the same line, the last element in each row is getting pushed to the next line. If I delete the last element then the matrix displays correctly. I am getting this error when I compile -

You have given more \span or & marks than there were in the preamble to the \halign or \valign now in progress. So I'll assume that you meant to type \cr instead.

\documentclass[a4paper,12pt,times,numbered,print,index]{article}   
\RequirePackage[left=37mm,right=30mm,top=35mm,bottom=30mm]{geometry}
\RequirePackage{libertine} 
\RequirePackage[small,bf,labelsep=space,
    tableposition=top]{caption} 
\usepackage{multirow}  
\usepackage{subfig,amsfonts,amsmath,amssymb,braket}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx

\begin{document}

\begin{figure}[ht]
\centering
H_{ab}=
\begin{bmatrix}
    1 & 1 & 0 & \dots   & \dots   & 0 &  0    & 0 & \dots   & \dots & 0 \\
    0 & 0 & 0 & \dots   & \dots   & 1 & -1    & 0 & \dots   & \dots & 0 \\
    0 & 0 & 0 & 0       & \dots   & 1 & 0     & 0 & \dots   & 0     & 0 \\
    0 & 0 & 0 & 0       & \dots   & 1 & 0     & 0 & \dots   & 0     & 0 \\
    0 & 0 & 0 & 0       & \dots   & 1 & 0     & 0 & \dots   & 0     & 0 \\ 
\end{bmatrix}
$$
\caption{Transition matrix for a $1$-step memory walk where the number of steps $n = 2$.}
\label{qw_mem_p_transition_mat}
\end{figure}
\end{document}

How can I get all the elements on each row to display on the same line?

sonicboom
  • 579
  • You should always fix the first error in the document, later errors are often spurous. Your error is `! Missing $ inserted. $ l.15 H_ {ab}= ` because you forgot to start math mode with `\[` – David Carlisle Apr 05 '14 at 17:12

0 Answers0