1

So I've recently started using pandoc on windows system for linux (WSL) to generate PDFs. I have come across an odd problem where pandoc-citeproc fails to create the proper in-text references for figures, stating instead that pandoc-citeproc: reference fig:figure5a not found

Inside markdown, I state the images using:

![captions here](../resources/figure5a.pdf){#fig:figure5a width=90%}

and refer to the images using:

[@fig:figure5a]

Can anyone give me advice about what's going on? it works when pandoc is called through ubuntu os instead of wsl. Also, pandoc is v2.7, and pandoc-citeproc is v0.16.1.1.

SNTag
  • 87
  • 8
  • 1
    Are you perhaps confusing pandoc-citeproc with pandoc-crossref? – John MacFarlane Mar 05 '19 at 16:50
  • others thought the same, but pandoc-citeproc is the only error that comes up. i can't figure it out if its a pandoc-crossref due to difficulties with it. – SNTag Mar 08 '19 at 13:53

1 Answers1

3

So with the emerging deadline for my thesis, I figured it out: I'm using pandoc scholar and a makefile to direct file creation. I haven't figured out all the details, but there is something pandoc scholar which is calling citeproc. Now as citeproc and crossref use similar notation, crossref needs to be called first (which I cannot seem to make happen because, again, some line somewhere in pandoc scholar)

Solution: In the makefile, call crossref followed by another citeproc call. It is still throwing up errors from the first citeproc call, and takes a little longer, but it works.

edit: some words

edit 2: Here is an example of what I did. Note that I have the line FILTERS = XXXXXX repeated twice. once at the start, and again after declaring details like ARTICLE_FILE, BIB, PDFENGINE. probably not the best approach, but it works, and I ain't fixing my thesis after submission!

TEMPLATE = uni-thesis

FILTERS = --filter pandoc-crossref --filter pandoc-citeproc  --lua-filter=short-captions.lua

EXTENSIONS := simple_tables+table_captions+yaml_metadata_block+smart

PDFENGINE=pdflatex

## CSL stylesheet (usually located in ~/.csl)
CSL = elsevier-harvard-thesis

ARTICLE_FILE        = THESIS-name.md
OUTFILE_PREFIX      = THESIS-name
DEFAULT_EXTENSIONS  = pdf
BIB   = ../citations.bib
PDFENGINE=pdflatex

FILTERS = --filter=pandoc-crossref --filter=pandoc-citeproc  --lua-filter=short-captions.lua

EXTENSIONS := simple_tables+table_captions+yaml_metadata_block+smart
PANDOC_LATEX_OPTIONS  = --pdf-engine=$(PDFENGINE)

LUA_FILTERS +=  $(LUA_FILTERS_PATH)/pagebreak/pagebreak.lua

OS := $(shell uname)
SNTag
  • 87
  • 8
  • 1
    Maybe you can add 2 lines showing the example of such calls, for future readers :) – Andreas DM May 15 '20 at 16:36
  • Thank you. In my case, I was using pandoc-xnos to cross reference equations, and I had to do exactly what you said: call pandoc-xnos before `citeproc`. So I had: `pandoc --citeproc --filter pandoc-xnos Thesis.md -o Thesis.html` and instead I needed: `pandoc --filter pandoc-xnos --citeproc Thesis.md -o Thesis.html`. – alelom May 17 '22 at 19:14