Issue #897 new

# LaTeX Formatter mishandles Text and Token styles

Andrew Pinkham
created an issue

Consider the following Python 3 Traceback code, found in `tests/examplefiles`:

```  File "<stdin>", line 1
1+
^
SyntaxError: invalid syntax
```

When using the `monokai` style in the `LaTeX` formatter, the `File`, `line`, `SyntaxError` and `:` tokens are not correctly colored. (similar problems appear in the `vim` style)

There are two cases to the problem:

1. In the case of `File`, `line` and `:`, no style is being applied (there is no `\PY{style}{File}`, only `File`)
2. `SyntaxError` is output as `\PY{g+gr}{SyntaxError}`. However, neither `g` nor `gr` are defined in `monokai`, and because Token/Text styles are output as `\csname PY@tok@\endcsname`, and are separate from Generic styles (not inherited by), this style is not being applied.

An easy solution to both would be to set a default text color for the verbatim environment. This would avoid changing the handling of styles, or introducing special cases.