From dad59c3d3d092b598567b9fc11e3f7b5a82ea021 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 15 Sep 2019 00:33:25 +1000 Subject: [PATCH] Fix incorrect p column width calculation in LaTeX leading to overfull and over-wide tables --- example.pdf | Bin 13113 -> 14367 bytes legalmd/latex_renderer.py | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example.pdf b/example.pdf index 96b89b8847166af4b0f3215ad46b7475e20b8282..18ce7e0322d3015863a2c8fa91e8e8f9f5115395 100644 GIT binary patch delta 5722 zcmai2RZtv&lEhsXm%t*+!s0A0!6mqcEbbEAEny)@g3IFWgy0(7-QAreNN@`pF8A*0 zes8L}s%NVI=3{!g#U|Ia284nlD3l;Y1~1khb3PWt+nCZnz$}O?PMIITK3 z<~sd0U@Q<-_3#L~sreBBw%0*JT}d1tV(=Tzaw#=6vE-lmb$~Q}vX32&kmTu4fo7zw zSO7f&pj)}wvS&s`=t?;|yGHL)!5>)?_c`{P#qZOsz|0>JTdj_%9+KD9ml0ns;pHA5 z^muRF<81?Bf$N=R#*TFp$0Fn2pgMy32vtGQv3J&m_U7OFi#o`<{TNwWKFfJ-8^M~ z#xHwllqt0!w;`Ql8vUV451(ycv>?+9#kir_&1wmAi!6w!J?QsYftz zi0dj;p>%)>naECm9uT)KJo0NeUPjsc`_S4ltOQ;S`)q7Bk$_`_Kw&&WQfYm% z`KIB@)x0RRlsKTEt~axsRnQ_#{B6Cg$G zQ{r0`KL?QctA^>8J2Sp99qYGwKJ6*>F`HeuNiK8qqG4v9Q#U*#bS31Y%ZOPD2y>t= z!=_=bqC@%B5((KnZ&Sl3(b~wR26}T*`#2>{jy^;U{txoRQPrMWd^`}-c5P-}9~7Sd z>9yw^dQ@Nry^WA0!CY`$Pbr`~<=IU&!>M7(6^Hos<;*_w6kshbcsgZk>ig14uY^x78R?svL$P;26&Bv zj8#1XDfi<%8iEkmEphV27RZ-mxSz$QwIt*JJ_wu-@jTrL|5^Wyk9{HcH;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eSA4KLrsCAt)zy^lm{mpeG5$8FaZ!>e8nG0_%TJKd5#ojBKnLe0eS)KIG ziGNm1Kq)=Wh#La6R=7jh(5`_6>`a>Mh%-3#}5 za1-z$#$VV>zH5(P5yc)dn8psAp-%<%Ad%!??i*=DRfB%Ik}suDuFiuZW(rruL5fdy z7lz);AFKBkTU}&Uw&~AQM&ey-!yTsUp42~=vYL8HDvOcaxqOFxV6EjG`6+Xop#jLI zUxOn1EDhM8r0$kfqyDKf_k+@Yb?U58H#Y+Cu#^;LD1TTJ_U zjDRh4=oH4vnXR*@niMPh?Tn@)>vW^a;ki)7^!J98FxNBJ!OQNG*Ar&r=fCuts7WK% z)=XO?2Nzf_`7d@3>NTRa-gGMC^JPO*&U1vQEwa33Oz0=o(CKtKYQJWlK%rS0WvFKx z?^_k^0}c-i)0>Ne4j}0zLx&@o2Uj=ES?&@Kdwy*q&ie)?CM1`%6}}f&Cis$XJAYBg zVkB%C!|H=*05GhZ6emUs&SAwNV))!2#qk$KOgSt$L^;I%&flwno7+ncDJc#phXIF( zI@-aFLrVI87nQ#{IcZU8C1o)sF*S+DP$d;kRQuq-c%naqj9@${sfOM@~0y<7&YAWVvCGcQ`6 z>$p~#orpsCBq2=N{B#%7pJwBHQTjnI)q9WaQLcS(v8tQ-zMy62>&`xU{;d0pe2KlF aYrvQmbv^b>`T@C^6kM8&mseF+jqE?AA#im7 diff --git a/legalmd/latex_renderer.py b/legalmd/latex_renderer.py index bf786f9..8b7aed4 100644 --- a/legalmd/latex_renderer.py +++ b/legalmd/latex_renderer.py @@ -219,9 +219,9 @@ class LaTeXRenderer(mistletoe.latex_renderer.LaTeXRenderer): for cell in token.children: if cell.colnum == 0: - coldef = format(r'p{\dimexpr\linewidth-\tabucolX-\tabcolsep\relax}', + coldef = format(r'p{\dimexpr\linewidth-1cm-1ex-\tabucolX-\tabcolsep\relax}', colx=sum(col.weight for col in token.children[1:]), - colnd=2 * (len(token.children) - 1) + colnd=2*len(token.children) ) cells1.append(format('\\multicolumn{2}{}{\\bfseries Column