Pandoc: Support `\fullcite`, `\citeauthor`, `\citetitle` biblatex commands

Created on 29 Jul 2015  ·  15Comments  ·  Source: jgm/pandoc

I would like to report the issue that basic (and critical) biblatex commands are not converted from TeX > docx with pandoc. These commands are:

1. Creating a MWE with the following code in file pandoc.tex:

\documentclass{article}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{abc,
author = {John Doe},
year = {1970},
title = {Article Title},
journaltitle = {Journal Name},
volume = {1},
number = {2},
pages = {13--17},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
abcdefgh
ijklmnop
xyvwz

cite: \cite[Cf.][13--17]{abc}
Cite: \Cite[Cf.][13--17]{abc}
parencite: \parencite[Cf.][13--17]{abc}
Parencite: \Parencite[Cf.][13--17]{abc}
footcite: \footcite[Cf.][13--17]{abc}
footcitetext: \footcitetext[Cf.][13--17]{abc}
textcite: \textcite[Cf.][13--17]{abc}
Textcite: \Textcite[Cf.][13--17]{abc}
smartcite: \smartcite[Cf.][13--17]{abc}
Smartcite: \Smartcite[Cf.][13--17]{abc}
fullcite: \fullcite[Cf.][13--17]{abc}
footfullcite: \footfullcite[Cf.][13--17]{abc}
citeauthor: \citeauthor[Cf.][13--17]{abc}
Citeauthor: \Citeauthor[Cf.][13--17]{abc}
citetitle: \citetitle[Cf.][13--17]{abc}
citeyear: \citeyear[Cf.][13--17]{abc} 

\printbibliography
\end{document}

The commands are from the official biblatex manual http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf

2. Typed in command line:

pdflatex pandoc.tex
biber pandoc
pdflatex pandoc.tex
pandoc --bibliography=pandoc.bib -o pandoc.docx pandoc.tex

3. List of non-functional commands

Using pandoc 1.15.0.6 the following commands are not working (highlighted in bold):

  • [x] \cite
  • [ ] \Cite
  • [x] \parencite
  • [x] \Parencite
  • [x] \footcite
  • [x] \footcitetext
  • [x] \textcite
  • [x] \Textcite
  • [x] \smartcite
  • [x] \Smartcite
  • [ ] \fullcite
  • [ ] \footfullcite
  • [x] \citeauthor
  • [ ] \Citeauthor
  • [ ] \citetitle
  • [x] \citeyear

Could you, please, provide functionality for the missing biblatex commands? IMHO \citetitle, \footcite and \fullcite are pretty critical.

EDIT: Attached screenshots

4. Result in LaTeX

latex

5. Result from pandoc in DOCX

pandoc

high enhancement LaTeX reader

Most helpful comment

It would be nice to have an equivalent of \fullcite in markdown, though.

In a syllabus, e.g., you might want to use an author-date style in general, but still occasionally give the full details of a recommended textbook, or of the reading for a particular date _in the text itself_, like:

Blah blah blah. The recommended textbook for this course is:

Knox, Paul L., and Steven Pinch. 2006. _Urban Social Geography: An Introduction._ 5th ed. Harlow: Pearson/Prentice Hall.

Blah blah blah.

Since this would just have to _copy_ the entry that is being generated anyway for the list of references, this might not be too difficult.

As to syntax, we’d have to invent something; maybe a plus sign (+) before the @ would do, like [+@knox], or just +@knox.

Thoughts?

All 15 comments

These are very easy to add in general. You can see an example of how cite is implemented here.

Thanks @mpickering, though have no idea how to make a patch for this. Anybody can help with this?

Looked into the link you provided. While few of the citation formats are simply missing (i.e. they are easy to add), I could not figure out how to introduce the \citetitle command. Could somebody here have a look into this please?

If \citetitle prints the title of the citation, then
there's no way to do this with current pandoc-citeproc
architecture.

+++ DOFfactory [Jul 31 15 05:56 ]:

Looked into the link you provided. While few of the citation formats
are simply missing (i.e. they are easy to add), I could not figure out
how to introduce the citetitle command. Could somebody here have a
look into this please?


Reply to this email directly or [1]view it on GitHub.

References

  1. https://github.com/jgm/pandoc/issues/2335#issuecomment-126682366

Why not to add it? We have a bib(la)tex file, all the data are there ... Just as one calls the author, one should be able to call the title from the same file.

It would be a large change, including changes to the
underlying pandoc types. (We'd need to modify CitationMode,
which now includes AuthorInText, SuppressAuthor, and
NormalCitation to include something like TitleOnly. We'd
need to think about whether there was some natural
markdownish syntax for this. And we'd need to modify
pandoc-citeproc to handle the additional CitationMode.)

+++ DOFfactory [Aug 06 15 13:11 ]:

Why not to add it? We have a bib(la)tex file, all the data are there
... Just as one calls the author, one should be able to call the title
from the same file.


Reply to this email directly or [1]view it on GitHub.

References

  1. https://github.com/jgm/pandoc/issues/2335#issuecomment-128491850

@DOFfactory, it would help if you were more specific about what is "not working" in your list, and how.

\footcite and footcitetext do get parsed as citations in notes.

As I've indicated, \citeauthor and \citetitle can't be done without signficant changes in pandoc and pandoc-citeproc architecture. (Though we could parse them as regular citations, which would be better than doing nothing.) \fullcite is probably in the same boat, though I'm not really sure what it's supposed to do. \Cite should be easy enough to add.

Hi @jgm, I attached the screenshots. You are right, \footcite and \footcitetext does get parsed, my bad. \Cite should be also easily implemented.

What this ticket initially supposed to point out was that biblatex is getting to be used widely in the LaTeX-using community. It would be great if biblatex commands would be parsed straightforward in pandoc because, I believe, a big group this community (mostly from academia) will then use pandoc and markdown for conversion/writing.

I've implemented \Cite. Getting \fullcite, \citeauthor, and \citetitle would require major architectural changes in pandoc and pandoc-citeproc.

Many thanks! Since I do not have an expertise to re-write your pandoc-citeproc code either, I will leave this issue open as a reminder and future reference for others. It would be great to have fully implemented biblatex for the reasons mentioned above. Thanks again.

It would be nice to have an equivalent of \fullcite in markdown, though.

In a syllabus, e.g., you might want to use an author-date style in general, but still occasionally give the full details of a recommended textbook, or of the reading for a particular date _in the text itself_, like:

Blah blah blah. The recommended textbook for this course is:

Knox, Paul L., and Steven Pinch. 2006. _Urban Social Geography: An Introduction._ 5th ed. Harlow: Pearson/Prentice Hall.

Blah blah blah.

Since this would just have to _copy_ the entry that is being generated anyway for the list of references, this might not be too difficult.

As to syntax, we’d have to invent something; maybe a plus sign (+) before the @ would do, like [+@knox], or just +@knox.

Thoughts?

Since @ref gives the author's name, [@ref] the actual reference, then maybe "@ref" is a good syntax for the title (i.e. citetitle)?

For others following this issue, I have found a work-around that might suit your purposes (e.g. writing syllabi like @dbosk). You can trick Pandoc and CSL into rendering full citations in-text (ala \fullcite) throughout the whole document by doing the following:

  1. Choose a CSL file that writes full citations in footnotes.
  2. Change class="note" to class="in-text" in the XML's root <style> element.

CSL makes such a strong distinction between in-text and (foot)note styles that apparently changing that class attribute will change one to the other (see cs:style in the CSL spec). Unfortunately it's all or nothing, though.

The Zotero CSL repository has several full-note styles. I've tried this with
Chicago 17th Edition (full note) and Chicago 17th Edition (full note, short title subsequent), and it seems to work just fine.

I generated the following using the Chicago short-title-subsequent CSL.

Input:

> Lorem ipsum let's say I'm in the middle of my text and I want a full citation to an IoT paper:
>
> @Bittencourt2018IotFogAndCloud
>
> Now another one:
>
> @AbdelBaky20178ComputingInTheContinuum
>
> Now back to the first again for a short title:
>
> @Bittencourt2018IotFogAndCloud

Command (the inline sed command makes the class change on the fly as the CSL file is fed into Pandoc):

pandoc --filter pandoc-citeproc \
    --bibliography syllabus.bib \
    --csl <(sed '2s/class="note"/class="in-text"/' \
            chicago-fullnote-bibliography-short-title-subsequent.csl) \
    -M suppress-bibliography=true \
   demo.md --to gfm -o demo-out.md

Output:

Lorem ipsum I'm in the middle of a syllabus table...

Luiz Bittencourt et al. "The Internet of Things, Fog and Cloud Continuum: Integration and Challenges," Internet of Things 3-4 (2018): 134--55, https://doi.org/https://doi.org/10.1016/j.iot.2018.09.005.

M. AbdelBaky et al. "Computing in the Continuum: Combining Pervasive Devices and Services to Support Data-Driven Applications," in 2017 Ieee 37th International Conference on Distributed Computing Systems (Icdcs), 2017, 1815--24, https://doi.org/10.1109/ICDCS.2017.323.

Here is a repeated citation with the short-title form:

Bittencourt et al. "The Internet of Things, Fog and Cloud Continuum."

This isn't a full solution because it's so all-or-nothing and can't be chosen on a per-citation basis, but it's useful for me and I thought I'd share.

Very useful indeed, thanks for sharing! Sent from my less-usable device-------- Original message --------From: Mike Murphy notifications@github.comDate: Fri, 21 Feb 2020, 19:14To: jgm/pandoc pandoc@noreply.github.comCc: dbosk dbosk@kth.se, Mention mention@noreply.github.comSubject: Re: [jgm/pandoc] Support \fullcite, \citeauthor, \citetitle biblatex commands (#2335)For others following this issue, I have found a work-around that might suit your purposes (e.g. writing syllabi like @dbosk). You can trick Pandoc and CSL into rendering full citations in-text (ala \fullcite) throughout the whole document by doing the following:
Choose a CSL file that writes full citations in footnotes.Change class="note" to class="in-text" in the XML's root