aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-30 16:02:59 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-30 16:03:28 -0800
commit171187a4527497701b3c77bd56cea2d770d4e3b0 (patch)
treefb433e3135ef5330b7f4323e35045f64a2a37997 /src/Text/Pandoc
parent7a8c830734688a6ff9db805df8e3e5a9bd71033f (diff)
downloadpandoc-171187a4527497701b3c77bd56cea2d770d4e3b0.tar.gz
LaTeX writer: Add keepaspectratio to includegraphics...
...if only one of height/width is given.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 8620f989b..1972269ff 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -1125,7 +1125,12 @@ inlineToLaTeX (Image attr _ (source, _)) = do
[d <> text (show dim)]
Nothing ->
[]
- dimList = showDim Width ++ showDim Height
+ -- if we just have a width or a height, we add keepaspectratio:
+ keepaspectratio = case (dimension Height attr, dimension Width attr) of
+ (Nothing, Just _) -> ["keepaspectratio"]
+ (Just _, Nothing) -> ["keepaspectratio"]
+ _ -> []
+ dimList = showDim Width ++ showDim Height ++ keepaspectratio
dims = if null dimList
then empty
else brackets $ cat (intersperse "," dimList)