# Pandoc citeproc not recognizting pnfmt{}

Situation:

• I'm converting from .tex to .docx (for collaboration purposes...) using pandoc.
• Because I use a lot of citations with "emphasis added" (using authordate) I am using pnfmt{}to apply the field format only to the page numbers. This is explained on texse here.

So, many of my citations look like this:

First citation \autocite[382]{sigfridsson1999}
Second citation \autocite[\pnfmt{382}]{sigfridsson1999}
Third citation \autocite[\pnfmt{382}, emphasis added]{sigfridsson1999}



Using pandoc,

pandoc --bibliography=references.bib --citeproc -o out.docx main.tex


I get the proper output on the first citation, but not on the second and third:

First citation (Sigfridsson, 1999, p. 382)

Second citation (Sigfridsson, 1999)

Third citation (Sigfridsson, 1999, emphasis added)

Any way to get pandoc to recognize the \pnfmt{} and print the page number in the 2nd and 3rd citation?

• If this works correctly when you compile with LaTeX, then it stands to reason that the "problem" is on the pandoc/citeproc side. I suspect they simply don't know \pnfmt, which is fairly new. It is probably worth reporting this to the maintainers so they can consider adding supporting \pnfmt (if they think that would be useful, the semantics of \pnfmt might be a bit weird, because it is essentially a trick to work around biblatex's auto-formatting features). May 8, 2021 at 11:23
• Yeah, it is an issue on the Pandoc side. @ DG' s answer below seems to work fine as a workaround and for the occasional compile to docx it should be enough. :) Havent tested @Marijn's longer answer yet. Just thought to give everybody in the other thread a heads up as well, in case they are including some pandoc in their workflow. May 8, 2021 at 19:33

Pandoc can parse your own definitions, adding the dummy \renewcommand\pnfmt[1]{#1} somewhere in your document (you could add a file that contains the line with the option --include-in-header=FILE) should do the trick.

There are probably better ways, but an easy workaround could be to (re)define \pnfmt in the document itself to let Pandoc/citeproc use that definition. Of course this means that you do not get the usual processing of \pnfmt that handles all different cases, but for sharing the document with a collaborator that may not be such a big problem as long as you produce the end result with LaTeX (in which case you need to remove the redefinition again).

MWE:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear-ibid, ibidpage]{biblatex}