4

I have a problem with the vertical lines, the second vertical line doesn't fill the cell completely as the first one, the obtained output is this: enter image description here

Here the complete snippet tested with Sharelatex:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\begin{document}

\begin{table}
  \caption{ciao}
  \label{tab:solutions}
  \center
  \begin{tabular}{l|c|c}
      \toprule
      Task & primo & secondo \\
      \midrule 
      Twitter \\ anonymization & okokokokoko &  okokokoko \\
      \midrule 
      IP partial \\ anonymization & ahiahiahaihaihaihai & okioki \\
      \bottomrule
  \end{tabular}
\end{table}

\end{document}

The second line should fill the cell as the first, how do I do it?

Regards

3
  • 1
    The user guide of the booktabs package is very clear: If you want to use the macros of the booktabs package, don't use any vertical rules. Conversely, if you want to employ vertical rules anyway, don't employ the macros of the booktabs package. Assuming you don't really have to typeset stuff like "okokokokoko" -- in which case there's probably no scope for help anyway :-) -- I suggest replacing \begin{tabular}{l|c|c} with \begin{tabular}{@{}lcc@{}} and recompiling.
    – Mico
    Dec 19, 2017 at 14:35
  • 1
    Also, if you insist on maintaining vertical rules, consider replacing Twitter with Twitter && and replacingIP partial withIP partial &&.
    – Mico
    Dec 19, 2017 at 14:41
  • Mico great! It works, if you create an answer from your last comment I'll elect it as good answer. Thanks Dec 19, 2017 at 14:48

1 Answer 1

2

To get complete vertical rules between the second and third columns, I suggest replacing

      Twitter \\ anonymization & okokokokoko &  okokokoko \\
      \midrule 
      IP partial \\ anonymization & ahiahiahaihaihaihai & okioki \\

with

      Twitter && \\ anonymization & okokokokoko &  okokokoko \\
      \midrule 
      IP partial && \\ anonymization & ahiahiahaihaihaihai & okioki \\

More generally, though, you should reconsider the case for using vertical rules in the first place. Does your table really need it or does it actually look better without any vertical rules?

Moreover, the user guide of the booktabs package is very clear:

  • If you want to use the macros of the booktabs package, don't use any vertical rules. No exceptions.

  • Conversely, if you want to employ vertical rules anyway, don't employ the macros of the booktabs package.

I would therefore like to suggest that you replace \begin{tabular}{l|c|c} with \begin{tabular}{@{}lcc@{}} and then recompile the document. I'm quite confident that you'll prefer the result, which is a much more "open" look.

1
  • I'm currently forced to use the vertical lines, not my choice :-), but your suggestion (&&) works like a charm. Dec 19, 2017 at 15:58

You must log in to answer this question.

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