sympy/sympy — pull request #2488 by MOBle (2013-09-29 18:23:39+00:00)
Title: Add new translate function to include accents and other latex macros in symbol names

This commit adds the ability to create more complex symbol names with accents, bolds, etc., and still have them translated into reasonable latex on printing (inspired by the `latex_ex` function from the `galgebra` submodule). For example, some times I want the vector `L` and its corresponding unit vector to both be defined, and possibly even distinguished from some scalar `L`. I can do something like the following:

```python
L, Lvec, Lhat = symbols('L, Lvec, Lhat')
```
Normally, when these are printed to latex, they will just be strings of italic letters. With this patch, when these are printed in latex, they get converted automatically to `L`, `\vec{L}`, and `\hat{L}` automatically, without interfering with other sympy processes. The list of recognized macros is stored in the new `accent_keys` list.

The other option would be to do something like

```python
L, Lvec, Lhat = symbols(r'L, \vec{L}, \hat{L}')
```
But when these are printed to non-latex things, this comes out looking terrible. For example, with the `ccode` printer, this would give invalid C code. So this patch gives the best of both worlds.

Also, this patch adds the more familiar spelling "Lambda" to the list of recognized capital Greek letters, while leaving the Unicode-y spellings in place.