Advertisement
snifer

Python highlighting en LaTeX

Feb 11th, 2012
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.16 KB | None | 0 0
  1. %% Python highlighting en LaTeX
  2. %% Sniferl4bs www.sniferl4bs.blogspot.com
  3. %% Follow me: @sniferl4bs
  4.  
  5. \documentclass[12pt,a4paper]{article}
  6. \usepackage[latin1]{inputenc}
  7. \usepackage{amsmath}
  8. \usepackage{amsfonts}
  9. \usepackage{amssymb}
  10. % El paquete que hemos instalado y debemos usar para que quede bonito =)
  11. \usepackage{pythonhighlight}
  12. \usepackage{listings}
  13. %%
  14. \author{Jose Moruno Cadima}
  15. \title{Ejemplo de documento con codigo en Python}
  16. \begin{document}
  17.  
  18. \bf {  Ejemplo de Codigo de Python en  \LaTeX.}
  19. %%Para meter el codigo solamente debemos realizar un \begin{python}
  20. \begin{python}
  21. # -*- coding: utf-8 -*-
  22. from PyQt4 import QtCore, QtGui
  23. import sys
  24.  
  25. class Mi_Programa(QtGui.QWidget):
  26.  
  27.  def __init__(self, parent=None):
  28.  
  29.    QtGui.QWidget.__init__(self, parent)
  30.    self.resize(200,200) #Dimensiones del formulario
  31.  
  32. aplicacion = QtGui.QApplication(sys.argv)
  33. formulario = Mi_Programa() # Instanciamos la clase
  34.                           #de nuestro programa
  35. formulario.show() # Mostramos el Formulario
  36. aplicacion.exec_() # Ejecutamos
  37. \end{python}
  38. %%Una vez hemos acabado el codigo en Python introducimos un \end{python}
  39. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement