Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Thursday, February 7, 2013

Custom bibliographies

I've recently encountered in more than one occasion a publisher that will ask for references in a particular format (If there are three or less authors then all should be mentioned in the references but only one +"et al." in the text unless there are two, and if there are more than three then it must be the first three authors then "et al." in the references and only one +"et al." in the text).

This is the "prefered format" (as of now) in ADS, but I haven't found a bibliography style file (.bst) for Bibtex that meets that criteria. If you try to change your favorite .bst file, you'll find that it uses an odd language, and some people online might have some suggestions on how to change it, but I couldn't easily find how to edit it.

Instead I found a mention on an elusive package called makebst. After a couple of broken links I found it (via here).

Download it, unzip it, then run:

latex makebst.tex
It will then ask a great amount of questions for every possible situation. In my humble opinion this should be a file provided by the people in charge of editing the publication. But this information will be useful for those writing their own book (e.g. Thesis) and need their BibTeX output in a certain way.

As for the makebst.zip sadly I can't seem to be able to attach a file to this post, and as nothing is eternal, I don't know where to place it where it will be more reliable than the link already provided.

Sunday, September 9, 2012

Compiling LaTeX in gedit with one key

This might be useful for a very small niche, but just in case anyone else needs it, well I hope you land here.

The scenario is simple: You like using the popular gedit text editor for writing your latex presentations and papers (as I write this gedit is the default text editor in ubuntu and many other linux distributions related to GNOME). To see changes fast you want to have a keypress that will update the pdf file which you may have open in your favorite viewer (and love how you don't have to do anything for it to refresh automatically).

If you go to Tools > Manage External Tools, you can run your own commands by pressing certain keys. Using the Enviroment Variables that can be found in the documentation, you can write a simple little bash script that will run both latex and dvipdf with only one press key:




#!/bin/sh
TEXNAME=$GEDIT_CURRENT_DOCUMENT_NAME
DVINAME=${TEXNAME%".tex"}".dvi"
latex $TEXNAME
dvipdf $DVINAME


Note that to change the extension from .tex to .dvi I used the string DVINAME=${TEXNAME%".tex"}".dvi" thanks to root45 at askubuntu.com for this.
I was first compelled to use: ${$TEXNAME:0:${#texname}-3}"dvi" but this substitution is not accepted by gedit (although it's perfectly valid in bash).

So in the end this is how your external tool should look like:

After that well define the shortcut key, and the applicability only to LaTeX files. You may want to set the output to be displayed in the "Bottom Pane" to see errors when there are some. I just prefer to save screen space and if it doesn't update the document then I run these commands on a terminal to troubleshoot.