[latex3-commits] [l3svn] 02/02: Experimental \mode_leave_vertical:
noreply at latex-project.org
noreply at latex-project.org
Tue Jul 4 14:42:22 CEST 2017
This is an automated email from the git hooks/post-receive script.
joseph pushed a commit to branch master
in repository l3svn.
commit ba7e44fabc62a58a3ea3b4cda60702bb5e4734d2
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Jul 4 13:41:49 2017 +0100
Experimental \mode_leave_vertical:
---
l3kernel/l3candidates.dtx | 47 ++++++++++++++++++++++++++++
l3kernel/l3coffins.dtx | 2 +-
l3kernel/testfiles/m3expl001.luatex.tlg | 1 +
l3kernel/testfiles/m3expl001.ptex.tlg | 1 +
l3kernel/testfiles/m3expl001.tlg | 1 +
l3kernel/testfiles/m3expl001.uptex.tlg | 1 +
l3kernel/testfiles/m3expl001.xetex.tlg | 1 +
l3kernel/testfiles/m3expl003.luatex.tlg | 1 +
l3kernel/testfiles/m3expl003.ptex.tlg | 1 +
l3kernel/testfiles/m3expl003.tlg | 1 +
l3kernel/testfiles/m3expl003.uptex.tlg | 1 +
l3kernel/testfiles/m3expl003.xetex.tlg | 1 +
l3trial/xbox/xbox.dtx | 52 ++++++-------------------------
13 files changed, 67 insertions(+), 44 deletions(-)
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index fa57e36..24ca5cb 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -82,6 +82,23 @@
% into the kernel. However, real use sometimes leads to better ideas, so functions from this module are
% \textbf{not necessarily stable} and we may have to adjust them!
%
+% \section{Additions to \pkg{l3basics}}
+%
+% \begin{function}[added = 2017-07-04]{\mode_leave_vertical:}
+% \begin{syntax}
+% \cs{mode_leave_vertical:}
+% \end{syntax}
+% Ensures that \TeX{} is not in vertical (inter-paragraph) mode. In
+% a horizontal mode this command has no effect, in vertical mode it inserts
+% the \tn{everypar} token list and switches to horizontal mode.
+% \begin{texnote}
+% This results in the contents of the \tn{everypar} token register being
+% inserted, after \cs{mode_leave_vertical:} is complete. Notice that in
+% contrast to the \LaTeXe{} \tn{leavevmode} approach, no box is used
+% by the method implemented here.
+% \end{texnote}
+% \end{function}
+%
% \section{Additions to \pkg{l3box}}
%
% \subsection{Viewing part of a box}
@@ -817,6 +834,36 @@
%<*initex|package>
% \end{macrocode}
%
+% \subsection{Additions to \pkg{l3basics}}
+%
+% \begin{macro}{\mode_leave_vertical:}
+% The approach here is different to that used by \LaTeXe{} or plain \TeX{},
+% which unbox a void box to force horizontal mode. That inserts the
+% \tn{everypar} tokens \emph{before} the re-inserted unboxing tokens. The
+% approach here uses either the \tn{quitvmode} primitive or the equivalent
+% protected macro. In vertical mode, the \tn{indent} primitive is inserted:
+% this will switch to horizontal mode and insert \tn{everypar} tokens and
+% nothing else. Unlike the \LaTeXe{} version, the availability of \eTeX{}
+% means using a mode test can be done at for example the start of an
+% \tn{halign}. The \tn{quitevmode} primitive essentially wraps the same
+% code up at the engine level.
+% \begin{macrocode}
+\cs_new_protected:Npx \mode_leave_vertical:
+ {
+ \cs_if_exist:NTF \pdftex_quitvmode:D
+ { \pdftex_quitvmode:D }
+ {
+ \exp_not:n
+ {
+ \if_mode_vertical:
+ \exp_after:wN \tex_indent:D
+ \fi:
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3box}}
%
% \begin{macrocode}
diff --git a/l3kernel/l3coffins.dtx b/l3kernel/l3coffins.dtx
index 20014dd..ee99775 100644
--- a/l3kernel/l3coffins.dtx
+++ b/l3kernel/l3coffins.dtx
@@ -1331,7 +1331,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5
{
- \hbox_unpack:N \c_empty_box
+ \mode_leave_vertical:
\@@_align:NnnNnnnnN \c_empty_coffin { H } { l }
#1 {#2} {#3} {#4} {#5} \l_@@_aligned_coffin
\box_use:N \l_@@_aligned_coffin
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index a0368ae..1b78a4a 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -5350,6 +5350,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index d268eb1..4a74bbe 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -5340,6 +5340,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index e558ff0..cf9f208 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -5340,6 +5340,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 4742554..71baab2 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -5338,6 +5338,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 718d810..9553d00 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -5328,6 +5328,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index a60ee2a..6bca929 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -5351,6 +5351,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 71fa3be..551ed70 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -5341,6 +5341,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 6e4e005..f4ea536 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -5341,6 +5341,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index b23b16e..37c4af5 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -5339,6 +5339,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 9376975..f26796c 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -5329,6 +5329,7 @@ Defining \sys_if_output_pdf_p: on line ...
Defining \c_sys_output_str on line ...
Defining \__deprecation_error:Nnn on line ...
Defining \deprecation_error: on line ...
+Defining \mode_leave_vertical: on line ...
Defining \box_clip:N on line ...
Defining \box_clip:c on line ...
Defining \box_trim:Nnnnn on line ...
diff --git a/l3trial/xbox/xbox.dtx b/l3trial/xbox/xbox.dtx
index 8ec3cc9..ca2fc72 100644
--- a/l3trial/xbox/xbox.dtx
+++ b/l3trial/xbox/xbox.dtx
@@ -256,15 +256,6 @@
%
% \section{Code-level interfaces}
%
-% \begin{function}{\xbox_leave_vmode:}
-% \begin{syntax}
-% \cs{xbox_leave_vmode:}
-% \end{syntax}
-% Ensures that \TeX{} is not in vertical (inter-paragraph) mode. In
-% a horizontal mode this command has no effect, in vertical mode it inserts
-% the \tn{everypar} token list and switches to horizontal mode.
-% \end{function}
-%
% \begin{function}{\xbox_to_wd:nnn}
% \begin{syntax}
% \cs{xbox_to_wd:nnn} \Arg{width} \Arg{position} \Arg{content}
@@ -442,31 +433,6 @@
{L3 Experimental document level boxes}
% \end{macrocode}
%
-% \subsection{Leaving vertical mode}
-%
-% \begin{macro}{\xbox_leave_vmode:}
-% At present, there is no \pkg{expl3} command to leave vertical mode, and
-% indeed the best way to handle this is not agreed. As such, a
-% \enquote{local} function is set up to do this.
-%
-% The approach here is different to that used by \LaTeXe{} or plain \TeX{},
-% which unbox a void box to force horizontal mode. That inserts the
-% \tn{everypar} tokens \emph{before} the re-inserted unboxing tokens. The
-% approach here uses the \tn{indent} primitive, which will switch to
-% horizontal mode and insert \tn{everypar} tokens and nothing else. The
-% main difference is that this approach requires that the function is not
-% expanded for example at the start of \tn{halign} cells. \eTeX{}'s protected
-% functionality allows that: not the case for the \LaTeXe{} kernel.
-% \begin{macrocode}
-\cs_new_protected:Npn \xbox_leave_vmode:
- {
- \if_mode_vertical:
- \exp_after:wN \tex_indent:D
- \fi:
- }
-% \end{macrocode}
-% \end{macro}
-%
% \subsection{Setting up to measure natural width}
%
% \begin{variable}[int]{\l_@@_tmp_box}
@@ -764,7 +730,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \kern_horizontal:n #1
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\tex_kern:D \__dim_eval:w #1 \__dim_eval_end:
}
\cs_new_protected:Npn \kern_vertical:n #1
@@ -842,7 +808,7 @@
% \begin{macrocode}
\NewDocumentCommand { \mbox } { +m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\hbox:n {#1}
}
% \end{macrocode}
@@ -857,7 +823,7 @@
\NewDocumentCommand { \makebox }
{ o > { \SplitArgument { 1 } { , } } d ( ) O { c } +m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\IfNoValueTF {#2}
{
\IfNoValueTF {#1}
@@ -887,7 +853,7 @@
% \begin{macrocode}
\NewDocumentCommand { \fbox } { +m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\hbox_frame:nnn {#1} { \fboxrule } { \fboxsep }
}
% \end{macrocode}
@@ -903,7 +869,7 @@
\NewDocumentCommand { \framebox }
{ o > { \SplitArgument { 1 } { , } } d ( ) O { c } +m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\IfNoValueTF {#2}
{
\IfNoValueTF {#1}
@@ -1039,7 +1005,7 @@
% \begin{macrocode}
\NewDocumentCommand { \usebox } { m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\box_use:N #1
}
% \end{macrocode}
@@ -1052,7 +1018,7 @@
% \begin{macrocode}
\NewDocumentCommand { \rule } { O { 0 pt } m m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\rule:nnn { #1 + ( #3 ) } { 0 pt - ( #1 ) } {#2}
}
% \end{macrocode}
@@ -1070,12 +1036,12 @@
% \begin{macrocode}
\NewDocumentCommand { \llap } { m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\hbox_overlap_left:n {#1}
}
\NewDocumentCommand { \rlap } { m }
{
- \xbox_leave_vmode:
+ \mode_leave_vertical:
\hbox_overlap_right:n {#1}
}
% \end{macrocode}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the latex3-commits
mailing list