LaTeX tables in definition lists (and other lists?) #10727
bpj
started this conversation in
Show and tell
Replies: 2 comments
-
I just corrected a rather serious bug in the Lua filter: I had inadvertently deleted a |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can also put \setlength\LTleft{0pt}
\setlength\LTright\fill in your LaTeX preamble, but you still want the top-aligned minipage! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
'Today I found that tables inside definition list values get badly vertically misaligned, appearing above instead of below the term.
So with Markdown like this
Alpha : Some text here Beta : | 1 | 2 | 3 |:---|:---|:--- | delta | epsilon | zeta | eta | theta | iota | kappa | lambda | mu | nu | xi | omicron | pi | rho | sigma : Delta to sigma Gamma : | 1 | 2 | 3 |:---|:---|:--- | tau | upsilon | phi | chi | psi | omega : Tau to omega.
I get results like this:

However there is an easy solution: wrapping each description containig a table in a top-aligned minipage.
Which gives
The
\vspace{0pt}
is important: it ensures uniform vertical alignment within each minipage.You can also put
in your LaTeX preamble, but you still want the top-aligned minipage!
It is helpful to adjust the width of the minipage so that the tables don’t appear so far to the right, but unfortunately there (of course) is no single value which fit all: I used
0.4\textwidth
for both tables, which as you can see gives better results for Beta than for Gamma. In fact I think I like it better this way than having this minipage wrapping builtin in the latex writer precisely because I can tweak the width (and maybe alignment?) of each minipage.I don’t really like to litter my markdown with raw LaTeX markup so I wrote a filter which inserts the LaTeX based on a div with attributes which hopefully will be useful with other formats as well.
Using this filter this
if run through
pandoc -L minipage.lua -w markdown-raw_tex
becomesThe div must have a class
.minipage
and takes some attributes:width=INT
75
align=A
t
t
/b
/c
)..keep
I use a percentage of the textwidth as value of the width attribute so that you don’t need to quote the attribute value in the Markdown. The filter divides that value by 100 and adjusts it to two decimals in the format string to get the fractional number TeX expects.
If this StackOverflow answer holds what it promises you can use that percentage attribute in HTML as well, should you need it.
Beta Was this translation helpful? Give feedback.
All reactions