LaTeX style accents in regular text

LaTeX has some handy macros that allow the insertion of diacritics and other special characters in text mode. Relevant tables from the Comprehensive LaTeX Symbol List:

These are handy since they don't require special input methods nor remembering unicode character numbers but, more importantly, mathematicians know and use them all the time. (I regularly get emails addressed "Dear Fran\c{c}ois"!) It would be nice if some useful subset of these were recognized on MathOverflow.

• I'm suddenly ashamed that I put myself in this otherwise impressive list of mathematicians! (They were the first examples that came to mind...) Jun 29 '13 at 16:15
• This is a great suggestion. Also on MO not infrequently does one see LaTeX-style 'pseudo-diacritics'. Some even actually use MathJax to get them to print, which is however unfortunate due to different font, rendering time, and some other reasons.
– user9072
Jun 29 '13 at 16:18
• Should we also expand the 'for example' list here. Accents grave and circonflexe spring to mind. Also the i without dot, I do not know how this is called, but I know of Yıldırım. Also one might want to be able to spell Gauß easily.
– user9072
Jun 29 '13 at 16:25
• @FrançoisG.Dorais, I liked your list of the names better... :-) Jun 29 '13 at 16:44
• François, should we expect people to also write Андре́й Андре́евич Ма́рков, 姚期智, ஸ்ரீனிவாஸ ராமானுஜன், ... or is this expectation only for names in Latin based languages? If all names should be written in their original language please write my name as کاوه. :) Jun 29 '13 at 22:59
• @Kaveh: I've never been asked about that. (I've also never saw anyone write write Ма́рков instead of Markov in an question or answer.) Jun 29 '13 at 22:59
• @François, I know that. Russian uses Cyrillic script so no surprise people write Ма́рков as Markov. My point is, IMHO, we shouldn't be too picky about names. There are many published articles that write Kurt Gödel as Kurt Godel. Almost none of my American/European colleagues can even pronounce my first name correctly let alone my last name. German and French share most of their symbols with English but the symbols used by these names are not on standard English keyboards that we use. And people with other native languages may not even notice the difference between symbols like è and é. Jun 29 '13 at 23:30
• @Kaveh: I only relate what people ask me. I generally appreciate when people try since my name has a diacritic and I like it, but that has no bearing on whether I would request this on their behalf or not. [If you're asking me personally, if I were to cite a paper by کاوه from АЛГЕБРА и ЛОГИКА (the original, not the translation), I will try to keep the original names as such if possible, perhaps with a parenthetical translation/transliteration into whatever language I'm writing in.] Jun 29 '13 at 23:31
• @François, I understand. I am just saying that we should be tolerant to people whose native language is different from ours when they can't write our names properly. (I doubt it be straightforward to publish an article in say JSL with author name Алекса́ндр Алекса́ндрович Разбо́ров, not to even mention names in languages using right to left scripts like Hebrew.) Jun 29 '13 at 23:56
• @Kaveh: The request was not for my name, though I suspect that's why people often ask me personally, my guess is that it's mostly for Erdős which is kind of a pain even for me to type. Jun 30 '13 at 0:02
• @François, I understand that this feature is what people request from you and I support this feature-request. Probably shouldn't have posted these under the question. Apologies. Jun 30 '13 at 0:24
• @Kaveh: No problem. Jun 30 '13 at 0:43
• I should explain that this feature request was triggered by an answer of mine mathoverflow.net/a/135187/6794 (before it was edited), in which I wanted to put correct accents on the name of one of my teachers. I found that my computer and browser, though perfectly capable of putting an acute accent on various letters, balked at putting it on a c (they inserted a space and put the accent on that). I also found that I had no idea how to produce a the accents that TeX calls \v and \H . (I invited others to edit in the accents, and Mariano Suárez-Alvarez kindly did so.) Jun 30 '13 at 1:26
• @Kaveh, François is in no way propose to make it mandatory to write people name in their original scripts, he just wants to be able to do so. Jun 30 '13 at 1:55
• I'd even add to Mariano's comment that it's not about being able to do so, but making work what some people try already (but does not work). @Kaveh: there is a difference between using a (correct) transliteration and dropping diacritics. For example, on the Wiki page (the English one) it says Gödel, only this, on that of Markov one has Markov and the original. The correct way to write Gödel in English is like this; Godel is simply wrong (of course it is very minor error and should definitely be tolerated but it is still wrong) while using a correct transliteration is not wrong.
– user9072
Jun 30 '13 at 11:54

So you want to load even more javascript on us so that you don't have to remember how to input unicode characters?

I can write "François" by pressing Alt+c to get the ç on my keyboard.

If I forget the unicode, I can use a little PHP script that I wrote some time back to convert basic LaTeX accent code into unicode. You can find it at http://www.math.ntnu.no/~stacey/code/latexToUTF/utf.php

The above works on single commands. If you want to put in whole sentences, such as "Fran\c{c}ois Dorias asked for a way to type Erd\H{o}s", try http://www.math.ntnu.no/~stacey/PHPLaTeX/index.php which will yield:

François Dorais asked for a way to type Erdős

• This wouldn't be JS, it would be server side. Jun 29 '13 at 21:15
• @Manishearth So you'd load it into the Markdown parser? Even so, it's not a great idea. How many different ways of entering unicode characters would you like to support? We already have direct unicode characters and entities. The more possibilities that you add in, then the more chance there is of bizarre behaviour. Jun 29 '13 at 21:38
• Not too bizarre an idea, other sites have similar site-specific syntax (check out Poker or Chess). As long as an important subset of the symbol list is supported, it ought to be fine. Jun 29 '13 at 21:43
• Actually, that script is exactly what the last user asked for! Thanks! Jun 29 '13 at 21:47
• Would it be hard to have it recognize more complex expressions? E.g. if I could type Erd\H{o}s to get Erdős. Jun 29 '13 at 21:52
• (By the way, this is not for me: I don't want anything of the kind, I just get tired of adding disclaimers all the time.) Jun 29 '13 at 21:59
• @Manishearth But where would you stop? There is a huge number of unicode characters with "simple" LaTeX macros. Would you support all of them? You may as well just run TeX on the user input and be done with it! Jun 29 '13 at 22:42
• @FrançoisG.Dorais Shouldn't be too hard to add. I'll consider that a feature request. Jun 29 '13 at 22:42
• Thanks Andrew ! Jun 29 '13 at 22:44
• People should explore their OSes and find out how to produce weird' characters: it is surprisingly easy in most of them (and it does not involve remembering unicode point numbers in any OS I use, at least) Jun 30 '13 at 1:58
• +1 for Mariano's comment. Actually, even in LaTeX, I think \usepackage{inputenc} and native input is recommended over macros --- I recall reading on tex.se that there are some subtle hyphenation and pdf issues if one uses "the old way". Jul 2 '13 at 9:13
• @FedericoPoloni My reading of tex.stackexchange.com/a/44699/86 is that this is not the case. inputenc transforms the characters into their macro equivalents. It is fontenc that is crucial for hypenation. However, I agree with the endorsement of Mariano's comment. Jul 2 '13 at 10:43
• You are right, I mixed up the two packages. There is still a benefit in using real accented characters in your source rather than TeX macros though: they work with spellcheckers. Jul 2 '13 at 11:13
• @FrançoisG.Dorais See latest edit. I remembered why I wrote the utf.php script as a single command issue: parsing TeX in a non-TeX language is a nightmare. Fortunately, I also remembered that I'd already done it in PHP and that script works for more complex expressions. Jul 2 '13 at 11:44
• Thanks Andrew! It's a fantastic tool. Jul 3 '13 at 3:35

HTML entities already work on Math Overflow, and the non-numeric ones are not too hard to remember

• Eduard &Ccaron;ech / Eduard Čech
• Fran&ccedil;ois G. Dorais / François G. Dorais
• Kurt G&ouml;del / Kurt Gödel
• George P&oacute;lya / George Pólya

For example, the HTML entity for an accented letter (replacing - with the letter) is:

• &-cedil;:Çedilla
• &-uml:Ümlaut
• &-caron: Čaron
• &-acute: Ácute
• &-grave`: Gràve

I cannot find non-numeric entities for the others, though. This would be a nice feature.

I'll see if I can userscript a virtual keyboard that behaves similarly to this one

• The idea is that mathematicians already have a way that they use all the time. Support for HTML entities is not uniform: &ccaron;aron, &ccedil;edil, &uuml;mlaut,... Jun 29 '13 at 20:20
• @FrançoisG.Dorais I know :) I'm not sure if this has a chance of being implemented. However, I will try to modify my IPA Keyboard script to fit this. Jun 29 '13 at 20:23
• It is slightly ironic that there are words with wrong diacritics in this answer (but I assume this is intentional). Otherwise, while it does not really answer the question, I think it could be useful for some to have the information around. My way of doing it is copying from somewhere else, typically Wikipedia, which works well for me.
– user9072
Jun 29 '13 at 20:53
• @quid yeah, it was intentional, just to make it clear which accent is which. Jun 29 '13 at 21:19
• Character escapes are not recommended by the W3C (w3.org/International/questions/qa-escape). Our pages are encoded in UTF-8, so there's absolutely no reason to obfuscate text by using unnecessary character escapes! It's been a very long time since this was the correct way to handle "foreign" characters, so I don't think dredging it up now is useful. Jul 6 '13 at 19:27