Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.09k stars 958 forks source link

Tables with overlapping rows #160

Closed amaridev closed 4 years ago

amaridev commented 4 years ago

Hi, I am a bit unhappy on how my tables are rendered. Not sure if it can be considered a bug. But maybe someone has an idea on how to fix.

I use pandocs pipe tables as in their example:

 Right | Left | Default | Center |
|------:|:-----|---------|:------:|
|   12  |  12  |    12   |    12  |
|  123  |  123 |   123   |   123  |
|    1  |    1 |     1   |     1  |

  : Demonstration of pipe table syntax.

Unfortunately in my specific case some rows are too narrow and overlap while others have plenty free space.

badtable

Have a look at those headers on the left. Here is how I have it in code. In case it helps to figure out if I mad a misstake at the syntax.

| Trackp. | Kandidat | Gewicht | Emission | Inv. Em. | Heading Trackp. | Heading Kante | Distanz Point <> Kante | Transition Gewicht |
| ------- | -------- | ------- | -------- | -------- | --------------- | ------------- | ---------------------- | ------------------ |
| 17      | 1        | 0.0005  | 0.0004   | 0.0004   | 275             | 357.48        | 27.0 m                 | 0.0100             |
|         | 2        | 0.0079  | 0.0055   | 0.0055   | 275             | 180.00        | 11.0 m                 | 0.0100             |
microraptor commented 4 years ago

Pipe tables have issues in general, when they exceed the page width and cells have to become multiline, like in the title row of the table. For that exact reason Pandoc introduced multiline tables. See https://pandoc.org/MANUAL.html#tables

However it seems like Pandoc also respects the amount of '-' in pipe tables:

: Pipe Table

| Trackp. | Kandidat | Gewicht | Emission | Inv. Em. | Heading Trackp. | Heading Kante | Distanz Point <> Kante | Transition Gewicht |
| ------- | -------- | ------- | -------- | -------- | --------------- | ------------- | ---------------------- | ------------------ |
| 17      | 1        | 0.0005  | 0.0004   | 0.0004   | 275             | 357.48        | 27.0 m                 | 0.0100             |
|         | 2        | 0.0079  | 0.0055   | 0.0055   | 275             | 180.00        | 11.0 m                 | 0.0100             |

: Pipe Table with a few more strategic '-'

| Trackp. | Kandidat | Gewicht | Emission | Inv. Em. | Heading Trackp. | Heading Kante | Distanz Point <> Kante | Transition Gewicht |
| --------- | ---------- | --------- | ---------- | ---------- | --------------- | ------------- | ---------------------- | ------------------ |
| 17      | 1        | 0.0005  | 0.0004   | 0.0004   | 275             | 357.48        | 27.0 m                 | 0.0100             |
|         | 2        | 0.0079  | 0.0055   | 0.0055   | 275             | 180.00        | 11.0 m                 | 0.0100             |

: Multiline Table

----------------------------------------------------------------------------------------------------------------------------
 Trackp.   Kandidat   Gewicht   Emission   Inv. Em.  Heading Trackp. Heading Kante Distanz Point <> Kante Transition Gewicht
--------- ---------- --------- ---------- ---------- --------------- ------------- ---------------------- ------------------
17        1          0.0005    0.0004     0.0004     275             357.48        27.0 m                 0.0100

          2          0.0079    0.0055     0.0055     275             180.00        11.0 m                 0.0100
----------------------------------------------------------------------------------------------------------------------------

image

Wandmalfarbe commented 4 years ago

Pipe tables have issues in general, when they exceed the page width and cells have to become multiline, like in the title row of the table. [...] However it seems like Pandoc also respects the amount of '-' in pipe tables:

To quote the manual on pipe tables:

The cells of pipe tables cannot contain block elements like paragraphs and lists, and cannot span multiple lines. If a pipe table contains a row whose printable content is wider than the column width (see --columns), then the table will take up the full text width and the cell contents will wrap, with the relative cell widths determined by the number of dashes in the line separating the table header from the table body. (For example ---|- would make the first column 3/4 and the second column 1/4 of the full text width.) On the other hand, if no lines are wider than column width, then cell contents will not be wrapped, and the cells will be sized to their contents.

For that exact reason Pandoc introduced multiline tables. See https://pandoc.org/MANUAL.html#tables

That's right. Multiline tables might solve this particular problem.