LaTeX writer: always use a minipage for cells with line breaks...
if width information is available. Otherwise the way we treat them can lead to content that overflows a cell. Closes #7393.
This commit is contained in:
parent
eee648447a
commit
ed3974a254
2 changed files with 11 additions and 3 deletions
|
@ -26,7 +26,8 @@ import Text.DocLayout
|
|||
( Doc, braces, cr, empty, hcat, hsep, isEmpty, literal, nest
|
||||
, text, vcat, ($$) )
|
||||
import Text.Pandoc.Shared (blocksToInlines, splitBy, tshow)
|
||||
import Text.Pandoc.Walk (walk)
|
||||
import Text.Pandoc.Walk (walk, query)
|
||||
import Data.Monoid (Any(..))
|
||||
import Text.Pandoc.Writers.LaTeX.Caption (getCaption)
|
||||
import Text.Pandoc.Writers.LaTeX.Notes (notesToLaTeX)
|
||||
import Text.Pandoc.Writers.LaTeX.Types
|
||||
|
@ -261,8 +262,12 @@ cellToLaTeX blockListToLaTeX celltype annotatedCell = do
|
|||
Para{} -> True
|
||||
Plain{} -> True
|
||||
_ -> False
|
||||
let hasLineBreak LineBreak = Any True
|
||||
hasLineBreak _ = Any False
|
||||
result <-
|
||||
if not hasWidths || (celltype /= HeaderCell && all isPlainOrPara blocks)
|
||||
if not hasWidths || (celltype /= HeaderCell
|
||||
&& all isPlainOrPara blocks
|
||||
&& not (getAny (query hasLineBreak blocks)))
|
||||
then
|
||||
blockListToLaTeX $ walk fixLineBreaks $ walk displayMathToInline blocks
|
||||
else do
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
>{\raggedright\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{1.00}}@{}}
|
||||
\toprule
|
||||
\endhead
|
||||
{\vtop{\hbox{\strut text}\hbox{\strut text2 }}} \\
|
||||
\begin{minipage}[t]{\linewidth}\raggedright
|
||||
{ text\\
|
||||
text2 }
|
||||
\end{minipage} \\
|
||||
\bottomrule
|
||||
\end{longtable}
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue