Set python3 option for console lexer
For python 3 code I can specify the lexer for verbatim environments as py3, but for console output I wish to use the pycon lexer with its python3=True option. Currently I see no mechanism to pass this option in pythontex to pygmatize, whereas minted has an option for this.
Here is a sample document where the highlighting of the @ operator in the console output is wrong.

\documentclass{article}
\usepackage{pythontex}
\setpythontexpyglexer[py]{py3}
\begin{document}
\begin{pyconsole}
print(sys.version)
import numpy as np
print(np.array([[1,0],[0,1]]) @ np.array([[0,1]])
\end{pyconsole}
\begin{pyverbatim}
print(sys.version)
import numpy as np
print(np.array([[1,0],[0,1]]) @ np.array([[0,1]])
\end{pyverbatim}
\end{document}
At this point, everything really should default to Python 3 compatibility. In the last commit, I've set pycon to use python3=True always and also changed the default Python lexer to python3. Adding support for setting arbitrary lexer options is more complicated given the current design, so I will look into that later.
Many thanks - this now works well for python3 which is what I am interested in. Andrew
-- Andrew Swann | Associate Professor | Tel +45 871 55767 | [email protected]mailto:[email protected] | http://home.math.au.dk/swann/ | Department of Mathematics, Aarhus University, Ny Munkegade 118, Bldg 1530, DK-8000 Aarhus C, Denmark | Dept +45 871 50000 | Fax +45 8613 1769
From: Paulo Cereda [email protected] Reply to: gpoore/pythontex [email protected] Date: Friday, 20 September 2019 at 13:08 To: gpoore/pythontex [email protected] Cc: Andrew Francis Swann [email protected], Author [email protected] Subject: Re: [gpoore/pythontex] Set python3 option for console lexer (#156)
At this point, everything really should default to Python 3 compatibility. In the last commit, I've set pycon to use python3=True always and also changed the default Python lexer to python3. Adding support for setting arbitrary lexer options is more complicated given the current design, so I will look into that later.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/gpoore/pythontex/issues/156?email_source=notifications&email_token=ACDDEFNQZ5PJFNVDK2BZDXLQKSVKRA5CNFSM4IWXGTQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7GLSIQ#issuecomment-533510434, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACDDEFN4534R2CBBQ6YWIXDQKSVKRANCNFSM4IWXGTQQ.