# Fighting through the LaTeX startup hassles

You kids know I’m not a Windows user, so I experience a different set of problems than you usually do. But the WinStat systems can be made to work, and the CRMDA systems can too. You just need to be a little patient and read the error messages.

Today I succeeded in compiling the ku-thesis document on a WinStat system,
but there were some hiccups. We’ve asked ITTC admins to install a few more packages for the LaTeX distribution, and I’ve uncovered one little flaw in the thesis document I created. Well, not so much as a flaw, but an omission that prevents compilation on these particular Windows systems (but not on other Windows systems or on Linux…)

I’ve been testing ResStat 2 (3389).

First, start simple. Compile a very simple LaTeX document, this one:

http://pj.freefaculty.org/guides/Computing-HOWTO/LatexAndLyx/LaTeX-General-1/example.tex

I just open that in Emacs, then Click “Command” -> TeXing Options -> Generate PDF, and then

Click “Command” again and click “LaTeX”. That compiles the thing into pdf.

So I know the elementary setup is good.

2. Try a more difficult project.

But a lot of bells and whistles make this more complicated. Yesterday we learned of the need to install some packages on WinStat (packages, setspace). As far as I can tell, we are good to go to at-least compile a corrected version of the dissertation exemplar.

You may not know hat I made a LaTeX document template and style file for the KU Grad School last year. There is one version in LyX and also a LaTeX version exported from LyX. I just checked and I can compile that on the cluster compute nodes with pdflatex, but ran into some trouble in the WinStat systems.

Look in here:

http://pj.freefaculty.org/guides/Computing-HOWTO/KU-thesis/

The pdf file that should be produced as a result is in there. ALso there’s a tarball that includes everything needed to reproduce that document.

If I open “ku-thesis.tex”, and try to compile the same way, It fails, and the minibuffer says “hit C-c ` to see errors.”

That says

ERROR: I can’t write on the file ‘thesis-ku.pdf’

The existing pdf file is sitting in the way of my work. I think it is open with the adobe reader, and on Windows, unlike Linux, that will block me from writing on the pdf again. So I close everything, and delete the pdf file for sanity.

Then I try to compile again,

########################

You requested a family/series/shape/size combination that is totally unknown. There are to cases in which this error can occur.
1) You used the \size macro to select a size that is not available.
2) If you did not do that, go to your local ‘wizard’ and complain fiercely that the font selection tables are corrupted!

#########################

That doesn’t seem right, but I am willing to yell at wizards, if necessary. But at some point, you just end up yelling at yourself.

So either that system is missing some package I’m implicitly assuming, or there is some other package I can invoke that will fix it. I’m going to pursue fix #2.

We get better looking fonts in pdf from the Latin Modern font set, and the LaTeX package for that is installed in WinStat, so in the preamble of ku-thesis.tex, I insert this:

\usepackage{lmodern}

After that, I can compile the document.

There is an error, though, if we just compile once. Emacs minibuffer wanrs:

LaTeX: There were unresolved citation, (21) pages.

That reminds me there’s some work left, because there’s a bibtex bibliography file and a table of contents to fix.

In Linux, I know of two fixes for this problem. First, this is the standard LaTeX instruction. Tun the commands over and over, like this:

# pdflatex
# bibtex
# pdflatex
# pdflatex

That’s boring, but it works.

Second, in Linux, we also have various programs and scripts that can do all of that for us. One that is recommended by the R project is “texi2pdf”, and in my experience it works well.

On Windows, I’m finding this more trouble. When I click “Command” and “Bibtex”, the minibuffer says

BibTeX finished with 2 error messages. Type ‘C-c C-l’ to display output.

The error there:

“I couldn’t open style file apalike2.bst”

Apparently, the WinStat system is lacking in a bibliography file. I can ask the administrators to fix that for me, but I’m pretty sure I know of a solution for which I do not need their help.

Copy apalike2.bst into the working directory.

After that, Emacs is able to make bibtex work! Minibuffer says

BibTeX finished successfully. Run LaTeX again to get citations right.

Then it tells me to run LaTeX again to get reference right. But, at the end,

LaTeX: successfully formatted (22) pages.

###########################

Maybe you want to edit the tex file with some other program? My favorite LaTeX specific editor is “TexMaker”, but it appears on WinStat we have TexWorks, which is provided with MikTeX:

In TeXWorks, I open ku-thesis.tex, and I see that TexWorks is clever. It notices my document has bibliography and references, and it sees special compiling is required.

You see that if you click “Typeset” and the top and it offers “pdfLaTeX + MakeIndex +BibTeX.

That program has a big green arrow on the top left, and if you click that, then the LaTeX compiler is called and all the work gets done. The pdf document pops up automatically.

So, as frustrating as this hour has been, I’m convinced (again) that this can be made to work.