LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Thu, 10 Nov 2005 13:16:40 +0100
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
8bit
In-Reply-To:
Content-Type:
text/plain; charset=iso-8859-1
From:
Bernd Raichle <[log in to unmask]>
Parts/Attachments:
text/plain (82 lines)
On Thursday, 10 November 2005 11:09:46 +0100,
Heiko Oberdiek <[log in to unmask]> writes:
 > On Thu, Nov 10, 2005 at 09:03:16AM +0100, Uwe Lück wrote:
 > > At 07:52 10.11.05, Will Robertson wrote:
 > > 
 > > >Finally, somehow the topic of extensions to pdf-e-TeX came up, and
 > > >there were some naive comments from me and some interesting comments
 > > >from Morten. I proposed the idea of something like \previouschar,
 > > >which we interpreted in two separate ways:
 > > >
 > > > - it "would return the slot number of the most recently seen char
 > > >or ligature node independently of whether we just saw a glue node or
 > > >another char/lig node; any other node type could reset it to
 > > >-1" [morten]
 > > >
 > > > - it would actually be more like LaTeX's \@ifnextchar, and look at
 > > >the input token list [me]

When looking at the way ((pdf)e)TeX works, Morten is right ... and the
name \previouschar of the control sequence is misleading:

 a) TeX is reading _characters_ from files/stdin which get converted
    to _tokens_.

 b) When these tokens are dealt with by TeX's main control loop where
    the typesetting is done, the _tokens_ are triggering the building
    of _nodes_.

Within the TeX macros language, it is not really possible to access
_characters_.  You can only get access to _tokens_ and _nodes_ and
their properties.

The other problem is that the typesetting process (tokens -> nodes)
introduces an asymetry:

 - If you want to look forward, you access _tokens_.
 - If you want to look backward, you access _nodes_.



 > > >Implicit in my thinking was that you could also eat up previous chars
 > > >in the same was as \unskip with a sort of fine-grained \lastbox; to
 > > >which idea Morten replied:
 > > >
 > > >  This is exactly what some languages need.
 > > >
 > > >  Since there are so many different node types the only safe
 > > >  (IMO) way is to backtrack one node at a time so ideally we
 > > >  would want the pair \lastchar and \unchar. And then we might
 > > >  as well get one for each different node type. I guess someone
 > > >  has to come up with a good idea about what to do with \discretionary
 > > >  because I'm not at all sure what the semantics should be.

e-TeX provides the new primitive \lastnodetype to query the type of
node in the current node list.  What's missing and what was thought
about was a set of additional primitives \last... similar to \lastbox,
\lastpenalty, \lastkern, \lastskip to get access to (and remove) all
possible type of nodes.

This was postponed for e-TeX because (a) the implementation will be
rather tricky for e.g., special nodes and in some contexts where the
result of real arithmetic can be accessed (e.g., \accent
constructions) which will lead to implementation dependend behaviour.
And (b) additional data types has to be introduced for (e-)TeX to be
able to save all different kind of nodes.


 > > by accident, this occurred to me as well, if only for a
 > > rather fun application. \lastchar 
 > 
 > And what kind of object is the return value of \lastchar?
 > A number is quite useless, because this misses the font property.

Better use the name \lastcharnode (or \lastglyphnode?) and it will
return a _charnode_ which is a data type consisting of atleast a glyph
position and a font ... and probably other properties?


Regards,
  -bernd
  Former member of the e-TeX team.

ATOM RSS1 RSS2