LaTeX and math symbols in text fonts

August 10, 2009

While doing the layout of a small magazine in Finnish, I’ve for a long time already been using unicode with LaTeX. It is just so much easier to write everything using unicode under Emacs, and then let LaTeX/TeX take care of the rest. Mostly, this even works quite well, but occasionally there are some surprising quirks. Like yesterday, when  I was doing the layout for the next issue to appear in a few weeks. There was an article about archaeological dating methods, and a few paragraphs dealt with radiocarbon dating, which is characterized by the calibration process required, and the uncertainty in the results, usually expressed with something like 225 AD ± 75 years. Now, of course LaTeX has a symbol for this, you can easily get is using

$\pm$

Now, the problem with this is, that in the middle of the text, using the face Garamond,with old style figures, there suddenly appears a mathematical symbol in TeX’s own math font, which is naturally quite beautiful, but does not really look that nice within the surrounding Garamond environment. Especially since the Garamond I’m using does include a glyph of its own for the plusminus symbol. Now, since I’m working with Unicode (or, to be more specific, text encoded as UTF-8), the natural choice was to find out, how to enter the corresponding symbol using Emacs (‘_’ + ‘+’ in the input-method latin-9-prefix).

Now, to make LaTeX handle UTF-8, I’ve been using the package inputenc like this:

\usepackage[utf8x]{inputenc}

I have read somewhere, the one actually should use the option “utf8″ instead of “utf8x” as it is better supported or something, but in practice, “utf8″ never works well, and alway, even for simple texts, calls for me to enter some kind of declarations for special characters and so on, so I’ve been sticking to “utf8x” this far. Now, one would expect, that using this setup, when LaTeX encounter the UTF-8 encoded ± in the text, it would find the corresponding glyph in the font and use that. But no, that is not what happens; instead, even though using ± in the middle of the text, LaTeX still finds the glyph in the TeX math font. Why?

Well, that’s because of this code in the file uni-0.def:

\uc@dclc{177}{default}{\ensuremath{\pm}}%

As we see, it forces the math mode on, and thus ensures, that this symbol is always taken from the math fonts, no matter whether the text font has it or not!

Now, a remedy: use the package textcomp, which has the command \textpm. That picks the right glyph from the right font! This is quite stupid though, because the whole point in using unicode is not having to use these LaTeX commands to arrive at special characters.

And it remains to be seen, whether the option “utf8″ to inputenc would give better results in this case. Perhaps I’ll test that at some point.


pdfLaTeX and a0poster

February 22, 2008

Just a quick note to record something I just found out, while planning my first poster ever. Of course the first choice, as always when doing layout, is to see, whether it could be done with LaTeX. I just hate the idea of using some WYSIWYG horror, where everything will be inconsistent anyway, no matter how hard you try to Set Things Right.

The natural choice for a poster seems to be the a0poster class, which is designed to set LaTeX properly up for making these huge pages, especially regarding the font and paper sizes. To my surprise, the paper size did not work with pdfLaTeX, but the result was big text on an A4. From some source (lost the site already) I found out, that supposedly the path LaTeX -> PS -> PDF should work, but I’d rather not go there, things are complicated enough when forced to work with XP.

Luckily, the use of geometry package saved me: just include geometry at the beginning of your document with the option a0paper, and the resulting document is A0. Voilà!


Converting LaTeX to OpenOffice

October 23, 2007

As a happy user of LaTeX for a few years, a recurrent problem has been the sharing of my documents with other persons. In the early days I was a happy latex2rtf user, and I even contributed some minor details to its development. Quite soon it became apparent, however, that the only reasonable solution to exporting my products is something that acts like a TeX-processor.

In the cases I need to export my texts to other formats than PDF for printing, the layout is of secondary importance. Of major importance, however, is that the certain “academic” structure gets through as well as possible:

  • The footnotes have to be footnotes also in the end product
  • The bibliography must come through as produced by jurabib.

Everything other is secondary, as the articles written will be layed out by the journals, anyway, but they want the reference system to work. Ever heard of a journal in the humanities giving out its LaTeX-styles? Me neither. This means, that I have to try to reach a citation format which fills out the requirements of the journals through tweaking the options of jurabib.

This far, the only solution which actually seems to work is TeX4ht. This is a program that works by running a TeX-processor, and it has quite many output formats. Only bad thing, the documentation is quite lousy, and most of the commands are not described at all.

But I get pretty ok OpenOffice output with oolatex, although ooxelatex is better if you want to use other languages that pretty plain English. Classical Greek works fine, though… I had some trouble getting this to function, for a long while, in fact. It seems, that TeX4ht did not like the hyperref package at all; once I dropped that from the preamble, everything went nice and smoothly. The problem seemed to be related to jurabib, somehow. Probably should file a bug report, some day.

A sad thing is, that jurabib is unmaintained. Jens Berger, the guy who developed the package, cannot devote any more time to the package, so the package is frozen until someone volunteers to take it over. I wish I had the time… A replacement pointed to also by Jens is biblatex. It seems to be quite a potent too for the bibliographic needs in the humanities, but it is still beta-level and not officially released, so you can’t find it in any of the TeX distributions, yet. It seems to include many of the good features in jurabib, like fields for gender, original languages and translations — all very necessary for a historian. To the surprise of many, the hegemony of English is not nearly absolute in for example Classical Studies. French, German, Italian, even Spanish are still major languages, and a researcher unable to read any of there is bound to miss major contributions in the field; therefore, support for original language information of publications is important or people working in these fields.

But none of these really help in getting over the main problem in humanities word processing with LaTeX: the incredible backwardness of BibTeX. In a world where almost everything begins to support Unicode, BibTeX is happy only with 7-bit ASCII. As the only decent BibTeX-file editor is Emacs (IMHO), this is a major pain-in-the-ass. Who wants to keep up a bibliography, when you cannot write Köln but you have to type in K\”oln. Not too handy nor readable.

I’ve actually been running BibTeX on unicoded files happily for some time now, you just have to be very, very careful with the entry keys — better to use plain ASCII in those. This is not supposed to work, though, but luckily, it does. There are rumours (about five years old or something) about a new version of BibTeX, which might address some of the problems. Who knows, perhaps in ten or twenty years we’ll see the next version. I just think, that unless it appears soon, there won’t be many who care about it, anymore.