2

I've seen a lot of examples for coding a single table using the tabular environment like the following:

\begin{tabular}{|c|c|c|}
    \hline
    Column 1 & Column 2 & Column 3 \\
    \hline
    second row & & \\
    \hline
    third row & & \\
    \hline
\end{tabular}

While this is sufficient for my purpose, it would be great to change how tables are displayed in general, so that I don't have to add the | and \hline for every single table. Instead maybe I only write something like this:

\begin{tabular}
    Column 1 & Column 2 & Column 3 \\
    second row & & \\
    third row & & \\
\end{tabular}

and the same result is produced in the resulting PDF file. My question is not only about tabular, but also about other packages, which might be used for this.

How can I style my tables in such a way?

EDIT#1

I'd like to be able to have multiline cells, automatically linebreaking when a line gets too long, causing the table to be wider than textline width. so that I don't have to use \\ (which also causes problems in the example code). I also like horizontal lines for separating those multiline cells or cells in general from the other cells. An alternative would be having visibly more vertical spacing between cells than between lines of one and the same cell. However more space would not allow multiple paragraphs in a cell, or similar. One should be able to choose alignment (even better if both, vertically and horizontally), if necessary, otherwise default values for that (maybe centered).

7
  • 1
    Are you content with the material in all columns being centered? What if the material in some of the columns should be left-aligned, right-aligned, or fully justified? Is there ever a case where some of the material should "wrap" across several lines? Separately, are you content with giving all tables the "data in prison cells" look, or would you prefer to create a more inviting and readable look? Do you ever have tables with complex headers?
    – Mico
    Feb 27, 2016 at 13:36
  • @Mico I'd like to be able to have multiline cells, automatically linebreaking when a line gets too long, causing the table to be wider than textline width. I also like horizontal lines for separating those multiline cells from the other cells. An alternative would be having more vertical spacing between cells than between lines of one and the same cell. One should be able to choose alignment, if necessary, otherwise default values for that (maybe centered). I'll add to my question. Feb 27, 2016 at 13:47
  • After your edit, your posting reads like a long wish-list. But is there a question? E.g., "Is there a package that does all these things?" (The answer to that question is "no", by the way.)
    – Mico
    Feb 27, 2016 at 14:01
  • 1
    c is a single-line entry, if you want multi-line entries with line breaking use p{3cm} but I agree with Mico, there is not really a question here. Feb 27, 2016 at 14:24
  • 4
    I'm voting to close this question as off-topic because it is solved by comments.
    – Mensch
    Sep 27, 2016 at 17:31

0

Browse other questions tagged .