iandol / scrivomatic

A writing workflow using Scrivener's style system + Pandoc for output…
https://iandol.github.io/scrivomatic/
GNU General Public License v3.0
297 stars 30 forks source link

use Pandoc citeproc to convert [@citekey] to \cite{citekey} instead of hyperlink #40

Open bbchen opened 3 years ago

bbchen commented 3 years ago

In the workflow, pandoc citations [@citekey] are converted to something like this in LaTeX:

"Sint meis quo et, vis ad fæcete dolorem! Ad quøt moderatius elaboraret
eum(Crivellato \& Ribatti \protect\hyperlink{ref-crivellato2007}{2007}),
pro paulo ridens quaestio ut. 

Is it possible to convert [@citekey] to latex \cite{citekey} instead?

Thank you!

iandol commented 3 years ago

Hi @bbchen, by default I always use Pandoc's citeproc engine to generate the formatted references, not BibLaTeX. You will see that the reference itself is already formatted. The hyperlink comes from the setting link-citations (see here for documentation). citeproc handles everything I and many other users need, so unless there is a formatting requirement CSL cannot fulfill, it is worth sticking to its use.

If you prefer to use Bib[La]TeX then you have to disable Pandoc's citeproc engine (doc here) in the metadata and enable the BibLaTeX transformation (biblatex or natbib depending on your workflow). To do that:

      citeproc: false
      biblatex: true

You can edit pandocomatic.yaml directly, or add this to your Scrivener front-matter YAML to override the pandocomatic template. In my pandocomatic templates, I use [refs] as generic settings and then add them to my output types like [latex-refs] or [docx-refs]:

https://github.com/iandol/dotpandoc/blob/master/pandocomatic.yaml#L28

Adjust this as required for your preferences...

bbchen commented 3 years ago

Thank you so much for your very detailed answers. That solved my problem. citeproc works well for me, but sometimes I will need to work with collaborators using overleaf and they prefer bibtex.

Thanks again for the workflow. I have used Scrivener with your Scrivomatic to write a few proposals and manuscripts already.