TeXnical Issues
Posted by John Baez
Thanks to Jacques Distler, this blog uses some marvelous technology that lets you write comments with equations in them. It’s based on TeX. The TeX - or more precisely
itex - is converted to
MathML.
As with any sufficiently advanced technology, you can waste a lot of time trying to figure out why the hell it isn’t working.
So, here’s a place for asking questions and giving other people help! I’m not an expert on this stuff, so I hope other people will answer all the questions, leaving me free to think about math.
Before you post questions, please read the following little FAQ, which may grow as time passes.
n-Category Café – TeXnical FAQ
Here are answers to some really basic problems you may have with this blog.
-
Why do all the equations look like gobbledygook?
Maybe you don’t know math, so all equations look like gobbledygook.
More likely, you forgot to download the necessary fonts. To do this, read Jacques Distler’s advice. He tells you what to do, depending on what operating system and browser you use. If you use Windows, I recommend switching to Firefox if you haven’t already; then installing the requisite fonts is easy. Your mileage may vary — if you get stuck, see the discussions below, especially this.
You can check to see you have all the necessary fonts by going to Jason Blevin’s test page. Look at all the symbols, and see which look okay.
-
Why doesn’t it work when I make comments using TeX?
When you post comments, you are given a choice of “Text Filters”. The default choice is “Convert Line Breaks”. That’s good if you don’t want TeX. But if you want TeX, it won’t work!
For TeX, I suggest
-
“itex to MathML with parbreaks” if you like writing in XML, or
-
“markdown with itex to MathML” if you prefer a simple markdown system.
If you’re used to TeX, please keep in mind that on this system, TeX kicks in only inside equation environments. Outside those, your chosen text filter is in charge!
There are lots of other things that can go wrong, since itex and MathML are sort of complicated. But, if you keep clicking on “preview” and struggling to decipher the cryptic error messages, you’ll either figure out your problem… or you won’t.
-
Why doesn’t it work when I include HTML links?
Maybe you’re using “A HREF” instead of the lower-case “a href”. Unlike HTML, the system here is case-sensitive. This should work:
<a href = "http://math.ucr.edu/home/baez/TWF.html">This
Week's Finds</a>
This would not:
<A HREF = "http://math.ucr.edu/home/baez/TWF.html">This
Week's Finds</a>
Since we’re engaged in scholarly discussion, I encourage including references with links. If you want to make me really happy, something like this is great:
<ul>
<li>
Ross Street,
<a href = "http://arxiv.org/abs/math.CT/0303175">Categorical and
combinatorial aspects of descent theory</a>.
</li>
</ul>
It should give you something like this:
-
Why doesn’t it work when I use “blockquote” to quote someone?
Again you need lowercase, but also, when using the text filters “Convert Line Breaks” and “itex to MathML with parbreaks”, you need to skip a line before and after the “blockquote” command. So, with these text filters, this should work:
John Baez said:
<blockquote>
In the 60's, Grothendieck led the reggae group
shown in this rare photo:
</blockquote>
This would not:
John Baez said:
<blockquote>
In the 60's, Grothendieck led the reggae group
shown in this rare photo:
</blockquote>
Other text filters have other demands.
You may also run into trouble if you just cut and paste the text you’re trying to quote, because it may contain math or other special characters - see below.
-
How come weird stuff happens when I use symbols like & or < ?
Some symbols have special meanings in HTML. To keep the computer from thinking you intend those special meanings, instead of typing a raw & you have to type
&
which is the HTML code for an ampersand. Similarly, instead of < you need to type
<
(Extra credit if you can figure out what I have to type for you to see "&".)
-
Can I customize my view of the comments, to help keep track of the mammoth conversations on this fascinating blog?
A little - at the bottom right of the list of comments, you can click on a little button saying “view chronologically” to see the comments in chronological order. Then it says “view threaded”; clicking on it again restores the original view.
-
Can I customize my view of the comments a lot more, get the comments form to automatically choose “itex to MathML with parbreaks” every time, and stuff like that?
Only if you’re smarter than me. If you’re using Firefox, you can download
Greasemonkey, an add-on which lets you customize your web-browsing experience using little programs called scripts.
Mike Stay has written a Greasemonkey script specially for viewing this blog.
You can get it here.
Posted at September 2, 2006 8:46 AM UTC
TrackBack URL for this Entry: http://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/916
blockquote
Concerning the blockquote-tag, the point is that it does require the content included in <blockquote>…</blockquote> to be inside a paragraph environment enclosed by <p>…</p>.
So you either have a text filter chosen which converts line breaks to such <p>…</p> tags and then insert line breaks before and after the blockquote-tag as John says above – or you add in the tags by hand and do
<blockquote><p>text goes here</p><blockquote>
And if the quoted text has itself several paragraphs you type
<blockquote>
<p>
first paragraph
</p>
<p>
second paragraph
</p>
<blockquote>
which produces this output
first paragraph
second paragraph
Making the font package
I’ve tried several times to get this to work, with no success. I’m running the xft-disabled build of firefox on Linux (I think). I try to follow the instructions for creating the font packages here:
http://swissnet.ai.mit.edu/projects/intelligent-book/mathml/#gnu
I discover that there is no “type1inst” command on my distribution (Fedora Core 5). I find a “type1inst” on:
http://www.ibiblio.org/pub/Linux/X11/xutils/
and install it manually. Following instructions by running type1inst on the cmpsfont/pfb, I get messages:
94 fonts found
94 were standard PostScript fonts
——————————————————-
For 94 of these I couldn’t figure out which foundry
the font is from. Thus, these fonts will appear under the
foundry unknown, i.e. X font name -unknown-*.
Please consult the README file to see what this means.
I don’t know if this is a problem or not.
When, as instructed, I run type1inst on the PCF/ directory, I get the message:
There are no PostScript fonts in this directory
So I’m not surprised when I follow the rest of the instructions, and fonts don’t work. (Add to that the fact that my up-to-date Linux distribution seems to handle fonts in a differnt way than the older ones described in these instructions … and, of course, I don’t know anything about fonts …)
Has anybody ever gotten this to work? I’m curious.
Re: TeXnical issues
You can’t type $x^{*}$ in markdown with itex to mml, because it thinks the asterisk is for emphasis. I got around it by using $x^{\star}$.
Re: TeXnical issues
Why doesn’t it work when I include HTML links?
If you’re using markdown, then you’d write links like this:
A neat paper by Abramsky and Coecke(http://arxiv.org/abs/quant-ph/0402130)
and they’d appear like this:
A neat paper by Abramsky and Coecke
You can put a backslash before most symbols to get them to appear, but using the markdown with itex to mml filter, \ means “center this equation” so I wrap the bracket in dollar signs. I don’t know how to escape a dollar sign under this filter.
Mike Stay has written a “greasemonkey script” that lets you do stuff like this if you’re using Firefox. Don’t ask me what that means.
Firefox is a web browser. Greasemonkey is a plugin for the browser that allows you to preprocess your web pages before seeing them. People write up little programs, called user scripts, that rewrite the web page in a way that’s more useful to them. For example, you can remove ads, rewrite links to go to “printer” versions of articles instead of the click-through ones, change color schemes that are hard on your eyes, etc.
My user script hides all the comments except the one you’re responding to, and also sets the filter to markdown with itex to mml.
Re: TeXnical issues
Thanks, folks! As time passes I will try to update the FAQ to provide better answers to the questions, and answers to more questions - but probably always with an emphasis on the questions of the most clueless sort, since I’m sure there are lots of good mathematicians and physicists who are flummoxed by the simplest things here.
I’m afraid that “TeX” and “posting to a blog” are sufficiently scary to prevent a lot of good people from joining in the conversation, because I’ve been getting a certain number of comments via email. I don’t now have the energy to try to help people overcome those barriers, but maybe someday I can include links to places that explain that stuff.
I’m just curious, Jacques - which do you find to be the most efficient filter for posting to your blog? Or do you pick one based on what you’re trying to do? Right now I’m using “itex to MathML with parbreaks” except for posts with no math at all.
Re: TeXnical issues
Long ago, Arthur C. Clarke famously stated that “any sufficiently advanced technology is indistinguishable from magic”, leading Gregory Benford (among others) to conclude that any technology distinguishable from magic is insufficiently advanced. By the same logic, I suppose we should adopt Baez’s Nth Law, “Any technology which does not break in fantastically incomprehensible ways is so insufficiently advanced it’s not worth bothering about.”
Re: TeXnical issues
I wonder if in a few years time those involved in talking about maths on the internet will lament the passing of days when they had to use ASCII. Unlikely, I guess. More reasonable though to lament the passing of the blackboard. Sasha Borovik has a good post on this.
As I predicted, Borovik’s blog is proving very interesting.
related issues
In one of the comment sections, John
wrote
I think I’ll keep posting the “main line” of my Socratic dialog with Urs as comments that will appear on the very bottom of this page, instead of commenting on a comment on a comment….
That’s fine with me.
I just remark that this need not be an either-or decision. Using the button “view chronologically” found at the bottom of each comment section we can always turn the tree of comments into a linear list and see our latest comments appear at the bottom.
Therefore personally I tend to use the nested threading, becasuse - if desired - this is useful for disentangling parallel discussions in a long comment section.
Re: TeXnical Issues
Is it just me, or did you change the way preview works recently? It doesn’t have the parent_id as part of the URL and thus my greasemonkey script has no way to pick out the message. (Maybe I just never noticed that it only works on the first screen after hitting “Reply to this”.) Is it possible to make the parent_id part of the url when previewing comments?
Search
Is search broken for anyone else?
Input box
Is it a design choice that the box where you type in comments is rather small, or is it just a facet of my particular configuration?
As I see it (in Firefox on Linux), it’s 42 characters wide and 10 high. To me this feels quite claustrophobic, and I’d prefer something much bigger. For instance, when I use a text editor for typing Latex etc, it’s 75 characters wide and 35 high, and I find that comfortable.
Thanks.
fonts… and css
Why do all the equations look like gobbledygook?
Well, what I found in firefox (and mozilla) under Solaris, is that it was gobbledygook even after installing the fonts. The problem is the line for the font-family in the file …/mozilla/res/mathml.css; it gives Symbol precedence over every other math type except CMSY10, and this one is specifyed in uppercase, btw. Putting Symbol at the end of the line seems to solve the gibberish look. Tip from Ian Hutchinson.
Two Tips for Perfectionists
For the aesthetic totalitarians among you, who like everything as beautiful as humanly possible:
-
Due to some slight bug, letters in math formulas come out in roman font if no space is left between them. Thus, if you multiply the variables and , you’ll get instead of unless you put in a space.
-
Use only right-handed single quotes if you want
‘quotes like this’
If you use a left-handed single quote on the left side, the way you learn to do in TeX, you’ll get
`quotes like this’,
which aren’t nearly as pretty.
I hope nobody fixes these ‘bugs’, now that I’ve written reams of material that’s adapted to them.
Diagrams
I drew this diagram
(1)
when Toby asked
How did you make this diagram, Urs?
I am using hacks like this one:
\array{
P_1(U) &\stackrel{p}{\to}&
P_1(X)
\\
\mathrm{tra}_U
\downarrow
\;\;
&
\sim\Downarrow t
&
\;\;
\downarrow
\mathrm{tra}
\\
T'
&
\stackrel{i}{\to}
&
T
}
Read the post
Full Disclosure
Weblog: Musings
Excerpt: A serious MovableType security vulnerability.
Tracked: January 7, 2007 5:19 AM
mimetex public server
I just discovered this: there’s a public server that will take math-mode tex and render it as a gif. (Not that we need it here, but it might be useful to readers.)
Just insert this into your webpage
<img src=”http://www.forkosh.com/mimetex.cgi?c=\sqrt{a^2+b^2}”
alt=”” border=0 align=middle>
to get this: 
Re: TeXnical Issues
Bruce Bartlett asked me:
I’ve noticed there are a few wizards at the cafe (most notably the hosts and Jacques Distler) who can write down commutative diagrams, insert jpg’s, do accents (like Poincar’e), and even use bold and italic with ease. I don’t know how to do this stuff - it doesn’t seem to work the same way as in LaTeX - so it would be cool if you could explain some
of the standard work-arounds.
The key thing to remember is that on this blog, TeX only turns on inside equation environments — that is, inside things like this:
$ $
and this:
$$ $$
and (for numbered equations) this:
\[ \]
Outside those, your chosen text filter is in charge!
For example:
-
For accents, don’t use TeX commands — they won’t work. Instead, learn how accents and other symbols work in HTML! So, to see
Poincaré
don’t write
Poincar\'e
Write
Poincaré
-
To insert jpgs, you do the usual HTML thing. But, since you’re really using XML, you have to be a good boy and include an ‘alternate text’ for the image in case the one you want is temporarily unavailable. This can be empty. So, to see this:

(very useful when Urs gets too abstract), you can type this:
<img src = "http://math.ucr.edu/home/baez/emoticons/cry.gif"
alt = ""/>
-
I can’t give a complete description of how to draw diagrams, but to get this:
(1)
you do this.
For a longer example, see this post by Urs. Then, see how he did it!
Re: TeXnical Issues
OK, this is starting to bug me … and since we’re talking about writing mathematics badly …. What’s with all the primes floating at the feet of their letters, like this?
Shouldn’t the primes be in superscript position, like this?
Maybe it’s a bug in the interpretation software, but to get the prime in superscript position, you have to do it explicitly, like this (except between dollar signs):
H^\prime
Otherwise the prime isn’t superscripted.
Or is this some weird convention I don’t know about?
SVG in Comments
OK … Why not allow SVG in comments?
A little tweaking was necessary, but you can now do things like this:
Example Young Tableaux in SVG
Some Young Tableaux
or this:
Picture of Trefoil Knot
Framed Trefoil Knot
Read the post
The First Edge of the Cube
Weblog: The n-Category Café
Excerpt: The notion of smooth local i-trivialization of transport n-functors for n=1.
Tracked: May 4, 2007 9:01 PM
Re: TeXnical Issues
I suspect this is probably not something easily fixable in the blogging software but: is there a reason why the comment box appears to be a fixed size in pixels? It’s a bit annoying because I’ve got a largish screen and use larger than default-size fonts but the comment box resolutely sticks to its size, which means I get about 36 characters on a line in the comment box. This makes seeing larger stretches of the text for editing annoying.
blockquote
Concerning the blockquote-tag, the point is that it does require the content included in <blockquote>…</blockquote> to be inside a paragraph environment enclosed by <p>…</p>.
So you either have a text filter chosen which converts line breaks to such <p>…</p> tags and then insert line breaks before and after the blockquote-tag as John says above – or you add in the tags by hand and do
<blockquote><p>text goes here</p><blockquote>
And if the quoted text has itself several paragraphs you type
<blockquote>
<p>
first paragraph
</p>
<p>
second paragraph
</p>
<blockquote>
which produces this output