Raw LaTeX Citation Export for Multimarkdown

58 views
Skip to first unread message

Marsh

unread,
Feb 16, 2012, 6:27:02 PM2/16/12
to zoter...@googlegroups.com
I've taken the first step in what I hope will eventually behave like a
Zotero plugin for <a href="http://fletcherpenney.net/multimarkdown/">Multimarkdown</a>. I successfully downloaded and installed 
<a href="http://forums.zotero.org/discussion/5094/drag-and-drop-bibtex-cite/">Kramer's drag-and-drop BibLaTeX cite{} translator</a>.

All it does is allow the user to drag and drop a citation into
a LaTeX document, with the citation formatted as a BibLaTeX citation.
A typical citation looks like "\cite{buitelaar_zoning_2009}," where
the part in curly brackets is a "key" constructed according
to certain arbitrary rules.  

Multimarkdown will take a text file with a simple markup language
and translate it into LaTeX. Because it wants to preserve the
original text in the text file, Multimarkdown translates anything
that looks like raw LaTeX code into LaTeX commands that LaTeX will
process and have the formatted output look like the original. For
instance, it translates the above citation into
"extbackslashcite\{buitelaar\_zoning\_2009\}."

But I want to have Multimarkdown interpret the citation as raw LaTeX
code. The mechanism for doing so is to escape the code by putting it
within a HTML comment. Thus, instead of adding
"\cite{buitelaar_zoning_2009}" to the text file, I want to add
"&lt;!--\cite{buitelaar_zoning_2009}--!\&gt;". Making the changes to Kramer's
code was very simple. Where the original JavaScript code had:
<pre>
     Zotero.write("\\cite{"+citekey+"}");
</pre>
I simply substituted:
<pre>
     Zotero.write("&lt;!--\\cite{"+citekey+"}--&gt;");
</pre>
I installed Kramer's translator by first finding my Zotero data directory (Zotero > Preferences > Advanced > Show Data Directory on a Mac) and then digging down to zotero/translators and pasting Kramer's original .js file there. It worked exactly as advertised.

I then did the same thing with my modified version of Kramer's file. But when I try to find it in Zotero Standalone (Zotero > Preferences > Export > Default Output Format), Kramer's BibLaTeX-Cite translator appears in the drop-down list, but my MultiMarkDown-BibLaTeX-Cite does not.
 
This is my first crack at customizing a translator, so I'm quite the novice. Can anyone suggest what's wrong?

Marsh

unread,
Feb 16, 2012, 6:30:55 PM2/16/12
to zoter...@googlegroups.com
Sorry about the HTML in my original post. I copied it verbatim to this forum and didn't know if it would import the HTML or not. Is there any way I can edit the post?

P.S. Adam Smith suggested the problem might be a duplicate translator key. Where are translator keys documented, and how does one generate a unique key?

Dan Stillman

unread,
Feb 16, 2012, 6:41:46 PM2/16/12
to zoter...@googlegroups.com
On 2/16/12 6:30 PM, Marsh wrote:
> P.S. Adam Smith suggested the problem might be a duplicate translator
> key. Where are translator keys documented, and how does one generate a
> unique key?

http://www.zotero.org/support/dev/translators#metadata

adamsmith

unread,
Feb 16, 2012, 6:55:25 PM2/16/12
to zotero-dev
the easiest way to generate a unique translator ID would be to install
scaffold and have it generate one for you.
I don't know if/how you can test export translators with Scaffold -
otherwise the best way to find errors is to run debug and look at the
output:
http://www.zotero.org/support/debug_output

a duplicate ID would also show up in a simple error report, I believe.
Reply all
Reply to author
Forward
0 new messages