diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-12-01 21:18:29 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-12-01 21:18:29 -0800 |
commit | 1193c1a505aac616d41a7b1c61c0cde07d2560d2 (patch) | |
tree | 3ef5b5d680432b35c9f6e28c49fea4651734e9a1 /src/Text | |
parent | 29ec13184ddb869038ca712e260e8a135992c8e9 (diff) | |
download | pandoc-1193c1a505aac616d41a7b1c61c0cde07d2560d2.tar.gz |
LaTeX writer: allow specifying just width or height for image size.
Previously both needed to be specified (unless the image was
being resized to be smaller than its original size).
If height but not width is specified, we now set width to
textwidth (and similarly if width but not height is specified).
Since we have keepaspectratio, this yields the desired result.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 70744bde3..18138bf4c 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -1124,7 +1124,12 @@ inlineToLaTeX (Image attr _ (source, _)) = do Just dim -> [d <> text (show dim)] Nothing -> - [] + case dir of + Width | isJust (dimension Height attr) -> + [d <> "\\textwidth"] + Height | isJust (dimension Width attr) -> + [d <> "\\textheight"] + _ -> [] dimList = showDim Width ++ showDim Height dims = if null dimList then empty |