kubaPod/M2MD

TeXForm of 2 is not supported.

Closed this issue · 5 comments

vsht commented

I started to transition the full FeynCalc documentation to Markdown using M2MD not so long ago,
but there are still some edge cases where I cannot obtain a proper LaTeX output and get only an image instead.
For example

M2MD[Cell[BoxData[
    FormBox[
      FractionBox["1", 
        TemplateBox[{"\"(\"", 
            SuperscriptBox[
              FormBox[
                FormBox["p", TraditionalForm], TraditionalForm], 2], 
       "\"+\"", 
            RowBox[{"2", " ", 
                RowBox[{"(", 
                    RowBox[{
                        FormBox[
                          FormBox["p", TraditionalForm], 
              TraditionalForm], 
                        
             FormBox["\"\[CenterDot]\"", TraditionalForm], 
                        FormBox[
                          FormBox["q", TraditionalForm], 
              TraditionalForm]}], ")"}]}], 
            RowBox[{"-", 
                SuperscriptBox["m", "2"]}], "\"+\"", 
            RowBox[{"\[ImaginaryI]", " ", "\"\[Eta]\""}], "\")\""},
          "RowDefault"]], TraditionalForm]], "Output",
   CellLabel -> "Out[13]="]]
During evaluation of In[15]:= TeXForm::unspt: TeXForm of 2 is not supported.

Out[15]= $$![1n6s7udnvjhyu](img/1n6s7udnvjhyu.png)$$

This happens for SFAD[{{p, 2 p . q}, m^2}] in FeynCalc. Is there perhaps a simple workaround for this problem?

vsht commented

It seems that setting

System`Convert`TeXFormDump`maketex[i_Integer] := ToString[i]

fixes the issue in this example. I'll check if it helps in all cases and report back.

vsht commented

Works for all my examples.

Have you complained to WRI about TeXForm? They are more likely to fix things when more people complain.

My biggest complaints:

  • It hasn't been updated in ages, and does not support many "newer" construct ("newer" meaning introduced in version 10.0 in 2014 seven years ago ...) Just try TeXForm[<|1 -> 2|>], and consider that associations are a fundamental data structure now.
  • It keeps outputting \unicode{1234} for unsupported characters. Unfortunately, this is next to impossible to make interpretable either by LaTeX or MathJax (even ignoring the fact that most of these point to private character codes)
  • It is not customizable by users, so neither can we update it to work with our own stuff, nor can be fix any of the glaring omissions!

Sometimes I suspect like I'm the only one who keeps complaining, so they assume that it's "just the one grumpy user"

@vsht I also try to generate the IGraph/M documentation using M2MD and Pandoc, see http://szhorvat.net/mathematica/IGDocumentation/ I am very interested in sharing ideas. I have not yet managed to make multi-page documentation work.

vsht commented

Have you complained to WRI about TeXForm? They are more likely to fix things when more people complain.

Yes, I did. It would be great if they could at least fix this weird TeXForm of 2 is not supported bug, since the fix is trivial.

@vsht I also try to generate the IGraph/M documentation using M2MD and Pandoc, see http://szhorvat.net/mathematica/IGDocumentation/ I am very interested in sharing ideas. I have not yet managed to make multi-page documentation work.

I've seen your IGraph/M documentation and it indeed looks very nice. My plan is actually to replace

https://feyncalc.github.io/FeynCalcBook/guide/FeynCalc.html

using M2MD, but it still might need some work. Furthermore, I'd like to have FeynCalc documentation available
as a PDF file, where the Markdown output of M2MD will be converted to LaTeX via pandoc.

The good thing about M2MD is that one can put TeX (with $) directly into .m files like in

https://github.com/FeynCalc/feyncalc/blob/master/FeynCalc/DocumentationFiles/Mathematica/Dirac/DiracOrder.m

and it gets properly processed. At the moment I'm still in the process of polishing the .m files that I automatically
generated from our documentation notebooks.