<TeXmacs|1.0.7.11>

<style|<tuple|tmdoc|octave>>

<\body>
  <tmdoc-title|Further details on the <name|Octave> plug-in>

  <name|Octave> and <TeXmacs> communicate via a synchronous pipe interface.
  This allows the <name|Octave> console to be presented in a typeset region
  of a <TeXmacs> document. To display typeset materials in this <TeXmacs>
  region, <name|Octave> code can print escape sequences to transfer
  <name|Scheme>, <LaTeX>, or Postscript materials for display.\ 

  This <name|Octave> interface is implmeneted a a set of m-files for
  interacting with <TeXmacs> via <name|Scheme>. As of v1.0.1 <TeXmacs>
  includes the required interface code and should automagically detect the
  presense of <name|Octave>. These m-files generate <TeXmacs> content from
  <name|Octave> and perform related functions:

  <\indent>
    <with|color|blue|tmdisp.m> \ Displays an <name|Octave> variable
    "pretty-printed" via the <TeXmacs> interface. It supports scalar, matrix,
    structure, list and string types. You must use tmdisp, instead of disp,
    to get \ <TeXmacs> formatted variable output.

    <with|color|blue|mesh.m> \ Modified mesh routine for use with <TeXmacs>.
    Also included are modified back-end plot routines using gnuplot to
    transfer the embedded Postscript to <TeXmacs>. High level interfaces like
    plot work as expected.

    <with|color|blue|polyout.m> \ Modified polynomial printer to use a
    <LaTeX> formula.

    <with|color|blue|scheme.m> \ Executes a string as a <name|Scheme>
    expression via <TeXmacs>.

    <with|color|blue|num2scm.m> Converts a number (scalar) to a <TeXmacs>
    <name|Scheme> expression.

    <with|color|blue|mat2scm.m> \ Converts a matrix to a <TeXmacs>
    <name|Scheme> expression.

    <with|color|blue|str2scm.m> \ Converts a string to a <TeXmacs>
    <name|Scheme> expression.

    <with|color|blue|struct2bullet.m> Converts a structure to a bulleted
    <TeXmacs> list.

    <with|color|blue|struct2tree.m> \ Converts a structure to a <TeXmacs>
    tree. The leaves of the tree are "switchable" and can be switched to the
    variable name or content for easy traversal of complicated <name|Octave>
    structures.\ 

    <with|color|blue|struct2scm.m> Converts a structure to a <TeXmacs>
    <name|Scheme> expression by calling either struct2bullet or struct2tree,
    depending on the user's configuration. The TMSTRUCT global <name|Octave>
    variable is used. If TMSTRUCT = 0 a tree is used, else a bulleted list is
    used.

    <with|color|blue|list2scm.m> \ Converts a list to a <TeXmacs>
    <name|Scheme> expression.\ 

    <with|color|blue|obj2scm.m> Front end interface to the other converters
    to convert an arbitrary <name|Octave> variable to a <TeXmacs>
    <name|Scheme> expression. In most cases, user programs should use this
    function.
  </indent>

  The appearance of the <TeXmacs> output, namely the colors used, can be
  customized by setting the appropriate <name|Octave> global variables. These
  global variables should be defined in your ~/.octaverc or in the
  system-wide octaverc:

  <\indent>
    <\code>
      <\with|par-par-sep|0fn>
        global TMSTRUCT=0; ## Use tree output for structures.

        global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green";
        "blue";];

        global TMCOLIDX=6; ## number of colors
      </with>
    </code>
  </indent>

  The TMCOLORS array lists the available colors, in order, to be used by
  struct2bullet.m it will change to each color in turn as it indents the
  bulleted list. Additionally, the first color in the list is used as the
  color for the leaves of struct2tree.m output.\ 

  As an example of using these functions and of their behavior, consider the
  following sample <name|Octave> session:

  <\session|octave|default>
    <\output>
      GNU Octave, version 2.1.36 (i686-pc-linux-gnu).

      Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 John W. Eaton.

      This is free software; see the source code for copying conditions.

      There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or

      FITNESS FOR A PARTICULAR PURPOSE.

      \;

      Report bugs to \<less\>bug-octave@bevo.che.wisc.edu\<gtr\>.

      \;
    </output>

    <\input-math|octave\<gtr\> >
      <with|color|blue|M.mat=<matrix|<tformat|<table|<row|<cell|1>|<cell|3>|<cell|5>>|<row|<cell|5>|<cell|8>|<cell|0>>>>>;
      \ M.l=list<around|(|<around|[|1,2,3|]>,2,3|)>; M.branch.i=3;
      M.branch.j=4;>
    </input-math>

    <\unfolded-io-math|octave\<gtr\> >
      <with|color|blue|tmdisp<around|(|M|)>;> <with|color|black|## M.mat has
      been <rprime|''>switched<rprime|''>>
    <|unfolded-io-math>
      <tree|<with|color|red|<math|<big|triangleup>>>|<switch|<\hidden>
        <with|color|red|mat>
      </hidden>|<with|color|yellow|<math|<with|math-display|true|<with|color|blue|<matrix|<tformat|<table|<row|<cell|1>|<cell|3>|<cell|5>>|<row|<cell|5>|<cell|8>|<cell|0>>>>>>>>>>|<\switch>
        <with|color|red|l>
      </switch|<hidden|<with|color|yellow|<\enumerate-numeric>
        <item><math|<with|math-display|true|<matrix|<tformat|<table|<row|<cell|1>|<cell|2>|<cell|3>>>>>>>

        <item><math|2>

        <item><math|3>
      </enumerate-numeric>>>>|<tree|<with|color|red|branch>|<\switch>
        <with|color|red|i>
      </switch|<hidden|<with|color|yellow|<math|3>>>>|<\switch>
        <with|color|red|j>
      </switch|<hidden|<with|color|yellow|<math|4>>>>>>

      \;
    </unfolded-io-math>

    <\input-math|octave\<gtr\> >
      <with|color|blue|TMSTRUCT=1;>
    </input-math>

    <\unfolded-io-math|octave\<gtr\> >
      <with|color|blue|tmdisp<around|(|M|)>>
    <|unfolded-io-math>
      <\itemize-arrow>
        <item><with|color|red|mat = ><math|<with|math-display|true|<matrix|<tformat|<table|<row|<cell|1>|<cell|3>|<cell|5>>|<row|<cell|5>|<cell|8>|<cell|0>>>>>>>

        <item><with|color|red|l = ><\enumerate-numeric>
          <item><math|<with|math-display|true|<matrix|<tformat|<table|<row|<cell|1>|<cell|2>|<cell|3>>>>>>>

          <item><math|2>

          <item><math|3>
        </enumerate-numeric>

        <item><with|color|red|branch = ><\itemize>
          <item><with|color|black|i = ><math|3>

          <item><with|color|black|j = ><math|4>
        </itemize>
      </itemize-arrow>

      \;
    </unfolded-io-math>

    <\unfolded-io-math|octave\<gtr\> >
      <with|color|blue|tmpolyout<around|(|<around|[|4,5,6|]>|)>>
    <|unfolded-io-math>
      <\math>
        4\<cdot\>s<rsup|2>+5\<cdot\>s<rsup|1>+6
      </math>

      \;
    </unfolded-io-math>

    <\input|octave\<gtr\> >
      X=0:.1:3;
    </input>

    <\input|octave\<gtr\> >
      Y=sin(X);
    </input>

    <\unfolded-io|octave\<gtr\> >
      plot(X,Y);
    <|unfolded-io>
      \;

      \;

      <image|<tuple|<#[encoded data, 27094 characters]>|ps>||||>

      \;
    </unfolded-io>

    octave\<gtr\>\ 
  </session>

  <tmdoc-copyright|2011|Michael Graffam|Joris van der Hoeven>

  <tmdoc-license|Permission is granted to copy, distribute and/or modify this
  document under the terms of the GNU Free Documentation License, Version 1.1
  or any later version published by the Free Software Foundation; with no
  Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  Texts. A copy of the license is included in the section entitled "GNU Free
  Documentation License".>
</body>

<\initial>
  <\collection>
    <associate|language|english>
  </collection>
</initial>