
Show HN: Convert Matlab/NumPy matrices to LaTeX tables - tpaschalis
https://tpaschalis.github.io/numpy-matlab-matrix-to-latex/
======
westurner
LaTeX 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...](https://github.com/pandas-
dev/pandas/blob/master/pandas/core/generic.py)

_†* 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?hi...](https://pandas.pydata.org/pandas-
docs/stable/options.html?highlight=display.latex#available-options) *

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
Wouldn'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

