Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline bibliographies in pandoc markdown #931

Closed
jgm opened this issue Jul 31, 2013 · 10 comments
Closed

Inline bibliographies in pandoc markdown #931

jgm opened this issue Jul 31, 2013 · 10 comments

Comments

@jgm
Copy link
Owner

jgm commented Jul 31, 2013

It might be nice to allow bibliography entries to be specified inline in pandoc markdown, in a YAML format that duplicates citeproc JSON. (See here.)

Not quite sure what the syntax would be, and we might need to change the citation parsing so it doesn't assume that we already have the citation list in state.

@jgm
Copy link
Owner Author

jgm commented Jul 31, 2013

Some claim [@fenner2012a].

---
references:
- id: fenner2012a
  title: One-click science marketing
  author:
  - family: Fenner
    given: Martin
    orcid: 0000-0003-1419-2405
  container-title: Nature Materials
  volume: '11'
  URL: 'http://dx.doi.org/10.1038/nmat3283'
  DOI: '10.1038/nmat3283'
  issue: '4'
  publisher: Nature Publishing Group
  page: 261-263
  type: article-journal
  issued:
    date-parts:
    - - 2012
      - 3
---

@mfenner
Copy link

mfenner commented Jul 31, 2013

John, I was thinking about proposing this idea to you when I wrote the blog post you link to yesterday :). Although I'm not so sure I would differentiate top vs. bottom. For documents with a small (e.g. not more than 5) number of citations citeproc YAML in the top of the document might also work.

@jgm
Copy link
Owner Author

jgm commented Jul 31, 2013

Yes, I think that if we made the references metadata item special,
then it wouldn't really matter if it came at the top or the bottom.
But I'm thinking that authors normally want their content to start
as close to the top as possible, and the bibliography entries are
long.

Currently YAML metadata blocks are only parsed at the top of the
document (which makes them easy to find by external tools), but that
could be relaxed.

Another issue is formatting. Pandoc will interpret markdown in YAML
metadata (except in specially marked fields, ending in an underscore).
But I'm not sure how to convert formatted text to citeproc JSON.
For example, what if you have a title with an italicized word in it?
Or some LaTeX math (a common use case)?

@mfenner
Copy link

mfenner commented Aug 1, 2013

Citeproc-js (I don't know about citeproc-hs) supports a minimal set of markup (b, i, sc, sub, sup) within titles: http://citationstyles.org/downloads/upgrade-notes.html#rich-text-markup-within-fields

I don't know how Citeproc handles LaTeX math.

@rmzelle
Copy link

rmzelle commented Aug 1, 2013

That CSL documentation is slightly outdated. While citeproc-js still supports the <sc/> tag for small-caps, the preferred markup is now <span style="font-variant:small-caps;"/>. See http://www.zotero.org/support/kb/rich_text_bibliography

(it took months to convince Bruce D'Arcus that it would be a good idea to support (non-semantic) inline formatting, and while citeproc-js supports it, it never made it into the spec; another reason is that the CSL spec is rather oblivious about metadata input formats (which can be considered a good thing))

I'm pretty sure citeproc-js doesn't process LaTeX math. I can't recall any discussions on the topic either.

@jgm
Copy link
Owner Author

jgm commented Aug 2, 2013

I'm pretty sure citeproc-js doesn't process LaTeX math. I can't recall any discussions on the topic either.

This should be discussed, I think. Mathematicians (among others) often have formulas in the titles of their articles. They'll never be convinced to switch from bibtex to CSL if it lacks good mathematics formatting capabilities.

@rmzelle
Copy link

rmzelle commented Aug 2, 2013

Feel free to bring this up at https://lists.sourceforge.net/lists/listinfo/xbiblio-devel .

Are there any small open source libraries for processing snippets of LaTeX math that you're aware of?

@jgm
Copy link
Owner Author

jgm commented Aug 2, 2013

There is my texmath, which converts LaTeX math to MathML and Word equation objects. This probably wouldn't be much help in a javascript project, though, since it's in Haskell. It includes a cgi script, though, which one could call from javascript.

@jgm
Copy link
Owner Author

jgm commented Aug 25, 2013

I've made significant progress on this.

I've started to decouple citeproc from pandoc. The new pandoc-citeproc package (currently only on github) includes an executable, pandoc-citeproc, which works as a pandoc filter. Using the dev version of pandoc, you use it like this:

pandoc --filter pandoc-citeproc input.md

Here input.md is assumed to have csl and bibliography or references in its metadata. bibliography species an external file; references is a list of YAML references right in the document. With this setup, @mfenner 's example above works!

The pandoc-citeproc package also includes an executable, mods2yaml, that converts from MODS to a YAML format suitable for inclusion in pandoc documents. This should make it fairly easy to switch from using external bibliographies to including the bibliographic information directly in pandoc markdown files.

@jgm
Copy link
Owner Author

jgm commented Aug 25, 2013

Correction: the sample above doesn't work as is; one needs to change the date part as follows:

issued:
  year: 2013
  month: 3

Also, orcid is currently ignored, as it isn't a filed in citeproc-hs's representation of a Reference.

@jgm jgm closed this as completed Sep 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants