Monday, 7 June 2010

Non-coloured hyperrefs in latex

So, I love to leap around my thesis like superman using the "hyperref" package. However, I do not like increased printing costs by having pretty pink references on every page (our printer selects the cheaper b/w printing intelligently). I was colouring my links black using this clunky bit of code:
\hypersetup{
colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=black,%
urlcolor=black
}
...but this resulted in the printer choosing to mix colours to achieve black text on pages with a hyperlink! Argh! It looked stupid, it was stupid! Hopefully this more elegant bit of code might fix whatever oddity is occuring:
\hypersetup{pdfborder={0 0 0},colorlinks = false}
The pdf certainly looks no different... fingers crossed for printing time.

Friday, 4 June 2010

Sidewaystable prints upside down

I have two consecutive landscape tables in my thesis using the "sidewaystable" package. The package rotates them so that the top of the table is closest to the spine of the book, however this manifests itself in the pdf as the page headers and footers appearing to the right of one landscape page, and to the left of the next. When I print double sided, one page has a header which is upside down. My preamble is thusly:

\documentclass[a4paper,11pt,twoside]{book}
\usepackage{rotating}

... the solution was to choose:

\usepackage[figuresright]{rotating}

So that the figures are always in one direction. Now my headers are always to the right of the landscape page. Hopefully this will now force them to be the right-way-up! If they both print upside down, I suppose I must choose [figuresleft] instead. I've no idea if this is just a symptom of my particular combination of pdf reader and printer, but hey-ho.

Thanks to the Szwer for solving this one for me.

Wednesday, 24 March 2010

Breaking URLs in BibTeX

Here's a work-around for a sticky problem when citing URLs in LaTeX documents.

My problem manifested itself in ugly URLs in my bibliography which did not break over multiple lines, causing underfull hboxes all over the shop: the line of text preceding the URLs had 5 words spread horridly across the page.

I tried various work-arounds found via google but the one that eventually solved my problem was found here in "BibTeX tips and FAQ" by M. Shell and D. Hoadley.

My preamble contains the following:
\usepackage{url}
\usepackage[ps2pdf, pagebackref]{hyperref}

And I cite all my URLs in BibTeX like this:
\url{http://morecakelessfish.blogspot.com/}

I like to compile into pdf by using dvi2ps then ps2pdf otherwise I seem to have some issues with offset bounding boxes in my pyxplot .eps graphics. Despite calling the url package in my references (see example above), my URLs still weren't breaking. Apparently this is a problem when going via dvi after including the hyperref package. The problem was solved by including breakurl.sty AFTER the hyperref package in my preamble thusly:

\usepackage{url}
\usepackage[ps2pdf, pagebackref]{hyperref}
\usepackage{breakurl}

Jobs a good'un.

Thursday, 23 July 2009

Battles won against my laptop

My 7 year old laptop is now too geriatric to run anything too meaty. Windows is definitely out of the question, so I have Xubuntu.
Today, I bring you:

How to add a terminal launcher to the xfce panel:
right-click>add new item>launcher
Then find the terminal program in /usr/bin/xfce4-terminal and drag it into the launcher. Or, just set command to "/usr/bin/xfce4-terminal" and uncheck the "run in terminal" box. Give it a nice name and picture of a terminal window.


How to connect to a windows shared area when smb4k is acting up:
If you can see the various windows computers in smb4k (eg ACOMPUTER) but it won't let you mount ACOMPUTER/afile, then try this on the command line...
sudo mount -t smbfs //ACOMPUTER/afile/ -o username=myname /home/myfile/MyMount/
...where you have provided your username to access the shared area. When prompted, give the corresponding password.
To unmount:
sudo umount /home/myfile/MyMount/

Friday, 17 July 2009

Greek letters in Inkscape

To get greek letters, press Ctrl+u. You'll see "Unicode (Enter to finish)" come up in the status bar. Let go of Ctrl+u and type in your unicode number followed by the return key.

w00.

Friday, 3 July 2009

Formatted Read Statements yet again.

Further to my last post, I want to add a code snippet for reading in large arrays with many columns. It has some nice implicit do-loops. "myfile.ans" contains 1 column of integers, followed by Ncols of data that I want to read into "Blam" and Ncols that I want to read into "Dlam".

integer :: i, Nrows, Ncols
real :: Blam(Nrows, Ncols), Dlam(Nrows, Ncols)
integer :: pixies(Nrows)
character(1) :: tmp

open(unit=2,file='myfile.ans',status='OLD',action='READ')
do i = 1,Nrows,
read(2,20) pixies(i), (tmp,Blam(i,j), j=1,Ncols), (tmp,Dlam(i,j), j=1,Ncols)
enddo
close(2)
20 format(I3, 36(A1,F6.4))

Annoyingly, I can't seem to replace 36 (=2*Ncols) with a variable name or my compiler shouts. A mystery for another time I think.

Monday, 22 June 2009

Formatted Read Statements again.

Grrr. I'm trying to read in a formatted file of integers such as:
1 1 1
10 10 10
100 100 100
(... three characters wide, one space between each column)
Fortran is giving me junk unless I format my read statement with
10 format(I3,A1,I3,A1,I3)
where I read the single space into a temporary variable declared as:
character(1) :: tmp
This is why I am in a bad mood with Fortran today. I put faith in it, and this is how it repays me. Plus, the fridge has frozen my tomatoes. I wonder if they are in league.