Tuesday, 31 March 2009

Bash extract function

Extract function for bash. Put in .bashrc


function extract() # Handy Extract Program.
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

Friday, 27 March 2009

epstopdf

It's epstopdf joe not eps2pdf

Fixing backspace on edred vim

To fix the backspace key on the vim on edred add this to .vimrc

set backspace=indent,eol,start

Thursday, 26 March 2009

latex figures

To get rid of strange behaviour in latex where it does weird things with figure numbers its has to be done in a strict order.

\begin{figure}
\begin{center}
\includegraphics{...}
\end{center}
\caption{...}
\label{...}
\end{figure}

I think caption can go above \begin{center} but it must be outside of the centre section

Gnuplot PDF+Latex files

To create a pdf file from gnuplot with latex text do the following:

In the plot use the terminal:
set terminal epslatex


Then convert the eps to a pdf file.

Include the figure using
\input{figure.tex}

Wednesday, 25 March 2009

Printing variables from gnuplot to a file

To output variables such as fitting parameters from gnuplot use.
set fit errorvariables # creates a_err type variables for fitting errors
set print "tmp.dat"
print a,a_err,b,b_err

Tuesday, 24 March 2009

Labeling figures in Latex

If labeling of figures has gone wrong in latex it's probably because the \label{} must be at the end of the figure block after the includegraphics and caption.