Allow InputTransformers to raise SyntaxErrors

This is a relatively trivial modification of the IPython main loop to
catch a possible SyntaxError and print it instead of
quitting. Doctesting this change is somewhat tricky since we actually
need to run the main TerminalInteractiveShell.interact() loop, and is
done through a subprocess and piping in a testcase.
Also catch SyntaxErrors from InputTransformers in run_cell()

The run_cell() method is not used in the IPython terminal, so there
are two code paths where the SyntaxError needs to be caught.  Also,
this commit moves the terminal test to IPython/terminal/test/ instead
of IPython/app/test. I've checked that this works in the terminal, the
Qt console, and the html notebook.
Refactor run_cell for clarity.
Don't clear input if InputTransformer raises SyntaxError.
Mechanism for testing terminal interact loop in-process.

While this is complex, I much prefer it to starting a separate process
and piping commands in.
Protect Qt console against SyntaxError from input transformers.
Document various QtConsole embedding approaches.

Also added loading of default config to the in-process embedding example.
Correct the explanations for embedding.
Revert config-loading change in embedding example.
Clarify embedding in IPython; mention 4th method.
Simplify IPythonInputSplitter API
Catch transformer syntax errors in zmq terminal console
Deal with ansi escape codes when nbconverting to latex

Correctly deals with "reset" codes and short codes.  Interprets blinking
style as bold.
Add Origin Checking.
Get rid of exc_info as there isn't an exception.
Indicate Py3 vs. Py2 codepath.
Use *args, **kwargs, log.warn
avoid import of nearby temporary with %edit

use mk**s**temp now,
and create files in subfolders.

should close gh-4731

Note that some part of the logic could now use
http://docs.python.org/2/library/tempfile.html#tempfile.NamedTemporaryFile
That will be deleted on close and avoid IPython to track it.
don't add unicode paths to sys.path

on Python 2

causes unicode warnings comparing unicode to str when non-ascii
add prefer_stream arg to utils.encoding.getdefaultencoding

sometimes the stream encoding should be ignored,
and start with locale (e.g. Popen on Windows Python 2).

Default behavior is unchanged.