How to export pdf with references

Hi everyone,

l am using Zotero Integration and pandoc-reference-list to manage my citation. As below image shows, the reference can be displayed on the right side of obsidian.
But after l export the note as pdf, all the references lost.
How can l keep the references with pdf? Could someone help me? Thanks!

You will need to compile the PDF also using Pandoc (see Pandoc documentation and following pages). That, in turn, requires a working installation of Latex. A single pandoc command with the appropriate options — which, however, could instead be specified in the YAML header of your Obsidian markdown document — will then convert the markdown to Latex code, and automatically invoke Latex to create the PDF.

I do not know whether a plugin for Obsidian is available for this.

As @vanadium says, you would need to compile the PDF. This is because the Pandoc Reference plugin only gets the info from Zotero to show it in the sidebar, it doesn’t actually do anything with the info. I played around with Pandoc for a while, but could never get it to work right, so I switched over to a LaTeX workflow, where I hit a command in Obsidian, and it then compiles my Obsidian note to a PDF via LaTeX, with the citations and bibliography baked in. However, depending on what OS you’re on, and whether you’re comfortable with LaTeX, this might not work for you. I can share more info if you’d like though.

Thanks you very much.
l used LaTex for a while.
So does you mean l should covert my literature note from markdown to Latex format?
l have installed Quick_Latex, and am exploring how to use it in Obsidian. l only used latex in overleaf. lt seems a bit different in Obsidian.
Hope you share more info about how to compiles Obsidian note to a PDF via LaTeX, keeping the citations and bibliography.

There are some misconceptions in the responses here.

  1. Pandoc Reference List can actually do some of what you are trying to do (render citations in the built-in PDF export). You don’t have to use Pandoc, although you might still want to for other reasons.

Here’s a demo:

Source mode:

Live preview:

Regular PDF export

I suppose the reason it’s not working for you is because you haven’t enabled the render feature in Reading mode:

Or alternatively, there’s some issue with your citekeys.

However, Pandoc Reference List doesn’t include the reference list, so you’ll have to use copy button at the upper right of the reference list and then paste it at the end of the document, if you want to avoid Pandoc. I missed that this was your main issue when first commenting.

This has some obvious drawbacks compared to Pandoc, which is one step, once you’ve set it up.

  1. That’s also what Pandoc does, so I’m not sure what you are doing differently.

Pandoc setup

I recommend the Enhancing Export plugin for interacting with Pandoc. You’ll have acquire a citation style, if you haven’t already.

To make Pandoc work in an academic context, you need to provide three arguments:

  1. --citeproc
  • This tells Pandoc to convert the citekeys into formatted citations, and to make a bibliography at the end of the document.
  1. --bibliography
  • This specifies the path to a file containing the bibliographic metadata necessary for step 1. You export this from a reference manager like Zotero.
  1. --csl
  • This tells citeproc which citation style to use when formatting the citations and bibliography. This can be a path to a CSL file or a URL pointing to the same. You’ll find these in the link above on citations styles. If you use the URL option, and the CSL file is hosted on Github, remember to get the link to the “raw” file.

These arguments all go into the Extra arguments field in the settings of Enhancing export. Note that each export format (like PDF or docx) has its own settings.

1 Like

l open the render feature in Pandoc Reference List.

The source mode:

Live preview:

The PDF export:

My problem is to export the bibliography with the citation. Currently, the pdf lost the bibliography. Does pandoc can do it?

OK, apologies, then I misunderstood what the References plugin does. But in @yl99 's case I don’t think it was just about rendering the citation, but the bibliography at the end, no? However, if at all possible, try using @Feralflora 's solution, because I’m not sure how to explain my method. Also, I’m using Linux Mint, so again, this might not work for you.

Eitherway, I’m not very good at this, I just put things to the test, till something works, and I couldn’t get Pandoc to work right at the time, or rather, on its own. I don’t remember exactly, but it was something about converting directly from .md to .pdf that I couldn’t figure out, if I wanted the citations and bibliography to be rendered in my specific way. So I added the LaTeX step, where I have a LaTeX template.

More explicitly:

  1. Install GitHub - Taitava/obsidian-shellcommands: Execute system commands via hotkeys or command palette in Obsidian ( Some automated events are also supported, and execution via URI links. in Obsidian (via the plugin manager)
  2. Create a LaTeX template. I won’t go into too much detail here, as there’s lots of info out there. It’s just important that you have the command \addbibresource{path/to/bib-file/} in there somewhere, so LaTeX knows where to look for the citation info. And you need something like \usepackage[authordate,autocite=footnote, cmsdate=both, backend=biber, isbn=false, noibid, url=false]{biblatex-chicago} to tell it which citation style you want to use.
  3. In the Shell Commands options menu create a new Command, and add in something like this:
mkdir -p /path/to/Output/folder/{{title}}
pandoc  -f markdown-blank_before_blockquote-auto_identifiers -w latex {{file_path:absolute}} -o /path/to/Output/folder/{{title}}/{{title}}.tex \
--template=/path/to/template/default-template.tex \
gnome-terminal -- bash -c "cd /path/to/Output/folder/{{title}}/{{title}}.tex && latexmk -pv- -pdflua < /dev/null && latexmk -c && exit; exec bash"

First, this creates a folder in the Output directory, with the name of the note you want to convert. Then it converts the .md file into a .tex file, and while rendering the .tex file it also creates a .pdf file. And this PDF should have the citations and the bibliography in it, if everything worked right. However, this uses gnome-terminal which is a Linux terminal. So again, if you’re using a different OS, e.g Windows, this won’t work.

You then need to trigger the shell command (e.g. via the command pallet, by default via Ctrl+P) while a note is active.

People who know more about this than me, please help me clarify this process.
Hope this helps

Right, I missed that the main issue was the bibliography, not the citations. I edited my comment to reflect this, and added some instructions for setting up Pandoc.

Notice that you are still using Pandoc from the terminal. By default, Latex is the intermediary format between the input and a PDF output by Pandoc. Latex itself is not the main program doing the conversion, it’s just used by Pandoc to typeset the PDF.

You’re right, but through my LaTeX template I’m able to tell Pandoc exactly what format of citations and bibliography it’s supposed to use. This way works best for me :slight_smile:

1 Like

Hi Feralflora, sorry to reply lately, l follow your guide.
l set the Extra arguments in Enhancing export plugin as below image:

Extra arguments is

pandoc "D:/" --citeproc --csl "D:/" --bibliography "D:/" -o "D:/"

but it failed to export . The error promopt is that
pandoc is not recognized as an internal or external command, operable program or batch file
l think there are something wrong with pandoc plugin.

According the guide in pandoc ,l type Get-Command pandoc in powershell, but it seems pandoc is not recognised.

Maybe one bug with pandoc, l uninstalled the pandoc in obsidian, and downloaded it directly from github, still in vain.

l guess my pandoc path should be below, l am not very sure. Should l set environment variable? Hope you share more experience.