Thursday, April 29, 2010

Best bibtex blog entry

Pretty much you should simply ignore my blog and go to Yang Feng's blog which covers similar material.

In fact, his post regarding bibtex is very comprehensive and in particular takes care of details like the shortcite option when there are a long list of authors:

http://yangfeng.wordpress.com/2009/09/14/reference-sheet-for-natbib-usage/

Wednesday, March 31, 2010

Bib-It: Generate your own bst file

I really need to check this out
http://bib-it.sourceforge.net/

It apparently offers a friendly user-interface which allows you to generate your own .bst file. The .bst file then controls your bibtex files.

AstroNat: Bibtex for Astronomy Journals (extends to other Science journals)

Setup: I work in parasitology and many of the parasitology journals require submission of .doc files. I use a commercial software (GrindEq) to turn my .tex file to .doc. But I think Baker's code offers a free solution? (I haven't tried it out yet)

Baker has put together an interesting package of LaTeX, BibTeX and Perl software. I think that this is the goal:
1. You want to use the functionality of latex/bibtex
2. You are submitting to a journal which does not allow you to submit separate .tex and .bib files when they want your raw files (this happens with many science journals)

Baker's solution:
1. Do everything first with latex/bibtex functionality. Output .tex,.bbl file
2. The run a perl script on the .tex and .bbl file and output an electronic copy of your paper which you can submit.

Obvious Question: I haven't tried this out yet, so I don't know what the output file formats are?

Anyway here is his link:
http://ads.harvard.edu/pubs/bibtex/astronat/doc/html/astronat_toc.html

Additional side notes of interest. One topic that Baker covers is the max author command to control how many authors you display in your references before et al is used. This is extremely important when referencing biology articles which often involve 10^6 authors.

I plan to post on the question of max author in general.

Bibtex Tutorial, with bibpunct

Roberts provides a wonderful introduction (and more) to Bibtex
http://www.andy-roberts.net/misc/latex/latextutorial3.html

In particular, I am glad that he discusses the use of the function:
\bibpunct{(}{)}{;}{a}{,}{,}

Statisticians might be familiar with this, because you need to mess around with bibpunct to get the right citation format for JASA articles.

Latex: Online Tutorials

Roberts provides a wonderful set of latex tutorials. This is definitely one of the best I've come across:
http://www.andy-roberts.net/misc/latex/

R: lme and lmer Basic Functionality

This is just a quick reference to someone else's work. First of all the basics:
1. lme
http://stat.ethz.ch/R-manual/R-patched/library/nlme/html/lme.html
2. lmer
http://cran.r-project.org/web/packages/lme4/index.html

Professor Vardeman (Iowa State) has posted a very nice summary for the basic functionality of these functions. It is important to heed is warning that these functions are constantly under development (which is generally applicable to R).
http://www.public.iastate.edu/~vardeman/stat511/stat511.html
search for: lme() and lmer() Functionality (4/17/09)

Tuesday, March 30, 2010

Automatically Generating Bibtex Entries

There are number of helpful tools to automatically generate bibtex entries for easy inclusion in LaTeX articles. My favorite is mathscinet because of the option to batch convert records to bibtex entries.

Mathscinet is limited to mathematics and statistics journals for the most part and it is of course important to be able to get entries from science journals. I have found two options for interfacing with Pubmed to generate bibtex entries.

1.This option is nice you simply need to input a list of PMID's separated by commas and it generates the corresponding bibtex entries:
http://software.bioinformatics.uwaterloo.ca/med2bib/
2. Hubmed: http://www.hubmed.org/

The wikipedia article about bibtex is actually pretty good and it lists other sources for generating bibtex entries, I have not experimented with these.
http://en.wikipedia.org/wiki/BibTeX

Several journal websites allow you to download bibtex entries. In fact, I have come across at least one website which allows you to download an article's entire bibliography in bibtex form. I will start compiling a list of such websites and post it soon.

Monday, March 29, 2010

Latex: Commenting out a Figure

Sometimes it is helpful to typeset your documents without including the figures. For instance,
1. You want to share your .tex with someone but don't want to send them all of your eps figures.
2. You have one million figures in your document and this will allow you to compile it faster.

One solution is the following. You can use the ifthen package to comment out figures, by setting a global boolean at the head of your document.

Here are some latex details.

%Document Preamble
\usepackage{epsfig,graphicx, ifthen}

\newboolean{includefigs}
\setboolean{includefigs}{false} %true = show graphs or false = don't
\newcommand{\condcomment}[2]{\ifthenelse{#1}{#2}{}}

%Usage Example
\condcomment{\boolean{includefigs}}{
\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.4]{Fig.eps}
\end{center}
\vskip -0.2in
\caption{Fun with graphics}
\end{figure}

Saturday, March 27, 2010

Latex: Boldface greek letters

I always come up with a new hack for this. Anyway, here is a list that you can just copy and paste. In fact this shows a couple of ways to do it.

\usepackage{amsmath}
\newcommand{\bbV}{\mbox{\bf V}}
\newcommand{\bbZ}{\mbox{\bf Z}}
\newcommand{\bbX}{\mbox{\bf X}}
\newcommand{\bQ}{\mbox{\bf Q}}
\newcommand{\bH}{\mbox{\bf H}}
\newcommand{\be}{\mbox{\bf e}}
\newcommand{\bU}{\mbox{\bf U}}
\newcommand{\bW}{\mbox{\bf W}}
\newcommand{\bbA}{\mbox{\bf A}}
\newcommand{\bbB}{\mbox{\bf B}}
\newcommand{\bb}{\mbox{\bf b}}
\newcommand{\bR}{\mbox{\bf R}}
\newcommand{\bD}{\mbox{\bf D}}
\newcommand{\bC}{\mbox{\bf C}}
\newcommand{\bY}{\mbox{\bf Y}}

\newcommand{\bvarepsilon}{\boldsymbol{{\varepsilon}}}
\newcommand{\balpha}{\boldsymbol{{\alpha}}}
\newcommand{\bvarpi}{\boldsymbol{{\varpi}}}
\newcommand{\bbeta}{\boldsymbol{{\beta}}}
\newcommand{\bdelta}{\boldsymbol{\delta}}
\newcommand{\boldeta}{\boldsymbol{\eta}}
\newcommand{\bxi}{\boldsymbol{\xi}}
\newcommand{\bGamma}{\boldsymbol{\Gamma}}
\newcommand{\bgamma}{{\gamma}}
\newcommand{\bSigma}{\boldsymbol{\Sigma}}
\newcommand{\bLambda}{\boldsymbol{\Lambda}}
\newcommand{\bPi}{\boldsymbol{\Pi}}
\newcommand{\bpi}{\boldsymbol{\pi}}
\newcommand{\bzeta}{\boldsymbol{c}}
\newcommand{\btheta}{\boldsymbol{\theta}}
\newcommand{\bx}{\boldsymbol{x}}
\newcommand{\bc}{\boldsymbol{c}}
\newcommand{\bd}{\boldsymbol{d}}
\newcommand{\bX}{X}
\newcommand{\bZ}{Z}
\newcommand{\by}{y}
\newcommand{\bu}{u}
\newcommand{\bTheta}{\boldsymbol{\Theta}}
\newcommand{\bz}{\boldsymbol{z}}
\newcommand{\bB}{B}
\newcommand{\ba}{\boldsymbol{a}}
\newcommand{\bA}{\boldsymbol{A}}
\newcommand{\bV}{\boldsymbol{V}}
\newcommand{\bv}{\boldsymbol{v}}

Introduction and Promises of Things to Come

I often find myself forgetting little R, Matlab, or latex tricks. So why not post them on a blog in searchable fashion. I stole the name and idea from a fellow researcher:
http://atparwith.blogspot.com

I was also encouraged to share my little tidbits from my friend's comment:
You are such a fountain of eclectic useful tidbits!

I would have titled the blog "The eclectic eccentric," but that's a reference I assume no one would get.

I often come up with some hack solution to a problem. If you have a better idea, please let me know.