print_latex

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Fri May 10 19:47:04 CEST 2002


Hi,

On Mon, 29 Apr 2002, Alessandro Zaccagnini wrote:
> I have been using print_latex and I found that the following piece of
> code 
> 
> #include <iostream>
> #include <ginac/ginac.h>
> 
> using namespace std;
> using namespace GiNaC;
> 
> int main() {
>   GiNaC::ex q;
> 
>   q = 2 * pow(6, numeric(1,3));
> 
>   q.print(print_latex(std::cout));
> 
> }
> 
> produces the output 
> 
> 2 6^{{(\frac{1}{3})}}
> 
> which latex then typesets in the wrong way, since the space is lost.
> Putting a \cdot in place of the blank seems to fix the problem. 

Hmm, I am somewhat reluctant to introduce a "\cdot" there.  Putting
parenthesis around 6^(1/3) in LaTeX-output would either bloat the printing
routines or bloat the normal output with superfluous parenthesis as well,
as in 2(x^2) instead of 2 x^2.  May I suggest to change the space to a
hard space "\ " in LaTeX?  This would then produce
  2\ 6^{{(\frac{1}{3})}}
which seems legible to me, when typeset.  (Try it with a two-digit
basis.)  Would that be okay for you folks?

Regards
    -richy.

PS: It's a real pity LaTeX is dedicated to printed format instead of
    semantical format.    :-(
-- 
Richard B. Kreckel
<Richard.Kreckel at Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>





More information about the GiNaC-list mailing list