Open-Systems-Pharmacology / OSPSuite.ReportingEngine

R implementation of the reporting engine
https://www.open-systems-pharmacology.org/OSPSuite.ReportingEngine/
Other
5 stars 5 forks source link

Pandoc fails to convert embedded TEX formula #1029

Open Yuri05 opened 1 year ago

Yuri05 commented 1 year ago

Translation.md contains the inline TEX formula Eq. 1: ${\Huge GMFE = 10^{\frac{\sum(|log(\frac{Pred}{Obs})|)}{n}} }$ which is properly displayed in MD: Eq. 1: ${\Huge GMFE = 10^{\frac{\sum(|log(\frac{Pred}{Obs})|)}{n}} }$

However when converting it to Word via pandoc I get the following:

pandoc --from=markdown+tex_math_dollars+superscript+subscript+raw_attribute -t docx -o output.docx Translation.md
[WARNING] Could not convert TeX math {\Huge GMFE = 10^{\frac{\sum(|log(\frac{Pred}{Obs})|)}{n}} }, rendering as TeX:
  {\Huge GMFE = 10^{\frac{\sum(|log(\frac{
         ^
  unexpected control sequence \Huge
  expecting "%", "\\label", "\\tag", "\\nonumber" or whitespace

and the formula is not properly erendered in Word: output.docx grafik

Have tried it with the latest pandoc version 3.1.2 - same. Any ideas how to fix?

Yuri05 commented 1 year ago

@pchelle I think it's a pandoc limitation in translating TEX and nothing we can do about it. Maybe it's somehow possible to tell pandoc "just ignore unknown TEX instructions and proceed anyway"

pchelle commented 1 year ago

Indeed, it seems that the translation limits to Math TeX only. Thus, no LaTeX tags setting fonts seem to work. I have tried to convert manually to raw openxml but I did not succeed in displaying the equation. I also tried to set the style of the reference document but did not find where the equation style could be defined.

Yuri05 commented 9 months ago

Last tested with pandoc 3.1.11 (released 16.12.2023) - still cannot be rendered.

pchelle commented 8 months ago

LaTeX to OMML (word math langage) Pandoc conversion supports only the main LaTeX math package(s): https://github.com/jgm/pandoc/issues/9403 I haven't found the list of LaTeX packages that are actually supported though