[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Adding TeXmacs symbols to FriCAS math-mode input

From: François Poulain
Subject: Re: [Texmacs-dev] Adding TeXmacs symbols to FriCAS math-mode input
Date: Fri, 28 Mar 2014 15:40:01 +0100


[I remove fricas-devel from CC, since it seems impossible to email them
without be part of the group...]

Le Thu, 27 Mar 2014 08:42:08 -0400,
Bill Page <address@hidden> a écrit :

> > Most of the doc is in Help -> Interfacing.
> Yes. :( Unfortunately unicode does not seem to be mentioned anywhere
> there.

Actually, charset is a confusing thing into TeXmacs (due to Cork which
is almost-but-not-completely ascii compliant, often confused with
latin1, and other weirds things like TS1 (or T2A in recent past...)).

As far as strings are concerned, cork->utf8 will generally make the job.

At document level (stree), a serialisation procedure has to be
written. The definition via plugin-input-converters allows you to
tweak the "generic" serializer for fricas specificities. 

I am not sure that there is much more to say about it.

> But my problem is how to ensure that TeXmacs converts the utf-8
> characters in scheme: output format generated by FirCAS into math
> symbols inside TeXmacs.

Actually, utf8 characters in a scheme: session will be badly
interpreted, because your fricas output should send scheme valid code
(so with TeXmacs universal encoding).

A way to workaround this without rewriting a converter from scratch is
to call a TeXmacs function at the rendering level via "extern". Try
e.g. to paste this from "TeXmacs scheme" into TeXmacs :

(math (extern "(lambda (x) (utf8-<gtr>cork (tree-<gtr>stree x)))" "ℝ"))

I used this in the Scilab converter. Be carefull to properly escape the

>  The examples in the documentation only
> consider the case of latex: format which FriCAS no longer uses for the
> TeXmacs interface.  FriCAS now interfaces directly with TeXmacs
> without any intermediate conversion program in the pipe.

So, you have to comply a minimum with the TeXmacs format (charset and

> In experiments I found that TeXmacs does sometimes recognize and
> convert utf-8 characters to the Cork

This may be possible. There is heuristic detection of charset at
different input level.

> form but it seems this happens
> only is parts of the scheme markup that is supposed to be interpreted
> as literal text and for example the result for char(945) is shown
> literally as <alpha> in TeXmacs - not the Greek symbol alpha.

If this append, you're quite right : the charset is good. *But*, you
should use this string in a math environment.

> In other cases char(945) results in
> two unexpected non-ascii characters which seem related to the internal
> utf-8 encoding so that TeXmacs has not performed the conversion.
> Again, I do not know where this happens in the TeXmacs source code.
> It is not something that I do in the code.

I guess there is no conversion, then there is nowhere to search in the
code. char(945) should result in the string "\xCE\xB1" which,
interpreted as Cork encoding, means "Îś". Isn't it?

But it is uneasy to properly understand what happen since I don't have
fricas installed. It should be simpler with a document containing an
executed session and, optionnaly, the log (with Debug -> io


François Poulain <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]