Monday, November 26, 2012

changing colour of citations in-text

So I had a figure where a certain colour represented data from a certain citation and I didn't want to put the name beside every single datapoint - it would be better in the figure legend. But I came across an issue - \textcolor{} just changes the text colour but the not the colour of the citation itself if you're using hyperref, so for instance:
shows up as
Smith (2011) 
which is not what I want. The easiest way to do it with hyperref is by using the citecolor of hypersetup:
shows up as:
Smith (2011) 
obviously, this is cumbersome, and that brackets are still black and you still need to revert the link colour back to black, so just create a newcommand:
This generates a citation in-text and then converts the colour set-up back to black each time. As the brackets would still be black, you have to use the textcolor command to change them as well.
So now I can just use:
to generate
Smith (2011) 

Saturday, November 24, 2012

glossaries entry too long

So I realised at some point that I had glossary entries that weren't showing up in my glossary, and were referencing back to pg. 1. The output from Kile was telling me:
[entry] has been referenced but does not exist 
which was weird because it was showing up in text with the right acronym so obviously it did exist! It wasn't a helpful error, but thankfully, some germans figured it out:
Zu Lang ist --> hier gibt eine kleinen Hack: 
\newcommand{\MeinZuLangerGlossarEintrag}{Super Langer Text, der einfach}
   name=Name des Modells im Singular,
   plural=Name des Modells im Plural,
   description={ \protect\MeinZuLangerGlossarEintrag
so basically, my glossary items it wasn't defining were because the description is too long (potentially the limit is 1024 characters). So you can either use \def\xxxxDescription of \newcommand{\xxxxDescription} and use that to define your description, and then use that in the glossary entry:
\def\wordDescription{This is a really long description}
\newglossaryentry{word}{name=word,description={\protect \wordDescription}
and clean your files and re-run makeglossaries and ta-da! 

Thursday, November 22, 2012

davmail crashing on startup

so, I finally updated davmail (4.1.0-2042 ) after it asking me to for literally years. But when it started up startup, it immediately crashed. At the same time, I got an error relating to the jre. A quick google got me to some information about how sometimes the open jdk is better than the sun java. So I checked which one I was running with:
sudo update-alternatives --config java
 which gives me:
There are 3 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                            Priority   Status
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  *1            /usr/lib/jvm/java-6-sun/jre/bin/java             63        manual mode
 2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode
Press enter to keep the current choice[*], or type selection number:
I switched to  [2], and now it runs!

Saturday, November 17, 2012

upgrading to Windows 8 with less than 20GB free space.

Ok, so I got the upgrade to windows 8 for $15. My win 7 wasn't exactly working properly after flashing from the iso and I hadn't really used it anyway, just booted into it occasionally. So I downloaded the iso during the install and burnt it to a dvd. Would have thought that I could just proceed with the install on my 50GB partition for windows - wrong, you need at least 20GB free space on c:/. I had to set-up my partitions such that the windows partition was prior to the linux partition, and it wasn't possible to extend it without wiping the linux partition (which I didn't want to do).

So here's how I upgraded to Windows 8 with less than 20GB of free space (I started with 2GB). For this you will need to have chosen the option to install of a DVD and you will not be importing any of your old Windows 7 stuff during install. If you want to keep all of your applications and settings etc and import them, this is not the method for you. First of all, I got rid of hiberfil.sys which was taking up 6-8GB on my hard drive. If your pagefile is running off c:/ you can get rid of that too. All you need is 8.5GB free if you do the install straight off the DVD.

Boot onto the install DVD. During the install, choose the option that does not import any of your settings (the other option takes you back to windows and requires 20GB). I didn't need any of my applications or settings so this was fine for me. From here you can choose to install on any hard drive, however, as I'm upgrading, the installer fails on a hard drive that does not have Windows. Install onto your current Windows 7 partition. It backs up your old set-up as Windows.old, which you can delete to free up 20+GB when you're in Windows 8 later using disk cleanup. Though for some reason it still shows up on the windows splash screen as an option. Good one Windows.

Now for the Ubuntu part:
Now, to get grub back up and running (the Windows install deletes it). If you've got a reasonably new livecd around (new enough to have grub2 on it) then just boot onto that and follow these instructions:
First, open the Terminal.
Mount the partition you Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is Usually a EXT4 Partition. Replace the XY with the drive letter, and partition number. Example: sudo mount/dev/sda5 /mnt. Then bind the directories, you need, like so:
sudo mount /dev/sdXY /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
Now we jump into that using chroot.
sudo chroot /mnt
Now install, check, and update grub. This time you only need to add the partition letter (usually a) to replace X. Example:grub-install /dev/sdagrub-install –recheck /dev/sda
grub-install /dev/sdX
grub-install --recheck /dev/sdX
Now you can exit you mounted hard disk, and unmount.
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt
and then sudo reboot

and then when you get back into ubuntu you're going to need to sudo update-grub to get your windows partition back, or alternately I guess you could mount it with your ubuntu drive earlier on the livecd, but that would require way more than a single command!