Posso usar o estilo pygmentize com Pygments no PythonTeX. Deixe MWE assim:
\documentclass{article}
\usepackage{pythontex}
\begin{document}
\begin{pygments}[style= murphy]{python} % murpyhy is style from pygmentize
#!/usr/bin/env python
import Tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='Quit',
command=self.quit)
self.quitButton.grid()
app = Application()
app.master.title('Sample application')
app.mainloop()
\end{pygments}
\end{document}
E vou pegar o estilo Pygmentize assim:
\documentclass{article}
\usepackage{minted}
\usemintedstyle{murphy}
\begin{document}
\begin{minted}[mathescape]{python}
#!/usr/bin/env python
import Tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='Quit',
command=self.quit)
self.quitButton.grid()
app = Application()
app.master.title('Sample application')
app.mainloop()
\end{minted}
\end{document}
O resultado acima, use o pacote cunhado, mas preciso usar o pacote pythontex porque é simples com meu documento e a captura de tela do resultado:
Alguma solução para resolver isso?
Responder1
Não sei se o estilo pode ser alterado no meio do documento, mas funciona:
\documentclass{article}
\usepackage[pygopt={style=murphy}]{pythontex}
\begin{document}
\begin{pygments}{python}
#!/usr/bin/env python
import Tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='Quit',
command=self.quit)
self.quitButton.grid()
app = Application()
app.master.title('Sample application')
app.mainloop()
\end{pygments}
\end{document}