On 01/27/2018 08:13 PM, 'Nasser M. Abbasi' via FriCAS - computer algebra
system wrote:
> FYI;
> 
> I think the Latex code generated by Fricas here might not be valid. But I am 
> not 
> sure.
> 
> But it hangs Lualatex when I compile it and when I am using breqn package.
> 
> Here it is
> 
> ------------------------
> ii:=integrate(1/(a^2-b^2*x^2), x)
> tex(ii::OutputForm::TexFormat)
> 
>     [
>      "{{\log \left( {{{b \  x}+a}} \right)} -{\log \left( {{{b \  x} -a}} 
> \right
>      )}} \over {2 \  a \  b}"
>       ]
> ------------------------
> 
> Now I put the above code in a latex file and compile it:
> 
> |\documentclass[]{article}\usepackage{amsmath}\usepackage{breqn}\begin{document}\begin{dmath*}[frame={.5pt}]{{\log\left({{{b
>  
> \ x}+a}}\right)}-{\log\left({{{b \ x}-a}}\right)}}\over{2 \ a \ 
> b}\end{dmath*}\end{document}|
> 
> 
> Using lualatex foo.tex
> 
> This seems to hangs or crashes lualatex.  amsmath does not like the latex 
> code 
> and gives warning
> 
> |Package amsmath Warning: Foreign command \over; (amsmath)\fracor 
> \genfracshould 
> be used instead (amsmath)on input line 8.|
> 
> 
> May be \over can be replaced by \frac ?
> 
> I posted this question 
> at  
> https://tex.stackexchange.com/questions/412450/why-this-latex-code-hangs-lualatex-foreign-command-over
>   
> asking for workaround.
> 
> Thanks
> --Nasser

You can replace tex.spad by

https://github.com/hemmecke/fricas/blob/master-hemmecke/src/algebra/tex.spad

and use

https://github.com/hemmecke/fricas/blob/master-hemmecke/src/doc/fricasmath.sty

or use

https://github.com/hemmecke/fricas/blob/mathjax/src/algebra/mathjax.spad

You have much more flexibility of what latex output is generated.
In fact, it generates LaTeX not plain TeX.

Ralf

===========================================================

(1) -> ii::OutputForm::TexFormat

   (1)  ["\begin{fricasmath}{}", "\SYMBOL{ii}", "\end{fricasmath}"]
                                                              Type:
TexFormat
(2) -> ii:=integrate(1/(a^2-b^2*x^2), x)

        log(b x + a) - log(b x - a)
   (2)  ---------------------------
                   2 a b
                                         Type:
Union(Expression(Integer),...)
(3) -> mjx := (ii::OutputForm::MathJaxFormat)

   (3)
   ["$$",

"\frac{\log{\left(b\,x+a\right)}-{\log{\left(b\,x-{a}\right)}}}{2\,a\,b}",
    "$$"]
                                                          Type:
MathJaxFormat
(4) -> concat concat [prologue mjx, format mjx, epilogue mjx]

   (4)

"$$\frac{\log{\left(b\,x+a\right)}-{\log{\left(b\,x-{a}\right)}}}{2\,a\,b}$$"
                                                                 Type:
String

===============
\documentclass{article}
\begin{document}
$$\frac{\log{\left(b\,x+a\right)}-{\log{\left(b\,x-{a}\right)}}}{2\,a\,b}$$
\end{document}

===================================================================

or with my version of TexFormat:

(5) -> tx := (ii::OutputForm::TexFormat)

   (5)
   ["\begin{fricasmath}{}",
    "\frac{\log{\PAREN{\SYMBOL{b}\TIMES
\SYMBOL{x}+\SYMBOL{a}}}-{\log{\PAREN{",
    "\SYMBOL{b}\TIMES \SYMBOL{x}-{\SYMBOL{a}}}}}}{2\TIMES
\SYMBOL{a}\TIMES ",
    "\SYMBOL{b}}", "\end{fricasmath}"]
                                                              Type:
TexFormat
(6) -> concat concat [prologue tx, format tx, epilogue tx]

   (6)
  "\begin{fricasmath}{}\frac{\log{\PAREN{\SYMBOL{b}\TIMES
\SYMBOL{x}+\SYMBOL{a}
  }}-{\log{\PAREN{\SYMBOL{b}\TIMES \SYMBOL{x}-{\SYMBOL{a}}}}}}{2\TIMES
\SYMBOL{
  a}\TIMES \SYMBOL{b}}\end{fricasmath}"
                                                                 Type:
String

====================
\documentclass{article}
\usepackage{fricasmath}
\begin{document}
\begin{fricasmath}{}
\frac{\log{\PAREN{\SYMBOL{b}\TIMES
\SYMBOL{x}+\SYMBOL{a}}}-{\log{\PAREN{\SYMBOL{b}\TIMES
\SYMBOL{x}-{\SYMBOL{a}}}}}}{2\TIMES \SYMBOL{a}\TIMES
\SYMBOL{b}}\end{fricasmath}
\end{document}

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to