3

I'm not sure what I'm doing wrong, I'm trying to create a line of bits with labels. I'm trying to do this with an array:

$\begin{array}{c|ccccccc}

\mbox{L1} & \mbox{L2} & \mbox{L3} & \mbox{L4} & \mbox{L5} & \mbox{L6} & \mbox{L7} & \mbox{L8}
0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 

\end{array}$

However this doesn't work, I get the error:

! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 

l.705 0 &
          0 & 1 & 0 & 1 & 0 & 1 & 1 \end{array}$
? 

It does work if I only have one row.

What is going wrong? I'm compiling with pdfLaTeX. Alternatively if there's a better way to do this (I'm trying to label a row of bits so that the distances between the 1s and 0s remains constant) let me know.

1 Answer 1

7

You have to break line after \mbox{L8}.

The following is compiled without any errors:

\documentclass{article}

\begin{document}

$\begin{array}{c | c c c c c c c}
\mbox{L1} & \mbox{L2} & \mbox{L3} & \mbox{L4} & \mbox{L5} & \mbox{L6} & \mbox{L7} & \mbox{L8}\\
0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 
\end{array}$

\end{document}
2
  • Ah, I thought the ` \\ ` was just an indication of a carriage return, rather than something that needed to be typed, thanks for the help!
    – fredley
    Mar 22, 2011 at 20:05
  • @fredley: Newlines are (usually) treated as spaces by TeX, unless there are two in a row in which case the second is treated like \par.
    – TH.
    Mar 23, 2011 at 1:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .