On Jan 5, 6:20 am, Lars Madsen <
dal...@RTFMSIGNATUREimf.au.dk> wrote:
> Phillip Helbig---undress to reply wrote, On 2012-01-05 13:10:
>
>
>
>
>
>
>
>
>
> > In article <4f05899b$0$285$
14726...@news.sunsite.dk>, Lars Madsen
Quotes usually have the following rule: outer quotes are always
the same (say, doublequotes), first level inner quotes are always
the same (say, singlequotes), etc. Thus each open quote has only
to increment the nesting leve and place the open quote mark
attached to that level. Then each close quote places the close quote
mark and decrements the level. Of course, there can be other
complications, but the implementation of nesting is usually pretty
simple.
On the other hand, the rules for fences are usually the reverse:
innermost fences are always (), next outer are [], etc. This means
the opening fence has to wait until all the fences between it and
the matching close have been detected before it can decide whether
to be ( or [ or {.
I can only think of a two-stage process: the first stage merely
executes the contents in a box, each nested fence merely
incrementing a depth parameter. Afterward the command
places the fence associated with the depth around its contents.
Something like the following pseudocode:
\fence{X}
-> incr depth (globally)
run X in box z
case depth
1 -> (box z)
2 -> [box z]
3 -> {box z}
endcase
decr depth
Caveat: not even implemented, much less tested.
Dan