First, you need a bibtex bibliography, and the bibtex tool somewhere that texmacs can access it - I run TeXmacs under Cygwin so I need the Cygwin version of bibtex, not just the windows version.
Next, you can't use the TeXMacs bibliography tools unless there are no spaces in the paths to either your document or your bibliography. So save copies in some appropriate location - for me: C:/cygwin/tmp.
Now, choose the TeXMacs menu option Text->Automatic->Bibliography to insert your bibliography. TeXMacs will ask you for
(1) the bibliography style; type in "plain" for the moment.
(2) the path to the bibliography file. Under Cygwin it's a "unix-style" file path like /cygdrive/c/tmp/biblio.bib
Next use Insert->Link->Citation to put in citations. You will get a cite tag like this: . Fill it in with the bibtex key of your citation. You can see this key in your bibtex manager, or in the raw .bib file. Here's an example with the key highlighted in red:
@ARTICLE{benoit_models_2004,
author = {Kenneth Benoit},
title = {Models of electoral system change}}
Now use Document->Update->Bibliography and you should see your bibliography be filled in with a citation. You will probably also see something like "[1]" where your citation is.
So far so good. If you want to do author-date referencing... unfortunately it gets more complicated.
First, you will need the new cite-author-date.st TeXMacs package file. If you have this already, use the menu option Document->Add package->Customize->cite-author-year. If this option doesn't exist, try getting it from here and putting it in /usr/share/TeXMacs/packages/customize (or the equivalent on your system - your mileage may vary).
Your troubles are not yet over. To use this correctly, you need to get the plainnat.bst style file and put it in your $HOME/.TeXMacs/system/bib directory. This is a bibtex style file and can be found all over the web, e.g. here. Now, change your bibliography in your TeXMacs document to use "plainnat" style. Probably simplest just to delete your old Bibliography and put the new one in.
Now you should be able to type \cite-author[return]bibtex_key and get an author citation, or \cite-year[return]bibtex_key and get a year citation. One warning - sometimes you will need to run Document->Update->Bibliography twice before you see your citations properly; and sometimes you will need to update the citations themselves e.g. by putting the cursor in front of them and hitting [backspace]
But if you are like me you want more - you'd like a single command to put in "(Author year)" or "Author (year)". Maybe there's a way to do this with standard TeXMacs tools, but this way works for me:
Go to Document->View->Edit source tree so you can see the beautiful raw TeXMacs code of your document. Now enter this at the start of your document:
<assign|caby|<macro|x|<cite-author|x>(<cite-year|x>)>>>
<assign|cay|<macro|x|<cite-author|x><cite-year|x>>>
<assign|cbay|<macro|x|(<cay|x>)>>
Unfortunately, you can't type this in verbatim AFAIK - you have to type \assign[return]caby to type in assign, similarly for macro and cite-author etc., type alt-right before the first x's, and type alt-# before inserting the second and third x's. (If this sounds insane, it is - see the Texmacs help on writing style files. There's probably an easier way to do this.)
If you have done this right, you can go back and uncheck Edit source tree. You should now be able to type
\cbay[return]bibtex_key and get a nice (Author year) citation; while
\caby[return]bibtex_key gets you Author (year).
I guess all of this reads like a kind of propaganda post for Scientific Word. The fact is TeXMacs has terrible usability - sorry, Joris - but it still has the ONLY mathematical word processor that I can use fast enough for it to be intuitive. So until LyX lets me define keyboard shortcuts the way I like, I'm stuck with it.
Thanks! starting to use TeXmacs for presentations. This might work for me.
ReplyDelete