On Thu, Feb 27, 2020 at 10:41:32PM +0100, Kurt Pagani wrote:
> I'd like to point out two small issues. Would be great if one or the other
> could
> be resolved in a next release:
>
> -- The (TexFormat) output of derivatives of (univariate) functions looks ugly.
> Examples:
> - http://fricas-wiki.math.uni.wroc.pl/TexFormat0
> - http://fricas-wiki.math.uni.wroc.pl/DerivFunc
>
> The same also holds for TeXmacs (see attached pdf).
>
> Personally, I'm using a slightly hacked version of TexFormat:
> - http://fricas-wiki.math.uni.wroc.pl/TexFormat1
> Maybe someone has a better idea (op 'PRIME)?
The attached diff solves TeX problem in similar but I
think slightly better way. It may also work for TeXmacs,
but that I did not test it. In particular I do not know
if "<prime>" is the right TeXmacs sequence to get derivative sign.
--
Waldek Hebisch
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/20200229141527.GB31425%40math.uni.wroc.pl.
Index: src/algebra/formula.spad
===================================================================
--- src/algebra/formula.spad (revision 2620)
+++ src/algebra/formula.spad (working copy)
@@ -253,7 +253,8 @@
op = "PAREN" =>
group parenthesize formatFormula(first args, minPrec)
op = "PRIME" =>
- formatSpecial("SUPERSUB", [first args, " "::E, second(args)], prec)
+ formatSpecial("SUPERSUB", [first args, empty()$E,
+ second(args)], prec)
op = "OVERBAR" =>
empty?(args) => ""
group concat [formatFormula(first args, minPrec)," bar"]
Index: src/algebra/mathml.spad
===================================================================
--- src/algebra/mathml.spad (revision 2620)
+++ src/algebra/mathml.spad (working copy)
@@ -740,7 +740,7 @@
s := s"<mo>′</mo>"
if commaS = commaTest then
arg2 := message(s)
- formatSpecial('SUPERSUB, [first args, " "::E, arg2], prec)
+ formatSpecial('SUPERSUB, [first args, empty()$E, arg2], prec)
formatPlex(op : Sy, args : L E, prec : I) : S ==
p : I := position(op, plexOps)
Index: src/algebra/tex.spad
===================================================================
--- src/algebra/tex.spad (revision 2620)
+++ src/algebra/tex.spad (working copy)
@@ -319,6 +319,27 @@
parenthesize str ==
concat ["\left( ",str," \right)"]
+ format_prime(args : L E, prec : I) : S ==
+ arg2 := second(args)
+ narg2 :=
+ string?(arg2) =>
+ arg2s : S := string(arg2)
+ c_char := char(",")
+ every?(c +-> c = c_char, arg2s) =>
+ prime_str := "\prime"
+ n := #arg2s
+ n = 1 => message(prime_str)
+ res := new(n*#prime_str, char(" "))
+ k := 1
+ for i in 1..n repeat
+ for j in 1..#prime_str repeat
+ qsetelt!(res, k, qelt(prime_str, j))
+ k := k + 1
+ message(res)
+ arg2
+ arg2
+ formatSpecial('SUPERSUB, [first args, empty()$E, narg2], prec)
+
formatSpecial(op : Sy, args : L E, prec : I) : S ==
arg : E
prescript : Boolean := false
@@ -352,7 +373,7 @@
op = 'PAREN =>
group parenthesize ungroup formatExpr(first args, minPrec)
op = 'PRIME =>
- formatSpecial('SUPERSUB, [first args, " "::E, second(args)], prec)
+ format_prime(args, prec)
op = 'OVERBAR =>
empty?(args) => ""
group concat ["\overline ", formatExpr(first args, minPrec)]
Index: src/algebra/texmacs.spad
===================================================================
--- src/algebra/texmacs.spad (revision 2620)
+++ src/algebra/texmacs.spad (working copy)
@@ -998,6 +998,27 @@
parenthesize str ==
concat [" _"(_" ",str," _")_" "]
+ format_prime(args : L E, prec : I) : S ==
+ arg2 := second(args)
+ narg2 :=
+ string?(arg2) =>
+ arg2s : S := string(arg2)
+ c_char := char(",")
+ every?(c +-> c = c_char, arg2s) =>
+ prime_str := "<prime>"
+ n := #arg2s
+ n = 1 => message(prime_str)
+ res := new(n*#prime_str, char(" "))
+ k := 1
+ for i in 1..n repeat
+ for j in 1..#prime_str repeat
+ qsetelt!(res, k, qelt(prime_str, j))
+ k := k + 1
+ message(res)
+ arg2
+ arg2
+ formatSpecial('SUPERSUB, [first args, empty()$E, narg2], prec)
+
formatSpecial(op : Sy, args : L E, prec : I) : S ==
arg : E
prescript : Boolean := false
@@ -1035,7 +1056,7 @@
op = 'PAREN =>
group parenthesize ungroup formatExpr(first args, minPrec)
op = 'PRIME =>
- formatSpecial('SUPERSUB, [first args, " "::E, second(args)], prec)
+ format_prime(args, prec)
op = 'OVERBAR =>
empty?(args) => ""
concat ["(wide ", formatExpr(first args, minPrec), " _"<bar>_")"]