[XeTeX] additional beginL endL nodes in math

Khaled Hosny khaledhosny at eglug.org
Tue Apr 14 22:14:54 CEST 2015


On Tue, Apr 14, 2015 at 05:47:29PM +0100, David Carlisle wrote:
> As noted in the release notes direction support now works in math
> which is a good thing but a side effect seems to be that beginL endL
> nodes are added to every math list

This is part of the TeX-XeT code actually and not related to the
mentioned change. This is the part that ensure math is always set
left-to-right even if the surrounding text is set right-to-left.

> Would it be possible for the automatic beginL node _not_ to be added
> if the current context was already left to right?

That should be theoretically possible, but I don’t know how. My naïve
attempt below does not work (in the sense that the condition is always
false even if the text was surrounded by \beginR/\endR. So if someone
can come up with a working patch, I’ll happily apply it.

Regards,
Khaled

diff --git a/source/texk/web2c/xetexdir/xetex.web b/source/texk/web2c/xetexdir/xetex.web
index cffc4a9..a488669 100644
--- a/source/texk/web2c/xetexdir/xetex.web
+++ b/source/texk/web2c/xetexdir/xetex.web
@@ -32475,10 +32475,12 @@ begin if p=null then safe_info:=-1 at +else safe_info:=info(p);
 end;
 
 @ @<Append a |begin_L| to the tail of the current list@>=
-tail_append(new_LR(begin_L_code))
+if safe_info(LR_ptr)=begin_R_code then
+  tail_append(new_LR(begin_L_code))
 
 @ @<Append an |end_L| to the tail of the current list@>=
-tail_append(new_LR(end_L_code))
+if safe_info(LR_ptr)=begin_R_code then
+  tail_append(new_LR(end_L_code))
 
 @ When the stack-manipulation macros of this section are used below, variables
 |LR_ptr| and |LR_tmp| might be the global variables declared above, or they


More information about the XeTeX mailing list