diff --git a/lib/Text/Pandoc/CrossRef/References/Blocks.hs b/lib/Text/Pandoc/CrossRef/References/Blocks.hs
--- a/lib/Text/Pandoc/CrossRef/References/Blocks.hs
+++ b/lib/Text/Pandoc/CrossRef/References/Blocks.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Rank2Types, MultiWayIf #-}
+{-# LANGUAGE Rank2Types, MultiWayIf, CPP #-}
 module Text.Pandoc.CrossRef.References.Blocks
   ( replaceAll
   ) where
@@ -199,7 +199,11 @@
         idxStr <- replaceAttr opts label (lookup "label" attrs) alt imgRefs
         let alt' = case outFormat opts of
               f | isFormat "latex" f ->
+#if MIN_VERSION_pandoc(1,17,0)
+                alt
+#else
                 RawInline (Format "tex") ("\\label{"++label++"}") : alt
+#endif
               _  -> applyTemplate idxStr alt $ figureTemplate opts
         return $ Image attr alt' img
        | otherwise ->
diff --git a/pandoc-crossref.cabal b/pandoc-crossref.cabal
--- a/pandoc-crossref.cabal
+++ b/pandoc-crossref.cabal
@@ -2,7 +2,7 @@
 -- documentation, see http://haskell.org/cabal/users-guide/
 
 name:                pandoc-crossref
-version:             0.2.1.1
+version:             0.2.1.2
 synopsis:            Pandoc filter for cross-references
 description:         pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them.
 license:             GPL-2
@@ -25,7 +25,7 @@
 source-repository this
   type: git
   location: https://github.com/lierdakil/pandoc-crossref
-  tag: v0.2.1.1
+  tag: v0.2.1.2
 
 library
   exposed-modules:     Text.Pandoc.CrossRef
