Wednesday, 19 December 2007

Another post, in which I continue to destroy/re-build my LaTeX installation with my hopeless fumblings.

So, for some reason, I downloaded the TeTeX documentation and stumbled across kpathsea.pdf in the TeTeX documentation menu in Kile. It seems that this is involved in searching for various files needed for LaTeX. For some reason, I tried to run mktexlsr instead of texhash. I probably wasn't managing to find the place where the script was saved, but something seemed to run. But then there was no ls-R file in /usr/local/share/texmf anymore. When I tried to compile any LaTeX code, the text came out ok, but any mathematical symbols, etc. were totally missing. On closer inspection, it was secretly crying that kpathsea couldn't find mf.base. So I managed to stop it finding metafont, or something crazy. I tried to compile the RevTeX sample which came out as a hopeless jumble of lines and which decided randomly to print itself on the group printer.
The shame! The despair!
I have since restored /usr/share/texmf/web2c/texmf.cnf to its former glory and run texhash and I now at least have a working LaTeX again.
Again, I make the changes to texmf.cnf that I made before, and this time run texhash. Boo hoo hoo. Computer says no:

This is dvips(k) 5.95b Copyright 2005 Radical Eye Software (
' TeX output 2007.12.19:1045' ->
kpathsea: Running mktexpk --mfmode ljfour --bdpi 600 --mag 1+57/600 --dpi 657 cmmi10
kpathsea: Running mktexfmt mf.base
fmtutil: format `mf' not available.
mktexpk: Mismatched mode ljfour and resolution 600; ignoring mode.
mktexpk: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1+57/600; nonstopmode; input cmmi10
This is METAFONT, Version 2.71828 (Web2C 7.5.5)
kpathsea: Running mktexfmt mf.base
fmtutil: format `mf' not available.
I can't find the base file `mf.base'!
grep: cmmi10.log: No such file or directory
mktexpk: `mf-nowin -progname=mf \mode:=ljfour; mag:=1+57/600; nonstopmode; input cmmi10' failed to make cmmi10.657pk.
kpathsea: Appending font creation commands to missfont.log.
dvips: Font cmmi10 not found, characters will be left blank.
kpathsea: Running mktexpk --mfmode ljfour --bdpi 600 --mag 1+0/600 --dpi 600 cmmi8
kpathsea: Running mktexfmt mf.base
fmtutil: format `mf' not available.
mktexpk: Mismatched mode ljfour and resolution 600; ignoring mode.
mktexpk: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1+0/600; nonstopmode; input cmmi8
This is METAFONT, Version 2.71828 (Web2C 7.5.5)
kpathsea: Running mktexfmt mf.base
fmtutil: format `mf' not available.
I can't find the base file `mf.base'!
grep: cmmi8.log: No such file or directory
mktexpk: `mf-nowin -progname=mf \mode:=ljfour; mag:=1+0/600; nonstopmode; input cmmi8' failed to make cmmi8.600pk.
dvips: Font cmmi8 not found, characters will be left blank.
. [1]

I think I must be creating the wrong files. A more intelligent approach is needed, ie. engage brain.

Tuesday, 18 December 2007

Mandriva sound problems

Unfortunately, the version of Mandriva that is installed on my machine at work appears to be incompatible with my soundcard. That means from time to time it will scream like a banshee, and there's not much I can do about it, except mute the whole sound system. It can be done on the command-line like this:
and then choose "mute" or somesuch. That should stop the screaming. Thanks Greg!

Monday, 17 December 2007

Installing LaTeX packages

This post is going to change a lot as I try this new feat. I'm writing as I go, and this may not even work. Worse, I might break my current LaTeX distribution. Wish me luck.

I'm using several very helpful pages. One is the readme file for the package I'm installing, and the other is here.

I download the package I want: it happens to be REVTeX4. It's saved as revtex4.tar.gz somewhere temporary. My path $TEXMFLOCAL happens to correspond to /usr/local/share/texmf. This is where all my updates will be stored- in a nice local file, so I can find them again. In this path, I created some handy directories...
mkdir /usr/local/share/texmf/tex
mkdir /usr/local/share/texmf/tex/latex

I changed directories here:
cd /usr/local/share/texmf/tex/latex
next moved the tar file into this location...
cp /temporarylocation/revtex4.tar.gz .
the full-stop is not a typo. I un-tarred it like so:
tar -zxvf revtex4.tar.gz
I had to be acting as a superuser, of course, to wield such fantastic powers. I now have a lovely directory named revtex4. The readme suggests I put the *.bst files in $TEXMFLOCAL/bibtex/bst/revtex4, so I do the following:
cd /usr/local/share/texmf/
mkdir bibtex
mkdir bibtex/bst
mkdir bibtex/bst/revtex4
cd bibtext/bst/revtex4
cp /usr/local/share/texmf/tex/latex/revtex4/*.bst .
I think I shall also delete them from their current home in /tex/latex/revtex4 for good measure. It is now time to instruct my TeX system where to find it all. I altered a cunning file:
kwrite /usr/share/texmf/web2c/texmf.cnf
From here on, I (almost) quote verbatim from this page.

I had already defined a directory for local material, and stuck everything there. This was /usr/local/share/texmf.

If your configuration file has a line that says something like:
...then you are fine; leave it alone. Some older distributions instead have a line like
...commented out (it starts with a percent sign). If yours is commented out, then below it put the non-commented $SELFAUTOPARENT line (and date the change in the file; sometimes that's helpful).
Mine had the "older distribution" option, but it wasn't commented out, so I left it as it was.

Turn on searching of that local directory. A bit further down I found this line
I commented this line out by prefixing a percent sign to the line. Below it I added a new line:
TEXMF={$HOMETEXMF,$TEXMFLOCAL,!!$TEXMFMAIN} which I've deleted the twin exclamation points. The twin exclamation points tell the system that if it does not find a file in the main tree's ls-R database then it should not go on to search the disk. That's OK because your main tree will never change since you will put new things into the local tree. So the rehashing done [later] will be up to date forever. (Older versions have a TEXMF=!!$TEXMFMAIN line which you can comment out and replace with what's above.)

The page also offers wisdom on what I'm actually doing. The re-hashing I do at the end.

Your TeX system can precompute the position of [certain] files so that, instead of scanning the directory tree on your physical disk, your system finds where a file is in a database file called 'ls-R', which lists that directory tree. Then your TeX goes straight to that spot in the directory structure on the disk to get the file's contents. (The software libraries that do this work are called `kpath'.) Point One: If you make any changes to a precomputed portion of your setup then you must rebuild (or `rehash') the database of files, or your changes won't be found.

I continue:

Insure that searching of that local directory is done on disk. For certain kinds of files (such as .vf files), if the system finds a filename database in the directory tree then it will look for that file only in the database -- it will not go on to search the disk (whether there are twin exclamation points or not). Thus, for those files, forgetting to rehash results in your system saying that it cannot find files that you know are in the right place. To avoid that puzzlement, we will omit creation of that database for the local tree... I found this line
...commented it out with a percent sign, and added this just below it:
The version with TEXMF would have caused TEXMFDBS to expand to include the local tree, but now with TEXMFMAIN it will only include the distribution's tree.

And now for the hashing of the database:

Run the command to remake the ls-R filename database. I first checked that there was no ls-R file in the local directory /usr/local/share/texmf and then I did this.
The system responded by telling me that it had made /usr/share/texmf/ls-R (and also a /var/lib/texmf/ls-R file that has to do with user-created fonts that I will not discuss). The main point is that the system did not make /usr/local/share/texmf/ls-R. Consequently, searches of the local material will be made on disk.

Et voila. Thank you, oh great author of handy page (and sorry for stealing your text- I reproduce it here in case it disappears, or I can't find it again!)

LATER: Ok, this appears to have broken my LaTeX as predicted. I'm having problems with finding Metafont. Will sort this out and post in a later post about it, if I can fix it.

Wednesday, 12 December 2007

A really silly post to remind myself of 4 letters

ps ux
... will show me all processes running for my user on my work (mandriva) linux computer. Then I can get rid of the process number that has hung up via the "kill" command.

Also, I think perhaps the following is true for mandriva:
urpmi -install a package
urpme -uninstall a package

Tuesday, 4 December 2007

Converting integers to strings in Fortran

Assisted by this page, I present the result:

character(11), parameter :: fstart = "Xfiles/Xbin"
character(4), parameter :: fend =".txt"
character(3) :: fnum
character(18) :: fname
integer :: blob

blob = 2
write (fnum,1000) blob
1000 format(I3)
fname = fstart//trim(adjustl(fnum))//fend

The double slash "//" concatenates strings. The strange form of the write command (rather than just char(blob) gives you the value of blob as a character, rather than the ascii character for that number. The adjustl(fnum) function moves the contents of string "fnum" to the left, to leave all trailing blanks to the right. The call to trim(string) then removes the trailing blanks. This is necessary to avoid spaces appearing in "fname" if the value of blob is only 2 digits or less, since I defined "fnum" to be three characters long.