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.

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.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

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}
share|improve this answer
    
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 '11 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 '11 at 1:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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