GmailTeX is a plugin which adds (La)TeX capability to Gmail and Gmail Chat.

GmailTeX uses MathJax as its TeX typesetting engine, and CodeCogs for hosting images.

April 20, 2013

## Current version: 5.7.9

• 1.0, Jun 7, 2010: The initial release.

• New in v.4.*: WYSIWYG (what you see is what you get) editing of outgoing messages. Your addressee does not have to have GmailTeX installed or use Gmail in order to view the math. Math is viewable in most mail readers and browsers, including mobile ones.

• New in v.5*: also works with Chat. Also adds auto mode.

v.5.6: moved GmailTeX panel to a different place, since it was not showing for some people after the last refresh of Gmail's code.

v.5.7: better baselines.

## Usage

After clearing the browser cache and restarting Gmail, you should see the collapsible GmailTeX menu in the Gmail Navigation Bar on the left. (If you used the alternative installation, you need to click on the newly created Gmail bookmarklet first.) The menu should have the following items:

• rich math (F8)
• simple math (F9)
• auto: off 1 2 4 8
• images: gif svg
• help

### Reading email

When you receive an email containing LaTeX-encoded math, hit the link simple math or rich math, or press F9, resp. F8. LaTeX in your emails will be transformed into something more readable (only temporarily, until you close the message).

For rich math to work, LaTeX must be properly enclosed in $...$ or $$...$$. For simple math, it does not have to be: the program will guess which part is math, and which part is not.

The simple math method only supports a subset of LaTeX (subscripts, superscripts, greek letters, \sqrt, \sum, \prod, \cap, \cup, etc.) and may not work on every input (after all, it is guessing). But it is useful when you receive an email with pseudo-LaTeX which is not enclosed in proper delimiters.

### Sending email in "Rich format" mode

The easiest is to compose an email in Rich format. Hitting the link or rich math or pressing F8 will transform your LaTeX into images with equations. Double-clicking on the image will turn it back into plain text.

If you are composing using new Compose/Reply, make sure you are NOT in "Plain text mode"!

Hitting the link simple math or pressing F9 will transform your LaTeX into simple HTML with subscripts, superscripts, greek letters etc. Ctrl-Z works for "undo".

Exactly the same as for reading, for rich math to work, LaTeX must be properly enclosed in $...$ or $$...$$. For simple math, it does not have to be: the program will guess which part is math, and which part is not.

Occasionally, after hitting F9 you may have trouble exiting out of subscript or superscript mode. (Pro tip: putting a dot "." after a superscript or subscript before hitting F9 works well to avoid this problem.) If it happens, select the text that should not be subscripted or superscripted, and press the button "Remove Formatting" from Gmail HTML editor's toolbar.

Whichever method you use, your addressee does not need to have GmailTeX installed. The math should be directly viewable in most browsers, including mobile browsers.

Here are some things to consider when choosing between HTML or images in the outgoing emails:

• simple math is just standard HTML, which any browser or email client can read, online or offline.
• rich math means links to images hosted by CodeCogs on their server, and used in this app with their explicit permission. The images are not available offline, unless they have been cached by your computer.
• If a server goes down or the service is discontinued (as Google's LaTeX engine is going to do soon), the images will no longer render.
• The server at CodeCogs has a daily fair usage limit, currently 3,000 equations (per IP address?)

Note:

1. Colors works with F8. Try writing $\color{Red}{\mathbb C^n}$ and pressing F8 to get . Other available colors: Blue, Green, Yellow, Pink, Orange, Purple, Maroon, Teal.
2. TeX accents work with F9. Try writing H\'el\`ene and pressing F9 to get Hélène.

### Sending email in "Plain Text" mode

When composing in Plain Text mode, pressing F8 will open a preview window for your LaTeX (and Shift-F8 will close it). The email is sent out as is, without any modifications. To view math nicely typeset, your addressee also needs to have GmailTeX installed.

Now that there is a WYSIWYG way of sending emails, I may remove this method.

### auto: off 1 2 4 8

Turning this on by clicking on 1, 2, 4, or 8 is equivalent to letting GmailTeX press the F8 key (rich math) automatically every 1, 2, 4, or 8 seconds. Thus, received emails with properly enclosed math will be rendered automatically, and the math enclosed in $...$ and $$...$$ in the emails you are composing will automatically turn into images (every 1, 2, 4, or 8 seconds).

### images: gif svg

You can set the format for the outgoing images. The default is GIF. In the SVG format, the images look better when magnified. However, old versions of Internet Explorer (before v.9) and the default Android browser (before v.3) do not support SVG. Also, the the SVG math output produced by the CodeCogs LaTeX server may be occasionally buggy. If you encounter such a bug, just switch to GIF.

Novice LaTeX users may also find CodeCogs' Online LaTeX Equation Editor useful. The link is available at the bottom of GmailTeX's window. You can compose your formula there and then paste it in the Compose window.

### Using LaTeX with Chat

Just include your math in $...$ or $$...$$. It should automatically show upon entering.

## Troubleshooting

• If you are upgrading from a previous version of GmailTex, you need to clear the cache and restart the browser, to make sure that the new version is loading.
• If you used the alternative installation as a bookmarklet, and the control panel does not appear, try going to the http address in your bookmark manually, to make sure that it exists and that you have the necessary permissions to access it.
• To typeset multiline equations, for example with a matrix or \cases: simply remove the linebreaks. GmailTeX is optimized to work with each text block separately, otherwise it would work much slower and would take up more resources. So it does not look across the line breaks.
• If some formulas do not typeset correctly, switching from SVG to GIF output may fix it (The SVG engine at CodeCogs is glitchy.)

## Privacy and security

GmailTeX, as written by me, does nothing beyond the basic functions explained in the Usage section above. It does not collect or send out any information about its users, does not make any XMLHttpRequests, and does not load any external code other than MathJax, and now also images from CodeCogs.

And of course GmailTeX is an open source human-readable Javascript program, so you can examine it yourself.

Beware of installing GmailTeX from anywhere but the sources listed in Installation. I uploaded GmailTeX to those sites myself. But I do not control any of the 3rd party web sites, such as Softpedia etc. and their content.

## Thanks

• To the MathJax project for providing a superb TeX typesetting engine.
• To CodeCogs for providing the engine for images, and for hosting them.
• To Kristi Tsukida for writing wrappers for a Chrome extension and Greasemonkey userscript.

I, Valery Alexeev, wrote this program for myself, but I am releasing it here for free in the hope that it could be useful to others, mathematics students and researchers alike. For feedback or bug reports on GmailTeX, you may use this email.