Git Product home page Git Product logo

pandoc-fignos's Introduction

New in 2.4.0: Updated for pandoc 2.11.

more...

pandoc-fignos 2.4.0

pandoc-fignos is a pandoc filter for numbering figures and their references when converting from markdown to other formats. It is part of the pandoc-xnos filter suite. LaTeX/pdf, html, and epub output have native support. Native support for docx output is a work in progress.

Demonstration: Processing demo3.md with pandoc + pandoc-fignos gives numbered figures and references in pdf, tex, html, epub, docx and other formats.

This version of pandoc-fignos was tested using pandoc 1.15.2 - 2.11.1.1,1 and may be used with linux, macOS, and Windows. Bug reports and feature requests may be posted on the project's Issues tracker. If you find pandoc-fignos useful, then please kindly give it a star on GitHub.

See also: pandoc-eqnos, pandoc-tablenos, pandoc-secnos
Other filters: pandoc-comments, pandoc-latex-extensions

Contents

  1. Installation
  2. Usage
  3. Markdown Syntax
  4. Customization
  5. Technical Details
  6. Getting Help
  7. Development
  8. What's New

Installation

Pandoc-fignos requires python. It is easily installed -- see here.2 Either python 2.7 or 3.x will do.

Pandoc-fignos may be installed using the shell command

pip install pandoc-fignos --user

and upgraded by appending --upgrade to the above command. Pip is a program that downloads and installs software from the Python Package Index, PyPI. It normally comes installed with a python distribution.3

Instructions for installing from source are given in DEVELOPERS.md.

Usage

Pandoc-fignos is activated by using the

--filter pandoc-fignos

option with pandoc. Alternatively, use

--filter pandoc-xnos

to activate all of the filters in the pandoc-xnos suite (if installed).

Any use of --filter pandoc-citeproc or --bibliography=FILE should come after the pandoc-fignos or pandoc-xnos filter calls.

Markdown Syntax

The cross-referencing syntax used by pandoc-fignos was developed in pandoc Issue #813 -- see this post by @scaramouche1.

To mark a figure for numbering, add an identifier to its attributes:

![Caption.](image.png){#fig:id}

The prefix #fig: is required. id should be replaced with a unique string composed of letters, numbers, dashes and underscores. If id is omitted then the figure will be numbered but unreferenceable. Alternatively, reference link attributes may be used.

To reference the figure, use

@fig:id

or

{@fig:id}

Curly braces protect a reference and are stripped from the output.

Demonstration: Processing demo.md with pandoc + pandoc-fignos gives numbered figures and references in pdf, tex, html, epub, docx and other formats.

Clever References

Writing markdown like

See fig. @fig:id.

seems a bit redundant. Pandoc-fignos supports "clever references" via single-character modifiers in front of a reference. Users may write

 See +@fig:id.

to have the reference name (i.e., "fig.") automatically generated. The above form is used mid-sentence; at the beginning of a sentence, use

 *@fig:id

instead. If clever references are enabled by default (see Customization, below), then users may disable it for a given reference using4

!@fig:id

Demonstration: Processing demo2.md with pandoc + pandoc-fignos gives numbered figures and references in pdf, tex, html, epub, docx and other formats.

Note: When using *@fig:id and emphasis (e.g., *italics*) in the same sentence, the * in the clever reference must be backslash-escaped; i.e., \*@fig:id.

Tagged Figures

The figure number may be overridden by placing a tag in the figure's attributes block:

![Caption.](image.png){#fig:id tag="B.1"}

The tag may be arbitrary text, or an inline equation such as $\text{B.1}'$. Mixtures of the two are not currently supported.

Disabling Links

To disable a link on a reference, set nolink=True in the reference's attributes:

@fig:id{nolink=True}

Subfigures

Pandoc does not provide syntactical support for subfigures. However, subfigures of arbitrary complexity may be assembled using the native capabilities of each output format, and referenced using pandoc-fignos.

LaTeX/pdf subfigures may be coded and referenced as shown in demo4.md. Processing with pandoc + pandoc-fignos gives demo4.pdf. This technique uses capabilities provided by the subcaption package. "Bad reference" warnings involving subfigures may be ignored when using this approach.

Html/epub subfigures may be coded and referenced as shown in demo5.md. Processing with pandoc + pandoc-fignos gives demo5.html. This technique uses pandoc's fenced divs. Fenced divs may be nested and styled as required with css. Note that pandoc requires figures to be in their own paragraph (i.e., with a blank line above and below).

The above demos use certain customizations, described next.

Customization

Pandoc-fignos may be customized by setting variables in the metadata block or on the command line (using -M KEY=VAL). The following variables are supported:

  • fignos-warning-level or xnos-warning-level - Set to 0 for no warnings, 1 for critical warnings, or 2 (default) for all warnings. Warning level 2 should be used when troubleshooting.

  • fignos-cleveref or xnos-cleveref - Set to True to assume "+" clever references by default;

  • xnos-capitalise - Capitalises the names of "+" clever references (e.g., change from "fig." to "Fig.");

  • fignos-plus-name - Sets the name of a "+" clever reference (e.g., change it from "fig." to "figure"). Settings here take precedence over xnos-capitalise;

  • fignos-star-name - Sets the name of a "*" clever reference (e.g., change it from "Figure" to "Fig.");

  • fignos-caption-name - Sets the name at the beginning of a caption (e.g., change it from "Figure to "Fig." or "图");

  • fignos-caption-separator or xnos-caption-separator - Sets the caption separator (e.g., the colon in "Figure 1:") to something else. It must be one of none, colon, period, space, quad, or newline; and

  • fignos-number-by-section or xnos-number-by-section - Set to True to number figures by section (e.g., Fig. 1.1, 1.2, etc in Section 1, and Fig 2.1, 2.2, etc in Section 2). For LaTeX/pdf, html, and epub output, this feature should be used together with pandoc's --number-sections option enabled. For docx, use docx custom styles instead.

    This option should not be set for numbering by chapter in LaTeX/pdf book document classes.

  • xnos-number-offset - Set to an integer to offset the section numbers when numbering figures by section. For html and epub output, this feature should be used together with pandoc's --number-offset option set to the same integer value. For LaTeX/pdf, this option offsets the actual section numbers as required.

Note that variables beginning with fignos- apply to only pandoc-fignos, whereas variables beginning with xnos- apply to all of the pandoc-fignos/eqnos/tablenos/secnos filters.

Demonstration: Processing demo3.md with pandoc + pandoc-fignos gives numbered figures and references in pdf, tex, html, epub, docx and other formats.

Technical Details

LaTeX/pdf Output

During processing, pandoc-fignos inserts packages and supporting LaTeX into the header-includes metadata field. To see what is inserted, set the fignos-warning-level meta variable to 2. Note that any use of pandoc's --include-in-header option overrides all header-includes.

An example reference in LaTeX looks like

See \cref{fig:1}.

An example figure looks like

\begin{figure}
  \hypertarget{fig:1}{%
    \centering
    \includegraphics[width=1in,height=\textheight]{img/fig-1.png}
    \caption{The number one.}\label{fig:1}
  }
\end{figure}

Other details:

  • The cleveref and caption packages are used for clever references and caption control, respectively;
  • The \label and \ref macros are used for figure labels and references, respectively (\Cref and \cref are used for clever references);
  • Clever reference names are set with \Crefname and \crefname;
  • The caption name is set with\figurename;
  • Tags are supported by way of a custom environment that temporarily redefines \thefigure; and
  • Caption prefixes (e.g., "Figure 1:") are disabled for unnumbered figures by way of a custom environment that uses \captionsetup.

Html/Epub Output

An example reference in html looks like

See fig. <a href="#fig:1">1</a>.

An example figure looks like

<div id="fig:1" class="fignos">
  <figure>
    <img src="img/fig-1.png" style="width:1in" alt="" />
    <figcaption>
      <span>Figure 1:</span> The number one.
    </figcaption>
  </figure>
</div>

The figure and its caption are wrapped in a <div></div> with an id for linking and with class fignos to allow for css styling.

Docx Output

Docx OOXML output is under development and subject to change. Native capabilities will be used wherever possible.

Getting Help

If you have any difficulties with pandoc-fignos, or would like to see a new feature, then please submit a report to our Issues tracker.

Development

Pandoc-fignos will continue to support pandoc 1.15-onward and python 2 & 3 for the foreseeable future. The reasons for this are that a) some users cannot upgrade pandoc and/or python; and b) supporting all versions tends to make pandoc-fignos more robust.

Developer notes are maintained in DEVELOPERS.md.

What's New

New in 2.4.0: Updated for pandoc 2.11.

New in 2.3.1: Updated for pandoc 2.10.1.

New in 2.2.0: Html/epub subfigures support.

New in 2.1.2: LaTeX subfigures support. Documentation is provided to show how to reference LaTeX subfigures. No changes to existing code were required.

New in 2.1.1: Warnings for duplicate reference targets.

New in 2.0.0: This version represents a major revision of pandoc-fignos. While the interface is similar to that of the 1.x series, some users may encounter minor compatibility issues.

Warning messages are a new feature of pandoc-fignos. The meta variable fignos-warning-level may be set to 0, 1, or 2 depending on the degree of warnings desired. Warning level 1 will alert users to bad references, malformed attributes, and unknown meta variables. Warning level 2 (the default) adds informational messages that should be helpful with debugging. Level 0 turns all messages off.

Meta variable names have been updated. Deprecated names have been removed, and new variables have been added. Note in particular that the fignos-number-sections and xnos-number-sections variables have been renamed to fignos-number-by-section and xnos-number-by-section, respectively.

The basic filter and library codes have been refactored and improved with a view toward maintainability. While extensive tests have been performed, some problems may have slipped through unnoticed. Bug reports should be submitted to our Issues tracker.

LaTeX/PDF:

LaTeX codes produced by pandoc-fignos are massively improved. The hacks used before were causing some users problems. The new approach provides more flexibility and better compatibility with the LaTeX system.

Supporting LaTeX is now written to the header-includes meta data. Users no longer need to include LaTeX commands in the header-includes to get basic pandoc-fignos functions to work. Use fignos-warning-level: 2 to see what pandoc-fignos adds to the header-includes.

A word of warning: Pandoc-fignos's additions to the header-includes are overridden when pandoc's --include-in-header option is used. This is owing to a design choice in pandoc. Users may choose to deliberately override pandoc-fignos's header-includes by providing their own LaTeX through --include-in-header. If a user needs to include other bits of LaTeX in this way, then they will need to do the same for the LaTeX that pandoc-fignos needs.

Finally, the \label tags are now installed where pandoc chooses, which is currently outside the \caption field. Pandoc-fignos previously forced the \label to go inside \caption.

Html/Epub:

The figure is now enclosed in a <div> which contains the id and class fignos. This change was made to facilitate styling. The id was formerly contained in an anchor tag.

Epub support is generally improved.


Footnotes

1: Pandoc 2.4 broke how references are parsed, and so is not supported.

2: For MacOS, my preferred install method is to use the package available from python.org.

3: Anaconda users may be tempted to use conda instead. This is not advised. The packages distributed on the Anaconda cloud are unofficial, are not posted by me, and in some cases are ancient. Some tips on using pip in a conda environment may be found here.

4: The disabling modifier "!" is used instead of "-" because pandoc drops minus signs in front of references.

pandoc-fignos's People

Contributors

gromnitsky avatar oztalha avatar shoeffner avatar tomduck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandoc-fignos's Issues

Referencing with curly braces

... does not work for me:

Markdown input:

Some text here

![Caption here](legenda.png) {#fig:legend}

Referencing figure 1a:

1. No braces @fig:legend a
2. with braces {@fig:legend}a.

Processed with

/usr/bin/pandoc +RTS -K512m -RTS test.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output test.html --smart --email-obfuscation none --filter pandoc-fignos --standalone --section-divs --table-of-contents --toc-depth 3 --template /home/mbojan/R/library/3.2/rmarkdown/rmd/h/default.html --number-sections --variable 'theme:bootstrap' --include-in-header /tmp/RtmpkT19BC/rmarkdown-str496b1622d1ac.html --no-highlight --variable highlightjs=test_files/highlight 

creates HTML output (only relevant part):

<p>Some text here</p>
<a name="fig:legend"></a>
<div class="figure">
<img src="legenda.png" alt="Figure 1. Caption here" />
<p class="caption">Figure 1. Caption here</p>
</div>
<p>Referencing figure 1a:</p>
<ol style="list-style-type: decimal">
<li>No braces <a href="#fig:legend">1</a> a</li>
<li>with braces <a href="mailto:{@fig">{@fig</a>:legend}a.</li>
</ol>

As you can see the reference in item 2 is interpreted as an email address. If I switch off the autolink_bare_uris extension (not shown) the link is correctly produced, but the curly braces are not removed (as advertised in your README).

My goal is to have references to, say, "1a" where only "1" is a link and "a" is added as a plain text. Any suggestions? Is it possible to achieve this with simple @fig:legend reference to get "1a" without the space between 1 and a?

Cleveref problem

Pandoc 2.2.2.1, Python 3.6.6 on Windows 10.
I'm receiving the following error:

pandoc -f markdown-raw_tex+tex_math_single_backslash+grid_tables+pipe_tables+fancy_lists+smart+line_blocks+fenced_code_attributes -t html --mathjax --filter=pandoc-fignos --filter=pandoc-tablenos --filter=pandoc-eqnos --filter=pandoc-citeproc --bibliography=c:\users\deni\documents\archeo\library.bib --csl=c:\Users\deni\zotero\archeo\styles\journal-of-archaeological-science.csl --metadata=reference-section-title:Literatura --metadata=link-citations:true --metadata=lang:pl_PL --metadata=subparagraph:yes --metadata=fignos-caption-name:Ryc. --metadata=fignos-plus-name:ryc. --metadata=fignos-star-name:rycina --metadata=eqnos-plus-name:wz. --metadata=eqnos-star-name:wzór --metadata=xnos-cleveref:On --metadata=tablenos-caption-name:Tabela --metadata=tablenos-plus-name:tab. --metadata=tablenos-star-name:Tabela --metadata=xnos-number-sections:Off --metadata=xnos-cleveref-fake:On test.md
Traceback (most recent call last):
  File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python36\Scripts\pandoc-fignos.exe\__main__.py", line 9, in <module>
  File "c:\program files\python36\lib\site-packages\pandoc_fignos.py", line 415, in main
    process(meta)
  File "c:\program files\python36\lib\site-packages\pandoc_fignos.py", line 354, in process
    assert use_cleveref_default in [True, False]
AssertionError
Error running filter pandoc-fignos:
Filter returned error status 1

Caption location

I prefer to see captions as titles and descriptions of figures and as such it makes sense to place them on top of figures rather than below. I've also come across academic journals that have taken this approach. Is there currently a way of doing this in pandoc? If not, could this feature be added?

Implementing a similar syntax to tablenos would achieve this.

Figure: Caption. {#fig:id}

Issue with pandoc-fignos and -tablenos with LaTeX beamer class

Hi,

I'm using pandoc-fignos/-tablenos with the LaTeX beamer class. It seems that both filters create double tags for each caption such as

Tabelle 1: Table 1: Priority Inversion

The generated LaTeX code is

\caption{Table 1: Priority Inversion}\tabularnewline

The original markdown

Table: Priority Inversion {#tbl:ps2}

Everything's works fine with Article or Report class, it's just Beamer causing trouble.

Is this a bug?

Best,
Bid

completely broken output

Dear Tom,

After an update the output is broken on both mac and ubuntu.

air-di-davide:~ davide$ pip show pandoc-fignos

---
Metadata-Version: 2.0
Name: pandoc-fignos
Version: 0.12
Summary: Figure number filter for pandoc
Home-page: https://github.com/tomduck/pandoc-fignos
Author: Thomas J. Duck
Author-email: [email protected]
Installer: pip
License: GPL
Location: /usr/local/lib/python2.7/site-packages
Requires: psutil, pandocfilters, pandoc-attributes
Classifiers:
  Development Status :: 4 - Beta
  Intended Audience :: End Users/Desktop
  Environment :: Console
  License :: OSI Approved :: GNU General Public License v3 (GPLv3)
  Programming Language :: Python
Entry-points:
  [console_scripts]
  pandoc-fignos = pandoc_fignos:main
air-di-davide:~ davide$ 

attached a few exports

Hall_Handbook.docx

Hall_Handbook.pdf

TypeError: replace_refs_factory() missing 1 required positional argument: 'target'

The above error with pandoc-fignos was reported at greenelab/deep-review:

The problem: There is an API incompatibility between pandoc-fignos 1.0.0 and pandoc-xnos 0.15 (the library for the pandoc-xnos/eqnos/tablenos filters).

The solution: Upgrade to the most recent version of pandoc-fignos.

I would like to prevent such errors from occurring in the future. One way forward is to move pandoc-xnos to MAJOR.MINOR.PATCH versioning and require a particular MAJOR.MINOR version for a given pandoc-fignos release. The MINOR number would be incremented for API changes.

Feedback is welcome.

Does not work with pandoc version 2.0

I'm currently running pandoc from nightly builds, which means I am running pandoc 2.0:

$ pandoc --version
pandoc 2.0
Compiled with pandoc-types 1.17.0.5, texmath 0.9.4.1, skylighting 0.3.3

When I attempt to use pandoc-fignos I get a version-related error message:

$ echo 'test' | pandoc --filter pandoc-fignos -t html5
Traceback (most recent call last):
  File "/usr/local/bin/pandoc-fignos", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pandoc_fignos.py", line 379, in main
    PANDOCVERSION = pandocxnos.init(args.pandocversion, doc)
  File "/usr/local/lib/python2.7/dist-packages/pandocxnos/core.py", line 165, in init
    raise RuntimeError(msg)
RuntimeError: Cannot understand pandocversion=2.0
Error running filter pandoc-fignos:
Filter returned error status 1

The regular expression for valid pandoc versions in in line 153 of /usr/local/lib/python2.7/dist-packages/pandocxnos/core.py:

pattern = re.compile(r'^1\.[0-9]+(?:\.[0-9]+)?(?:\.[0-9]+)?$')

This matches the current debian/testing version of pandoc, 1.19.2.1, which runs with pandoc-fignos without any problem.

If I alter line 153 to also match version 2.0:

pattern = re.compile(r'^[1-2]\.[0-9]+(?:\.[0-9]+)?(?:\.[0-9]+)?$')

then pandoc version 2.0 runs just fine with the pandoc-fignos filter.

Linking of figures with refs is inconsistent

I started using fignos a couple of days ago. Very useful, the filter is greatly appreciated.

I noted an inconsistent behavior leading to "reference fig:b03 not found" warnings. Some cases where I observed this: (note that my text is longer which may be causing the behavior?)

(from md text)

ksk asjas asdjasj (figs. @fig:b03 & @fig:b04).

![ifka sims maia](./res/monos-b-03.png){ width=697px #fig:b03 }

![af sef ef ](.\res/monos-b-04.png){ width=697px #fig:b04 }

in this case it finds fig b04 but not b03.

if I remove the space between figs. and the reference, turning it into
(figs@fig:b03 & @fig:b04).
then it finds both. It seems either as the preceding character affects the readout of the reference, or as if the preceding character makes the label to be parsed by citeproc instead of fignos, since the error message looks like:

pandoc-citeproc: reference fig:b01 not found

perhaps there is a problem with the pattern which matches and consume the tags. I personally thing that the recognition of a fig. should not be affected by the preceding token.

this is the pandoc command:
pandoc ./text.md -s -o ./text.html --filter pandoc-fignos --filter pandoc-citeproc --bibliography="./sources.yaml"

Unnumbered figures have numbers in pdf output

I'm declaring this as an issue but will not likely address it until there is demand for a fix.

There are three different labeling possibilities arising from the syntax proposed by @scaramouche1 in pandoc Issue #813.

  1. Numbered, referenceable figures:
    ![Caption.](fig.png){#fig:A}
  1. Numbered, unreferenceable figures:
    ![Caption.](fig.png){#fig:}
  1. Unnumbered, unreferenceable figures:
    ![Caption.](fig.png){}

Presently, pandoc-fignos does the right thing for html output. For PDF output, however, the case 3 figures are numbered. This is because pandoc's TeX writer only produces numbered figures.

Notes:

  • A possible workaround in pandoc-fignos: Disable automatic caption numbering in LaTeX altogether and hard-code it as is done for the other output formats. Not pretty, but it could be used in a pinch.
  • LaTeX allows unnumbered figures by using the \caption* command in the caption package.

Multiple figures on a single line are not referenced.

If there are two figures on one line (or one two lines, with no blank in between), then figure referencing does not work. e.g.:

![some figure](path/to/image1.png}{#fig:one}
![another fig](path/to/image2.png}{#fig:two}

These figures will not be referenced. Not sure if this is intended behaviour, but if it is, maybe a note in the troubleshooting section? I just wasted a couple of hours trying to figure it out..

Feature Request: Custom Counter Style

Hi, @tomduck. Can I customize the counter style of figures and figure references? A counter-style variable could be used to set the style:

counter-style: Roman

Styles could be:

arabic -> 1, 2, 3, ...
alph -> a, b, c, ...
Alph -> A, B, C, ...
roman -> i, ii, iii, ...
Roman -> I, II, III, ...

Thank you.

Feature Request: Subfigures

By "subfigures", I mean multiple figures in the same line. And support caption for the whole figure and for subfigures, and references. Basically, it's what pandoc-crossref does, but I prefer using pandoc-fignos.

Thanks.

Error when processing TeX document

I get a similar error while using pandoc-tablenos. Pandoc was installed using homebrew, and pandoc-tablenos and pandoc-fignos using pip3. Is that a problem?

Traceback (most recent call last):
File "/usr/local/bin/pandoc-fignos", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.5/site-packages/pandoc_fignos.py", line 377, in main
altered)
File "/usr/local/lib/python3.5/site-packages/pandoc_fignos.py", line 375, in
altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
File "/usr/local/lib/python3.5/site-packages/pandocfilters.py", line 111, in walk
item['c'] if 'c' in item else None, format, meta)
File "/usr/local/lib/python3.5/site-packages/pandocxnos/core.py", line 615, in process_refs
_process_refs(value, labels)
File "/usr/local/lib/python3.5/site-packages/pandocxnos/core.py", line 119, in wrapper
ret = func(*args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/pandocxnos/core.py", line 570, in _process_refs
_get_label(v['t'], v['c']) in labels:
TypeError: unhashable type: 'list'
pandoc: Error running filter pandoc-fignos
Filter returned error status

pandoc-fignos, Rstudio, R markdown, and word output

Thanks a lot for the effort on this! This is about the last tool I need to be able to confine workflow to Rstudio and markdown. I am trying to use pandoc-fignos and the citeproc functionality in the same document. It seems the two are not behaving well together. I have added the citeproc info into the header of the demo.md and converted to .Rmd as seen below and added the .bib and .csl files to the demo directory. The demo.Rmd compiles the fig refs correctly without the csl and bibliography entry but not when they are used. Any thoughts?
Thanks,


---
output:
  word_document: 
    pandoc_args:
    - --filter
    - pandoc-word-newpage
    - --filter
    - pandoc-fignos
  html_document:
    pandoc_args:
    - --filter
    - pandoc-word-newpage
    - --filter
    - pandoc-fignos
csl: environmental-toxicology-and-chemistry.csl
bibliography: HAB.bib

---

Today's data are shown in Fig. @fig:today, and yesterday's data are shown in Fig. @fig:yesterday.

![Today's $y=mx+b$ data.](img/today.png) {#fig:today}

![Yesterday's $y=mx+b$ data.](img/yesterday.png) {#fig:yesterday}

Earlier data are shown in Fig. @fig:earlier.  Fig. {@fig:earlier}a is for two days ago and Fig. {@fig:earlier}b is for three days ago.

![Data from a) two days ago, and b) three days ago.](img/earlier.png) {#fig:earlier .wideimg}

Figures {@fig:today}--{@fig:earlier} (@fig:today,@fig:yesterday,@fig:earlier) reveal an increasing slope with time.


clever references with asterisk broken when utilizing asterisk for emphasis

As a note, the output is not getting parsed for me in the filter correctly when I have a paragraph using a clever reference with the asterisk if that same paragraph later contains an asterisk for emphasis like *emphasis*. The temporary solution/fix is to change the emphasis to use underscores: _emphasis_. It also fails if you try to use this referencing more than once in a single paragraph (of which the only solution is to form a new paragraph... not ideal).

Thanks for the awesome filter!

Feature request: reference figure number without creating a hyperlink

It would be nice to have a syntax that places the figure number but does not create a hyperlink. For example, maybe define a new prefix like {^@fig::foo}. In my documents, when I add a caption to the figure, I'd prefer it not to pickup link formatting since the figure is immediately next to the caption so the link is unnecessary. I don't have an opinion on an appropriate prefix, I just picked caret as an example. Thank you!

Add "Figure" label when referencing

When referencing a figure in the text, fignos produces only the figure number, without "fig" or "figure" label. Would it be possible to make its behaviour similar to pandoc-citeproc?

For example:
Figure insertion:
![My great chart with data.](fig/chart.png){#fig:chart}
Figure reference:
Lorem ipsum ({@fig:chart}) dolor sit amet
Result:
Lorem ipsum (1.1) dolor sit amet

And I mean this behaviour:
Figure reference:
Lorem ipsum ({@fig:chart}) dolor sit amet
Result:
Lorem ipsum (Figure 1.1) dolor sit amet

Figure reference:
Lorem ipsum ({-@fig:chart}) dolor sit amet
Result:
Lorem ipsum (1.1) dolor sit amet

It would also be nice to have the same behaviour in tablenos and eqnos :)

"Invalid expression" error with python 2.7.3

I am trying pandoc-fignos with pandoc-1.18 on Ubutu 12 and get the following error:

$ pandoc --filter pandoc-fignos demo.md
Traceback (most recent call last):
  File "/usr/local/bin/pandoc-fignos", line 9, in <module>
    load_entry_point('pandoc-fignos==0.18.1', 'console_scripts', 'pandoc-fignos')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2279, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/pandoc_fignos.py", line 50, in <module>
    import pandocxnos
  File "/usr/local/lib/python2.7/dist-packages/pandocxnos/__init__.py", line 1, in <module>
    from .core import *
  File "/usr/local/lib/python2.7/dist-packages/pandocxnos/core.py", line 419, in <module>
    _REF = re.compile(r'^((?:.*{)?[\*\+!]?)@([^:]*:[\w/-]+)(.*)?')
  File "/usr/lib/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python2.7/re.py", line 242, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat
pandoc: Error running filter pandoc-fignos
Filter returned error status 1

If I don't use pandoc-fignos, the same input file completes successfully:

$ pandoc demo.md
<p>Some data are shown in fig. <span class="citation">@fig:data</span>.</p>
<div class="figure">
<img src="plot1.png" alt="Some data." id="fig:data" />
<p class="caption">Some data.</p>
</div>

The input file is as simple as it gets:

$ cat demo.md

Some data are shown in fig. @fig:data.

![Some data.](plot1.png){#fig:data}


Any hint ?

Just stopped working

After updating my Python environment, the plugin simply stopped working (does not replace the tags at all). No error or warning is issued. Tablenos still seems to work properly.

Info:

Python 2.7.11
pandoc 1.16.0.2
pandocfilters 1.3.0
pandoc-attributes 0.1.7
pandoc-fignos 0.7.6

cross reference number failed when italiced or bolded

it works when code is like below:

{@fig:1}

![Number one.](img/fig-1.png){#fig:1 =}

However,in some condition, I need set the number italic or bold,
then the code failed,
the code is like below:

**{@fig:1}**

![Number one.](img/fig-1.png){#fig:1 =}

any solution?

KeyError for pandoc-fignos 0.16

With python2 I get

$ ./create_pdf.sh SonarQube_Regeln.md
Traceback (most recent call last):
  File "/home/hasufell/.local/bin/pandoc-fignos", line 11, in <module>
    load_entry_point('pandoc-fignos==0.16', 'console_scripts', 'pandoc-fignos')()
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandoc_fignos.py", line 357, in main
    detach_attrs_image], doc)
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandoc_fignos.py", line 355, in <lambda>
    altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandocfilters.py", line 34, in walk
    array.append(walk(item, action, format, meta))
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandocfilters.py", line 39, in walk
    obj[k] = walk(x[k], action, format, meta)
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandocfilters.py", line 39, in walk
    obj[k] = walk(x[k], action, format, meta)
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandocfilters.py", line 39, in walk
    obj[k] = walk(x[k], action, format, meta)
  File "/home/hasufell/.local/lib/python2.7/site-packages/pandocfilters.py", line 25, in walk
    res = action(item['t'], item['c'], format, meta)
KeyError: 'c'
pandoc: Error running filter pandoc-fignos
Filter returned error status 1

With python3:

$ ./create_pdf.sh SonarQube_Regeln.md
pandoc: Error running filter pandoc-fignos
fd:4: hPutBuf: resource vanished (Broken pipe)

The script I run is:

#!/bin/sh

die() {
    echo "$1"
    exit 1
}

[[ -z $1 ]] && die "missing arguments, usage: create_pdf.sh <input-file> [output-file]"

input="${1}"
output="${2:-${input%.*}.pdf}"
pandoc=${pandoc:-pandoc}

${pandoc} \
    -t latex \
    --template=default.latex \
    --toc \
    -f markdown+yaml_metadata_block+tex_math_dollars \
    --filter pandoc-fignos \
    -o ${output} \
    ${input}

Cleveref bug for textless doc.

The following code causes a crash in pandoc.

---
fignos-cleveref: On
...

![A simple figure.](plot.png){#fig:simple}

Here is the session:

$ pandoc-1.17.2 demo.md --filter pandoc-fignos -o out/demo.pdf
pandoc-1.17.2: Error in $[2]: expected [a], encountered Object
CallStack (from HasCallStack):
  error, called at pandoc.hs:153:46 in main:Main

If a sentence is put before the figure then everything is fine.

Not working with current pandoc 1.16 build

Thanks for the great functionality. I've been using this with pandoc 1.15.2, then just started using the current pandoc 1.16 build (build from source) and pandoc-fignos stopped working. I went to the 1.16 build since it has the new figure size specification capability. I'm wondering if this broke the filter, it uses a similar id syntax.
Cheers
Greg B.

"Filter pandoc-fignos not found"

Apologies for my very basic question, but I am not a coder and I don't get pandoc-fignos to work. Installing it worked fine. But the filter still does not seem to be there. After trying to use the filter employing this command in Terminal

pandoc --filter pandoc-fignos TableFigure.md -f markdown -t html -s -o TableFigure.html

I always get the error message:

pandoc: Filter pandoc-fignos not found

Any idea how I can solve this?
Best,
Julian

support "reference" images

Thanks for this useful tool! Would it be possible to also support "reference"-type images:

Caption here.{#fig:f1}

This currently does not work.

I need that because I'm now using Ulysses to edit my markdown for pandoc -- and Ulysses changes the img to become "referenced" instead of "direct".

Best regards, LatB

Attributes processing bug

Pandoc 2 supports image parameters to be passed as:

![Caption](blah.png "Alt"){width=50%}
![Caption](blah.png "Alt"){width=50%}{#fig:iBreak}
![Caption](blah.png "Alt"){width=50%, #fig:iBreakToo}
![Caption](blah.png "Alt"){#fig:iWork}

Apart from the last one the middle two break..

Feature Request: Custom Section Offset Numbering

I'm writing my thesis in markdown, now using fignos, and its great, thanks so much!

I've made a small hack on the code - not really a git user, so sorry, I would have issued a pull request, I'll try to work that out next time.

What I have done is added xnos-number-offset: its basically a prefix or starting offset for the section numbering, it works great for writing chapters in separate documents. Say I want all chapter 6 figures to start with 6.X.X. Or I want all the figures in Appendix 1 to start with A1.

---
fignos-cleveref: On
fignos-plus-name: Figure
fignos-caption-name: Figure
xnos-number-offset: 6
xnos-number-sections: On
...

in

def process(meta)

. . . . .

global numberoffset

. . . . .

    if 'xnos-number-offset' in meta and meta['xnos-number-offset']['c']:
        tmp = get_meta(meta, 'xnos-number-offset')
        numberoffset = tmp

and in

def process_figures 

. . . . .

global numberoffset

. . . . .

# For html, hard-code in the section numbers as tags
 kvs = PandocAttributes(attrs, 'pandoc').kvs
 if numbersections and fmt in ['html', 'html5'] and not 'tag' in kvs:
     if numberoffset:
         cursec = numberoffset
     else:
         if kvs['secno'] != cursec:
             cursec = kvs['secno']
             Nreferences = 1
     kvs['tag'] = cursec + '.' + str(Nreferences)
     Nreferences += 1

I've only performed a quick hack, but the idea could be a useful addition if implemented properly

Referencing one figure from another's caption results in an error

Something like:

![Figure 1](figures/figure_1.pdf){#fig:figure_one}
![Figure 2 - Subset of Figure @fig:figure_one](figures/figure_2.pdf){#fig:figure_two}

Leads to an error:

pandoc-citeproc: reference with no printed form

Weirdly, removing --filter pandoc-citeproc from my call to pandoc still results in the above error.

Image link attributes

I hadn't used this for about a year, so I updated it (using pip on a Mac) after I updated pandoc. So now I have pandoc 2.1.3 and pandoc-fignos 1.2.0. I also run it with citeproc but I'm careful to have fignos first. It all worked a year or so ago, but now it doesn't seem to process anything.

Here's my command line:

pandoc /Users/adam/Dropbox/projects/papers2018/selfTracking/draft.md -o third_draft.pdf --filter pandoc-fignos --filter pandoc-citeproc --csl /Users/adam/Dropbox/pandocStuff/styles-master/apa.csl --include-in-header /Users/adam/Dropbox/pandocStuff/titlesec.tex --include-in-header /Users/adam/Dropbox/pandocStuff/figsfloat.tex --template /Users/adam/Dropbox/pandocStuff/mytemplate.tex --pdf-engine=xelatex --toc

And this is the markdown:

#### Stress over time

![Time all measures][image-1]{#fig:technicalprocess}

Figure {@fig:technicalprocess} shows

And here's how the pdf turns out:

screen shot 2018-04-24 at 19 27 09

Citeproc tries to process it and complains there's no reference.

I've tried uninstalling - it complains about fignos being missing then so I know it's being picked up by pandoc - and reinstalling. I've uninstalled and re-installed pandoc, too. I've run the command without citeproc and it doesn't do anything then, either. Is there something I can do to find out what's going on? I've tried it with files that definitely worked before I updated it!

PyPI package

Hi!
Great package 👍 Why not release it to pypi?

Installation in Ubuntu 14.04

After installing python-pip and setuptools as root, the following errors are shown:

pip install pandoc-fignos 
Downloading/unpacking pandoc-fignos
  Downloading pandoc-fignos-0.7.4.tar.gz
  Running setup.py (path:/tmp/pip_build_root/pandoc-fignos/setup.py) egg_info for package pandoc-fignos

    warning: no files found matching 'demos/img/today.png'
    warning: no files found matching 'demos/img/yesterday.png'
    warning: no files found matching 'demos/img/earlier.png'
Downloading/unpacking pandocfilters (from pandoc-fignos)
  Downloading pandocfilters-1.3.0.tar.gz
  Running setup.py (path:/tmp/pip_build_root/pandocfilters/setup.py) egg_info for package pandocfilters

Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1235, in prepare_files
    req_to_install.assert_source_matches_version()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 465, in assert_source_matches_version
    % (display_path(self.source_dir), version, self))
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 70, in display_path
    if path.startswith(os.getcwd() + os.path.sep):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 31: ordinal not in range(128)

The version of Ubuntu is:

Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty

Not sure how to solve this.
Thanks.

Install problem on Windows with Python 2.7.12

Hi Tom, long time user of Fignos and Eqnos. I was trying to upgrade on Windows with Python 2.7.12 and failed. The error message included:

 File "setup.py", line 46, in run
    super(custom_install, self).run()
TypeError: super() argument 1 must be type, not classobj

I then hacked the setup.py file as follows (only portions with change showed):

class custom_install(install, object): # Added object
    """Ensures setuptools uses custom install_scripts."""
    def run(self):
        super(custom_install, self).run() # Added arguments to super

# Custom install_scripts command class for setup()
class install_scripts_quoted_shebang(install_scripts, object):  # added object
    """Ensure there are quotes around shebang paths with spaces."""
    def write_script(self, script_name, contents, mode="t", *ignored):
        shebang = str(contents.splitlines()[0])
        if shebang.startswith('#!') and ' ' in shebang[2:].strip() \
          and '"' not in shebang:
            quoted_shebang = '#!"%s"' % shebang[2:].strip()
            contents = contents.replace(shebang, quoted_shebang)
        super(install_scripts_quoted_shebang, self).write_script(script_name, contents, mode, *ignored)
       # Added arguments to super above

After that I was able to complete the install with python setup.py install. Saw this problem with eqnos too. Don't know if this just my environment or a general issues.

Thanks
Greg B.

pandoc-attributes install error

I'm getting an error trying to install this on Ubuntu 16.04 with Python 3.5 and latest pip.

pip3 install --upgrade --pre pandoc-fignos
Collecting pandoc-fignos
  Downloading pandoc-fignos-1.0.0rc1.tar.gz
Collecting pandoc-xnos>=0.11 (from pandoc-fignos)
  Downloading pandoc-xnos-0.11.tar.gz
Collecting pandocfilters (from pandoc-fignos)
  Downloading pandocfilters-1.4.2.tar.gz
Collecting pandoc-attributes (from pandoc-fignos)
  Downloading pandoc-attributes-0.1.7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-qi1xad7m/pandoc-attributes/setup.py", line 5, in <module>
        long_description = pypandoc.convert('README.md', 'rst')
      File "/home/werner/.local/lib/python3.5/site-packages/pypandoc/__init__.py", line 66, in convert
        raise RuntimeError("Format missing, but need one (identified source as text as no "
    RuntimeError: Format missing, but need one (identified source as text as no file with that name was found).
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qi1xad7m/pandoc-attributes/

Any idea what might cause this?

pandoc-tablenos?

Is it possible to use the same approach for table references?
Thanks
Joel

Creating links

"Links are not constructed -- just the figure numbers."

Do you have any plans to implement link creation?

Edit: I should mention that this of course works great for TeX as is. But I would love to see it work with HTML outputs as well.

Hanging process in Windows 10 with pandoc-fignos 0.8

Hello,

I tried to use the 0.8 release in my Windows 10 installation, but I ran into a problem.
My system:

  • Windows 10 Home
  • Python 2.7.11
  • Pandoc 1.16.0.2 (same thing happened with 1.17.0.2 and I tried to reverted to 1.16.0.2; didn't fix the issue)
  • pandoc-fignos 0.8
  • pandocfilters 1.3.0

File test.md contained:

#Heading

Test text.

Command I used:

pandoc.exe --filter=pandoc-fignos.exe -t latex -o test.tex test.md

No output in the command line. The process hung indefinitely. I forcefully killed the processes using another Command Line window:

taskkill /F /IM  pandoc-fignos.exe 
taskkill /F /IM  python.exe

I had to repeat those commands many times, until they managed to kill tens of processes that were open and quickly eating up all my memory.

After the processes were killed, the original command line showed the error below, many times:

Traceback (most recent call last):
  File "C:\Python27\Scripts\pandoc-fignos-script.py", line 9, in <module>
    load_entry_point('pandoc-fignos==0.8', 'console_scripts', 'pandoc-fignos')()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2355, in load
    return self.resolve()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Python27\lib\site-packages\pandoc_fignos.py", line 57, in <module>
    output = subprocess.check_output([command, '-v'])
  File "C:\Python27\lib\subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['C:\\Python27\\Scripts\\pandoc-fignos.exe', '-v']' returned non-zero exit status 1
pandoc.exe: Error running filter pandoc-fignos.exe
Filter returned error status 1

Reverting back to pandoc-fignos 0.7.6 seemed to have fixed it.

Hope that is useful. Cheers!

Inter-figure references in captions

Hi @tomduck -- thanks so much for contributing these filters to the community; I use your *nos filters for academic writing all the time!

It currently appears to be impossible to use an {@fig:my_fig} reference inside the caption of a tracked figure to reference another one (or itself?). I can imagine why this kind of recursion would be a pain to support, but I am surprisingly often missing this functionality. How hard would it be to implement?

'list' object has no attribute 'endswith'

Hi, thanks for the great filter. But I encountered an issue while using it.

Markdown:

[*Hello*](http://hello.com) world

Run with pandoc-fignos (0.7.3) and pandoc (1.16.0.2)

pandoc test.md --filter pandoc-fignos

Gives me an error:

Traceback (most recent call last):
  File "python/bin/pandoc-fignos", line 9, in <module>
    load_entry_point('pandoc-fignos==0.7.3', 'console_scripts', 'pandoc-fignos')()
  File "python/lib/python3.5/site-packages/pandoc_fignos.py", line 290, in main
    doc)
  File "python/lib/python3.5/site-packages/pandoc_fignos.py", line 288, in <lambda>
    altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
  File "python/lib/python3.5/site-packages/pandocfilters.py", line 34, in walk
    array.append(walk(item, action, format, meta))
  File "python/lib/python3.5/site-packages/pandocfilters.py", line 25, in walk
    res = action(item['t'], item['c'], format, meta)
  File "python/lib/python3.5/site-packages/pandoc_fignos.py", line 207, in preprocess
    newvalue = repair_broken_refs(value)
  File "python/lib/python3.5/site-packages/pandoc_fignos.py", line 158, in repair_broken_refs
    value[i+1]['t'], value[i+1]['c']):
  File "python/lib/python3.5/site-packages/pandoc_fignos.py", line 140, in is_broken_ref
    return key1 == 'Link' and value1[1][0]['c'].endswith('{@eq') \
AttributeError: 'list' object has no attribute 'endswith'
pandoc: Error running filter pandoc-fignos
Filter returned error status 1

Any idea on this?

pandoc: Unknown extension: fignos

I get the error pandoc: Unknown extension: fignos when trying to use this on Windows 10. I installed successfully with pip:

> pip show pandoc-fignos
Name: pandoc-fignos
Version: 0.20
Summary: Figure number filter for pandoc
Home-page: https://github.com/tomduck/pandoc-fignos
Author: Thomas J. Duck
Author-email: [email protected]
License: GPL
Location: c:\python27\lib\site-packages
Requires: pandoc-xnos, pandocfilters, pandoc-attributes

At the same time, the pandoc-eqnos extension, installed the same way, is working just fine.

Feature Request: Reference Multiple Figures

Hi, @tomduck. Can I reference multiple figures with pandoc-fignos? I would like to use the {@fig:} command with multiple figure labels separated by commas:

{+@fig:imgA,imgB} -> figs. 1 and 2
{+@fig:imgA,imgB,imgC} -> figs. 1--3

If this feature is added, the fignos-plus-name and fignos-star-name variables may need singular and plural forms:

fignos-plus-name:
    - "fig."
    - "figs."

fignos-star-name:
    - "Figure"
    - "Figures"

Thanks.

Installing in Mac

Hi there, I have not been able to install pandoc-fignos in Mac. I tried the command you suggest (also installed Python 3 before), and just get this:

sudo: pip: command not found

Thanks!

Fatal error with pandoc 2.0 if id contains slash

According to the pandoc-fignos github page label ids can contain "letters, numbers, dashes, slashes and underscores." If I include a slash ('/'), however, pandoc gives me the error:

$ pandoc --filter pandoc-fignos -t html eq-slash.md
Error running filter pandoc-fignos:
Error in $.blocks[1].c[0].c[0]: cannot unpack array of length 7 into a tuple of length 3

Test file eq-slash.md:

See figure @fig:my/image.

![My image](image.jpg "My image"){#fig:my/image}

Pandoc version: 2.0.5 (Compiled with pandoc-types 1.17.3, texmath 0.10, skylighting 0.5).
Pandoc-fignos version: 0.21.1.

Removing the slash from the figure ids stops the error occurring and pandoc generates correct output successfully.

Both pandoc-eqnos and pandoc-tablenos are able to successfully handle equation and table ids with slashes; this problem is occurring only with pandoc-fignos.

Error running pandoc-fignos with new pandoc 1.18

Hi,

I get the following error with Pandoc v1.18

Traceback (most recent call last):
  File "/Users/$USER/anaconda/envs/paper-env/bin/pandoc-fignos", line 11, in <module>
    sys.exit(main())
  File "/Users/$USER/anaconda/envs/paper-env/lib/python2.7/site-packages/pandoc_fignos.py", line 353, in main
    meta = doc[0]['unMeta']
KeyError: 0
pandoc: Error running filter pandoc-fignos
Filter returned error status 1
make: *** [ieeetex] Error 83

I believe the filter API has changed in the new version of Pandoc

Feature Request: Customizable "Figure" label

Hi,

Currently fignos transform the ![Some data.](img/plot1.png){#fig:data} to something like Figure 2.1.

However, we are now working on a Chinese version of our book, in which we prefer a localized label for word "Figure". e.g, in Chinese, it should be "图 2.1".

I had a look at related code, and it seems this is hard coded. But I am not a Pythoner at all so there might be a chance I missed something.

Is there a way now to specify the figure label to other text instead of "Figure"?

Thanks!

broken output for figures with spaces in filenames

EDIT: I'm on OS X & pandoc is installed via homebrew

I recently updated to pandoc 1.17.2 & pandoc-fignos master and notice that figures with spaces in their filenames are now broken.

The following markdown:

![(left) _Schotter_ Georg Nees 1969 (right) _Olympiad_ Lillian Schwartz 1971](figures/collaboration/Schotter and Olympiad.png){#fig:Schotter-Olympiad}

is generated into html:

<figure>
<img src="figures/collaboration/Schotter" alt="(left) Schotter Georg Nees 1969 (right) Olympiad  Lillian Schwartz 1971" id="fig:Schotter-Olympiad" /><figcaption>(left) <em>Schotter</em> Georg Nees 1969 (right) <em>Olympiad</em> Lillian Schwartz 1971</figcaption>
</figure>

and generating a pdf leads to errors:

pandoc: Could not find image `figures/collaboration/Schotter', skipping...

Clearly the spaces are currently not propagating through the filter. This was working fine a year ago.

As a test, I removed --filter pandoc-fignos from my pandoc build line and the images are linked correctly.

docx clickable references

hi

would it be difficult to implement clickable references in the docx format?
i assume this is not implemented or is it a bug (not clickable references)?

thanks!

Broken file encodings in utf-8

When using option --filter pandoc-fignos, the encoding of utf-8 file gets broken (the national characters are messed).

Below is sample code of source markdown file:


title: Tytuł
author: Dariusz Bobak
date: 2015
csl: c:\Users\deni\zotero\archeo\styles\harvard-polish-archaeology.csl
bibliography: c:\users\deni\documents\archeo\library.bib
...

Początek

Here you can see problems with polish national characters: zażółć gęślą jaźń
Lorem ipsum dolor sit amet, „consectetur adipiscing «elit». Maecenas at nisi ut sem imperdiet” malesuada. Sed sit amet dolor in ligula commodo accumsan nec et justo. Nunc et velit id libero venenatis vehicula. Pellentesque malesuada bibendum fringilla. Nunc pharetra ut metus (@fig:wykres) vitae semper (\autoref{fig:wykres}). Proin interdum, risus malesuada luctus fermentum, erat arcu tempus tellus, sed dictum quam magna sed quam. Vivamus accumsan id lectus a hendrerit. Etiam nibh turpis, molestie eget dapibus [@bisson_nineteenth_2000] ac, vestibulum nec risus.

Wykres klimatyczny, w którym pokazujemy mnóstwo ciekawych rzeczy. Na przykład, jak zmieniał się klimat bardzo dawno temu. {#fig:wykres}

Donec elementum dolor [@adams_bukk_2009] urna, in rhoncus sapien eleifend vitae. Donec dignissim lacus at tellus convallis, sit amet consectetur metus tristique. Donec nec odio ultrices, varius dui sit amet, sodales mi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent libero enim, bibendum eu odio imperdiet, finibus pharetra felis. Proin ut blandit est, in accumsan odio. Sed dolor quam, varius non massa vitae, volutpat maximus erat. Etiam lacinia vulputate est a sodales. Aenean nec volutpat leo. Nullam scelerisque turpis eget suscipit varius. Donec mi tortor, sollicitudin sed ligula id, hendrerit imperdiet lectus. Quisque ac tortor quis ligula imperdiet suscipit a sit amet sem. Aliquam erat volutpat.

Podrozdział pierwszego poziomu

Sed pretium sit amet magna eu tempor. Ut sagittis est et turpis fringilla, a ultrices ex lacinia. Vestibulum leo est, lacinia at egestas a, dignissim maximus velit. Integer nisl neque, fermentum eget congue ac, pulvinar a mauris. Praesent dolor nisi, semper non tortor eu, lobortis mattis nibh. Maecenas rhoncus lorem vel dapibus semper. Praesent vel dolor non velit aliquam scelerisque. Cras quis tincidunt lorem, ac consectetur sapien. Aliquam euismod justo sed leo fringilla pellentesque. Nunc accumsan ut lorem a aliquet.

Podrozdział drugiego poziomu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.