Postprocess the text returned by the jupyter kernel for convenience
The jupyter kernel returns text, not python objects. There is also a distinction between text printed to stdout and text returned as 'text/plain', 'text/latex', etc. This will differ, of course, with other kernels.
Sometimes the text is returned with many decimals, sometimes enclosed within commas.
This is why there are now \evalstr
and \evaltex
besides \eval
, and it could be convenient for authors if we defined also \evalfloat
.
There is always, and there will always be, the possibility for the author to use the language to adapt the output, but I personally found \evalstr{'string number {0}'.format(1)}
more satisfying than \eval{print('string number {0}'.format(1),end='')}
.
However, the team had a preference for the following alternative format
-
\eval[type=str]{'string number {0}'.format(1)}
rather than\evalstr{'string number {0}'.format(1)}
-
\eval[type=tex]{r'string number \textbf{{{0}}}'.format(1)}
rather than\evaltex{r'string number \textbf{{{0}}}'.format(1)}
-
\eval[type=float, decimal=20]{np.pi}
rather than\evalfloat[decimal=20]{np.pi}
The goal of this issue is to think about this ideas, and settle for a syntax that is convenient to use for authors.