# Monthly Archives: March 2013

I imported a pdf into inkscape I made in gnuplot which used Times New Roman as a font, however Times wasn’t installed so it substituted the font for sans.
I have a pretty shaky knowledge of how fonts work, and why it was that it worked in gnuplot but Times isn’t available from other programs, but my solution was as follows:

Follow the instructions to use the script to install all msttcorefonts at:
http://blog.andreas-haerter.com/2011/07/01/install-msttcorefonts-fedora.sh

wget "http://blog.andreas-haerter.com/_export/code/2011/07/01/install-msttcorefonts-fedora.sh?codeblock=1" -O "/tmp/install-msttcorefonts-fedora.sh"
chmod a+rx "/tmp/install-msttcorefonts-fedora.sh"
su -c "/tmp/install-msttcorefonts-fedora.sh"

After rebooting this worked, but some of the fonts used by webpages had screwed up (which I believe were trebuchet and verdana)

I fixed this by (as root) navigating to /usr/share/fonts, ensuring out of the newly installed fonts only the times ones are available and refreshing the font cache:

cd /usr/share/fonts
mkdir mstt-times
cp msttcorefonts/times* mstt-times
mv msttcorefonts .msttcorefonts
fc-cache -v

This made a lot of text unrendered in the browser, but after rebooting everything worked as I wanted it to, and I was able to automatically use Times correctly in inkscape

I also found the following page useful: http://www.pwsdb.com/pgm/?p=172

I couldn’t find how to do this easily, but perhaps this is because I used rubbish search terms.

I eventually found my answer on http://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing (which ended up telling me lots of useful things about the hyperref package I didn’t know)

First source the hyperref package in the preamble

\usepackage{hyperref}

You’ll probably want to provide some options to make it look nicer. See the manual linked from the ctan page: http://www.ctan.org/pkg/hyperref

You can then add references choosing the text yourself with a command of the format

\hyperref[label-name]{link-text}

It helps to illustrate this with an example. In my case I have a figure 4, composed of 3 sub-figures 4a, 4b and 4c (though these are simply part of the same image, not specified as separate figures in latex). My figure is labelled ‘SEM’ and I want to reference figure 4c including a hyperlink to the figure it appears in. I can do this using:

\hyperref[fig:SEM]{\ref*{fig:SEM}c}

This sends the link to the SEM figure, and puts as the hyperlinked text ‘4c’. Using \ref in the curly brackets ensures the figure number is updated if it changes from 4, which is the usual behaviour we desire.

Another thing I came across on the wikibooks page was the \autoref command provided by hyperref. This looks like a better idea than using \ref and constantly typing figure, and could straightforwardly be included in the above example by changing \ref to \autoref

Thermo Scientific NanoDrop range of UV/Vis spectrophotometers (http://www.nanodrop.com/Absorbance.aspx) seem to be pretty good to me — apart from their terrible software.

I used the NanoDrop 1000 Spectrophotometer, and found the software to be so unintuitive that I had to read the entirety of the manual for the sections I used (which can be found at http://goo.gl/smXCT). The two main points I would note are:

• The data can be exported from the report – select ‘Show report’->’Save report’->’Full report’  which will save a .ndv file of all the spectra taken in the current session.
• The absorbance data at 0.2mm (NB on the report it is shown for 0.1mm so you can visually confirm it is a tenth of the 1mm absorbance, see the wikipedia page on the Beer-Lambert law for an explanation of this linearity) is stored in C:\NanoDrop Data\User name\ HiAbs — there is no other way to get to it.

The .ndv files saved are tab-delimited files which you can load into spreadsheet software to manipulate and plot. As I wanted to do further spectral analysis this was a bit useless to me, so I wrote a quick perl script to convert these files into a set of .csv files (one for each spectrum listed in the .ndv file).

This is available at my other site (for now, this link will expire in July 2013) at http://users.ox.ac.uk/~ball3126/ndv-converter.pl and is also listed below. Run ‘ndv-converter.pl –help’ for a usage guide. The default behaviour is to convert all .ndv files in the current working directory

ndv-converter code listing (pdf)

Fedora provides a texlive package (http://fedoraproject.org/wiki/Features/TeXLive), however it is incomplete, usually out of date and I haven’t been able to easily install new latex packages through it. In theory new packages can be installed by issuing the command:

yum install 'tex(epsfig.sty)'

However this never worked for me, and despite some searching I couldn’t work out what was going wrong.

Personally, as someone with plenty of free disk space, I’ve found the best solution is to install the full version of texlive. Certainly, ever since doing so I’ve never had any problems compiling my latex files and haven’t had to think about the install ever since.

This excellent post on the tex StackExchange describes in detail how to do this with Ubuntu:
http://tex.stackexchange.com/a/95373
which I would recommend reading before following any of the advice here

For fedora it may be slightly different (especially in faking packages, see step 1 below), but in summary what I did was as follows:

1. Install the official package from fedora using ‘yum install texlive’ (so that software with tex as a dependency can be installed)
3. Run the install-tl script
4. Make sure the install path is /opt (or /opt/texlive if you’d like)
5. Add /opt/texlive/2012/bin/x86_64-linux (with the correct year) to the path (see e.g. http://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path if unsure how to do this) making sure it’s added before /usr/bin so the correct latex programs are used rather than the ones from fedora’s texlive package
6. If using some software such as texmaker to edit and compile your latex, make sure it is correctly configured to run pdflatex, biber etc. from /opt/texlive/2012/bin/x86_64-linux (e.g for texmaker follow the instructions at http://www.xm1math.net/texmaker/doc.html#SECTION02)

• A lot more packages are included
• tlmgr is included, which allows incredibly easy installation of new packages from ctan (tlmgr install package-name)

• Not integrated into fedora’s package management
• You’ll now have to manually update using
tlmgr update –self
tlmgr update –all
rather than it simply working through yum (though there may be a way around this, I haven’t looked into it)
• Uses a lot of space (something like 3-4GiB)

Following the guidance of http://patrakov.blogspot.co.uk/2011/01/writing-systemd-service-files.html it was fairly straightforward to use systemctl on Fedora 17 to start the tinc daemon on startup.

Create a new file /etc/systemd/system/tincd.service containing:

[Unit]
Description=tinc vpn
After=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/tincd -n network-name

[Install]
WantedBy=multi-user.target

Replacing network-name with the name of your network.

Then enable the service to run on startup

sudo systemctl enable tincd

If you’re using the default firewall note you also need to open port 5353 (listed as multicast DNS) to get avahi to work with tinc

To generate the key pair (on the local machine)

ssh-keygen -t rsa -b 4096

Copy the public key to the host. I found I first need to restart ssh and execute ssh-add to load the newly created key. Execute the following commands on the local machine:

sudo systemctl restart sshd
ssh-copy-id remote-host
PasswordAuthentication no
KbdInteractiveAuthentication no