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

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.

Wednesday, November 4, 2009

Resizing EPS files

Sometimes an eps file from my favourite plotting device (gnuplot, matlab, mathematica) is just to big for the arxiv and a png or jpeg file produced directly from the plotting device is just useless; in my experience the lettering produced like this pixelize most of the time.

I have tried different methods to produce nice and small figure files. So far, when an image files is just too big even for a journal submission I do the following,

  1. Arxiv, convert the nice looking eps into a png and use the png for submission. Pdflatex can handle png files.

    gs -r300 -dEPSCrop -dTextAlphaBits=4 -sDEVICE=png16m -sOutputFile=output.png -dBatch -dNOPAUSE input.eps

  2. Journal, try to rezise the nice looking eps. I take the output of the aforementioned code

    convert -quality=100 input.png output.jpg
    convert input.jpg esp2:output.eps

These are modifications on the solutions posted by Luke at Terminally-Incoherent, the Four Forces, the gs manual and the imagemagick manual. It seems png -> eps2 fails that's why png->eps3 or jpg->eps2 has to be used, it seems quite an old problem. I prefer jpg->eps2 as it produces smaller files than png->eps3 does.

If you have a better solution I'm eager to read about that.

NOTE: I found almost the same solution with a great discussion on the topic here.

UPDATE (March 23rd, 2010): I've started using GIMP to parse EPS files into smaller EPS files and PNG files, it seems the best alternative so far without the hassle of keeping gs and convert commands in my memory.