texlive[66281] branches/branch2022.final/Master/texmf-dist:

commits+karl at tug.org commits+karl at tug.org
Wed Mar 1 22:06:08 CET 2023


Revision: 66281
          http://tug.org/svn/texlive?view=revision&revision=66281
Author:   karl
Date:     2023-03-01 22:06:07 +0100 (Wed, 01 Mar 2023)
Log Message:
-----------
tabularray (1mar23) (branch)

Modified Paths:
--------------
    branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/README.txt
    branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf
    branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/tabularray.tex
    branches/branch2022.final/Master/texmf-dist/tex/latex/tabularray/tabularray.sty

Modified: branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/README.txt
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/README.txt	2023-03-01 21:05:50 UTC (rev 66280)
+++ branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/README.txt	2023-03-01 21:06:07 UTC (rev 66281)
@@ -1,6 +1,6 @@
 Package: Typeset tabulars and arrays with LaTeX3
-Copyright: 2021-2022 (c) Jianrui Lyu <tolvjr at 163.com>
+Copyright: 2021-2023 (c) Jianrui Lyu <tolvjr at 163.com>
 CTAN: https://ctan.org/pkg/tabularray
 Repository: https://github.com/lvjr/tabularray
 Repository: https://bitbucket.org/lvjr/tabularray
-License: The LaTeX Project Public License 1.3
+License: The LaTeX Project Public License 1.3c

Modified: branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf
===================================================================
(Binary files differ)

Modified: branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/tabularray.tex
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/tabularray.tex	2023-03-01 21:05:50 UTC (rev 66280)
+++ branches/branch2022.final/Master/texmf-dist/doc/latex/tabularray/tabularray.tex	2023-03-01 21:06:07 UTC (rev 66281)
@@ -1,7 +1,7 @@
 % -*- coding: utf-8 -*-
 % !TEX program = lualatex
 \documentclass[oneside]{book}
-\newcommand*{\myversion}{2022D}
+\newcommand*{\myversion}{2023A}
 \newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
 
 \usepackage[a4paper,margin=2.5cm]{geometry}
@@ -729,7 +729,8 @@
 \end{tblr}
 \end{demohigh}
 
-You can use \verb!X!, \verb!Y!, \verb!Z! to denote the last three children, respectively.
+You can use \verb!U!, \verb!V!, \verb!W!, \verb!X!, \verb!Y!, \verb!Z! to
+denote the last six children, respectively.
 It is especially useful when you are writing long tables:
 
 \begin{demohigh}
@@ -1384,7 +1385,7 @@
   \K{colsep} & set horizontal space to both sides of every column & \V{6pt} \\
   \K{hspan} & horizontal span algorithm: \V{default}, \V{even}, or \V{minimal} & \V{default} \\
   \K{vspan} & vertical span algorithm: \V{default} or \V{even} & \V{default} \\
-  \K{verb} & you need this key to use verb commands & \None \\
+  %\K{verb} & you need this key to use verb commands & \None \\
   \K{baseline} & set the baseline of the table & \V{m} \\
 \end{spectblr}
 
@@ -1504,14 +1505,17 @@
 
 \subsection{Use Verbatim Commands}
 
-With \verb!verb! key, you can write \verb!\verb! commands in the cell text:
+%With \verb!verb! key, you can write \verb!\verb! commands in the cell text:
+%
+%\begin{demohigh}
+%\begin{tblr}{hlines,verb}
+%  20 & 30 & \verb!\hello{world}!40 \\
+%  50 & \verb!\hello!60 & 70 \\
+%\end{tblr}
+%\end{demohigh}
 
-\begin{demohigh}
-\begin{tblr}{hlines,verb}
-  20 & 30 & \verb!\hello{world}!40 \\
-  50 & \verb!\hello!60 & 70 \\
-\end{tblr}
-\end{demohigh}
+The inner key \verb!verb! is obsolete from version 2023A, and will be removed in the future.
+Instead you can use more reliable \verb!\fakeverb! command (see Section \ref{sec:fakeverb}).
 
 \subsection{Set Baseline for the Table}
 
@@ -1599,15 +1603,17 @@
 
 \subsection{Expand Macros First}
 
-\verb!Tabularray! need to see every \verb!&! and \verb!\\! when splitting the table body
-with \verb!l3regex!. And you can not put cell text inside any table command defined with
-\verb!\NewTableCommand!. But you could use outer specification \verb!expand! to make \verb!tabularray!
-expand every occurrence of a specified macro \underline{once} before splitting the table body.
-The macro \underline{can not} be defined with \verb!\NewDocumentCommand! or
-\verb!\NewExpandableDocumentCommand!, and \underline{can not} have optional argument.
+In contrast to traditional \verb!tabular! environment, \verb!tabularray! environments
+need to see every \verb!&! and \verb!\\! when splitting the table body with \verb!l3regex!.
+And you can not put cell text inside any table command defined with \verb!\NewTableCommand!.
+But you could use outer key \verb!expand! to make \verb!tabularray! expand
+every occurrence of a specified macro \underline{once} before splitting the table body.
+Note that you \underline{can not} expand a command defined with \verb!\NewDocumentCommand!.
 
+To expand a command without optional argument, you can define it with \verb!\newcommand!.
+
 \begin{demohigh}
-\def\tblrbody{
+\newcommand*\tblrbody{
  \hline
   20 & 30 & 40 \\
   50 & 60 & 70 \\
@@ -1624,7 +1630,23 @@
 \end{tblr}
 \end{demohigh}
 
-\section{Default Specifications}
+To expand commands with optional arguments, you \underline{can not} define them
+with \verb!\newcommand!. But you can define them with \verb!\NewExpandableDocumentCommand!,
+and use option \verb!expand=\expanded! to do exhaustive expansions.
+
+\begin{demohigh}
+\NewExpandableDocumentCommand\yes{O{Yes}m}{\SetCell{bg=green9}#1}
+\NewExpandableDocumentCommand\no{O{No}m}{\SetCell{bg=red9}#1}
+\begin{tblr}[expand=\expanded]{hlines}
+  What I get               & is below              \\
+  \expanded{\yes{}}        & \expanded{\no{}}      \\
+  \expanded{\yes[Great]{}} & \expanded{\no[Bad]{}}
+\end{tblr}
+\end{demohigh}
+
+Note that you need to protect fragile commands (if any) inside them with \verb!\unexpanded! command.
+
+\section{Default Specifications}%
 \label{sec:default}
 
 \verb!Tabularray! package provides \verb!\SetTblrInner! and \verb!\SetTblrOuter! commands
@@ -2713,6 +2735,9 @@
 \end{tblr}
 \end{demohigh}
 
+From version 2023A, you can evaluate all functions in the table body
+with option \texttt{evaluate=all}.
+
 \subsection{Inner key \texttt{process} in action}
 
 With inner key \verb!process!, you can modify the contents and styles before the table is built.
@@ -2987,6 +3012,55 @@
 From version 2022D, you can load \verb!zref! library
 to make \verb!\zref! and \verb!longtblr! work together.
 
+\chapter{Tips and Tricks}
+
+\section{Control Horizontal Alignment}
+
+You can control horizontal alignment of cells in \texttt{tabularray} with
+\href{https://www.ctan.org/pkg/ragged2e}{\texttt{ragged2e}} package,
+by redefining some of the following commands:
+
+\begin{codehigh}
+\RenewDocumentCommand\TblrAlignBoth{}{\justifying}
+\RenewDocumentCommand\TblrAlignLeft{}{\RaggedRight}
+\RenewDocumentCommand\TblrAlignCenter{}{\Centering}
+\RenewDocumentCommand\TblrAlignRight{}{\RaggedLeft}
+\end{codehigh}
+
+Please read the documentation of \texttt{ragged2e} package for more details of
+their alignment commands.
+
+\section{Use Safe Verbatim Commands}%
+\label{sec:fakeverb}
+
+Due to the limitation of TeX, even if you have passed \texttt{verb} option to a
+\texttt{tabularray} table, you still could not use some special characters in a
+\verb!\verb! command. As an replacement, you may use \verb|\fakeverb| command from \href{https://www.ctan.org/pkg/codehigh}{\texttt{codehigh}} package.
+
+The \verb|\fakeverb| command will remove the backslashes in the following control symbols before
+typesetting its content: \fakeverb{\\\\}, \fakeverb{\\\{}, \fakeverb{\\\}}, \fakeverb{\\\#}, \fakeverb{\\\^} and \texttt{\textbackslash\textvisiblespace}, \fakeverb{\\\%}.
+Also the argument of \verb|\fakeverb| command need to be enclosed with curly braces.
+Therefore it could be safely used inside \verb|tabularray| tables and other LaTeX commands.
+
+Here is an example of using \verb!\fakeverb! commands inside a \verb|tblr| environment
+(you don't need \texttt{verb} option to use \verb!\fakeverb!):
+
+\begin{demohigh}
+\begin{tblr}{hlines}
+  Special & \fakeverb{\abc{}$&^_^uvw 123} \\
+  Spacing & \fakeverb{\bfseries\ \#\%}    \\
+  Nesting & \fbox{\fakeverb{$\left\\\{A\right.$\#}}
+\end{tblr}
+\end{demohigh}
+
+In the above example, balanced curly braces and control words (such as \verb!\bfseries!)
+need not to be escaped---only several special characters need to be escaped.
+Please read the documentation of \texttt{codehigh} package for more details of
+\verb|\fakeverb| commands.%
+\footnote{By the way, \fakeverb{\EscVerb} command from
+\href{https://www.ctan.org/pkg/fvextra}{\texttt{fvextra}} package is similar to
+\fakeverb{\fakeverb} command, but with \fakeverb{\EscVerb} you need to escape every control word.}
+
 \chapter{History and Future}
 
 \section{The Future}
@@ -3007,6 +3081,10 @@
 The change log of \verb!tabularray! package will be updated on the wiki page:\newline
 \centerline{\url{https://github.com/lvjr/tabularray/wiki/ChangeLog}}
 
+In version 2023A, inner key \verb!verb! was marked as obsolete,
+and it will be removed in the future. But don't worry too much,
+because you can stick to old version by \verb!\usepackage{tabularray}[=2023-03-01]!.
+
 In version 2022A, there were several breaking changes:
 
 \begin{itemize}[nosep]

Modified: branches/branch2022.final/Master/texmf-dist/tex/latex/tabularray/tabularray.sty
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/latex/tabularray/tabularray.sty	2023-03-01 21:05:50 UTC (rev 66280)
+++ branches/branch2022.final/Master/texmf-dist/tex/latex/tabularray/tabularray.sty	2023-03-01 21:06:07 UTC (rev 66281)
@@ -1,9 +1,9 @@
 %%% % -*- coding: utf-8 -*-
 %%% ----------------------------------------------------------------------------
 %%% Tabularray: Typeset tabulars and arrays with LaTeX3
-%%% Copyright : 2021-2022 (c) Jianrui Lyu <tolvjr at 163.com>
+%%% Copyright : 2021-2023 (c) Jianrui Lyu <tolvjr at 163.com>
 %%% Repository: https://github.com/lvjr/tabularray
-%%% License   : The LaTeX Project Public License 1.3
+%%% License   : The LaTeX Project Public License 1.3c
 %%% ----------------------------------------------------------------------------
 
 %%% --------------------------------------------------------
@@ -18,7 +18,7 @@
 \DeclareCurrentRelease{}{2022-01-01}
 
 \RequirePackage{expl3}
-\ProvidesExplPackage{tabularray}{2022-11-01}{2022D}
+\ProvidesExplPackage{tabularray}{2023-03-01}{2023A}
   {Typeset tabulars and arrays with LaTeX3}
 
 %% \IfFormatAtLeastTF, xparse and lthooks are added in LaTeX 2020-10-01
@@ -62,6 +62,27 @@
 
 \cs_set_eq:NN \TblrNewPage \newpage
 
+%% Note that \cs_if_exist:NTF doesn't treat \relax as an existing command.
+%% Therefore we define our \__tblr_cs_if_defined:NTF here.
+\prg_set_conditional:Npnn \__tblr_cs_if_defined:N #1 { p, T, F, TF }
+  {
+    %% \if_cs_exist:N = \ifdefined in eTeX
+    \if_cs_exist:N #1
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+\prg_set_conditional:Npnn \__tblr_cs_if_defined:c #1 { p, T, F, TF }
+  {
+    %% \if_cs_exist:w = \ifcsname in eTeX
+    \if_cs_exist:w #1 \cs_end:
+      \prg_return_true:
+    \else:
+      \prg_return_false:
+    \fi:
+  }
+
 \cs_generate_variant:Nn \msg_error:nnnn { nnVn }
 \cs_generate_variant:Nn \prop_item:Nn { Ne, NV }
 \cs_generate_variant:Nn \prop_put:Nnn { Nxn, Nxx, NxV }
@@ -919,9 +940,9 @@
       { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
   }
 
-\regex_const:Nn \c__tblr_child_name_regex { ^ [X-Z] $ }
+\regex_const:Nn \c__tblr_child_name_regex { ^ [U-Z] $ }
 
-%% Convert X, Y, Z to the indexes of the last three childs, respectively
+%% Convert U, V, W, X, Y, Z to the indexes of the last six childs, respectively
 \cs_new_protected_nopar:Npn \__tblr_child_name_to_index:nN #1 #2
   {
     \regex_match:NnTF \c__tblr_child_name_regex {#1}
@@ -944,7 +965,7 @@
 \clist_new:N \g__tblr_table_commands_clist
 
 \msg_new:nnn { tabularray } { defined-table-command }
-  { Table ~ commnad ~ #1 has ~ been ~ defined! }
+  { Table ~ command ~ #1 already ~ defined! }
 
 \NewDocumentCommand \NewTableCommand { m O{0} o m }
   {
@@ -957,7 +978,8 @@
         \__tblr_make_xparse_arg_spec:nnN { #2 } { #3 } \l__tblr_a_tl
         \exp_args:NcV \NewDocumentCommand
           { __tblr_table_command_ \cs_to_str:N #1 :w } \l__tblr_a_tl { #4 }
-        \cs_if_exist:NTF #1
+        %% we can not use \cs_if_exist:NTF here (see issue #328)
+        \__tblr_cs_if_defined:NTF #1
           {
             \cs_set_eq:cN { __tblr_table_command_ \cs_to_str:N #1 _saved:w } #1
           }
@@ -1004,6 +1026,9 @@
     \int_set:Nn \c at colnum {#2}
   }
 
+%% Add \empty as a table command so that users can write \\\empty\hline (see #328)
+\NewTableCommand\empty{}
+
 %% Table commands are defined only inside tblr environments,
 %% but some packages such as csvsimple need to use them outside tblr environments,
 %% therefore we define some of them first here.
@@ -1029,7 +1054,7 @@
 \clist_new:N \g__tblr_content_commands_clist
 
 \msg_new:nnn { tabularray } { defined-content-command }
-  { Content ~ commnad ~ #1 has ~ been ~ defined! }
+  { Content ~ command ~ #1 already ~ defined! }
 
 \NewDocumentCommand \NewContentCommand { m O{0} o m }
   {
@@ -2631,10 +2656,13 @@
     \group_align_safe_end:
   }
 
+\bool_new:N \lTblrMeasuringBool
+
 %% Read, split and build the table
 \cs_new_protected:Npn \__tblr_builder:nnn #1 #2 #3
   {
     \int_gincr:N \g_tblr_level_int
+    \bool_set_true:N \lTblrMeasuringBool
     \__tblr_clear_prop_lists:
     \__tblr_clear_spec_lists:
     \LogTblrTracing { step = init ~ table ~ outer ~ spec}
@@ -2660,6 +2688,7 @@
     \LogTblrTracing { step = calculate ~ cell ~ and ~ line ~ sizes}
     \__tblr_enable_content_commands:
     \__tblr_calc_cell_and_line_sizes:
+    \bool_set_false:N \lTblrMeasuringBool
     \LogTblrTracing { step = build ~ the ~ whole ~ table}
     \__tblr_build_whole:
     \int_gdecr:N \g_tblr_level_int
@@ -4831,6 +4860,10 @@
   }
 \SetTblrTemplate { contfoot } { normal }
 
+\DefTblrTemplate { conthead-pre } { empty } { }
+\DefTblrTemplate { conthead-pre } { normal } { \space }
+\SetTblrTemplate { conthead-pre } { normal }
+
 \DefTblrTemplate { conthead-text } { normal } { \tblrcontheadname }
 \SetTblrTemplate { conthead-text } { normal }
 
@@ -4962,7 +4995,7 @@
         \UseTblrTemplate { caption-tag } { default }
         \UseTblrTemplate { caption-sep } { default }
         \UseTblrTemplate { caption-text } { default }
-        \space
+        \UseTblrTemplate { conthead-pre } { default }
         \UseTblrTemplate { conthead-text } { default }
       }
     \dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
@@ -4984,7 +5017,7 @@
         \UseTblrTemplate { caption-tag } { default }
         \UseTblrTemplate { caption-sep } { default }
         \UseTblrTemplate { caption-text } { default }
-        \space
+        \UseTblrTemplate { conthead-pre } { default }
         \UseTblrTemplate { conthead-text } { default }
       }
     \dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
@@ -5018,7 +5051,7 @@
     \UseTblrTemplate { caption-tag } { default }
     \UseTblrTemplate { caption-sep } { default }
     \UseTblrTemplate { caption-text } { default }
-    \space
+    \UseTblrTemplate { conthead-pre } { default }
     \UseTblrTemplate { conthead-text } { default }
     \par
   }
@@ -5348,6 +5381,9 @@
 \cs_new_protected:Npn \__tblr_build_table_head_foot:
   {
     \__tblr_get_table_width:
+    % make each of \lTblrCaptionTl, \lTblrEntryTl, \lTblrLabelTl and the
+    % three corresponding booleans available in all head-foot templates
+    \__tblr_set_table_label_entry:
     \__tblr_build_table_head_aux:Nn \l__tblr_table_firsthead_box
       {
         \__tblr_build_table_label_entry:
@@ -5375,9 +5411,37 @@
       }
   }
 
+\bool_new:N \l__tblr_table_no_title_bool
+\bool_new:N \l__tblr_table_no_entry_bool
+\bool_new:N \l__tblr_table_no_label_bool
+\tl_const:Nn \c_tblr_none_tl { none }
+
+\cs_new_protected:Npn \__tblr_set_table_label_entry:
+  {
+    \tl_set:Nx \lTblrCaptionTl { \InsertTblrText { caption } }
+    \tl_set:Nx \lTblrEntryTl { \InsertTblrText { entry } }
+    \tl_set:Nx \lTblrLabelTl { \InsertTblrText { label } }
+    \bool_set:Nn \l__tblr_table_no_title_bool
+      { \tl_if_empty_p:N \lTblrCaptionTl }
+    \bool_set:Nn \l__tblr_table_no_entry_bool
+      { \tl_if_eq_p:NN \lTblrEntryTl \c_tblr_none_tl }
+    \bool_set:Nn \l__tblr_table_no_label_bool
+      { \tl_if_eq_p:NN \lTblrLabelTl \c_tblr_none_tl }
+    \bool_if:NT \l__tblr_table_no_title_bool
+      {
+        \SetTblrTemplate { conthead-pre } { empty }
+      }
+    \bool_if:NT \l__tblr_table_no_label_bool
+      {
+        \SetTblrTemplate { caption-tag }{ empty }
+        \SetTblrTemplate { caption-sep }{ empty }
+      }
+  }
+
 \cs_new_protected:Npn \__tblr_build_tall_table_head_foot:
   {
     \__tblr_get_table_width:
+    \__tblr_set_table_label_entry:
     \__tblr_build_table_head_aux:Nn \l__tblr_table_firsthead_box
       {
         \__tblr_build_table_label_entry:
@@ -5394,15 +5458,8 @@
 
 \cs_new_protected:Npn \__tblr_build_table_label_entry:
   {
-    \tl_set:Nx \lTblrCaptionTl { \InsertTblrText { caption } }
-    \tl_set:Nx \lTblrEntryTl { \InsertTblrText { entry } }
-    \tl_set:Nx \lTblrLabelTl { \InsertTblrText { label } }
-    \tl_if_eq:NnTF \lTblrLabelTl { none }
+    \bool_if:NF \l__tblr_table_no_label_bool
       {
-        \SetTblrTemplate { caption-tag }{ empty }
-        \SetTblrTemplate { caption-sep }{ empty }
-      }
-      {
         \refstepcounter { table }
         \tl_if_empty:NF \lTblrLabelTl
           {
@@ -5411,10 +5468,10 @@
             \exp_args:NV \label \lTblrLabelTl
           }
       }
-    %% We put caption-lot code at last, so that an user can modify \lTblrEntryTl
-    %% in a caption-label template. For example, an user may want to use
+    %% We put caption-lot code at last, so that a user can modify \lTblrEntryTl
+    %% in a caption-label template. For example, a user may want to use
     %% short caption in nameref, but at the same time not to add LoT entry.
-    \tl_if_eq:NnF \lTblrEntryTl { none }
+    \bool_if:NF \l__tblr_table_no_entry_bool
       { \UseTblrTemplate { caption-lot } { default } }
   }
 
@@ -6340,12 +6397,6 @@
       {
         \tl_set:Nn \l__tblr_vline_abovepos_tl {0} % default position
       }
-    \tl_set:Nx \l__tblr_vline_belowpos_tl
-      { \__tblr_spec_item:ne { vline } { [#1][#2](#3) / belowpos } }
-    \tl_if_empty:NT \l__tblr_vline_belowpos_tl
-      {
-        \tl_set:Nn \l__tblr_vline_belowpos_tl {0} % default position
-      }
     \fp_compare:nNnF { \l__tblr_vline_abovepos_tl } = {0}
       {
         \dim_set:Nn \l_tmpa_dim
@@ -6361,8 +6412,10 @@
           }
       }
     %% To join two vline segment above and below a cline,
-    %% we choose to extend every vline downwards a little (#55).
-    \fp_compare:nNnTF { \l__tblr_vline_belowpos_tl } = {0}
+    %% we choose to extend every vline downwards a little (#55, #272).
+    \tl_set:Nx \l__tblr_vline_belowpos_tl
+      { \__tblr_spec_item:ne { vline } { [#1][#2](#3) / belowpos } }
+    \tl_if_empty:NTF \l__tblr_vline_belowpos_tl
       {
         \dim_set:Nn \l__tblr_vline_belowskip_dim
           {
@@ -7082,11 +7135,16 @@
       {
         \tl_set:Nx \l__tblr_evaluate_tl
           { \__tblr_spec_item:nn { outer } { evaluate } }
-        \tl_set:Nx \l__tblr_evaluate_tl { \tl_head:N \l__tblr_evaluate_tl }
         \tl_if_empty:NF \l__tblr_evaluate_tl
           {
-            \exp_last_unbraced:NNV
-            \__tblr_evaluate_table_body:NN \l__tblr_body_tl \l__tblr_evaluate_tl
+            \tl_if_eq:NnTF \l__tblr_evaluate_tl { all }
+              {
+                \tlSet \l__tblr_body_tl { \evalWhole {\expValue \l__tblr_body_tl} }
+              }
+              {
+                \exp_last_unbraced:NNV
+                \__tblr_evaluate_table_body:NN \l__tblr_body_tl \l__tblr_evaluate_tl
+              }
           }
       }
     %% Evaluate every occurrence of the specified function



More information about the tex-live-commits mailing list.