Skip to content

[latex] Column spacing is incorrect (\tabcolsep) [2.11.2.0] #6883

@gabyx

Description

@gabyx

Pandoc generates latex column spacing in latex output for a nCols=3-column like this:

IMO: \columnwidth - 2\tabcolsep) * \real{0.41} should be \columnwidth - (2*(nCols - 1))\tabcolsep) * \real{0.41}
Latex inserts for each column a \tabcolsep at the beginning and the end. So the space between two adjacent columns is 2\tabcolsep.

Bonus: It might be nice, to put the format (\columnwidth - 2\tabcolsep) * \real{0.30}}\raggedright directly into the column. e.g. (also removing unnecessary minipage if possible, might still stay...)

\begin{longtable}[]{@{}>{\raggedright}p{(\columnwidth - 2\tabcolsep) * \real{0.30}}ll@{}}

Test:

+----------------------------+---------------------------------------+----------------------------+
| A                          | B                                     | A                          |
+============================+=======================================+============================+
| sdasdasda                  | asdasdasdasd                          | sdasdasda                  |
|                            |                                       |                            |
+----------------------------+---------------------------------------+----------------------------+

Table: Title
pandoc -f markdown -t latex Test.md
\begin{longtable}[]{@{}lll@{}}
\caption{Title}\tabularnewline
\toprule
\begin{minipage}[b]{(\columnwidth - 2\tabcolsep) * \real{0.30}}\raggedright
A\strut
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 2\tabcolsep) * \real{0.41}}\raggedright
B\strut
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 2\tabcolsep) * \real{0.30}}\raggedright
A\strut
\end{minipage}\tabularnewline
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{(\columnwidth - 2\tabcolsep) * \real{0.30}}\raggedright
A\strut
\end{minipage} &
\begin{minipage}[b]{(\columnwidth - 2\tabcolsep) * \real{0.41}}\raggedright
A\strut
\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{(\columnwidth - 2\tabcolsep) * \real{0.30}}\raggedright
sdasdasda\strut
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 2\tabcolsep) * \real{0.41}}\raggedright
asdasdasdasd\strut
\end{minipage} &
\begin{minipage}[t]{(\columnwidth - 2\tabcolsep) * \real{0.30}}\raggedright
sdasdasda\strut
\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions