# -*-Python-*-
# Created by eldond at 2018 Jun 21 14:02
"""
This script builds a sample LaTeX project.
This is the main script which calls the other sample file generators.
It will create a dummy figure, a dummy LaTex source file, copy sample references from OMFIT-source/samples/tex,
compile the document, and then open the resulting pdf file.
"""
defaultVars(mainroot='omfit_latex_sample', figure_name='latex_dummy_fig')
tx = root['OUTPUTS']['LaTeX_sample'] = OMFITlatex(main=os.extsep.join([mainroot, 'tex']), mainroot=mainroot)
tx.setdefault('figures', OMFITtree())
texroot = os.sep.join([OMFITsrc, '..', 'samples', 'tex', ''])
root['SCRIPTS']['LaTeX']['make_settings_table'].run(save_to=tx)
root['SCRIPTS']['LaTeX']['make_latex_sample'].run(mainroot=mainroot, save_to=tx, figure_name=figure_name)
root['SCRIPTS']['LaTeX']['make_dummy_figure'].run(save_to=tx['figures'], figure_name=figure_name)
tx['bib_style_d3dde.bst'] = OMFITascii(texroot + 'bib_style_d3dde.bst')
tx['sample_bib.bib'] = OMFITascii(texroot + 'sample_bib.bib')
tx.build(sequence='full') # Create output file, including citations and cross references
tx.run() # Opens output file