Monday, November 8, 2010

Tunning your Latex in a Linux box

Whenever I install Latex, in particular the texmf installation that comes with Ubuntu, I always end up missing some style, class and bibliography files. In order to fix this, I always do the following:

  1. Copy the files' directories that I'm missing to /usr/share/texmf/tex/latex/ for styles (*.sty) and classes (*.cls); and to /usr/sare/texmf/bibtex/bst/ for bibliographic styles (*.bbt, *.bst)
  2. Make sure the directories are accessible for all users: chmod 755 -r /usr/share/texmf/tex/latex/ /usr/sare/texmf/bibtex/bst/
  3. Reload texmf with: sudo texhash
This always works for me whenever I do a fresh install and have to install the proprietary classes and styles from OSA, IOP and APS.

Revtex 4.1 needs particular attention in Ubuntu, as the natbib package in the current distro is the old natbib. In order to make available the new natbib I do the following:

  1. Download natbib.ins and natbib.dtx and all the .bst files from http://tug.ctan.org/tex-archive/macros/latex/contrib/natbib/
  2. Compile the instaler: latex natbib.ins
  3. Copy the result to a natbib folder in /usr/share/texmf/tex/latex/ for styles (*.sty) and /usr/sare/texmf/bibtex/bst/ for bibliographic styles (*.bbt, *.bst)
  4. Make sure the directories are accessible for all users.
  5. Reload texmf with: sudo texhash

Now, everything should be ready to use the nice features of natbib in Revtex4-1 like \cite{SomeCite, *SomeOtherCite} in order to put SomeCite and SomeOtherCite in the same reference number without having to do it by hand.

I hope you find this helpful.

Monday, March 22, 2010

How to keep processes running after logging out from a remote server...

Sometimes, the workstation at my desk is not enough for running a simulation and simultaneous on-line procrastination; enter the workstation or the cluster of our theoretical optics group.

While a cluster usually has a queue manager, a workstation usually lacks this software. In our case, both cluster and workstation lack a queue manager. Now, a queue manager usually keeps a process running in the remote server no matter what your logged status is. How to do the same without a queue manager? The answer is simple: nohup.

For simplicity's sake, I'm using an SSH connection to a linux machine if I want to leave a process running at the server and then log out I use the command:


nohup command_to_run &

Note that the ampersand symbol has to be issued in order to send the process to the background.

Say, for example, I want to leave the compiled binary file for a fortran program running in the remote server even if I log out:


nohup ./BinFile &


Or a matlab m-file script, please remind yourself to always add an exit command at the end of your script or you will end up with many matlab iddle processes running in the background:


nohup matlab -r MatlabScript.m -nodesktop -nojvm -nosplash &


Or a mathematica m-file function, again remind yourself to add an Exit[] command at the end of your script or you will end up with an iddle mathematica process running in the background:


nohup math -noprompt -run "<<MathematicaFunction.m" &

Usually, all the terminal messages from the processes are written to a file named: nohup.out