1

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?

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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