|
From: Leo B. <Leo...@um...> - 2023-07-25 17:20:03
|
On Tue, Jul 25 2023, Wolfgang Hugemann <Au...@Hu...> wrote:
>> Perhaps you can file bugs on what's wrong and what Maxima should
>> produce instead?
I really think these examples are a case for making a *number* of
"style files" for different flavours of TeX and typesetting conventions.
Here are solutions to your examples:
> Examples:
>
> (%i1) tex(a*b)$
> $$a\,b$$
(%i1) texput("*"," ") $
(%i2) tex(a*b);
$$a b$$
>
> (%i2) tex(a/b)$
> $${{a}\over{b}}$$
(%i6) texput("/",lambda([r], block([n,d], n:num(r), d:denom(r), printf(false,"\\frac{~a}{~a}",tex1(n),tex1(d)))));
(%o6) lambda([r], block([n, d], n : num(r), d : denom(r),
printf(false, \frac{~a}{~a}, tex1(n), tex1(d))))
(%i7) tex(a/b);
$$\frac{a}{b}$$
(%i8) tex(a/(b+c/d));
$$\frac{a}{\frac{c}{d}+b}$$
(%i9) tex(a/(b+c/d+x*y/cos(t)));
$$\frac{a}{\frac{x y}{\cos t}+\frac{c}{d}+b}$$
>
> (%i3) tex(c[d]+c_d)$
> $$c_{d}+{\it c\_d}$$
How does one typeset a_big_long_variable_name ?
>
> (%i4) tex(matrix([a,b],[c,d]))$
> $$\ifx\endpmatrix\undefined\pmatrix{\else\begin{pmatrix}\fi a&b\cr c&
> d\cr \ifx\endpmatrix\undefined}\else\end{pmatrix}\fi $$
Agreed.
How about:
(%i15) texput(matrix,lambda([expr], printf(false, "\\begin{bmatrix} ~{~{~a~^&~}~^\\\\~} \\end{bmatrix}",map(lambda([row],map(lambda([element],tex1(element)),row)),args(expr)))))$
(%i16) tex(matrix([a,b],[c,d]));
$$\begin{bmatrix} a&b\\c&d \end{bmatrix}$$
(%i17) tex(matrix([a,b,c/d],[c,d,a*b],[u,v,sin(t)]));
$$\begin{bmatrix} a&b&\frac{c}{d}\\c&d&a b\\u&v&\sin t \end{bmatrix}$$
>
> (%i5) tex(%e+%i)$
> $$i+e$$
(%i18) texput(%i,"\\mathrm{i}");
(%o18) \mathrm{i}
(%i19) texput(%e,"\\mathrm{e}");
(%o19) \mathrm{e}
(%i20) tex(%i+%e);
$$\mathrm{i}+\mathrm{e}$$
Leo
|