texmacs-dev
[Top][All Lists]
Advanced

[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: Tue, 1 Apr 2014 11:12:01 +0200

Hi,

Le Fri, 28 Mar 2014 22:23:31 -0400,
Bill Page <address@hidden> a écrit :

> Yes they are interpreted in a useful way in the scheme session. I
> guess scheme (at least the version used in TeXmacs) does not support
> unicode.

Actually this is not about Scheme. You have to undestand your
generated Scheme as a data format rather than a language. This is like a
serialization of the buffer tree manipulated by TeXmacs. And the
(implicitly) expected charset of theses data is not utf8.

> So since we are generating scheme as an output from FriCAS,
> really we should be doing the conversion from utf-8 to cork in FriCAS
> itself, right?

Yes, exactly. If you chose the "scheme:" format to send data to
TeXmacs, you have to comply with the format. Notice that the "scheme"
format is very close to internal TeXmacs data format. Notice also that
there exists other possible data format, e.g. the "verbatim" format,
which perform the convertion (from utf8 or latin1 to TeXmacs charset).

Maybe, the "scheme" format is clearly difficult to handle. But its
benefits is that it allows to describe complex document structures,
like e.g. tables (as well as the TeX format).

>  Certainly this is possible and we can probably borrow
> some of the source code from TeXmacs to help with that.  Note: I did
> find a large table of cork -utf-8 equivalences in scheme/lisp format
> in the TeXmacs source but from what I understand this table is
> actually loaded into a fast hash table lookup routine written in C++.

Exactly. This is the way our converter works.

> > 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 brackets.
> >
> 
> Nice. Yes, this does work!  Thank you very much for explaining this. I
> can see however that what this really amounts to is extending the
> definition of the scheme format itself.  We can do this but it seems
> to have some serious limitations when it comes to cut-and-paste,
> particularly between FriCAS and other types of sessions in TeXmacs.

I agree. This is a usefull hack but should not be used extensively. 

> After all of this testing and although it now works, I am convinced
> that having chosen to use scheme, it is really our responsibility in
> FriCAS to generate proper scheme coding with symbols encoded in cork.
> It is just going to be a little more work.

Exactly.

François

-- 
François Poulain <address@hidden>



reply via email to

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