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 use the following code to draw a table:

\makebox[\textwidth]{%
\begin{tabularx}{\textwidth}{|X|S|S|S|S|S|X|}
  \hline
  & $--$ & $-$ & $-/+$ & $+$ & $++$ &\\
  \hline
  The necessary information was easy to find & $\square$ & $\square$ & $\square$ & $\square$ & $\square$ & The necessary information was hard to find\\
  \hline
  Information retrieval requires redundant user input  & $\square$ & $\square$ & $\square$ & $\square$ & $\square$ & Information retrieval does not require redundant user input\\
\\\hline
\end{tabularx}%
}

Now the table looks like this: enter image description here

If I dont use the last \\\hline:

\makebox[\textwidth]{%
\begin{tabularx}{\textwidth}{|X|S|S|S|S|S|X|}
  \hline
  & $--$ & $-$ & $-/+$ & $+$ & $++$ &\\
  \hline
  The necessary information was easy to find & $\square$ & $\square$ & $\square$ & $\square$ & $\square$ & The necessary information was hard to find\\
  \hline
  Information retrieval requires redundant user input  & $\square$ & $\square$ & $\square$ & $\square$ & $\square$ & Information retrieval does not require redundant user input\\
\end{tabularx}%
}

It looks like this:

enter image description here

So how can I make the last line correctly?

share|improve this question
    
What does columntype S mean? –  Leo Liu Feb 17 '11 at 19:40
    
@Leo: see tex.stackexchange.com/q/11305/2975 –  Martin Scharrer Feb 17 '11 at 19:41
2  
Please always include the full, but minimal document, so that people can simply copy&paste it. It is normally only a few lines more... –  Martin Scharrer Feb 17 '11 at 19:42
add comment

1 Answer

up vote 4 down vote accepted

You have two \\ now:

... redundant user input\\
\\\hline
\end{tabularx}%

Before you had no \\:

... redundant user input
\hline
\end{tabularx}%

which causes the mentioned error.

You need only one \\:

... redundant user input\\
\hline
\end{tabularx}%

And then it works properly.

The reason why some lines are missing when you have two \\ is that the cells are not filled out, e.g. there are not & in the last row. The lines are only drawn with the cells. Therefore no cells -> no lines.

share|improve this answer
add comment

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.