I'm trying to make a document with Markdown
/restructuredText
which will be converted with pandoc
to PDF using xelatex
.
I would like to return reference to figure and tables numbers in the text body.
In both Markdown and reSt markup languages, the cross reference return a link to the figure but not the figure number.
for example [the figure](#myfig)
with markdown or myfig_
with reST links to the figure but don't automaticly update the figure number.
Is it possible with Markdown or ReST markup languages to refer to figure and tables number?
Pandoc is a tool that runs from the command window or Linux shell to convert a markdown file to another file format. For this workflow, with the use of an appropriate CSS is available to help convert HTML, PDF, DOCX, and EPUB. You can also use your own or discovered CSS as well.
An extension can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION . For example, --from markdown_strict+footnotes is strict Markdown with footnotes enabled, while --from markdown-footnotes-pipe_tables is pandoc's Markdown without footnotes or pipe tables.
Some Pandoc templates for an article in PDF (vita LaTeX), HTML, or Microsoft Word. These go in ~/. pandoc/templates . These can be be pointed to directly with the --template= switch as appropriate.
Generating PDF from Markdown with Pandoc There are actually two steps involved in converting a Markdown file to a PDF file: The Markdown source file is converted to a LaTeX source file. Pandoc invokes the pdflatex or xelatex or other TeX command and converts the . tex source file to a PDF file.
I suggest using the pandoc-crossref filter with pandoc.
The demo gives you a good idea of the syntax. You invoke it by calling pandoc with --filter pandoc-crossref
.
The pandoc-fignos and pandoc-tablenos filters from the pandoc-xnos filters suite are good choices for cross-referencing in markdown with pandoc.
To mark a figure for numbering, add an identifier to its attributes:
![Caption.](image.png){#fig:id}
To reference the figure, use @fig:id
.
Similarly, to mark a table for numbering, add an identifier to its attributes:
A B
- -
0 1
Table: Caption. {#tbl:id}
To reference the table, use @tbl:id
.
When processing the markdown document, simply add --filter pandoc-fignos --filter pandoc-tablenos
to the pandoc
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With