Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TemplateBox with RowDefault tag is unsupported #30

Open
vsht opened this issue May 25, 2020 · 2 comments
Open

TemplateBox with RowDefault tag is unsupported #30

vsht opened this issue May 25, 2020 · 2 comments

Comments

@vsht
Copy link

vsht commented May 25, 2020

It appears that a TemplateBox containing a "RowDefault" tag
cannot be processed properly. Cf. e.g. this typesetting code
from https://mathematica.stackexchange.com/questions/174627/writing-partial-differentiation-in-a-subscript/174630#174630

Derivative /: MakeBoxes[
    Derivative[n_Integer?NonNegative, m_Integer?NonNegative][f_], form_
] := SubscriptBox[
    MakeBoxes[f, form],
    TemplateBox[Join[ConstantArray["x", n], ConstantArray["y", m]],"RowDefault"]
]

When trying to apply CellToTeX to

Derivative[1, 0][f][x, y]

as in

CellToTeX[
 Cell[BoxData[
   FormBox[RowBox[{SubscriptBox["f", 
       TemplateBox[{"x"}, "RowDefault"]], "(", 
      RowBox[{"x", ",", "y"}], ")"}], TraditionalForm]], "Output"]]

the function fails.

According to

https://mathematica.stackexchange.com/questions/55363/incompatibility-of-row-and-texform/182382#182382

"RowDefault" was introduced in Mma 9. Indeed I can workaround the issue if I generate my cells
in Mma 8, where no such tags arise.

@jkuczm
Copy link
Owner

jkuczm commented May 26, 2020

Similarly to linked answer, workaround for this problem is to replace internal function, used by CellsToTeXto convert TemplateBoxes, with builtin one:

CellsToTeX`Internal`templateBoxDisplayBoxes = BoxForm`TemplateBoxToDisplayBoxes;

I guess I was not aware of existence of BoxForm`TemplateBoxToDisplayBoxes function, when I started this package, so I created my own imperfect version.

@vsht
Copy link
Author

vsht commented May 26, 2020

Great, many thanks for this fix. I really appreciate all your work on this package.
Over the years it saved me a lot time in getting MMa output into LaTeX.

BTW, what would be the preferred way to cite CellsToTeX in a publication? Is there perhaps a Zenodo-DOI ?
https://guides.github.com/activities/citable-code/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants