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

\struts in LaTeX add too much vertical space above lists inside tables #3436

Closed
andrewheiss opened this issue Feb 11, 2017 · 5 comments
Closed

Comments

@andrewheiss
Copy link

When including lists inside grid tables, like so…

: Sample grid table.

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+

… there is too much vertical space above the list:

image

This appears to be a result of using a bunch of \struts in the resulting TeX file:

\begin{minipage}[t]{0.32\columnwidth}\raggedright\strut
\begin{itemize}
\tightlist
\item
  built-in wrapper
\item
  bright color
\end{itemize}\strut
\end{minipage}\tabularnewline

I've tried adding different commands to the preamble to remove the vertical space, but it appears that the \struts prevent this from happening.

If I remove \struts that precede \begin{itemize} either manually or with perl -0777 -pe 's/\\strut\n\\begin{itemize}/\n\\begin{itemize}/gm;' blah.tex, the vertical space disappears:

image

Removing the struts seems to go against earlier pull requests like #1573 and #2913 and feels wrong (and also depends on the user having Perl or manually adjusting the TeX file before compiling).

Is there a recommended way to remove vertical space above lists inside grid tables in LaTeX?

(This is all using pandoc 1.19.2.1 with the default TeX template)

@jgm
Copy link
Owner

jgm commented Feb 11, 2017

We need to carefully reconstruct why the \struts were added in the first place. Otherwise removing them might cause another problem to pop up. I think there's a relevant pandoc-discuss discussion and some discussions linked to the PRs you cite. Have you looked at those?

@jlduran perhaps you can shed some light on this issue?

@andrewheiss
Copy link
Author

I have—the discussions all deal with cell alignment and width resizing, which is fine. I think this extra-spacing-above-the-lists issue is an unintended side effect of using them, since none of the discussions mention the alignment of lists inside table cells.

Ideally it'd be nice to eliminate the spacing with some sort of adjustment or addition to the preamble rather than restructuring all the \struts…

@jlduran
Copy link
Contributor

jlduran commented Feb 11, 2017

Agreed. I'll take a look at it.

@jgm
Copy link
Owner

jgm commented Feb 22, 2017

@jlduran any progress on this?

@jlduran
Copy link
Contributor

jlduran commented Feb 22, 2017

Not really. The solution that comes to mind is to check for lists and remove the struts, otherwise leave as is. But that adds too much complexity and may even be another corner cases.

The other option, remove the struts entirely, is simpler and perhaps less noticeable.

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

No branches or pull requests

3 participants