ickc / pantable

CSV Tables in Markdown: Pandoc Filter for CSV Tables
https://ickc.github.io/pantable/
BSD 3-Clause "New" or "Revised" License
86 stars 15 forks source link

Inserting midrules #59

Closed pbsds closed 3 years ago

pbsds commented 3 years ago

Hi, i'm touching up my thesis and could use some midrules in my tables. I found that simply inserting them in standard markdown tables works fine, but not with pantable

example:

|1 | 1|1 |
|--|--|--|
|1 | 1|1 |
|1 | 1|1 |
|\midrule 1 | 1|1 |
|1 | 1|1 |

```table
---
markdown: false
---
1,1,1,1,1
1,1,1,1,1
1,1,1,1,1
\midrule 1,1,1,1,1
1,1,1,1,1
1,1,1,1,1
```

```table
---
markdown: true
---
1,1,1,1,1
1,1,1,1,1
1,1,1,1,1
\midrule 1,1,1,1,1
1,1,1,1,1
1,1,1,1,1
```

command:

pandoc test.md -F pantable -t latex

output:

\begin{longtable}[]{@{}lll@{}}
\toprule
1 & 1 & 1 \\
\midrule
\endhead
1 & 1 & 1 \\
1 & 1 & 1 \\
\midrule 1 & 1 & 1 \\
1 & 1 & 1 \\
\bottomrule
\end{longtable}

\begin{longtable}[]{@{}lllll@{}}
\toprule
1 & 1 & 1 & 1 & 1 \\
\midrule
\endhead
1 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
\textbackslash midrule 1 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
\bottomrule
\end{longtable}

\begin{longtable}[]{@{}
  >{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.20}}
  >{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.20}}
  >{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.20}}
  >{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.20}}
  >{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.20}}@{}}
\toprule
1 & 1 & 1 & 1 & 1 \\
\midrule
\endhead
1 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
\begin{minipage}[t]{\linewidth}\raggedright
\midrule 1
\end{minipage} & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
1 & 1 & 1 & 1 & 1 \\
\bottomrule
\end{longtable}

My use-case is markdown: true. The minipage block is likely added here. Is it possible to add a fix or workaround for this?