Open phockett opened 1 year ago
Looks like PD defaults, see:
import pandas as pd
pd.set_option("display.latex.repr", True)
Also related issues with styled outputs, see https://github.com/executablebooks/jupyter-book/issues/1553#issuecomment-998822118 and https://github.com/executablebooks/jupyter-book/issues/1512
Solution per above, and with latex additions as per https://github.com/executablebooks/jupyter-book/issues/1553#issuecomment-998822118 now working from 64bb418a00574cb12ab223e097b268f9ec639bc5
_config.yml
additions:
latex_elements:
# Note this line cheats the table parameter into the documentclass[] parameter
papersize: letterpaper,table
# These lines add the desired packages to the latex build
preamble: |+
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{multirow}
Notes:
symObj.displayXlm()
, although are OK in HTML - likely issue with lack of return object in this case. May not want to include these in any case, but adding return obj option to PEMtk code probably best bet to fix, see https://github.com/phockett/PEMtk/blob/bb51d8b601eee2486a5a8757f081549398e56e10/pemtk/sym/symHarm.py#L577.Issues with symmetry routines fixed in 7b3bcb92ce5262cfc46562366c2ce024dd4509d5, now have return option for standard PD table.
These do have issue with latex maths symbol rendering, but otherwise seem OK & glue() compatible.
Note that adding styler options still an issue, see notes above for work-around.
Reminder: currently generating the following output styles:
May want to fix Glue > HTML case for styled output if possible, or avoid using this. Also: this seems to have changed... not sure if this is due to glue wrapper, or something else. Previously this case was giving HTML output (e.g. 10th Feb builds, 4263720ddb7693f9a31bfb2d2d9f93f38d78c940) - TBC.
UPDATE: looks like a change with JupyterBook v>0.14 (version as of 2023-02-28), see https://jupyterbook.org/en/stable/explain/migration.html#changes-to-glue and https://myst-nb.readthedocs.io/en/latest/render/glue.html?highlight=glue#the-glue-figure-directive for details and similarly-styled static Pandas dataframe examples - may be able to change with mime priority settings? E.g. https://jupyterbook.org/en/stable/explain/migration.html#book-level-configuration and https://myst-nb.readthedocs.io/en/latest/configuration.html
Table references - currently can set this in text, e.g. with {numref}
Table %s
May be able to push latex to glue then use glue:text
?
Docs: https://jupyterbook.org/en/stable/reference/cheatsheet.html#tables and https://jupyterbook.org/en/stable/content/executable/output-insert.html (only found one issue on glue, https://github.com/executablebooks/jupyter-book/issues/1585)
Leave as figures for now, but should fix if possible.
Issues with LaTex in Pandas dataframe output - currently don't render correctly in HTML and PDF builds (e.g. final table in Sect. 3.2).
For a work-around see https://github.com/executablebooks/jupyter-book/issues/1501#issuecomment-1721378476
Note also tables in 6.4 missing from PDF builds, due to use of styler with HTML output. Need to add additional LaTex wrapper/option?
Quick local tests in sym-fitting-intro_240723-table_export_fix_141123.ipynb
with LaTex output for IOP builds, need to back-propagate to main build chain.
Currently renders as flat text block - should convert to proper latex table, not sure why it isn't, might be glue() issue again? (But OK in HTML output.)