Skip to content

Commit a125b56

Browse files
committed
Fixed an issue where TeX output contained a figure even if the caption was empty
1 parent 58c901f commit a125b56

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
44

5+
## Release 1.9.2
6+
7+
* Fixed an issue where TeX output contained a figure even if the caption was empty (#37).
8+
59
## Release 1.9.1
610

711
* Fixed an issue where extra parameters were not passed down to `pandoc`, depending on the output format (#38).

pandoc-plot.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: pandoc-plot
3-
version: 1.9.1
3+
version: 1.9.2
44
synopsis: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.
55
description: A Pandoc filter to include figures generated from code blocks.
66
Keep the document and code in the same location. Output is

src/Text/Pandoc/Filter/Plot/Embed.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,15 @@ figure ::
8282
PlotM Block
8383
figure as fp caption' =
8484
return . head . toList $
85-
-- We want the attributes both on the Figure element and the contained Image element
86-
-- so that pandoc-plot plays nice with pandoc-crossref and other filters
87-
figureWith as (simpleCaption (plain caption')) $
88-
plain $
89-
imageWith as (pack fp) mempty caption'
85+
if null caption'
86+
-- If there is no caption, a LaTeX figure may look strange. See #37
87+
then plain $ imageWith as (pack fp) mempty caption'
88+
else
89+
-- We want the attributes both on the Figure element and the contained Image element
90+
-- so that pandoc-plot plays nice with pandoc-crossref and other filters
91+
figureWith as (simpleCaption (plain caption')) $
92+
plain $
93+
imageWith as (pack fp) mempty caption'
9094

9195
-- TODO: also add the case where SVG plots can be
9296
-- embedded in HTML output

0 commit comments

Comments
 (0)