From 1193c1a505aac616d41a7b1c61c0cde07d2560d2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 1 Dec 2017 21:18:29 -0800 Subject: 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. --- src/Text/Pandoc/Writers/LaTeX.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3