Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] Cancellation of terms

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] Cancellation of terms


Chronological Thread 
  • From: Martial Tarizzo <address@hidden>
  • To: Sam Liddicott <address@hidden>
  • Cc: Miguel de Benito Delgado <address@hidden>, "address@hidden" <address@hidden>
  • Subject: Re: [TeXmacs] Cancellation of terms
  • Date: Sun, 22 Mar 2015 23:50:57 +0100

Finally, I got it ...

after digging for "draw-over" in the source, I found the definition in
TeXmacs-1.99.2-src/TeXmacs/packages/standard/std-graphics.ts.
There is also a "draw-under", and it's possible to switch with Ctrl-*.

(Frequently in TeXmacs, the doc is slightly out-of-sync with the code :
as SmallTalk, the code is the ultimate doc ...)

More intersting, the code uses <box-info|contents|lbrtwh> to get the
bouding box of contents (left, bottom, right, top, width, height) in a
tuple ! Now, we know everything needed.

So, I rewrote the macros, including arrow-slash, which seems to work
reasonably well. See attachments, comments in the .tm

One problem stays : vertical alignment on the base line. I tried various
formulae to compute the shift, bud didn't succeed in finding an
universal one, which works on a single character or a big equation.
As this should be rare, you cas adjust 'by hand' when needed...

Cheers

Martial


Le samedi 21 mars 2015 à 10:46 +0000, Sam Liddicott a écrit :
>
>
> On Fri, Mar 20, 2015 at 6:19 PM, Miguel de Benito Delgado
> <address@hidden> wrote:
> Awesome!
>
>
> I really like not having to hardcode more stuff.
>
>
> However... I really think that "replace" ought to provide the box
> units, and have the option to replace at least once even if the object
> is too big. It would be better than phantom+Draw-over in this case.
>
>
>
>
> What about using text-at to place the superindex as well? It
> should be a matter of adding a second argument to the macros
> and resizing the drawing area (using phantom and rsup?)
>
>
> text-at is unfortunate because we don't know exactly where to place
> the text - the vertical positioning is not quite right.
>
>
>
>
> On the other hand, won't draw-over have performance issues?
>
>
> replace?
>
......

Attachment: slash3.pdf
Description: Adobe PDF document

<TeXmacs|1.99.2>

<style|<tuple|generic|french>>

<\body>
  <\hide-preamble>
    This function is a hack : without it, <aslash|body|exponent> is not
    updated as you type when it is alone on its own line ... bug of the
    typesetter ?

    Used in aslash.

    <assign|_rw_|<macro|<extern|(lambda()(refresh-window) "")>>>

    \;

    default line width :

    <assign|slash-ln|1.5ln>

    \;

    slash :

    <assign|slash|<macro|x|<compound|<if|<equal|<arg|x>|>|identity|<macro|x|<draw-under|<arg|x>|<graphics|<with|line-width|<value|slash-ln>|<line|<point|0gw|-0.4gh>|<point|1gw|0.5gh>>>>>>>|<arg|x>>>>

    \;

    back-slash :

    <assign|bslash|<macro|x|<compound|<if|<equal|<arg|x>|>|identity|<macro|x|<draw-under|<arg|x>|<graphics|<with|line-width|<value|slash-ln>|<line|<point|0gw|0.5gh>|<point|1gw|-0.4gh>>>>>>>|<arg|x>>>>

    \;

    cross-slash :

    <assign|xslash|<macro|x|<compound|<if|<equal|<arg|x>|>|identity|<macro|x|<draw-under|<arg|x>|<graphics|<with|line-width|<value|slash-ln>|<line|<point|0gw|-0.5gh>|<point|1gw|0.5gh>>>|<with|line-width|<value|slash-ln>|<line|<point|0gw|0.5gh>|<point|1gw|-0.5gh>>>>>>>|<arg|x>>>>

    \;

    the body part of arrow-slash :

    <assign|_aslash_|<\macro|x|y>
      <style-with|src-compact|none|<compound|<style-with|src-compact|none|<if|<equal|<arg|x>|>|identity|<macro|x|<draw-under|<arg|x>|<graphics|<with|arrow-end|\<gtr\>|line-width|<value|slash-ln>|<line|<point|0gw|-0.4gh>|<point|<minus|1gw|0.5ex>|<minus|0.5gh|0.5ex>>>>>>>>>|<resize|<arg|x>|||<plus|1w|1ex>|<plus|1h|1ex>>>>
    </macro>>

    \;

    arrow-slash :

    <assign|aslash|<\macro|x|y>
      <compound|<macro|x|y|<with|body|<_aslash_|<arg|x>|<arg|y>>|<with|h|<look-up|<box-info|<value|body>|h>|0>|<surround|<value|body>||<shift|<small|<arg|y>>|0ex|<times|0.5ex|<over|<value|h>|<look-up|<box-info|x|h>|0>>>>>>><_rw_>>|<arg|x>|<arg|y>>
    </macro>>

    \;
  </hide-preamble>

  Macros test :\ 

  <\equation*>
    x+<slash|5*y><space|1em>x+<bslash|5*y><space|1em>x+<xslash|5*y><space|1em>x+<slash|5*y><space|1em>x+<aslash|5*y|\<infty\>>
  </equation*>

  <\equation*>
    <text| with <verbatim|\<less\>neg\<gtr\>> :
    ><frac|2.2.<neg|3>.<neg|5>|<neg|3>.<neg|5>>=<neg|4+<frac|1|2>><htab|5mm><text|with
    <verbatim|\<less\>slash\<gtr\>> : ><frac|2.2.<bslash|3>.<slash|5>|<bslash|3>.<slash|5>>=<slash|4+<frac|1|2>>
  </equation*>

  \;

  <with|slash-ln|5ln|A \S<nbsp><slash|slashed><nbsp>\T text and an in-line
  equation <math|<bslash|<frac|1|2>+5>> with a line width of 5ln.>

  \;

  <center|in a table : <tabular|<tformat|<cwith|1|-1|3|3|cell-row-span|2>|<cwith|1|1|3|3|cell-valign|c>|<twith|table-lborder|2px>|<twith|table-rborder|2px>|<twith|table-bborder|2px>|<twith|table-tborder|2px>|<table|<row|<cell|<xslash|aaaaaa>>|<cell|cccc>|<cell|<xslash|<tabular|<tformat|<table|<row|<cell|eeee>>|<row|<cell|ffffff>>>>>>>>|<row|<cell|bbbbb>|<cell|ddd>|<cell|>>>>>>

  Some more tests :

  <\equation*>
    x<rsup|2>=<dfrac|<move|<slash|x>+x<rsup|2>-||0.4ex><above|<wide|<xslash|<frac|2*x-x-x|2+5*<frac|x|4/3>>>|\<wide-overbrace\>>|=0>|<bslash|a+b+c>>+<aslash|<frac|<big|int><rsub|-\<infty\>><rsup|+\<infty\>>t*e<rsup|-t<rsup|2>>\<mathd\>t|x>|<text|0
    : odd function>><htab|5mm><xslash|<frac|1+2|3+4>-<frac*|3|7>>
  </equation*>

  <\equation*>
    <frac|-<frac|\<hbar\>|2*m>\<times\><frac|\<partial\><rsup|2>\<psi\>|\<partial\>x<rsup|2>>+<around*|(|V-E|)>*\<psi\>|x>=<slash|<frac|-<frac|\<hbar\>|2*m>\<times\><frac|\<partial\><rsup|2>\<psi\>|\<partial\>x<rsup|2>>+<around*|(|V-E|)>*\<psi\>|x>><space|1em>\<leftarrow\><tabular|<tformat|<table|<row|<cell|<text|alignment
    problem for fraction >>>|<row|<cell|<text|with different heights for
    num/den>>>>>>
  </equation*>

  \ 

  <\equation*>
    <frac|-<frac|\<hbar\>|2*m>\<times\><frac|\<partial\><rsup|2>\<psi\>|\<partial\>x<rsup|2>>+<around*|(|V-E|)>*\<psi\>|x>=<shift|<xslash|<frac|-<frac|\<hbar\>|2*m>\<times\><frac|\<partial\><rsup|2>\<psi\>|\<partial\>x<rsup|2>>+<around*|(|V-E|)>*\<psi\>|x>>||1ex><space|1em>\<leftarrow\><tabular|<tformat|<cwith|2|2|1|1|cell-halign|c>|<table|<row|<cell|<text|aligned
    with>>>|<row|<cell|<text|<verbatim|shift>>>>>>>
  </equation*>

  See <verbatim|TeXmacs-1.99.2-src/TeXmacs/packages/standard/std-graphics.ts>
  for more information on <verbatim|box-info> and the implementation of
  <verbatim|draw-over, draw-under>

  \;
</body>

<\initial>
  <\collection>
    <associate|font|roman>
    <associate|font-base-size|10>
    <associate|font-family|rm>
    <associate|page-medium|papyrus>
    <associate|page-type|user>
    <associate|preamble|false>
  </collection>
</initial>

<\references>
  <\collection>
    <associate|lipsum|<tuple|?|?>>
  </collection>
</references>



Archive powered by MHonArc 2.6.19.

Top of Page