Closed paul-kelleher closed 2 years ago
I discovered the problem (or at least how to work around it). I can convert md to pdf with perfect section crossrefs if my YAML includes "numbersections: true" with "numbersections" written without camel case. But in order to convert md to docx without receiving an error when opening up the docx, I must write "numberSections" using camel case.
The reason I didn't have a problem a few weeks ago is that this Youtube video (which should start at 3m54s) warned me that the Pandoc-crossref documentation seemed to be mistaken in calling for camel case. I think what I've discovered is that, for some reason, camel case is required for docx, but must be avoided for pdf.
That YouTube video is wrong... numbersections
works with LaTeX output due to a chain of coincidences. What you're supposed to use is --number-sections
command-line switch. Pandoc-crossref uses numberSections
, but LaTeX is special in that numbering is offloaded to LaTeX, so pandoc-crossref's numberSections
doesn't affect LaTeX output.
Ah, Ok. So if I'm following, you're saying: Whether you're moving from md to pdf or md to docx, you should use the --number-sections
command-line switch.
I just tried that (after removing any reference to numbering sections from my YAML header), and it worked for both pdf and docx output. Thanks!
Whether you're moving from md to pdf or md to docx, you should use the --number-sections command-line switch.
With LaTeX, you have to use --number-sections
. With docx, you have an option of numbering sections with pandoc-crossref (via numberSections
metadata option) instead of --number-sections
. That said, pandoc-crossref's numberSections
option was introduced primarily for output formats where --number-sections
doesn't work or when you need to do something non-standard (which is relatively straightforward with LaTeX via header-includes
, but not necessarily so with other formats)
Thank you!
Despite not having this problem a week or so ago, I've just noticed that pandoc-crossref for some reason is not working when I use pandoc to convert markdown to pdf. But it is working fine when I use pandoc to convert the same markdown to docx.
MWE:
This gives the following for docx using "pandoc test.md --filter pandoc-crossref --citeproc --bibliography=bibliography.bib -o output.docx":
But gives this for pdf using "pandoc test.md --filter pandoc-crossref --citeproc --bibliography=bibliography.bib -o output.pdf":
Like I said, this wasn't happening a week or so ago. I've tried using all the versions of pandoc-crossref I've used in that time period, and none work. I know this is bizarre. Any idea what might be going on? Thanks so much, and sorry if I'm doing something wrong!