On 24 March 2014 21:33, Waldek Hebisch <hebi...@math.uni.wroc.pl> wrote:
> Bill Page wrote:
>>
>> Here is a patch to the FriCAS plugin that I just submitted to TeXmacs.
>>  I have also attached a patch to the texmacs output formatter for
>> FriCAS to render the TeXmacs symbol <mapsto> for the FriCAS +-> arrow.
>
> It is an interesting hack.  However, AFAICS the patch depends on
> FriCAS doing no escaping in the output.  Consider the following
>
> s := id::String
> #s
> s(2)
> "< some literal string from input file"
> id([1, 2]) -- make scripted symbol
>
> where 'id' is some special Texmacs symbol.

An example from TeXmacs is attached to this email.

> Good input translation
> make sure that things stay consistent, that is conversion
> to string produces string containing given symbol, etc.

Yes perhaps that may be an issue.  As you can see the current TeXmacs
interface does display the string as containing just one TeXmacs
symbol but of course indexing into the string produces characters from
the TeXmacs encoded name for the symbol.  This might seem inconsistent
but it is quite easy to explain and understand. All we have to do is
remind people is that TeXmacs symbols are actually multi-character
symbols in FriCAS. This isn't such an odd idea to TeXmacs users since
they can in fact key the symbol in exactly this way. And practically
speaking how ofter do we really need that a symbol convert to a one
character string?

The only way I can see to prevent that is to actually re-code the
TeXmacs symbols into utf-8 characters (where that is possible).  Since
we can handle utf-8 in FriCAS that might be a good idea.  It is
something we can try but at first attempt I found TeXmacs rather
unfriendly to utf8 encoding.  It might require someone with a little
more knowledge of TeXmacs internals.

> Producing for example TeX or MathML form inside Texmacs
> session should give sensible results.

??? What purpose would TeX and MathML serve inside TeXmacs?

> Users expect
> input file to work, and strings containing special Texmacs
> characters should be properly escaped to produce equvalent
> output in Texmacs and outside.

The output (see attached) looks mostly normal to me. There is a
problem with your example

> "< some literal string from input file"

as you can see TeXmacs is too aggressive in trying to interpret this
as a TeXmacs symbol since the string begins with <.  This has nothing
to do with my proposed "hack". I think it should be considered either
a problem with the TeXmacs parsing of FriCAS output or maybe something
that should be handled by an escape added by the texmacs output
formatter.

>
>> One problem that I am having right now is the display of SPAD compiler
>> output from the ')compile' command in TeXmacs.  It seems like we may
>> not have the appropriate iohooks in place to demarc the output in such
>> a way that TeXmacs can synchronize and format it properly.
>
> IIRC there are no iohooks specific to compiler.
>


How difficult would it be to add the same iohooks to the compiler
output that we already have in the interpreter output?

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Attachment: fricas-symbols.pdf
Description: Adobe PDF document

<TeXmacs|1.99.1>

<style|generic>

<\body>
  <\session|fricas|default>
    <\unfolded-io>
      (8) -\<gtr\>\ 
    <|unfolded-io>
      <text|)clear completely>
    <|unfolded-io>
      \ \ \ All user variables and function definitions have been cleared.

      \ \ \ All )browse facility databases have been cleared.

      \ \ \ Internally cached functions and constructors have been cleared.

      \ \ \ )clear completely is finished.
    </unfolded-io>

    <\unfolded-io>
      (1) -\<gtr\>\ 
    <|unfolded-io>
      <math|id\<assign\>\<alpha\>>
    <|unfolded-io>
      \;

      <with|mode|math|\<alpha\>>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      Variable(\<alpha\>)
    </unfolded-io>

    <\unfolded-io>
      (2) -\<gtr\>\ 
    <|unfolded-io>
      s := string(id::Symbol)
    <|unfolded-io>
      \;

      <with|mode|math|\<alpha\>>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      String
    </unfolded-io>

    <\unfolded-io>
      (3) -\<gtr\>\ 
    <|unfolded-io>
      # s
    <|unfolded-io>
      \;

      <with|mode|math|7>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      PositiveInteger
    </unfolded-io>

    <\unfolded-io>
      (4) -\<gtr\>\ 
    <|unfolded-io>
      s(2)
    <|unfolded-io>
      \;

      <with|mode|math|a>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      Character
    </unfolded-io>

    <\unfolded-io>
      (5) -\<gtr\>\ 
    <|unfolded-io>
      "\<less\> some literal string from input file"
    <|unfolded-io>
      \;

      <with|mode|math|\< some literal string from input file>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      String
    </unfolded-io>

    <\unfolded-io>
      (5) -\<gtr\>\ 
    <|unfolded-io>
      "some other string"
    <|unfolded-io>
      \;

      <with|mode|math|some other string>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      String
    </unfolded-io>

    <\unfolded-io>
      (5) -\<gtr\>\ 
    <|unfolded-io>
      id[1,2]
    <|unfolded-io>
      \;

      <with|mode|math|\<alpha\><rsub|1,2>>

      \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Type:
      Symbol
    </unfolded-io>

    <\input>
      (8) -\<gtr\>\ 
    <|input>
      \;
    </input>
  </session>
</body>

<\initial>
  <\collection>
    <associate|page-type|letter>
  </collection>
</initial>

Reply via email to