citejax: like MathJax, for citations

642 views
Skip to first unread message

Erik Hetzner

unread,
Jun 11, 2013, 10:07:38 PM6/11/13
to zoter...@googlegroups.com
Hi all,

Some of you may be familiar with MathJax. It is an javascript library
that allows people to embed LaTeX math in their HTML and have it
displayed properly in the browser. Basically, you include a javascript
file, and MathJax will then scan your HTML and LaTeX math embedded in
\( ... \) into rendered math. (See http://util.io/mathjax for a demo).

It occurs to me that it would be possible (and not too difficult) to
create something similar with citeproc-js, the Zotero server API (or
CSL-JSON files), and pandoc-style citations (for which I have created
a Javascript parser using pegjs). In this way, users could include a
Javascript file, and then write in their HTML files, for example:

<p>@DoeBook2005 [p. 30] says blah.</p>

<p>@DoeBook2005 [-@DoeArticle2006 p. 30; see also @DoeWhy2007] says blah.</p>

<p>@@bibliography</p>

And have this translated into:

<p>Doe (2005, 30) says blah.</p>

<p>Doe (2005; 2006, 30; see also Doe and Roe 2007) says blah.</p>

<h1>References</h1>
<div class="csl-bib-body container">
<div class="csl-entry container">Doe, John. 2005. <em>First Book</em>. Cambridge: Cambridge University Press.</div>
<div class="csl-entry container">———. 2006. “Article.” <em>Journal of Generic Studies</em> 6: 33–34.</div>
<div class="csl-entry container">Doe, John, and Jenny Roe. 2007. “Why Water Is Wet.” In <em>Third Book</em>, edited by Sam Smith. Oxford: Oxford University Press.</div>
</div>

The great thing about this approach is that it can work with *any*
blogging, content management, or HTML authoring platform. MathJax has
proven very popular with the math and scientific community. I think
that a MathJax like approach for citations and bibliographies for HTML
could be similarly popular in the general academic community.

Any thoughts?

best, Erik

Bruce D'Arcus

unread,
Jun 14, 2013, 5:13:24 PM6/14/13
to zoter...@googlegroups.com
I think it's an interesting idea, particularly from a kind of
marketing perspective. But the parallels between citations (simple
"rich text" rendering) and math (rather complex rendering
requirements) aren't entirely clear to me.

Bruce
> Sent from my free software system <http://fsf.org/>.
>
> --
> You received this message because you are subscribed to the Google Groups "zotero-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.
> To post to this group, send email to zoter...@googlegroups.com.
> Visit this group at http://groups.google.com/group/zotero-dev?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

Erik Hetzner

unread,
Jun 15, 2013, 11:13:43 AM6/15/13
to zoter...@googlegroups.com, Bruce D'Arcus
At Fri, 14 Jun 2013 17:13:24 -0400,
Bruce D'Arcus wrote:
>
> I think it's an interesting idea, particularly from a kind of
> marketing perspective. But the parallels between citations (simple
> "rich text" rendering) and math (rather complex rendering
> requirements) aren't entirely clear to me.

Hi Bruce,

Here’s my thinking. Before MathJax, if a user wanted math on their
site, they needed to pre-process LaTeX into images or HTML on the
server side. This meant that you needed a plugin for every web
platform. With MathJax, because the processing happens on the
client-side, it works with every publishing platform: all you need to
do is include a javascript file, put LaTeX or MathML on your page, and
any modern browser will render the math.

The same thing would be true of a client-side citeproc-js based
system. Right now, if you want to handle citations and bibliographies
on a web site, you need to use one of the few platforms that support
it. citejax would allow anybody to handle citations and bibliographies
on a web site without tying into their particular platform.

(Of course, this leaves open the question if traditional citations and
bibliographies are appropriate on the web ...)

I’m thinking now I should probably post this on the xbiblio-dev list
as well. I’m prepared to work on this (I don’t think an initial
version will be too difficult), but I’d like to get feedback if others
think it will be useful first.

best, Erik

Frank Bennett

unread,
Jun 15, 2013, 8:46:09 PM6/15/13
to zoter...@googlegroups.com, Erik Hetzner
Erik,

This is interesting!

It seems to me that a client-side solution has potential application for legal resources. There has been quite a bit of discussion recently about formats for storage, editing and publishing of primary and secondary legal documents, and it seems to me, at least, that this would fit right in to some of the solutions on the table. I've posted a note to the Legal Informatics group, with a link back here, and a pointer to xbiblio-devel. We'll see if it catches the eye of developers at the Sunlight Foundation and elsewhere.

  https://groups.google.com/forum/?fromgroups#!topic/legal-informatics-research-network/pRBEaGN7h7w

Frank

Thom Neale

unread,
Jun 15, 2013, 9:03:49 PM6/15/13
to zoter...@googlegroups.com, Erik Hetzner
I agree that drafting citations with markup is a step in the right direction, and whether the rendering happens client-side or server-side--or with one markup format or another--are implementation details. So I would totally encourage you to experiment with this.

Bruce D'Arcus

unread,
Jun 16, 2013, 9:45:10 AM6/16/13
to zoter...@googlegroups.com
Only substantive suggestion I would make is that it'd be nice if we
standardized on a markup, and that the one pandoc uses is probably the
way to go.

And, for example, I would think this ...

<p>@@bibliography</p>

... might be better as something like:

<div class="citejax bibliography"></div>

Bruce
> --
> You received this message because you are subscribed to the Google Groups
> "zotero-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to zotero-dev+...@googlegroups.com.
> To post to this group, send email to zoter...@googlegroups.com.
> Visit this group at http://groups.google.com/group/zotero-dev.

Bruce D'Arcus

unread,
Jun 16, 2013, 10:03:46 AM6/16/13
to zoter...@googlegroups.com
... though granted, my suggestion my not work well for a blogger.

Eric Mill

unread,
Jun 16, 2013, 10:46:54 AM6/16/13
to zoter...@googlegroups.com, Erik Hetzner
I wasn't familiar with MathJax, but it looks awesome. I suspect one of the reasons it's been so successful is that it takes a language that people working with math are probably already familiar with -- LaTeX -- and give them a way to plop it into the browser. (Though its output is just a bunch of divs and spans - it seems like it might benefit from producing the somewhat recent HTML5 math tags instead.)

I don't work with citations of this nature myself, but if the syntax you outline is already familiar to people who work with them regularly, this seems like a valuable direction. I'd make use of HTML5 citations to the extent you can - I'm having trouble Googling for them now, but actually I'd think there'd already be libraries out there to generate footnotes from citation tags.

On Tuesday, June 11, 2013 10:07:38 PM UTC-4, Erik Hetzner wrote:

Erik Hetzner

unread,
Jun 16, 2013, 12:36:26 PM6/16/13
to Eric Mill, zoter...@googlegroups.com
Hi Eric,

At Sun, 16 Jun 2013 07:46:54 -0700 (PDT),
Eric Mill wrote:
>
> I wasn't familiar with MathJax, but it looks awesome. I suspect one of the
> reasons it's been so successful is that it takes a language that people
> working with math are probably already familiar with -- LaTeX -- and give
> them a way to plop it into the browser. (Though its output is just a bunch
> of divs and spans - it seems like it might benefit from producing the
> somewhat recent HTML5 math tags <http://www.w3.org/wiki/HTML/Elements/math>
> instead.)

MathJax does have support for MathML [1] but it’s not generally
supported for display by browsers at the moment, as I understand it.

> I don't work with citations of this nature myself, but if the syntax
> you outline is already familiar to people who work with them
> regularly, this seems like a valuable direction. I'd make use of
> HTML5
> citations<http://rachaelmoore.name/posts/design/html/citing-in-html5-cite-attribute-and-cite-tag/>
> to the extent you can - I'm having trouble Googling for them now,
> but actually I'd think there'd already be libraries out there to
> generate footnotes from citation tags.

I think that depends on support from citeproc-js.

As for footnotes, we can use javascript to create footnotes on the fly
for footnote styles.

best, Erik

1. http://docs.mathjax.org/en/latest/mathml.html

Erik Hetzner

unread,
Jun 16, 2013, 12:37:46 PM6/16/13
to zoter...@googlegroups.com, Bruce D'Arcus
At Sun, 16 Jun 2013 10:03:46 -0400,
Bruce D'Arcus wrote:
>
> ... though granted, my suggestion my not work well for a blogger.

Yes, I think that we need something that can be supported in blog
comments or stackoverflow or similar systems.

best, Erik
Reply all
Reply to author
Forward
0 new messages