python_to_latex.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. '''This file is created to be an Interface between Python and Latex.
  2. Goals are: Creating Latexfigures out of Plots '''
  3. from pylatex import Document,Section,Subsection,Tabular,Math, TikZ, Axis, Plot, Figure, Matrix, Alignat
  4. import numpy as np
  5. import os
  6. class PythonLatex:
  7. def __init__(self, geometrie_options, file_path, data=[]):
  8. self.geometrie_options = geometrie_options
  9. self.file_path = file_path
  10. self.data = data
  11. self.doc = Document(geometry_options= self.geometrie_options)
  12. def get_table(self):
  13. pass
  14. def get_equation(self):
  15. pass
  16. def get_matrix(self):
  17. pass
  18. class LatexPlots(PythonLatex):
  19. def __init__(self, plot_options, image_file_path=''):
  20. super().__init__(geometrie_options=geometrie_options)
  21. self.plot_options = plot_options
  22. if image_file_path:
  23. self.image_filename = os.path.join(os.path.dirname(__file__), image_file_path)
  24. else:
  25. self.image_filename = ''
  26. if __name__ == '__main__':
  27. geometrie_options = {'tmargin': '1cm', 'lmargin': '10cm'}
  28. PythonLatex(geometrie_options=geometrie_options)