[latex3-commits] [latex3/latex3] main: Detect bad alignment spec in xbox (88a766683)

github at latex-project.org github at latex-project.org
Sun Nov 5 21:49:09 CET 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/88a766683e664aa68c470398386d3bb82404492e

>---------------------------------------------------------------

commit 88a766683e664aa68c470398386d3bb82404492e
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Nov 5 20:49:09 2023 +0000

    Detect bad alignment spec in xbox
    
    Follows latex3/latex2e#1154


>---------------------------------------------------------------

88a766683e664aa68c470398386d3bb82404492e
 l3trial/xbox/testfiles/xbox002.luatex.tlg | 10 ++++++++++
 l3trial/xbox/testfiles/xbox002.lvt        |  6 ++++++
 l3trial/xbox/testfiles/xbox002.tlg        | 10 ++++++++++
 l3trial/xbox/testfiles/xbox002.uptex.tlg  | 10 ++++++++++
 l3trial/xbox/testfiles/xbox002.xetex.tlg  | 10 ++++++++++
 l3trial/xbox/xbox.dtx                     | 10 +++++++++-
 6 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/l3trial/xbox/testfiles/xbox002.luatex.tlg b/l3trial/xbox/testfiles/xbox002.luatex.tlg
index 59f945c49..49a9bde39 100644
--- a/l3trial/xbox/testfiles/xbox002.luatex.tlg
+++ b/l3trial/xbox/testfiles/xbox002.luatex.tlg
@@ -438,3 +438,13 @@ l. ...  }
 <argument> \myboxa 
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Bad alignment with \makebox 
+============================================================
+! Package xbox Error: Unknown position specifier 'x'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX was asked to position material inside a box using the specifier 'x', but
+this position was never defined. LaTeX will use 'c' (center) instead.
+============================================================
diff --git a/l3trial/xbox/testfiles/xbox002.lvt b/l3trial/xbox/testfiles/xbox002.lvt
index 0bade3258..7619a3d4b 100644
--- a/l3trial/xbox/testfiles/xbox002.lvt
+++ b/l3trial/xbox/testfiles/xbox002.lvt
@@ -77,4 +77,10 @@
     \showbox\myboxa
   }
 
+\TEST{Bad alignment with \makebox}
+  {%
+    \makebox[4cm][x]{text}%
+  }
+
+
 \END
diff --git a/l3trial/xbox/testfiles/xbox002.tlg b/l3trial/xbox/testfiles/xbox002.tlg
index 51f9b1b84..8ee2c6d46 100644
--- a/l3trial/xbox/testfiles/xbox002.tlg
+++ b/l3trial/xbox/testfiles/xbox002.tlg
@@ -438,3 +438,13 @@ l. ...  }
 <argument> \myboxa 
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Bad alignment with \makebox 
+============================================================
+! Package xbox Error: Unknown position specifier 'x'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX was asked to position material inside a box using the specifier 'x', but
+this position was never defined. LaTeX will use 'c' (center) instead.
+============================================================
diff --git a/l3trial/xbox/testfiles/xbox002.uptex.tlg b/l3trial/xbox/testfiles/xbox002.uptex.tlg
index 3d4e8f21e..03f74d1c5 100644
--- a/l3trial/xbox/testfiles/xbox002.uptex.tlg
+++ b/l3trial/xbox/testfiles/xbox002.uptex.tlg
@@ -456,3 +456,13 @@ l. ...  }
 <argument> \myboxa 
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Bad alignment with \makebox 
+============================================================
+! Package xbox Error: Unknown position specifier 'x'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX was asked to position material inside a box using the specifier 'x', but
+this position was never defined. LaTeX will use 'c' (center) instead.
+============================================================
diff --git a/l3trial/xbox/testfiles/xbox002.xetex.tlg b/l3trial/xbox/testfiles/xbox002.xetex.tlg
index a4bc71e14..7c63ae2d4 100644
--- a/l3trial/xbox/testfiles/xbox002.xetex.tlg
+++ b/l3trial/xbox/testfiles/xbox002.xetex.tlg
@@ -438,3 +438,13 @@ l. ...  }
 <argument> \myboxa 
 l. ...  }
 ============================================================
+============================================================
+TEST 6: Bad alignment with \makebox 
+============================================================
+! Package xbox Error: Unknown position specifier 'x'.
+For immediate help type H <return>.
+ ...                                              
+l. ...  }
+LaTeX was asked to position material inside a box using the specifier 'x', but
+this position was never defined. LaTeX will use 'c' (center) instead.
+============================================================
diff --git a/l3trial/xbox/xbox.dtx b/l3trial/xbox/xbox.dtx
index 1fd3a2449..3ac0b2097 100644
--- a/l3trial/xbox/xbox.dtx
+++ b/l3trial/xbox/xbox.dtx
@@ -708,7 +708,7 @@
   }
 \cs_new_protected:Npn \@@_position:n #1
   {
-    \str_case:nn {#1}
+    \str_case:nnF {#1}
       {
         { l } { \cs_set_eq:NN \@@_hposition:n \xbox_position_left:n }
         { c } { \cs_set_eq:NN \@@_hposition:n \xbox_position_hcenter:n }
@@ -717,9 +717,17 @@
         { t } { \cs_set_eq:NN \@@_vposition:n \xbox_position_top:n }
         { b } { \cs_set_eq:NN \@@_vposition:n \xbox_position_bottom:n }
       }
+      { \msg_error:nnn { xbox } { unknown-position } {#1} }
   }
 \cs_new_protected:Npn \@@_hposition:n #1 {#1}
 \cs_new_protected:Npn \@@_vposition:n #1 {#1}
+\msg_new:nnnn { xbox } { unknown-position }
+  { Unknown~position~specifier~'#1'. }
+  {
+    LaTeX~was~asked~to~position~material~inside~a~box~using~the~specifier~
+    '#1',~but~this~position~was~never~defined.~LaTeX~will~use~'c'~(center)~
+    instead.
+  }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}





More information about the latex3-commits mailing list.