Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gabyx opened this issue Nov 24, 2020 · 2 comments
Closed

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

gabyx opened this issue Nov 24, 2020 · 2 comments

Comments

@gabyx
Copy link

gabyx commented Nov 24, 2020

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}
jgm added a commit that referenced this issue Nov 25, 2020
@jgm jgm closed this as completed in 7c4d7db Nov 25, 2020
@jgm
Copy link
Owner

jgm commented Nov 25, 2020

I've tried to implement the strategy recommended in the stackexchange post you linked to in the other issue. Minipages are only used when necessary, and width and alignment information is put in the column descriptors at the outset.
This gives nicer latex output, at least.

@gabyx
Copy link
Author

gabyx commented Nov 26, 2020

This is awesome! Thanks a lot John!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants