3 ms·
Show HN: Convert Matlab/NumPy matrices to LaTeX tables
- westurner 9y agoLaTeX must be escaped in order to prevent LaTeX injection. AFAIU, numpy.savetxt does not escape LaTeX characters? Jupyter Notebook rich object display protocol checks for obj._repr_latex_() when converting a Jupyter notebook from .ipynb to LaTeX. The Pandas _repr_latex_() function calls to_latex(escape=True † ). https://github.com/pandas-dev/pandas/blob/master/pandas/core/generic.py https://github.com/pandas-dev/pandas/blob/master/pandas/core... †* The default value of escape ️ (and a few other presentational parameters) is determined from the display.latex.escape option: https://pandas.pydata.org/pandas-docs/stable/options.html?highlight=display.latex#available-options https://pandas.pydata.org/pandas-docs/stable/options.html?hi... * df = pd.read_csv('filename.csv', ); df.to_latex(escape=True) Or, with a Jupyter notebook: df = pd.read_csv('filename.csv', ); df # $ jupyter convert --to latex filename.ipynb
- westurner 9y agoWouldn't it be great if there was a LaTeX incantation that allowed for specifying that the referenced dataset URI (maybe optionally displayed also as a table) is a premise of the analysis; with RDFa and/ or JSONLD in addition to LaTeX PDF? That way, an automated analysis tool could identify and at least retrieve the data for rigorous unbiased analyses. http://schema.org/Dataset http://schema.org/Dataset http://schema.org/ScholarlyArticle http://schema.org/ScholarlyArticle #StructuredPremises