Monday, July 4, 2011

clang another good c compiler

It took me several minutes and googling to remember it is `clang', another c compiler. 

Sunday, July 3, 2011

obtain a figure file list from a tex file using grep and sed: new version

#!/bin/bash 

# to get a list of pdf files included in a tex file 
# echo "Usage: $0 {file.name}" 
# echo "Processing file $1"


EXPECTED_ARGS=1
E_BADARGS=65

if [ $# -ne $EXPECTED_ARGS ]
then
  echo "Usage: `basename $0` {tex.file}"
  exit $E_BADARGS
fi

tmpfile=`mktemp -p . exttmp.XXXX`

grep includegraphics $1 > $tmpfile
# sed -e 's/includegraphics/  /' -e 's/[\\{}]//g' -e 's/\[.*\]//g' -e 's/[^ ]\+//' -e 's/^ \+//' < $tmpfile 

# this one is much better than the above 
sed -e 's/.*{\(.*\.pdf\)}.*/\1/' < $tmpfile

if [ -f "$tmpfile" ]
then
    rm "$tmpfile"
fi

tmpfile=`mktemp -p . exttmp.XXXX`

grep includegraphics $1 > $tmpfile
sed -e 's/includegraphics/  /' -e 's/[\\{}]//g' -e 's/\[.*\]//g' -e 's/[^ ]\+//' -e 's/^ \+//' < $tmpfile

if [ -f "$tmpfile" ]
then
    rm "$tmpfile"
fi

#
# the includegraphics must be at the same line with the pdf or other figure files included. 

R mathplot plotmath

it is ?plotmath to get the help in R. 

You cannot imagine that at some time point, you would forget this. 

Friday, July 1, 2011

pwdx - current working directory of a process

  pwdx - report current working directory of a process

Vim file type detection: only R for .r and .R

copied from 
http://biostat.mc.vanderbilt.edu/wiki/Main/RVim

Filetype detection

Vim includes syntax highlighting for two other languages that use the .r and .R file extensions. Vim searches up to the first 50 lines of a file and checks the comment syntax to determine whether it is R or Rexx. If no comments are found, it defaults to Rexx. This can be annoying for starting a new script. If you want .r and .R to ALWAYS be associated with R syntax, put au BufNewFile,BufRead .r,.R  setf r in your ~/.vim/filetype.vim (alternatively, you can use the same line in~/.vim/ftdetect/r.vim).

=====

Under ubuntu maverick, I would just change file /usr/share/vim/vim72/filetype.vim