jupyter-book / mystmd

Command line tools for working with MyST Markdown.
https://mystmd.org/guide
MIT License
210 stars 63 forks source link

specify latex table package #379

Open jgunstone opened 1 year ago

jgunstone commented 1 year ago

Which area is this feature request for?

LaTeX Export

Describe the feature you'd like to request

i'd like to be able to specify what latex table package to export with.

based on this: https://github.com/executablebooks/mystjs/blob/ef07d85f49f84f575e2917437f333db6aacacfad/packages/myst-to-tex/src/tables.ts#L162-L194

it looks like the tabular package is hard-coded in?

Describe the solution you'd like

I'd like to use either:

The example below is produced using tabularray. To my understanding it would be impossible to do this using either tabular or longtable image test2_1.pdf

\documentclass[twocolumn]{article} \usepackage[margin=15mm]{geometry} \usepackage{tabularray} \usepackage[sfdefault,lf]{carlito} %% The 'lf' option for lining figures %% The 'sfdefault' option to make the base font sans serif \usepackage[T1]{fontenc} \renewcommand*\oldstylenums[1]{\carlitoOsF #1} \begin{document} Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. \begin{longtblr}[ caption = {Long Long Long Tabular}, entry = {Short Caption}, label = {tblr:test}, ]{ colspec = {XXX}, hlines, rowhead = 2, rowfoot = 1, row{1-2,Z} = {font=\bfseries}, } Head & Head & Head \\ Head & Head & Head \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ \end{longtblr} \begin{longtblr}[ caption = {Long Long Long Tabular}, entry = {Short Caption}, label = {tblr:test}, ]{ colspec = {XXX}, hlines, rowhead = 2, rowfoot = 1, row{1-2,Z} = {font=\bfseries}, } Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Foot & Foot & Foot \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ \end{longtblr} \begin{longtblr}[ caption = {Long Long Long Tabular}, entry = {Short Caption}, label = {tblr:test}, ]{ colspec = {XXX}, hlines, rowhead = 2, rowfoot = 1, row{1-2,Z} = {font=\bfseries}, } Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Alpha & Beta & Gamma \\ Epsilon & Zeta & Eta \\ Iota & Kappa & Lambda \\ Nu & Xi & Omicron \\ Rho & Sigma & Tau \\ Phi & Chi & Psi \\ Foot & Foot & Foot \\ \end{longtblr} Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. \end{document}

Describe alternatives you've considered

pandoc uses longtable by default.

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

ollyhensby commented 1 year ago

I am also looking at using longtable and tabularray because with the current table package that is used, tabular, the rows don't go nicely onto the next page.

It would be great to add support for these

stevejpurves commented 1 year ago

There is already some support for longtable in the myst-to-tex subpackage (here), however I don't think that the options are exposed to the directive level in mystmd cc @fwkoch ?