packages feed

pandoc-crossref 0.3.17.1 → 0.3.18.0

raw patch · 31 files changed

+292/−153 lines, 31 filesdep ~pandocPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: pandoc

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,19 @@+## 0.3.18.0++-   Add `eqnInlineTableTemplate` and `eqnDisplayTemplate` options.++-   Tweak how equation templates work.++    Cleaned-up and generalized the logic in equation templates. This should be+    mostly backwards-compatible, however some exotic workflows may need minor+    tweaks. Specific changes to look out for:++    - `eqnBlockInlineMath` will affect formatting when `tableEqns: false`.+    - `eqnInlineTemplate` has new template variables in scope: `t`, `nmi`,+      `nmri`.+    - `eqnBlockTemplate` has new template variables in scope: `e`, `ri`, `nmi`,+      `nmri`.+ ## 0.3.17.1  -   Fix images roundtripping through Markdown
docs/index.md view
@@ -714,15 +714,45 @@  -   `eqnInlineTemplate`, default `$$e$$$$equationNumberTeX$${$$i$$}` -    A template to typeset math when `tableEqns` is `false`. Similar to `eqnIndexTemplate`, formatting is mostly ignored, due to it being typeset-    inside a display math environment. However, most LaTeX should work (but backslashes need to be doubled). The following template variables are known:+    A template to typeset math when `tableEqns` is `false`. Similar to+    `eqnIndexTemplate`, formatting is mostly ignored, due to it being typeset+    inside a math environment. However, most LaTeX should work (but backslashes+    need to be doubled). The following template variables are known: -    - `ri`, "raw" index, before applying `eqnIndexTemplate`-    - `i`, index after applying `eqnIndexTemplate`-    - `e`, the equation itself+    - `e`, the equation itself,+    - `t`, the same as `e`, for backwards compatibility,+    - `i`, index after applying `eqnIndexTemplate`,+    - `nmi`, same as `i`, but see `eqnDisplayTemplate`,+    - `ri`, "raw" index, before applying `eqnIndexTemplate`,+    - `nmri`, here, same as `ri`, but see `eqnDisplayTemplate`.      `eqnInlineTemplate` is ignored if `tableEqns` is `true`. +-   `eqnInlineTableTemplate`, default `$$e$$`++    A counterpart of `eqnInlineTemplate` for when `tableEqns` is `true`. Behaves+    the same. The logic is split like this mostly for backwards compatibility, but it also allows specifying unambiguous defaults.++    `eqnInlineTableTemplate` is ignored if `tableEqns` is `false`.++-   `eqnDisplayTemplate`, default `$$e$$`++    A template to typeset the math element produced by applying+    `eqnInlineTemplate` or `eqnInlineTableTemplate`.++    The output of this template must be a sequence of inline elements. If you+    want to produce block elements, see `eqnBlockTemplate`.++    The same template variables from `eqnInlineTemplate` are available, with the+    following changes:++    - `e` (and `t`) is now the formatted equation (as per `eqnInlineTemplate` or+      `eqnInlineTableTemplate`) wrapped in a math environment (display or inline+      depending on `eqnBlockInlineMath`),+    - `i` and `ri` are now wrapped in a math environment (same type as `e`).++    `eqnDisplayTemplate` is ignored if `tableEqns` is `true`.+ -   `eqnBlockTemplate`, default      ```markdown@@ -734,18 +764,19 @@     +----------------------------------------------------------------+-----+     ``` -    When used with `tableEqns`, a block to use to format equations. A table-    by default, but could be literally any block. `$$t$$` stands in for the-    equation itself, and `$$i$$` stands in for the equation number.+    When used with `tableEqns`, a block to use to format equations. A table by+    default, but could be literally any block or a sequence of blocks. The+    behaviour is similar to `eqnDisplayTemplate`, but the elements produced are+    block elements (as opposed to inline).      Note that the default contains a raw block to fix vertical alignment     in docx output. If you're not targeting docx, it will be ignored by pandoc.      `eqnBlockTemplate` is ignored if `tableEqns` is `false` (the default). --   `eqnBlockInlineMath`, default `False`: if you need to use-    inline math while rendering equation block template. Useful, e.g., if you're-    using raw ooxml and tabstops to align equations in docx. For example,+-   `eqnBlockInlineMath`, default `False`: if you need to use inline math while+    rendering equation templates. Useful, e.g., if you're using raw ooxml and+    tabstops to align equations in docx. For example,      ```yaml     tableEqns: true
lib-internal/Text/Pandoc/CrossRef/References/Blocks.hs view
@@ -18,7 +18,8 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -} -{-# LANGUAGE Rank2Types, OverloadedStrings, FlexibleContexts, ScopedTypeVariables, LambdaCase #-}+{-# LANGUAGE Rank2Types, OverloadedStrings, FlexibleContexts, ScopedTypeVariables+  , LambdaCase, NamedFieldPuns #-} module Text.Pandoc.CrossRef.References.Blocks   ( replaceAll   ) where@@ -107,8 +108,8 @@         , Span spanAttr [RawInline (Format "latex") eq]         , RawInline (Format "latex") $ "\\end{equation}"]       else do-        (eq', idxStr) <- replaceEqn spanAttr eq-        pure [Span (label,clss,setLabel opts idxStr attrs) [Math DisplayMath eq']]+        ReplaceEqn{replaceEqnEq, replaceEqnIdx} <- replaceEqn eqnDisplayTemplate spanAttr eq+        pure [Span (label,clss,setLabel opts replaceEqnIdx attrs) replaceEqnEq]   else noReplaceRecurse replaceInlineMany _ = noReplaceRecurse 
lib-internal/Text/Pandoc/CrossRef/References/Blocks/Math.hs view
@@ -18,7 +18,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -} -{-# LANGUAGE Rank2Types, OverloadedStrings, FlexibleContexts #-}+{-# LANGUAGE Rank2Types, OverloadedStrings, FlexibleContexts, RecordWildCards #-}  module Text.Pandoc.CrossRef.References.Blocks.Math where @@ -39,38 +39,60 @@   opts <- ask   if tableEqns opts && not (isLatexFormat opts)   then do-    (eq', idxStr) <- replaceEqn (label, cls, attrs) eq-    let mathfmt = if eqnBlockInlineMath opts then InlineMath else DisplayMath-    replaceNoRecurse $ Div (label,cls,setLabel opts idxStr attrs) $-      applyTemplate [Math mathfmt $ stringify idxStr] [Math mathfmt eq']-        $ eqnBlockTemplate opts+    ReplaceEqn{..} <- replaceEqn eqnBlockTemplate (label, cls, attrs) eq+    replaceNoRecurse $ Div (label,cls,setLabel opts replaceEqnIdx attrs) replaceEqnEq   else noReplaceRecurse -replaceEqn :: Attr -> T.Text -> WS (T.Text, [Inline])-replaceEqn (label, _, attrs) eq = do+data ReplaceEqn a = ReplaceEqn+  { replaceEqnEq :: [a]+  , replaceEqnIdx :: [Inline]+  }++replaceEqn :: MkTemplate a t => (Options -> t) -> Attr -> T.Text -> WS (ReplaceEqn a)+replaceEqn eqTemplate (label, _, attrs) eq = do   opts <- ask   let label' | T.null label = Left "eq"              | otherwise = Right label   idxStrRaw <- replaceAttr label' attrs [] SPfxEqn   let idxStr = applyTemplate' (M.fromDistinctAscList [("i", idxStrRaw)]) $ eqnIndexTemplate opts-      eqTxt = applyTemplate' eqTxtVars $ eqnInlineTemplate opts :: [Inline]-      eqTxtVars = M.fromDistinctAscList-        [ ("e", [Str eq])-        , ("i", idxStr)-        , ("ri", idxStrRaw)+      eqTxt :: [Inline]+      eqTxt = applyTemplate' eqTxtVars $+        if tableEqns opts+        then eqnInlineTableTemplate opts+        else eqnInlineTemplate opts+      wrapMath x = [Math mathfmt $ stringify x]+      commonVars eqn = M.fromList $+        [ ("e", eqn)+        , ("t", eqn) -- backwards compatibility for eqnBlockTemplate+        , ("i", wrapMath idxStr)+        , ("ri", wrapMath idxStrRaw)+        , ("nmi", idxStr)+        , ("nmri", idxStrRaw)         ]-      eq' | tableEqns opts = eq-          | otherwise = stringify eqTxt-  return (eq', idxStr)+      eqTxtVars = commonVars [Str eq]+      eqInline = applyTemplate' eqInlineVars $ eqTemplate opts+      mathfmt = if eqnBlockInlineMath opts then InlineMath else DisplayMath+      eqInlineVars = commonVars $ wrapMath eqTxt+  pure $ ReplaceEqn+    { replaceEqnEq = eqInline+    , replaceEqnIdx = idxStr+    } + splitMath :: [Block] -> [Block] splitMath (Para ils:xs)-  | length ils > 1 = map Para (split [] [] ils) <> xs+  | _:_:_ <- ils -- at least two elements+  = map Para (split ils) <> xs   where-    split res acc [] = reverse (reverse acc : res)-    split res acc (x@(Span _ [Math DisplayMath _]):ys) =-      split ([x] : reverse (dropSpaces acc) : res)-            [] (dropSpaces ys)-    split res acc (y:ys) = split res (y:acc) ys+    split ys =+      let (before, after) = break isMath ys+          beforeEl+            | null before = id+            | otherwise = (before :)+      in beforeEl $ case after of+        z:zs -> [z] : split (dropSpaces zs)+        [] -> []     dropSpaces = dropWhile isSpace+    isMath (Span _ [Math DisplayMath _]) = True+    isMath _ = False splitMath xs = xs
lib-internal/Text/Pandoc/CrossRef/Util/Options.hs view
@@ -50,6 +50,8 @@                        , eqnBlockInlineMath :: Bool                        , eqnIndexTemplate :: Template                        , eqnInlineTemplate :: Template+                       , eqnInlineTableTemplate :: Template+                       , eqnDisplayTemplate :: Template                        , refIndexTemplate :: Text -> Template                        , subfigureRefIndexTemplate :: Template                        , secHeaderTemplate :: Template
lib-internal/Text/Pandoc/CrossRef/Util/Settings.hs view
@@ -135,6 +135,8 @@   <> linkReferences False   <> nameInLink False   <> equationNumberTeX ("\\qquad" :: T.Text)+  <> eqnDisplayTemplate (var "e")+  <> eqnInlineTableTemplate (var "e")   where     var = displayMath     wordVerticalAlign = rawBlock "openxml" "<w:tcPr><w:vAlign w:val=\"center\"/></w:tcPr>"
lib-internal/Text/Pandoc/CrossRef/Util/Template.hs view
@@ -22,6 +22,7 @@ module Text.Pandoc.CrossRef.Util.Template   ( Template   , BlockTemplate+  , MkTemplate   , makeTemplate   , makeIndexedTemplate   , applyTemplate
pandoc-crossref.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.36.0.+-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack  name:           pandoc-crossref-version:        0.3.17.1+version:        0.3.18.0 synopsis:       Pandoc filter for cross-references description:    pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them. category:       Text@@ -36,6 +36,12 @@     test/m2m/eqnBlockTemplate/expect.md     test/m2m/eqnBlockTemplate/expect.tex     test/m2m/eqnBlockTemplate/input.md+    test/m2m/eqnDisplayTemplate/expect.md+    test/m2m/eqnDisplayTemplate/expect.tex+    test/m2m/eqnDisplayTemplate/input.md+    test/m2m/eqnInlineTableTemplate/expect.md+    test/m2m/eqnInlineTableTemplate/expect.tex+    test/m2m/eqnInlineTableTemplate/input.md     test/m2m/eqnInlineTemplate/expect.md     test/m2m/eqnInlineTemplate/expect.tex     test/m2m/eqnInlineTemplate/input.md@@ -133,7 +139,7 @@   build-depends:       base >=4.11 && <5     , mtl >=1.1 && <2.4-    , pandoc >=3.1.8 && <3.2+    , pandoc >=3.1.8 && <3.5     , pandoc-crossref-internal     , pandoc-types ==1.23.*     , text >=1.2.2 && <2.2@@ -177,7 +183,7 @@     , microlens-mtl >=0.2.0.1 && <0.3.0.0     , microlens-th >=0.4.3.10 && <0.5.0.0     , mtl >=1.1 && <2.4-    , pandoc >=3.1.8 && <3.2+    , pandoc >=3.1.8 && <3.5     , pandoc-types ==1.23.*     , syb >=0.4 && <0.8     , template-haskell >=2.7.0.0 && <3.0.0.0@@ -198,7 +204,7 @@     , gitrev >=1.3.1 && <1.4     , open-browser ==0.2.*     , optparse-applicative >=0.13 && <0.19-    , pandoc >=3.1.8 && <3.2+    , pandoc >=3.1.8 && <3.5     , pandoc-crossref     , pandoc-types ==1.23.*     , template-haskell >=2.7.0.0 && <3.0.0.0@@ -219,7 +225,7 @@     , directory >=1 && <1.4     , filepath >=1.1 && <1.6     , hspec >=2.4.4 && <3-    , pandoc >=3.1.8 && <3.2+    , pandoc >=3.1.8 && <3.5     , pandoc-crossref     , pandoc-types ==1.23.*     , text >=1.2.2 && <2.2@@ -245,7 +251,7 @@     , hspec >=2.4.4 && <3     , microlens >=0.4.12.0 && <0.5.0.0     , mtl >=1.1 && <2.4-    , pandoc >=3.1.8 && <3.2+    , pandoc >=3.1.8 && <3.5     , pandoc-crossref     , pandoc-crossref-internal     , pandoc-types ==1.23.*@@ -265,7 +271,7 @@   build-depends:       base >=4.11 && <5     , criterion >=1.5.9.0 && <1.7-    , pandoc >=3.1.8 && <3.2+    , pandoc >=3.1.8 && <3.5     , pandoc-crossref     , pandoc-types ==1.23.*     , text >=1.2.2 && <2.2
test/m2m/emptyChapterLabels/expect.tex view
@@ -4,7 +4,7 @@  \begin{figure} \centering-\includegraphics{./image.png}+\pandocbounded{\includegraphics[keepaspectratio]{./image.png}} \caption{Figure1}\label{fig:figure1} \end{figure} 
test/m2m/eqnBlockTemplate/expect.md view
@@ -1,3 +1,6 @@ ::: {#eq:1}-$$\int_0^x e^x dx$$ $$(1)$$+[$$\int_0^x e^x dx$$]{.math-eq}+[$$\int_0^x e^x dx$$]{.math-eq-backwards-compat}+[$$(1)$$]{.math-eq-index-math} [(1)]{.math-eq-index-no-math}+[$$1$$]{.math-eq-index-raw-math} [1]{.math-eq-index-raw-no-math} :::
test/m2m/eqnBlockTemplate/input.md view
@@ -1,7 +1,13 @@ --- eqnBlockTemplate: |-  $$t$$ $$i$$+  <span class="math-eq">$$e$$</span>+  <span class="math-eq-backwards-compat">$$t$$</span>+  <span class="math-eq-index-math">$$i$$</span>+  <span class="math-eq-index-no-math">$$nmi$$</span>+  <span class="math-eq-index-raw-math">$$ri$$</span>+  <span class="math-eq-index-raw-no-math">$$nmri$$</span> tableEqns: true+eqnDisplayTemplate: foo # ensure it's ignored ---  $$\int_0^x e^x dx$${#eq:1}
+ test/m2m/eqnDisplayTemplate/expect.md view
@@ -0,0 +1,6 @@+[[ [$$e^{i\pi} = -1\qquad{(1)}$$]{.math-eq}+[$$(1)$$]{.math-eq-index-math} [(1)]{.math-eq-index-no-math}+[$$1$$]{.math-eq-index-raw-math} [1]{.math-eq-index-raw-no-math}+]{.math-eq-container}]{#eq:euler}++eq. 1
+ test/m2m/eqnDisplayTemplate/expect.tex view
@@ -0,0 +1,3 @@+\begin{equation}\phantomsection\label{eq:euler}{e^{i\pi} = -1}\end{equation}++eq.~\ref{eq:euler}
+ test/m2m/eqnDisplayTemplate/input.md view
@@ -0,0 +1,14 @@+---+eqnDisplayTemplate: |+  <span class="math-eq-container">+      <span class="math-eq">$$e$$</span>+      <span class="math-eq-index-math">$$i$$</span>+      <span class="math-eq-index-no-math">$$nmi$$</span>+      <span class="math-eq-index-raw-math">$$ri$$</span>+      <span class="math-eq-index-raw-no-math">$$nmri$$</span>+  </span>+---++$$e^{i\pi} = -1$${#eq:euler}++@eq:euler
+ test/m2m/eqnInlineTableTemplate/expect.md view
@@ -0,0 +1,8 @@+::: {#eq:euler}++:-------------------------------------------------------------:+-----:++| $$ e^{i\pi} = -1 (1) (1) 1 1 $$                               | $$(  |+|                                                               | 1)$$ |++---------------------------------------------------------------+------++:::++eq. 1
+ test/m2m/eqnInlineTableTemplate/expect.tex view
@@ -0,0 +1,3 @@+\begin{equation}\phantomsection\label{eq:euler}{e^{i\pi} = -1}\end{equation}++eq.~\ref{eq:euler}
+ test/m2m/eqnInlineTableTemplate/input.md view
@@ -0,0 +1,15 @@+---+eqnInlineTableTemplate: |+  <span class="math-eq-container">+      <span class="math-eq">$$e$$</span>+      <span class="math-eq-index-math">$$i$$</span>+      <span class="math-eq-index-no-math">$$nmi$$</span>+      <span class="math-eq-index-raw-math">$$ri$$</span>+      <span class="math-eq-index-raw-no-math">$$nmri$$</span>+  </span>+tableEqns: true+---++$$e^{i\pi} = -1$${#eq:euler}++@eq:euler
test/m2m/label-precedence/expect.tex view
@@ -4,7 +4,7 @@  \begin{figure} \centering-\includegraphics{image.png}+\pandocbounded{\includegraphics[keepaspectratio]{image.png}} \caption{A figure}\label{fig:fig1} \end{figure} @@ -14,7 +14,7 @@  \begin{figure} \centering-\includegraphics{image.png}+\pandocbounded{\includegraphics[keepaspectratio]{image.png}} \caption{A figure with custom label}\label{fig:fig2} \end{figure} @@ -26,7 +26,7 @@  \begin{figure} \centering-\includegraphics{fig.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig.png}} \caption{Figure}\label{fig:fig3} \end{figure} 
test/m2m/listOfTemplates-buillet-list/expect.tex view
@@ -1,54 +1,54 @@ \begin{figure} \centering-\includegraphics{fig1.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}} \caption{1}\label{fig:1} \end{figure}  \begin{figure} \centering-\includegraphics{fig2.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}} \caption{2}\label{fig:2} \end{figure}  \begin{figure} \centering-\includegraphics{fig3.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}} \caption{3}\label{fig:3} \end{figure}  \begin{figure} \centering-\includegraphics{fig4.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}} \caption{4}\label{fig:4} \end{figure}  \begin{figure} \centering-\includegraphics{fig5.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}} \caption{5}\label{fig:5} \end{figure}  \begin{figure} \centering-\includegraphics{fig6.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}} \caption{6}\label{fig:6} \end{figure}  \begin{figure} \centering-\includegraphics{fig7.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}} \caption{7}\label{fig:7} \end{figure}  \begin{figure} \centering-\includegraphics{fig8.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}} \caption{8}\label{fig:8} \end{figure}  \begin{figure} \centering-\includegraphics{fig9.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}} \caption{9}\label{fig:9} \end{figure} 
test/m2m/listOfTemplates-ord-list/expect.tex view
@@ -1,54 +1,54 @@ \begin{figure} \centering-\includegraphics{fig1.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}} \caption{1}\label{fig:1} \end{figure}  \begin{figure} \centering-\includegraphics{fig2.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}} \caption{2}\label{fig:2} \end{figure}  \begin{figure} \centering-\includegraphics{fig3.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}} \caption{3}\label{fig:3} \end{figure}  \begin{figure} \centering-\includegraphics{fig4.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}} \caption{4}\label{fig:4} \end{figure}  \begin{figure} \centering-\includegraphics{fig5.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}} \caption{5}\label{fig:5} \end{figure}  \begin{figure} \centering-\includegraphics{fig6.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}} \caption{6}\label{fig:6} \end{figure}  \begin{figure} \centering-\includegraphics{fig7.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}} \caption{7}\label{fig:7} \end{figure}  \begin{figure} \centering-\includegraphics{fig8.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}} \caption{8}\label{fig:8} \end{figure}  \begin{figure} \centering-\includegraphics{fig9.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}} \caption{9}\label{fig:9} \end{figure} 
test/m2m/listOfTemplates/expect.tex view
@@ -1,54 +1,54 @@ \begin{figure} \centering-\includegraphics{fig1.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}} \caption{1}\label{fig:1} \end{figure}  \begin{figure} \centering-\includegraphics{fig2.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}} \caption{2}\label{fig:2} \end{figure}  \begin{figure} \centering-\includegraphics{fig3.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}} \caption{3}\label{fig:3} \end{figure}  \begin{figure} \centering-\includegraphics{fig4.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}} \caption{4}\label{fig:4} \end{figure}  \begin{figure} \centering-\includegraphics{fig5.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}} \caption{5}\label{fig:5} \end{figure}  \begin{figure} \centering-\includegraphics{fig6.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}} \caption{6}\label{fig:6} \end{figure}  \begin{figure} \centering-\includegraphics{fig7.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}} \caption{7}\label{fig:7} \end{figure}  \begin{figure} \centering-\includegraphics{fig8.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}} \caption{8}\label{fig:8} \end{figure}  \begin{figure} \centering-\includegraphics{fig9.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}} \caption{9}\label{fig:9} \end{figure} 
test/m2m/loxItemTitle/expect.tex view
@@ -1,54 +1,54 @@ \begin{figure} \centering-\includegraphics{fig1.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}} \caption{1}\label{fig:1} \end{figure}  \begin{figure} \centering-\includegraphics{fig2.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}} \caption{2}\label{fig:2} \end{figure}  \begin{figure} \centering-\includegraphics{fig3.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}} \caption{3}\label{fig:3} \end{figure}  \begin{figure} \centering-\includegraphics{fig4.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}} \caption{4}\label{fig:4} \end{figure}  \begin{figure} \centering-\includegraphics{fig5.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}} \caption{5}\label{fig:5} \end{figure}  \begin{figure} \centering-\includegraphics{fig6.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}} \caption{6}\label{fig:6} \end{figure}  \begin{figure} \centering-\includegraphics{fig7.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}} \caption{7}\label{fig:7} \end{figure}  \begin{figure} \centering-\includegraphics{fig8.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}} \caption{8}\label{fig:8} \end{figure}  \begin{figure} \centering-\includegraphics{fig9.png}+\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}} \caption{9}\label{fig:9} \end{figure} 
test/m2m/numberOverride/expect.tex view
@@ -4,7 +4,7 @@  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1}\label{fig:img1} \end{figure} @@ -12,19 +12,19 @@  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1.6.2}\label{fig:img2} \end{figure}  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1.6.100500}\label{fig:img3} \end{figure}  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1.6.100501}\label{fig:img4} \end{figure} @@ -32,18 +32,18 @@  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1.7.1}\label{fig:img21} \end{figure}  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1.7.100500}\label{fig:img31} \end{figure}  \begin{figure} \centering-\includegraphics{img2.png}+\pandocbounded{\includegraphics[keepaspectratio]{img2.png}} \caption{Image 1.7.100501}\label{fig:img41} \end{figure}
test/m2m/secLabels/expect.tex view
@@ -4,7 +4,7 @@  \begin{figure} \centering-\includegraphics{myfig.png}+\pandocbounded{\includegraphics[keepaspectratio]{myfig.png}} \caption{my figure}\label{fig:myfig} \end{figure} 
test/m2m/setLabelAttribute/expect.tex view
@@ -2,7 +2,7 @@  \begin{figure} \centering-\includegraphics{./image.png}+\pandocbounded{\includegraphics[keepaspectratio]{./image.png}} \caption{Figure}\label{fig:1} \end{figure} 
test/m2m/subfigures-ccsDelim/expect.tex view
@@ -2,17 +2,17 @@  \begin{pandoccrossrefsubfigures} -\subfloat[1]{\includegraphics{fig1.png}\label{fig:subfig1}}-\subfloat[2]{\includegraphics{fig2.png}\label{fig:subfig2}}-\subfloat[3]{\includegraphics{fig3.png}}+\subfloat[1]{\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}}\label{fig:subfig1}}+\subfloat[2]{\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}}\label{fig:subfig2}}+\subfloat[3]{\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}}} -\subfloat[4]{\includegraphics{fig4.png}\label{fig:subfig4}}-\subfloat[5]{\includegraphics{fig5.png}}-\subfloat[6]{\includegraphics{fig6.png}\label{fig:subfig6}}+\subfloat[4]{\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}}\label{fig:subfig4}}+\subfloat[5]{\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}}}+\subfloat[6]{\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}}\label{fig:subfig6}} -\subfloat[7]{\includegraphics{fig7.png}\label{fig:subfig7}}-\subfloat[8]{\includegraphics{fig8.png}}-\subfloat[9]{\includegraphics{fig9.png}\label{fig:subfig9}}+\subfloat[7]{\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}}\label{fig:subfig7}}+\subfloat[8]{\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}}}+\subfloat[9]{\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}}\label{fig:subfig9}}  \caption[{Caption}]{Caption} @@ -22,23 +22,23 @@  \begin{pandoccrossrefsubfigures} -\subfloat[1]{\includegraphics{fig1.png}\label{fig:subfig21}}+\subfloat[1]{\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}}\label{fig:subfig21}} -\subfloat[2]{\includegraphics{fig2.png}\label{fig:subfig22}}+\subfloat[2]{\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}}\label{fig:subfig22}} -\subfloat[3]{\includegraphics{fig3.png}}+\subfloat[3]{\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}}} -\subfloat[4]{\includegraphics{fig4.png}\label{fig:subfig24}}+\subfloat[4]{\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}}\label{fig:subfig24}} -\subfloat[5]{\includegraphics{fig5.png}}+\subfloat[5]{\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}}} -\subfloat[6]{\includegraphics{fig6.png}\label{fig:subfig26}}+\subfloat[6]{\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}}\label{fig:subfig26}} -\subfloat[7]{\includegraphics{fig7.png}\label{fig:subfig27}}+\subfloat[7]{\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}}\label{fig:subfig27}} -\subfloat[8]{\includegraphics{fig8.png}}+\subfloat[8]{\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}}} -\subfloat[9]{\includegraphics{fig9.png}\label{fig:subfig29}}+\subfloat[9]{\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}}\label{fig:subfig29}}  \caption[{Caption}]{Caption} 
test/m2m/subfigures-grid/expect.tex view
@@ -2,17 +2,17 @@  \begin{pandoccrossrefsubfigures} -\subfloat[1]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig1.png}\label{fig:subfig1}}-\subfloat[2]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig2.png}\label{fig:subfig2}}-\subfloat[3]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig3.png}}+\subfloat[1]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig1.png}\label{fig:subfig1}}+\subfloat[2]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig2.png}\label{fig:subfig2}}+\subfloat[3]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig3.png}} -\subfloat[4]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig4.png}\label{fig:subfig4}}-\subfloat[5]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig5.png}}-\subfloat[6]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig6.png}\label{fig:subfig6}}+\subfloat[4]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig4.png}\label{fig:subfig4}}+\subfloat[5]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig5.png}}+\subfloat[6]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig6.png}\label{fig:subfig6}} -\subfloat[7]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig7.png}\label{fig:subfig7}}-\subfloat[8]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig8.png}}-\subfloat[9]{\includegraphics[width=0.3\textwidth,height=\textheight]{fig9.png}\label{fig:subfig9}}+\subfloat[7]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig7.png}\label{fig:subfig7}}+\subfloat[8]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig8.png}}+\subfloat[9]{\includegraphics[width=0.3\linewidth,height=\textheight,keepaspectratio]{fig9.png}\label{fig:subfig9}}  \caption[{Caption}]{Caption} @@ -22,23 +22,23 @@  \begin{pandoccrossrefsubfigures} -\subfloat[1]{\includegraphics{fig1.png}\label{fig:subfig21}}+\subfloat[1]{\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}}\label{fig:subfig21}} -\subfloat[2]{\includegraphics{fig2.png}\label{fig:subfig22}}+\subfloat[2]{\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}}\label{fig:subfig22}} -\subfloat[3]{\includegraphics{fig3.png}}+\subfloat[3]{\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}}} -\subfloat[4]{\includegraphics{fig4.png}\label{fig:subfig24}}+\subfloat[4]{\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}}\label{fig:subfig24}} -\subfloat[5]{\includegraphics{fig5.png}}+\subfloat[5]{\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}}} -\subfloat[6]{\includegraphics{fig6.png}\label{fig:subfig26}}+\subfloat[6]{\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}}\label{fig:subfig26}} -\subfloat[7]{\includegraphics{fig7.png}\label{fig:subfig27}}+\subfloat[7]{\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}}\label{fig:subfig27}} -\subfloat[8]{\includegraphics{fig8.png}}+\subfloat[8]{\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}}} -\subfloat[9]{\includegraphics{fig9.png}\label{fig:subfig29}}+\subfloat[9]{\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}}\label{fig:subfig29}}  \caption[{Caption}]{Caption} 
test/m2m/subfigures-one-row/expect.tex view
@@ -6,9 +6,9 @@ \begin{pandoccrossrefsubfigures}  \subfloat[cool-caption]{\includegraphics[width=0.4\textwidth,height=\textheight]{/tmp/LaTeX_logo.svg.png}\label{fig:logo1}}+caption]{\includegraphics[width=0.4\linewidth,height=\textheight,keepaspectratio]{/tmp/LaTeX_logo.svg.png}\label{fig:logo1}} \subfloat[cooler-caption]{\includegraphics[width=0.4\textwidth,height=\textheight]{/tmp/LaTeX_logo.svg.png}\label{fig:logo2}}+caption]{\includegraphics[width=0.4\linewidth,height=\textheight,keepaspectratio]{/tmp/LaTeX_logo.svg.png}\label{fig:logo2}}  \caption[{Copies of the LaTeX logo}]{Copies of the LaTeX logo} 
test/m2m/subfigures/expect.tex view
@@ -2,17 +2,17 @@  \begin{pandoccrossrefsubfigures} -\subfloat[1]{\includegraphics{fig1.png}\label{fig:subfig1}}-\subfloat[2]{\includegraphics{fig2.png}\label{fig:subfig2}}-\subfloat[3]{\includegraphics{fig3.png}}+\subfloat[1]{\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}}\label{fig:subfig1}}+\subfloat[2]{\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}}\label{fig:subfig2}}+\subfloat[3]{\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}}} -\subfloat[4]{\includegraphics{fig4.png}\label{fig:subfig4}}-\subfloat[5]{\includegraphics{fig5.png}}-\subfloat[6]{\includegraphics{fig6.png}\label{fig:subfig6}}+\subfloat[4]{\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}}\label{fig:subfig4}}+\subfloat[5]{\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}}}+\subfloat[6]{\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}}\label{fig:subfig6}} -\subfloat[7]{\includegraphics{fig7.png}\label{fig:subfig7}}-\subfloat[8]{\includegraphics{fig8.png}}-\subfloat[9]{\includegraphics{fig9.png}\label{fig:subfig9}}+\subfloat[7]{\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}}\label{fig:subfig7}}+\subfloat[8]{\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}}}+\subfloat[9]{\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}}\label{fig:subfig9}}  \caption[{Caption}]{Caption} @@ -22,23 +22,23 @@  \begin{pandoccrossrefsubfigures} -\subfloat[1]{\includegraphics{fig1.png}\label{fig:subfig21}}+\subfloat[1]{\pandocbounded{\includegraphics[keepaspectratio]{fig1.png}}\label{fig:subfig21}} -\subfloat[2]{\includegraphics{fig2.png}\label{fig:subfig22}}+\subfloat[2]{\pandocbounded{\includegraphics[keepaspectratio]{fig2.png}}\label{fig:subfig22}} -\subfloat[3]{\includegraphics{fig3.png}}+\subfloat[3]{\pandocbounded{\includegraphics[keepaspectratio]{fig3.png}}} -\subfloat[4]{\includegraphics{fig4.png}\label{fig:subfig24}}+\subfloat[4]{\pandocbounded{\includegraphics[keepaspectratio]{fig4.png}}\label{fig:subfig24}} -\subfloat[5]{\includegraphics{fig5.png}}+\subfloat[5]{\pandocbounded{\includegraphics[keepaspectratio]{fig5.png}}} -\subfloat[6]{\includegraphics{fig6.png}\label{fig:subfig26}}+\subfloat[6]{\pandocbounded{\includegraphics[keepaspectratio]{fig6.png}}\label{fig:subfig26}} -\subfloat[7]{\includegraphics{fig7.png}\label{fig:subfig27}}+\subfloat[7]{\pandocbounded{\includegraphics[keepaspectratio]{fig7.png}}\label{fig:subfig27}} -\subfloat[8]{\includegraphics{fig8.png}}+\subfloat[8]{\pandocbounded{\includegraphics[keepaspectratio]{fig8.png}}} -\subfloat[9]{\includegraphics{fig9.png}\label{fig:subfig29}}+\subfloat[9]{\pandocbounded{\includegraphics[keepaspectratio]{fig9.png}}\label{fig:subfig29}}  \caption[{Caption}]{Caption} 
test/m2m/titlesInRefs/expect.tex view
@@ -2,7 +2,7 @@  \begin{figure} \centering-\includegraphics{figure.png}+\pandocbounded{\includegraphics[keepaspectratio]{figure.png}} \caption{A Figure}\label{fig:figure} \end{figure} 
test/test-pandoc-crossref.hs view
@@ -307,7 +307,7 @@         it "Image labels" $           figure "img.png" "" "Title" Nothing "figure_label1"             <> para (citeGen "fig:figure_label" [1])-            `test` "\\begin{figure}\n\\centering\n\\includegraphics{img.png}\n\\caption{Title}\\label{fig:figure_label1}\n\\end{figure}\n\nfig.~\\ref{fig:figure_label1}"+            `test` "\\begin{figure}\n\\centering\n\\pandocbounded{\\includegraphics[keepaspectratio]{img.png}}\n\\caption{Title}\\label{fig:figure_label1}\n\\end{figure}\n\nfig.~\\ref{fig:figure_label1}"          it "Eqn labels" $           equation "x^2" "some_equation1"