diff options
Diffstat (limited to 'Master')
24 files changed, 1545 insertions, 193 deletions
diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf Binary files differindex 55c65524048..3188a560f7d 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3dt/l3dt.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf Binary files differindex 2461b6454cd..3d97aadb65e 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3sort/l3sort.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf Binary files differindex dde65fe1daf..88d16377d53 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf Binary files differindex f0638355366..aed9faa8626 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf Binary files differnew file mode 100644 index 00000000000..1def57701cd --- /dev/null +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf Binary files differindex e2ff96fcece..054011fb6d9 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf Binary files differindex c83ca55aa38..569b2812b5b 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf Binary files differindex aa6e24af214..246eaa85d21 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf Binary files differindex ecd13045c18..23cd24d82cd 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf Binary files differindex b19885f938f..6e6a13a08cf 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf Binary files differindex 39f3a94dbc8..21480eab557 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf +++ b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf diff --git a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx index 250fbd7bdf5..e6560eb79e1 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3dt.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3dt.dtx 4153 2012-08-29 07:18:26Z joseph $ {L3 Experimental data tables} %</driver|package> %<*driver> @@ -71,9 +71,9 @@ % \LaTeX3 implements a \enquote{data table} variable type, which is made up of % a series of rows each of which contain a number of key--value pairs. Thus % a data table is in effect an array of property lists. The rows of the table -% are stored in a fixed order, and are numbered consecutively from zero. +% are stored in a fixed order, and are numbered consecutively from one. % In the same way, the order of keys (columns) is recorded in a sequence-like -% manner, again indexed from zero. +% manner, again indexed from one. % % Within each row in a data table each entry must have a unique \meta{key}: if % an entry is added to a row within a data table which already contains the @@ -393,7 +393,7 @@ % \begin{macrocode} %<*initex|package> % \end{macrocode} -% +% % \begin{macrocode} %<@@=dt> % \end{macrocode} @@ -416,20 +416,21 @@ % numbered: % \begin{quote} % \Arg{rows} \\ -% \cs{q_@@} \meta{key$_0$} \cs{q_@@} \meta{key$_1$} \cs{q_@@} \ldots \\ +% \Arg{columns} \\ +% \cs{q_@@} \meta{key_1} \cs{q_@@} \meta{key_2} \cs{q_@@} \ldots \\ % \cs{q_nil} \\ % \cs{q_@@_header} \\ % \cs{q_@@_row} \\ -% \meta{row$_0$} \\ -% \cs{q_@@} \meta{key$_0$} \cs{q_@@} \Arg{data$_{0,0}$} \\ -% \cs{q_@@} \meta{key$_1$} \cs{q_@@} \Arg{data$_{0,1}$} \\ +% \meta{row_1} \\ +% \cs{q_@@} \meta{key_1} \cs{q_@@} \Arg{data_{1,1}} \\ +% \cs{q_@@} \meta{key_2} \cs{q_@@} \Arg{data_{1,2}} \\ % \ldots \\ % \cs{q_@@} \\ % \cs{q_nil} \\ % \cs{q_@@_row} \\ -% \meta{row$_2$} \\ -% \cs{q_@@} \meta{key$_0$} \cs{q_@@} \Arg{data$_{1,0}$} \\ -% \cs{q_@@} \meta{key$_1$} \cs{q_@@} \Arg{data$_{1,1}$} \\ +% \meta{row_2} \\ +% \cs{q_@@} \meta{key_1} \cs{q_@@} \Arg{data_{2,1}} \\ +% \cs{q_@@} \meta{key_2} \cs{q_@@} \Arg{data_{2,2}} \\ % \ldots \\ % \cs{q_@@} \\ % \cs{q_nil} \\ @@ -454,6 +455,7 @@ \tl_const:Nn \c_empty_dt { { 0 } + { 0 } \q_@@ \q_nil \q_@@_header @@ -468,15 +470,15 @@ % Internally, data tables are token lists, but an empty dt % is not an empty tl. % \begin{macrocode} -\cs_new_protected:Npn \dt_new:N #1 { \cs_new_eq:NN #1 \c_empty_dt } +\cs_new_protected:Npn \dt_new:N #1 { \cs_new_eq:NN #1 \c_empty_dt } % \end{macrocode} % \end{macro} % % \begin{macro}{\dt_clear:N, \dt_gclear:N} % The same idea for clearing. % \begin{macrocode} -\cs_new_protected:Npn \dt_clear:N #1 { \cs_set_eq:NN #1 \c_empty_dt } -\cs_new_protected:Npn \dt_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_dt } +\cs_new_protected:Npn \dt_clear:N #1 { \cs_set_eq:NN #1 \c_empty_dt } +\cs_new_protected:Npn \dt_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_dt } % \end{macrocode} % \end{macro} % @@ -564,21 +566,21 @@ % Finding a key in the header uses a similar approach to finding a key in % a property list. Here, if the key is found there will always be at least % one token between \cs{q_@@} and \cs{q_@@_header} due to the \cs{q_nil} -% which is part of a new table. The use of |##1##2| in \cs{@@_split:w} -% here is to deal with the overall number of rows. The set up here means -% that this will always be unbraced then rebraced: simply grabbing |##1| -% to include this and anything before the key of interest will give variable -% results depending on whether the match is to the very first key or not. +% which is part of a new table. The use of |##1##2##3| in \cs{@@_split:w} +% here is to deal with the overall number of rows and keys. The set up here +% means that these will always be unbraced then rebraced: simply grabbing +% |##1##2| to include this and anything before the key of interest will give +% variable results depending on whether the match is to the very first key or not. % \begin{macrocode} \cs_new_protected:Npn \@@_split_key_list:NnTF #1#2 { \exp_args:NNo \@@_split_key_list_aux:NnTF #1 { \tl_to_str:n {#2} } } \cs_new_protected:Npn \@@_split_key_list_aux:NnTF #1#2 { \cs_set_protected:Npn \@@_split:w - ##1##2 \q_@@ #2 \q_@@ ##3##4 \q_@@_header ##5 \q_mark ##6 \q_stop + ##1##2##3 \q_@@ #2 \q_@@ ##4##5 \q_@@_header ##6 \q_mark ##7 \q_stop { - \@@_split:nnnn ##3 - { { {##1} ##2 \q_@@ } { ##3##4 \q_@@_header ##5 } } + \@@_split:nnnn ##4 + { { {##1} {##2} ##3 \q_@@ } { ##4##5 \q_@@_header ##6 } } } \exp_after:wN \@@_split:w #1 \q_mark \q_@@ #2 \q_@@ { ? \use_ii:nn { } } \q_@@_header \q_mark \q_stop @@ -618,6 +620,7 @@ % \begin{macro}{\dt_add_key:Nn, \dt_gadd_key:Nn} % \begin{macro}[aux]{\@@_add_key:NNn} % \begin{macro}[aux]{\@@_add_key:NNnnn} +% \begin{macro}[aux]{\@@_add_key:NNnnn} % Here, there are two stages. If the key is already present in the list of % known keys then no action is taken, and the split list is thrown away. % On the other hand, if the key is not present then the header and body @@ -637,22 +640,27 @@ } } \cs_new_protected:Npn \@@_add_key:NNnnn #1#2#3#4#5 + { \@@_add_key:NNnnnwnn #1 #2 #4 \q_stop {#3} {#5} } +\cs_new_protected:Npn \@@_add_key:NNnnnwnn #1#2#3#4#5 \q_stop #6#7 { #1 #2 { - \exp_not:n {#4} - \tl_to_str:n {#3} - \exp_not:n { \q_@@ \q_nil #5 } + {#3} + { \int_eval:n { #4 + \c_one } } + \exp_not:n {#5} + \tl_to_str:n {#6} + \exp_not:n { \q_@@ \q_nil #7 } } } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\dt_add_row:N, \dt_gadd_row:N} % \begin{macro}[aux]{\@@_add_row:NN} -% \begin{macro}[aux]{\@@_add_row:NnN} +% \begin{macro}[aux]{\@@_add_row:NnN, \@@_add_row:NfN} % \begin{macro}[aux,EXP]{\@@_add_row:nw} % Adding a row means incrementing the total number and adding the structure % of an empty row. As finding the rows will get slow for large tables, this @@ -661,17 +669,18 @@ \cs_new_protected_nopar:Npn \dt_add_row:N { \@@_add_row:NN \tl_set:Nx } \cs_new_protected_nopar:Npn \dt_gadd_row:N { \@@_add_row:NN \tl_gset:Nx } \cs_new_protected:Npn \@@_add_row:NN #1#2 - { \exp_args:NNf \@@_add_row:NnN #1 { \dt_rows:N #2 } #2 } + { \@@_add_row:NfN #1 { \int_eval:n { \dt_rows:N #2 + \c_one } } #2 } \cs_new_protected:Npn \@@_add_row:NnN #1#2#3 { #1 #3 { - { \int_eval:n { #2 + \c_one } } + {#2} \exp_after:wN \@@_add_row:nw #3 \q_stop #2 \exp_not:n { \q_@@ \q_nil \q_@@_row } } } +\cs_generate_variant:Nn \@@_add_row:NnN { Nf } \cs_new:Npn \@@_add_row:nw #1#2 \q_stop { \exp_not:n {#2} } % \end{macrocode} % \end{macro} @@ -684,9 +693,9 @@ % arbitrary row. % \begin{macrocode} \cs_new_protected:Npn \dt_put:Nnn #1 - { \dt_put:Nnnn #1 { \dt_rows:N #1 - \c_one } } + { \dt_put:Nnnn #1 { \dt_rows:N #1 } } \cs_new_protected:Npn \dt_gput:Nnn #1 - { \dt_gput:Nnnn #1 { \dt_rows:N #1 - \c_one } } + { \dt_gput:Nnnn #1 { \dt_rows:N #1 } } % \end{macrocode} % \end{macro} % @@ -790,42 +799,19 @@ % \end{macro} % % \begin{macro}[EXP]{\dt_keys:N} -% \begin{macro}[aux, EXP]{\@@_keys:nn} -% \begin{macro}[aux, EXP]{\@@_keys:wN} -% A quick mapping is needed to count keys. The \cs{use_none:nn} here -% is used to remove the number of rows and initial \cs{q_@@}. This could -% also be handled by starting from $-1$ rather than $0$, but this makes -% the logic hopefully slightly clearer. -% \begin{macrocode} -\cs_new:Npn \dt_keys:N #1 - { \@@_split_header:NT #1 { \@@_keys:nn } } -\cs_new:Npn \@@_keys:nn #1#2 - { - \int_eval:n - { - 0 - \exp_after:wN \@@_keys:wN \use_none:nn #1 \q_recursion_tail \q_@@ - \__prg_break_point:Nn \dt_map_break: { } - } - } -\cs_new:Npn \@@_keys:wN #1 \q_@@ - { - \__quark_if_recursion_tail_break:nN {#1} \dt_map_break: - +1 - \@@_keys:wN - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% +% \begin{macro}[EXP, aux]{\@@_keys:nnw} % \begin{macro}[EXP]{\dt_rows:N} -% The number of rows in a dt is the very first entry. +% The number of rows in a dt is the very first entry. Getting the number of +% keys is almost the same, except a custom auxiliary is needed. % \begin{macrocode} +\cs_new:Npn \dt_keys:N #1 { \exp_after:wN \@@_keys:nnw #1 \q_stop } +\cs_new:Npn \@@_keys:nnw #1#2#3 \q_stop {#2} \cs_new:Npn \dt_rows:N #1 { \exp_after:wN \use_i_delimit_by_q_stop:nw #1 \q_stop } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Removing data} % @@ -833,10 +819,10 @@ % Deleting to the current row is simply a special case of deleting to an % arbitrary row. % \begin{macrocode} -\cs_new_protected:Npn \dt_remove:Nn #1 { \dt_remove:Nnn #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_gremove:Nn #1 { \dt_gremove:Nnn #1 - { \dt_rows:N #1 - \c_one } } +\cs_new_protected:Npn \dt_remove:Nn #1 + { \dt_remove:Nnn #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_gremove:Nn #1 + { \dt_gremove:Nnn #1 { \dt_rows:N #1 } } % \end{macrocode} % \end{macro} % @@ -892,6 +878,8 @@ { } } \cs_new_protected:Npn \dt_remove_key_aux:nNNnn #1#2#3#4#5 + { \dt_remove_key_aux:nNNnnwn {#1} #2 #3 #4 \q_stop {#5} } +\cs_new_protected:Npn \dt_remove_key_aux:nNNnnwn #1#2#3#4#5#6 \q_stop #7 { \cs_set:Npn \dt_remove_key_aux:w ##1 \q_@@ #1 \q_@@ ##2 ##3 { @@ -899,10 +887,13 @@ \__quark_if_recursion_tail_break:nN {##3} \dt_map_break: \dt_remove_key_aux:w ##3 } + #2 #3 { - \exp_not:n {#4} - \dt_remove_key_aux:w #5 \q_@@ #1 \q_@@ { } \q_recursion_tail + {#4} + { \int_eval:n { #5 - \c_one } } + \exp_not:n {#6} + \dt_remove_key_aux:w #7 \q_@@ #1 \q_@@ { } \q_recursion_tail \__prg_break_point:Nn \dt_map_break: { } } } @@ -1022,14 +1013,14 @@ % \begin{macro}[TF]{\dt_get:NnN} % Simple wrappers. % \begin{macrocode} -\cs_new_protected:Npn \dt_get:NnN #1 { \dt_get:NnnN #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_get:NnNT #1 { \dt_get:NnnNF #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_get:NnNF #1 { \dt_get:NnnNF #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_get:NnNTF #1 { \dt_get:NnnNTF #1 - { \dt_rows:N #1 - \c_one } } +\cs_new_protected:Npn \dt_get:NnN #1 + { \dt_get:NnnN #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_get:NnNT #1 + { \dt_get:NnnNF #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_get:NnNF #1 + { \dt_get:NnnNF #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_get:NnNTF #1 + { \dt_get:NnnNTF #1 { \dt_rows:N #1 } } % \end{macrocode} % \end{macro} % \end{macro} @@ -1236,14 +1227,14 @@ % \begin{macro}[pTF, EXP]{\dt_if_in_row:Nn} % Simple wrappers. % \begin{macrocode} -\cs_new:Npn \dt_if_in_row_p:Nn #1 { \dt_if_in_row_p:Nnn #1 - { \dt_rows:N #1 - \c_one } } -\cs_new:Npn \dt_if_in_row:NnT #1 { \dt_if_in_row:NnnT #1 - { \dt_rows:N #1 - \c_one } } -\cs_new:Npn \dt_if_in_row:NnF #1 { \dt_if_in_row:NnnF #1 - { \dt_rows:N #1 - \c_one } } -\cs_new:Npn \dt_if_in_row:NnTF #1 { \dt_if_in_row:NnnTF #1 - { \dt_rows:N #1 - \c_one } } +\cs_new:Npn \dt_if_in_row_p:Nn #1 + { \dt_if_in_row_p:Nnn #1 { \dt_rows:N #1 } } +\cs_new:Npn \dt_if_in_row:NnT #1 + { \dt_if_in_row:NnnT #1 { \dt_rows:N #1 } } +\cs_new:Npn \dt_if_in_row:NnF #1 + { \dt_if_in_row:NnnF #1 { \dt_rows:N #1 } } +\cs_new:Npn \dt_if_in_row:NnTF #1 + { \dt_if_in_row:NnnTF #1 { \dt_rows:N #1 } } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx new file mode 100644 index 00000000000..792cdcb105f --- /dev/null +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -0,0 +1,944 @@ +% \iffalse meta-comment +% +%% File: l3str-format.dtx Copyright (C) 2012 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3experimental bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +% +%<*driver|package> +\RequirePackage{expl3} +\GetIdInfo$Id: l3str-format.dtx 3940 2012-07-09 00:41:44Z bruno $ + {L3 Experimental string formatting} +%</driver|package> +%<*driver> +\documentclass[full]{l3doc} +\usepackage{amsmath} +\begin{document} + \tableofcontents + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% +% \title{^^A +% The \textsf{l3str-format} package: formatting strings of characters^^A +% \thanks{This file describes v\ExplFileVersion, +% last revised \ExplFileDate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \ExplFileDate} +% +% \maketitle +% +% \begin{documentation} +% +% \section{Format specifications} +% +% In this module, we introduce the notion of a string \meta{format}. +% The syntax follows that of Python's \texttt{format} built-in function. +% A \meta{format specification} is a string of the form +% \begin{equation*} +% \meta{format specification} = [[\meta{fill}]\meta{alignment}] +% [\meta{sign}] [\meta{width}] [.\meta{precision}] [\meta{style}] +% \end{equation*} +% where each $[\ldots]$ denotes an independent optional part. +% \begin{itemize} +% \item \meta{fill} can be any character: it is assumed to be present +% whenever the second character of the \meta{format specification} +% is a valid \meta{alignment} character. +% \item \meta{alignment} can be |<|~(left alignment), |>|~(right +% alignment), |^|~(centering), or |=|~(for numeric types only). +% \item \meta{sign} is allowed for numeric types; it can be |+|~(show +% a sign for positive and negative numbers), |-|~(only put a sign +% for negative numbers), or a space~(show a space or a~|-|). +% \item \meta{width} is the minimum number of characters of the +% result: if the result is naturally shorter than this \meta{width}, +% then it is padded with copies of the character \meta{fill}, with a +% position depending on the choice of \meta{alignment}. If the +% result is naturally longer, it is not truncated. +% \item \meta{precision}, whose presence is indicated by a period, +% can have different meanings depending on the type. +% \item \meta{style} is one character, which controls how the given +% data should be formatted. The list of allowed \meta{styles} +% depends on the type. +% \end{itemize} +% The choice of \meta{alignment} |=| is not implemented yet. +% +% \section{Formatting various data-types} +% +% \begin{function}[EXP]{\tl_format:Nn, \tl_format:cn, \tl_format:nn} +% \begin{syntax} +% \cs{tl_format:nn} \Arg{token list} \Arg{format specification} +% \end{syntax} +% Converts the \meta{token list} to a string according to the +% \meta{format specification}. The \meta{style}, if present, must +% be~|s|. If \meta{precision} is given, all characters of the string +% representation of the \meta{token list} beyond the first +% \meta{precision} characters are discarded. +% \end{function} +% +% \begin{function}[EXP]{\seq_format:Nn, \seq_format:cn} +% \begin{syntax} +% \cs{seq_format:Nn} \Arg{sequence} \Arg{format specification} +% \end{syntax} +% Converts each item in the \meta{sequence} to a string according to +% the \meta{format specification}, and concatenates the results. +% \end{function} +% +% \begin{function}[EXP]{\int_format:nn} +% \begin{syntax} +% \cs{int_format:nn} \Arg{intexpr} \Arg{format specification} +% \end{syntax} +% Evaluates the \meta{integer expression} and converts the result to a +% string according to the \meta{format specification}. The +% \meta{precision} argument is not allowed. The \meta{style} can be +% |b| for binary output, |d| for decimal output (this is the default), +% |o| for octal output, |X| for hexadecimal output (using capital +% letters). +% \end{function} +% +% \begin{function}[EXP]{\fp_format:nn} +% \begin{syntax} +% \cs{fp_format:nn} \Arg{fpexpr} \Arg{format specification} +% \end{syntax} +% Evaluates the \meta{floating point expression} and converts the +% result to a string according to the \meta{format specification}. +% The \meta{precision} defaults to $6$. The \meta{style} can be +% \begin{itemize} +% \item |e| for scientific notation, with one digit before and +% \meta{precision} digits after the decimal separator, and an +% integer exponent, following |e|; +% \item |f| for a fixed point notation, with \meta{precision} digits +% after the decimal separator and no exponent; +% \item |g| for a general format, which uses style |f| for numbers +% in the range $[10^{-4}, 10^{\meta{precision}})$ and style |e| +% otherwise. +% \end{itemize} +% \end{function} +% +% \section{Possibilities, and things to do} +% +% \begin{itemize} +% \item Provide a token list formatting \meta{style} which keeps the +% last \meta{precision} characters rather than the first +% \meta{precision}. +% \end{itemize} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3str-format} implementation} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=str> +% \end{macrocode} +% +% \begin{macrocode} +%<*package> +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\RequirePackage{l3str} +%</package> +% \end{macrocode} +% +% \subsection{Helpers} +% +% \begin{macro}[aux, EXP]{\use:nf, \use:fnf} +% A simple variant. +% \begin{macrocode} +\cs_generate_variant:Nn \use:nn { nf } +\cs_generate_variant:Nn \use:nnn { fnf } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\tl_to_str:f} +% A simple variant. +% \begin{macrocode} +\cs_generate_variant:Nn \tl_to_str:n { f } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_if_digit:NTF} +% Here we expect |#1| to be a character with category other, or +% \cs{s__stop}. +% \begin{macrocode} +\prg_new_conditional:Npnn \@@_format_if_digit:N #1 { TF } + { + \if_int_compare:w \c_nine < 1 #1 \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP] +% {\@@_format_put:nw, \@@_format_put:ow, \@@_format_put:fw} +% Put |#1| after an \cs{s__stop} delimiter. +% \begin{macrocode} +\cs_new:Npn \@@_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 } +\cs_generate_variant:Nn \@@_format_put:nw { o , f } +% \end{macrocode} +% \end{macro} +% +% \subsection{Parsing a format specification} +% +% \begin{macro}[aux, EXP]{\@@_format_parse:n} +% \begin{macro}[aux, EXP] +% { +% \@@_format_parse_i:NN, +% \@@_format_parse_ii:nN, +% \@@_format_parse_iii:nN, +% \@@_format_parse_iv:nwN, +% \@@_format_parse_v:nN, +% \@@_format_parse_vi:nwN, +% \@@_format_parse_vii:nN, +% \@@_format_parse_end:nwn, +% } +% The goal is to parse +% \begin{equation*} +% \meta{format specification} = [[\meta{fill}]\meta{alignment}] +% [\meta{sign}] [\meta{width}] [.\meta{precision}] [\meta{style}] +% \end{equation*} +% \begin{macrocode} +\cs_new:Npn \@@_format_parse:n #1 + { + \exp_last_unbraced:Nf \@@_format_parse_i:NN + \@@_to_other:n {#1} \s__stop \s__stop {#1} + } +\cs_new:Npx \@@_format_parse_i:NN #1#2 + { + \exp_not:N \@@_if_contains_char:nNTF { < > = ^ } #2 + { \exp_not:N \@@_format_parse_iii:nN { #1 #2 } } + { + \exp_not:N \@@_format_parse_ii:nN + { \c_catcode_other_space_tl } #1 #2 + } + } +\cs_new:Npn \@@_format_parse_ii:nN #1#2 + { + \@@_if_contains_char:nNTF { < > = ^ } #2 + { \@@_format_parse_iii:nN { #1 #2 } } + { \@@_format_parse_iii:nN { #1 ? } #2 } + } +\cs_new:Npx \@@_format_parse_iii:nN #1#2 + { + \exp_not:N \@@_if_contains_char:nNTF + { + - \c_catcode_other_space_tl } + #2 + { \exp_not:N \@@_format_parse_iv:nwN { #1 #2 } ; } + { \exp_not:N \@@_format_parse_iv:nwN { #1 ? } ; #2 } + } +\cs_new:Npn \@@_format_parse_iv:nwN #1#2; #3 + { + \@@_format_if_digit:NTF #3 + { \@@_format_parse_iv:nwN {#1} #2 #3 ; } + { \@@_format_parse_v:nN { #1 {#2} } #3 } + } +\cs_new:Npn \@@_format_parse_v:nN #1#2 + { + \token_if_eq_charcode:NNTF . #2 + { \@@_format_parse_vi:nwN {#1} 0 ; } + { \@@_format_parse_vii:nN { #1 { } } #2 } + } +\cs_new:Npn \@@_format_parse_vi:nwN #1#2; #3 + { + \@@_format_if_digit:NTF #3 + { \@@_format_parse_vi:nwN {#1} #2 #3 ; } + { \@@_format_parse_vii:nN { #1 {#2} } #3 } + } +\cs_new:Npn \@@_format_parse_vii:nN #1#2 + { + \token_if_eq_meaning:NNTF \s__stop #2 + { \@@_format_parse_end:nwn { #1 ? } #2 } + { \@@_format_parse_end:nwn { #1 #2 } } + } +\cs_new:Npn \@@_format_parse_end:nwn #1 #2 \s__stop \s__stop #3 + { + \tl_if_empty:nF {#2} + { \__msg_kernel_expandable_error:nnn { str } { invalid-format } {#3} } + #1 + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Alignment} +% +% The $4$ functions in this section receive an \meta{body}, a +% \meta{sign}, a \meta{width} and a \meta{fill} character (exactly one +% character). For non-numeric types, the \meta{sign} is empty and the +% \meta{body} is the (other) string we want to format. For numeric +% types, we wish to format \meta{sign} \meta{body} (both are other +% strings). The alignment types |<|, |>| and |^| keep \meta{sign} and +% \meta{body} together. The |=| alignment type, however, inserts the +% padding between the \meta{sign} and the \meta{body}, hence the need to +% keep those separate. +% +% \begin{macro}[aux, EXP]{\@@_format_align_<:nnnN} +% \begin{quote} +% \cs{@@_format_align_<:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \meta{fill} +% \end{quote} +% Aligning \enquote{\meta{sign} \meta{body}} to the left +% entails appending |#4| the correct number of times. Then convert +% the result to a string. +% \begin{macrocode} +\cs_new:cpn { @@_format_align_<:nnnN } #1#2#3#4 + { + \use:nf { #2 #1 } + { + \prg_replicate:nn + { \int_max:nn { #3 - \@@_count_unsafe:n { #2 #1 } } { 0 } } + {#4} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_align_>:nnnN} +% \begin{quote} +% \cs{@@_format_align_>:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \meta{fill} +% \end{quote} +% Aligning an \enquote{\meta{sign} \meta{body}} to the right +% entails prepending |#4| the correct number of times. Then convert +% the result to a string. +% \begin{macrocode} +\cs_new:cpn { @@_format_align_>:nnnN } #1#2#3#4 + { + \prg_replicate:nn + { \int_max:nn { #3 - \@@_count_unsafe:n { #2 #1 } } { 0 } } + {#4} + #2 #1 + } +% \end{macrocode} +% \end{macro} +% +% \begingroup\catcode`\^=12 +% \begin{macro}[aux, EXP]{\@@_format_align_^:nnnN} +% \begin{quote} +% \cs{@@_format_align_^:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \meta{fill} +% \end{quote} +% Centering \enquote{\meta{sign} \meta{body}} entails +% prepending and appending |#4| the correct number of times. If the +% number of |#4| to be added is odd, we add one more after than +% before. +% \begin{macrocode} +\cs_new:cpn { @@_format_align_^:nnnN } #1#2#3#4 + { + \use:fnf + { + \prg_replicate:nn + { + \int_max:nn \c_zero + { #3 - \@@_count_unsafe:n { #2 #1 } - \c_one } + / \c_two + } + {#4} + } + { #2 #1 } + { + \prg_replicate:nn + { + \int_max:nn \c_zero + { #3 - \@@_count_unsafe:n { #2 #1 } } + / \c_two + } + {#4} + } + } +% \end{macrocode} +% \end{macro} +% \endgroup +% +% \begin{macro}[aux, EXP]{\@@_format_align_=:nnnN} +% \begin{quote} +% \cs{@@_format_align_=:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \meta{fill} +% \end{quote} +% The special numeric alignment |=| means that we insert the +% appropriate number of copies of |#4| between the \meta{sign} and the +% \meta{body}. Then convert the result to a string. +% \begin{macrocode} +\cs_new:cpn { @@_format_align_=:nnnN } #1#2#3#4 + { + \use:nf {#2} + { + \prg_replicate:nn + { \int_max:nn { #3 - \@@_count_unsafe:n { #2 #1 } } { 0 } } + {#4} + } + #1 + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Formatting token lists} +% +% \begin{macro}[EXP]{\tl_format:Nn, \tl_format:cn, \tl_format:nn} +% Call \cs{@@_format_tl:NNNnnNn} to read the parsed \meta{format +% specification}. Then convert the result to a string. +% \begin{macrocode} +\cs_new_nopar:Npn \tl_format:Nn { \exp_args:No \tl_format:nn } +\cs_generate_variant:Nn \tl_format:Nn { c } +\cs_new:Npn \tl_format:nn #1#2 + { + \tl_to_str:f + { + \exp_last_unbraced:Nf \@@_format_tl:NNNnnNn + { \@@_format_parse:n {#2} } + {#1} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_tl:NNNnnNn} +% \begin{quote} +% \cs{@@_format_tl:NNNnnNn} \meta{fill} \meta{alignment} \meta{sign} +% \Arg{width} \Arg{precision} \meta{style} \Arg{token list} +% \end{quote} +% First check that the \meta{alignment} is not |=|, and set the +% default alignment |?| to |<|. Place the modified information after +% a trailing \cs{s__stop} for later retrieval. Then check that there +% was no \meta{sign}. The width will be useful later, store it after +% \cs{s__stop}. Afterwards, check the \meta{precision}: if it is +% empty, we will eventually use the whole string, otherwise we will +% only use a substring, starting at the index $1$, and ending at |#5|. +% There is a need to use the \enquote{unsafe} function, as otherwise +% leading spaces would get stripped by |f|-expansion. Finally, check +% that the \meta{style} is |?| or |s|. +% \begin{macrocode} +\cs_new:Npn \@@_format_tl:NNNnnNn #1#2#3#4#5#6 + { + \token_if_eq_charcode:NNTF #2 = + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-align-format } {#2} {tl} + \@@_format_put:nw { #1 < } + } + { + \token_if_eq_charcode:NNTF #2 ? + { \@@_format_put:nw { #1 < } } + { \@@_format_put:nw { #1 #2 } } + } + \token_if_eq_charcode:NNF #3 ? + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-sign-format } {#3} {tl} + } + \@@_format_put:nw { {#4} } + \tl_if_empty:nTF {#5} + { \@@_format_put:nw { \use:n { } } } + { \@@_format_put:nw { \@@_substr_unsafe:nnn { {1} {#5} } } } + \token_if_eq_charcode:NNF #6 s + { + \token_if_eq_charcode:NNF #6 ? + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-style-format } {#6} {tl} + } + } + \@@_format_tl_s:NNnnNNn + \s__stop + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_tl_s:NNnnNNn} +% \begin{quote} +% \cs{@@_format_tl_s:NNnnNNn} \cs{s__stop} \meta{function} +% \Arg{arguments} \Arg{width} \meta{fill} \meta{alignment} +% \Arg{token list} +% \end{quote} +% The \meta{function} and \meta{arguments} are built in such a way +% that |f|-expanding \meta{function} \Arg{other string} +% \meta{arguments} yields the piece of the \meta{other string} that we +% want to output. The \meta{other string} is built from the +% \meta{token list} by |f|-expanding \cs{@@_to_other:n}. +% \begin{macrocode} +\cs_new:Npn \@@_format_tl_s:NNnnNNn #1#2#3#4#5#6#7 + { + \exp_args:Nc \exp_args:Nf + { @@_format_align_#6:nnnN } + { \exp_args:Nf #2 { \@@_to_other:n {#7} } #3 } + { } + {#4} #5 + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Formatting sequences} +% +% \begin{macro}[EXP]{\seq_format:Nn, \seq_format:cn} +% Each item is formatted as a token list according to the +% specification. First parse the format and expand the sequence, then +% loop through the items. Eventually, convert to a string. +% \begin{macrocode} +\cs_new:Npn \seq_format:Nn #1#2 + { + \tl_to_str:f + { \@@_format_seq:of {#1} { \@@_format_parse:n {#2} } } + } +\cs_generate_variant:Nn \seq_format:Nn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_seq:nn, \@@_format_seq:of} +% The first argument is the contents of a \texttt{seq} variable. The +% second is a parsed \meta{format specification}. Set up the loop. +% \begin{macrocode} +\cs_new:Npn \@@_format_seq:nn #1#2 + { + \@@_format_seq_loop:nnNn { } {#2} + #1 + { ? \@@_format_seq_end:w } { } + } +\cs_generate_variant:Nn \@@_format_seq:nn { of } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_seq_loop:nnNn} +% \begin{quote} +% \cs{@@_format_seq_loop:nnNn} \Arg{done} \Arg{parsed format} +% \cs{__seq_item:n} \Arg{item} +% \end{quote} +% The first argument is the result of formatting the items read so +% far. The third argument is a single token (\cs{__seq_item:n}), +% until we reach the end of the sequence, where |\use_none:n #3| ends +% the loop. +% \begin{macrocode} +\cs_new:Npn \@@_format_seq_loop:nnNn #1#2#3#4 + { + \use_none:n #3 + \exp_args:Nf \@@_format_seq_loop:nnNn + { \use:nf {#1} { \@@_format_tl:NNNnnNn #2 {#4} } } + {#2} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_seq_end:w} +% Pick the right piece in the loop above. +% \begin{macrocode} +\cs_new:Npn \@@_format_seq_end:w #1#2#3#4 { \use_ii:nnn #3 } +% \end{macrocode} +% \end{macro} +% +% \subsection{Formatting integers} +% +% \begin{macro}[EXP]{\int_format:nn} +% Evalute the first argument and feed it to \cs{@@_format_int:nn}. +% \begin{macrocode} +\cs_new:Npn \int_format:nn #1 + { \exp_args:Nf \@@_format_int:nn { \int_eval:n {#1} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_int:nn} +% Parse the \meta{format specification} and feed it to +% \cs{@@_format_int:NNNnnNn}. Then convert the result to a string +% \begin{macrocode} +\cs_new:Npn \@@_format_int:nn #1#2 + { + \tl_to_str:f + { + \exp_last_unbraced:Nf \@@_format_int:NNNnnNn + { \@@_format_parse:n {#2} } + {#1} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_int:NNNnnNn} +% \begin{quote} +% \cs{@@_format_int:NNNnnNn} \meta{fill} \meta{alignment} +% \meta{sign} \Arg{width} \Arg{precision} \meta{style} \Arg{integer} +% \end{quote} +% First set the +% default alignment |?| to |>|. Place the modified information after +% a trailing \cs{s__stop} for later retrieval. Then check the +% \meta{sign}: if the integer is negative, always put~|-|. Otherwise, +% if the format's \meta{sign} is |~|, put a space (with category +% \enquote{other}); if it is~|+| put |+|; if it is |-| (default), put +% nothing, represented as a brace group. The width |#4| will be +% useful later, store it after \cs{s__stop}. Afterwards, check that +% the \meta{precision} was absent. Finally, dispatch depending on the +% \meta{style}. +% \begin{macrocode} +\cs_new:Npn \@@_format_int:NNNnnNn #1#2#3#4#5#6#7 + { + \token_if_eq_charcode:NNTF #2 ? + { \@@_format_put:nw { #1 > } } + { \@@_format_put:nw { #1 #2 } } + \int_compare:nNnTF {#7} < \c_zero + { \@@_format_put:nw { - } } + { + \str_case:nnn {#3} + { + { ~ } { \@@_format_put:ow { \c_catcode_other_space_tl } } + { + } { \@@_format_put:nw { + } } + } + { \@@_format_put:nw { { } } } + } + \@@_format_put:nw { {#4} } + \tl_if_empty:nF {#5} + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-precision-format } {#5} {int} + } + \str_case:nnn {#6} + { + { ? } { \@@_format_int:NwnnNNn \use:n } + { d } { \@@_format_int:NwnnNNn \use:n } + { b } { \@@_format_int:NwnnNNn \int_to_binary:n } + { o } { \@@_format_int:NwnnNNn \int_to_octal:n } + { X } { \@@_format_int:NwnnNNn \int_to_hexadecimal:n } + } + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-style-format } {#6} { int } + \@@_format_int:NwnnNNn \use:n + } + \s__stop {#7} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_int:NwnnNNn} +% \begin{quote} +% \cs{@@_format_int:NwnnNNn} \meta{function} \cs{s__stop} +% \Arg{width} \Arg{sign} \meta{fill} \meta{alignment} \Arg{integer} +% \end{quote} +% Use the |format_align| function corresponding to the +% \meta{alignment}, with the following arguments: +% \begin{itemize} +% \item the string formed by combining the sign |#4| with the result +% of converting the absolute value of the \meta{integer} |#7| +% according to the conversion function |#1|; +% \item the \meta{width}; +% \item the \meta{fill} character. +% \end{itemize} +% \begin{macrocode} +\cs_new:Npn \@@_format_int:NwnnNNn #1#2 \s__stop #3#4#5#6#7 + { + \exp_args:Nc \exp_args:Nf + { @@_format_align_#6:nnnN } + { #1 { \int_abs:n {#7} } } + {#4} + {#3} #5 + } +% \end{macrocode} +% ^^A todo: note similarity with \@@_format_tl_s:NNnnNNn +% \end{macro} +% +% \subsection{Formatting floating points} +% +% \begin{macro}[EXP]{\fp_format:nn} +% Evalute the first argument to an internal floating point number, and +% feed it to \cs{@@_format_fp:nn}. +% \begin{macrocode} +\cs_new:Npn \fp_format:nn #1 + { \exp_args:Nf \@@_format_fp:nn { \__fp_parse:n {#1} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp:nn} +% Parse the \meta{format specification} and feed it to +% \cs{@@_format_fp:NNNnnNn}. Then convert the result to a string +% \begin{macrocode} +\cs_new:Npn \@@_format_fp:nn #1#2 + { + \tl_to_str:f + { + \exp_last_unbraced:Nf \@@_format_fp:NNNnnNw + { \@@_format_parse:n {#2} } + #1 + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp:NNNnnNw} +% \begin{quote} +% \cs{@@_format_fp:NNNnnNw} \meta{fill} \meta{alignment} +% \meta{format sign} \Arg{width} \Arg{precision} \meta{style} +% \cs{s__fp} \cs{__fp_chk:w} \meta{fp type} \meta{fp sign} \meta{fp +% body} |;| +% \end{quote} +% First set the default alignment |?| to |>|. Place the modified +% information after a trailing \cs{s__stop} for later retrieval. Then +% check the \meta{format sign} and the \meta{fp sign}: if the floating +% point is negative, always put~|-|. Otherwise (including +% \texttt{nan}), if the format's \meta{sign} is |~|, put a space (with +% category \enquote{other}); if it is~|+| put |+|; if it is |-| +% (default), put nothing, represented as a brace group. The width +% |#4| will be useful later, store it after \cs{s__stop}. Afterwards, +% check the \meta{precision}: if it was not given, replace it by $6$ +% (default precision). Finally, dispatch depending on the +% \meta{style}. +% \begin{macrocode} +\cs_new:Npn \@@_format_fp:NNNnnNw + #1#2#3#4#5#6 \s__fp \__fp_chk:w #7 #8 + { + \token_if_eq_charcode:NNTF #2 ? + { \@@_format_put:nw { #1 > } } + { \@@_format_put:nw { #1 #2 } } + \token_if_eq_meaning:NNTF 2 #8 + { \@@_format_put:nw { - } } + { + \str_case:nnn {#3} + { + { ~ } { \@@_format_put:ow { \c_catcode_other_space_tl } } + { + } { \@@_format_put:nw { + } } + } + { \@@_format_put:nw { { } } } + } + \@@_format_put:nw { {#4} } + \tl_if_empty:nTF {#5} + { \@@_format_put:nw { { 6} } } + { \@@_format_put:nw { {#5} } } + \str_case:nnn {#6} + { + { e } { \@@_format_fp:wnnnNNw \@@_format_fp_e:wn } + { f } { \@@_format_fp:wnnnNNw \@@_format_fp_f:wn } + { g } { \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } + { ? } { \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } + } + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-style-format } {#6} { fp } + \@@_format_fp:wnnnNNw \@@_format_fp_g:wn + } + \s__stop + \s__fp \__fp_chk:w #7 #8 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp:wnnnNNw} +% \begin{quote} +% \cs{@@_format_fp:wnnnNNw} \meta{formatting function} \cs{s__stop} +% \Arg{precision} \Arg{width} \Arg{sign} \meta{fill} +% \meta{alignment} \cs{s__fp} \cs{__fp_chk:w} \meta{fp type} +% \meta{fp sign} \meta{fp body} |;| +% \end{quote} +% \begin{macrocode} +\cs_new:Npn \@@_format_fp:wnnnNNw + #1 \s__stop #2 #3 #4 #5#6 #7 ; + { + \exp_args:Nc \exp_args:Nf + { @@_format_align_#6:nnnN } + { #1 #7 ; {#2} } + {#4} + {#3} #5 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp_round:wn} +% Round the given floating point (not its absolute value, to play +% nicely with unusual rounding modes). +% \begin{macrocode} +\cs_new:Npn \@@_format_fp_round:wn #1 ; #2 + { \__fp_parse:n { round ( #1; , #2 - \__fp_exponent:w #1; ) } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp_e:wn} +% \begin{macro}[aux, EXP]{\@@_format_fp_e_ii:wn} +% With the |e| type, first filter out special cases. In the normal +% case, round to |#4+1| significant figures (one before the decimal +% separator, |#4| after). +% \begin{macrocode} +\group_begin: +\char_set_catcode_other:N E +\tl_to_lowercase:n + { + \group_end: + \cs_new:Npn \@@_format_fp_e:wn \s__fp \__fp_chk:w #1#2#3 ; #4 + { + \int_case:nnn {#1} + { + {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } e 0 } + {2} { inf } + {3} { nan } + } + { + \exp_last_unbraced:Nf \@@_format_fp_e_ii:wn + \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 } + {#4} + } + } + \cs_new:Npn \@@_format_fp_e_ii:wn + \s__fp \__fp_chk:w #1#2 #3 #4#5#6#7 ; #8 + { + \@@_format_put:fw { \int_eval:n { #3 - 1 } } + \@@_format_put:nw { e } + \int_compare:nNnTF {#8} > \c_sixteen + { + \@@_format_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \@@_format_put:fw { \use_none:n #4#5#6#7 } + } + { + \@@_format_put:fw + { \str_substr:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } } + } + \@@_format_put:fw { \use_i:nnnn #4 . } + \use_none:n \s__stop + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp_f:wn} +% \begin{macro}[aux, EXP]{\@@_format_fp_f_ii:wwn} +% With the |f| type, first filter out special cases. In the normal +% case, round to |#4| (absolute) decimal places. +% \begin{macrocode} +\cs_new:Npn \@@_format_fp_f:wn \s__fp \__fp_chk:w #1#2#3 ; #4 + { + \int_case:nnn {#1} + { + {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } } + {2} { inf } + {3} { nan } + } + { + \exp_last_unbraced:Nf \@@_format_fp_f_ii:wwwn + \fp_to_decimal:n + { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) } + . . ; + {#4} + } + } +\cs_new:Npn \@@_format_fp_f_ii:wwwn #1 . #2 . #3 ; #4 + { + \use:nf + { #1 . #2 } + { \prg_replicate:nn { #4 - \@@_count_unsafe:n {#2} } {0} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux, EXP]{\@@_format_fp_g:wn} +% \begin{macro}[aux, EXP]{\@@_format_fp_g_ii:wn} +% With the |g| type, first filter out special cases. In the normal +% case, round to |#4| significant figures, then test the exponent: if +% $-4\leq \meta{exponent} < \meta{precision}$, use the presentation +% type |f|, otherwise use the presentation type |e|. Also, a +% \meta{precision} of $0$ is treated like a precision of $1$. +% Actually, we don't reuse the |e| and |f| auxiliaries, because we +% want to trim trailing zeros. Thankfully, this is done by +% \cs{fp_to_decimal:n} and \cs{fp_to_scientific:n}, acting on the +% (absolute value of the) rounded value. +% \begin{macrocode} +\cs_new:Npn \@@_format_fp_g:wn \s__fp \__fp_chk:w #1#2 ; #3 + { + \int_case:nnn {#1} + { + {0} { 0 } + {2} { inf } + {3} { nan } + } + { + \exp_last_unbraced:Nf \@@_format_fp_g_ii:wn + \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2 ; + { \int_max:nn {1} {#3} } + { \int_max:nn {1} {#3} } + } + } +\cs_new:Npn \@@_format_fp_g_ii:wn #1; #2 + { + \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } + { \fp_to_scientific:n } + { + \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} + { \fp_to_scientific:n } + { \fp_to_decimal:n } + } + { \__fp_abs_o:w #1; \prg_do_nothing: } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Messages} +% +% All of the messages are produced expandably, so there is no need for +% an extra-text. +% \begin{macrocode} +\__msg_kernel_new:nnn { str } { invalid-format } + { Invalid~format~'#1'. } +\__msg_kernel_new:nnn { str } { invalid-align-format } + { Invalid~alignment~'#1'~for~type~'#2'. } +\__msg_kernel_new:nnn { str } { invalid-sign-format } + { Invalid~sign~'#1'~for~type~'#2'. } +\__msg_kernel_new:nnn { str } { invalid-precision-format } + { Invalid~precision~'#1'~for~type~'#2'. } +\__msg_kernel_new:nnn { str } { invalid-style-format } + { Invalid~style~'#1'~for~type~'#2'. } +% \end{macrocode} +% +% \subsection{Todos} +% +% \begin{itemize} +% \item Check what happens during floating point formatting when a +% number is rounded to $0$ or $\infty$. I think the |e| and |f| +% types break horribly. +% \end{itemize} +% +% \begin{macrocode} +%</initex|package> +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx index 51c42856c3c..7e8f00ef923 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3str.dtx 3940 2012-07-09 00:41:44Z bruno $ +\GetIdInfo$Id: l3str.dtx 4119 2012-08-16 22:35:59Z bruno $ {L3 Experimental strings} %</driver|package> %<*driver> @@ -1316,9 +1316,9 @@ % \begin{syntax} % \cs{@@_if_contains_char:nNTF} \Arg{token list} \meta{char} % \end{syntax} -% Converts the \meta{token list} to a \meta{string} and tests whether -% the \meta{char} is present in the \meta{string}. Spaces are -% ignored. +% Expects the \meta{token list} to be an \meta{other string}: the +% caller is responsible for ensuring that no (too-)special catcodes +% remain. Spaces with catcode $10$ are ignored. % Loop over the characters of the string, comparing character codes. % The loop is broken if character codes match. Otherwise we return % \enquote{false}. @@ -1326,14 +1326,13 @@ \prg_new_conditional:Npnn \@@_if_contains_char:NN #1#2 { T , TF } { \exp_after:wN \@@_if_contains_char_aux:NN \exp_after:wN #2 - \etex_detokenize:D \exp_after:wN {#1} { \__prg_break:n { ? \fi: } } + #1 { \__prg_break:n { ? \fi: } } \__prg_break_point: \prg_return_false: } \prg_new_conditional:Npnn \@@_if_contains_char:nN #1#2 { TF } { - \exp_after:wN \@@_if_contains_char_aux:NN \exp_after:wN #2 - \tl_to_str:n {#1} { \__prg_break:n { ? \fi: } } + \@@_if_contains_char_aux:NN #2 #1 { \__prg_break:n { ? \fi: } } \__prg_break_point: \prg_return_false: } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins index d8429f908fa..4605b50c851 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins @@ -38,6 +38,7 @@ Do not distribute a modified version of this file. \generate{\file{l3flag.sty} {\from{l3flag.dtx} {package}}} \generate{\file{l3str.sty} {\from{l3str.dtx} {package}}} \generate{\file{l3regex.sty} {\from{l3regex.dtx} {package}}} +\generate{\file{l3str-format.sty} {\from{l3str-format.dtx} {package}}} \generate{\file{l3tl-analysis.sty} {\from{l3tl-analysis.dtx} {package}}} \generate{\file{l3tl-build.sty} {\from{l3tl-build.dtx} {package}}} \generate{\file{l3regex-trace.sty} {\from{l3regex.dtx} {package,trace}}} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx index ef4d26bfe75..6cc38e6afd9 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx @@ -955,7 +955,7 @@ \cs_new_protected:Npn \tl_show_analysis:N #1 { \exp_args:No \@@:n {#1} - \__msg_show_variable:Nnn #1 + \__msg_show_variable:Nnx #1 { tl-analysis } { \exp_after:wN \@@_show_loop:wNw \g_@@_result_tl diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index 783ebbf0113..33d957e4b3f 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{xparse} -\GetIdInfo$Id: l3galley.dtx 4009 2012-07-20 18:18:29Z joseph $ +\GetIdInfo$Id: l3galley.dtx 4155 2012-08-29 10:29:58Z joseph $ {L3 Experimental galley code} %</driver|package> %<*driver> @@ -1752,7 +1752,7 @@ % \subsection{Inter-word spacing} % % Setting the spacing between words and between sentences is important -% for achieving the correct output from ragged and centred output. At +% for achieving the correct output from ragged and centered output. At % the same time, as far as possible the aim is to retain the spacing % specified by the font designer and not to use arbitrary values % (\emph{cf.}~the approach in \emph{The \TeX{}book}, p.~101). diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index 9ad68d87e0b..8a76d00cd01 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: xgalley.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: xgalley.dtx 4155 2012-08-29 10:29:58Z joseph $ {L3 Experimental galley} %</driver|package> %<*driver> @@ -435,18 +435,6 @@ % paragraph. % \end{TemplateDescription} % -% \begin{InstanceDescription}{justification}{centered}{std} -% \InstanceKey{end-skip}{0 pt} -% \InstanceKey{fixed-word-spacing}{true} -% \InstanceKey{indent-width}{0 pt} -% \InstanceKey{left-skip}{0 pt plus 1 em} -% \InstanceKey{right-skip}{0 pt plus 1 em} -% \InstanceSemantics -% Centres typeset material such that hyphenation will still occur and -% such that very short lines are discouraged. This is similar to the -% \LaTeXe{} \pkg{ragged2e} \env{Centering} environment. -% \end{InstanceDescription} -% % \begin{InstanceDescription}{justification}{ragged-left}{std} % \InstanceKey{end-skip}{0 pt} % \InstanceKey{fixed-word-spacing}{true} @@ -471,17 +459,15 @@ % similar to the \LaTeXe{} \pkg{ragged2e} \env{RaggedLeft} environment. % \end{InstanceDescription} % -% \begin{InstanceDescription}{justification}{centering}{std} +% \begin{InstanceDescription}{justification}{center}{std} % \InstanceKey{end-skip}{0 pt} % \InstanceKey{fixed-word-spacing}{true} % \InstanceKey{indent-width}{0 pt} % \InstanceKey{left-skip}{0 pt plus 1 fil} % \InstanceKey{right-skip}{0 pt plus 1 fil} % \InstanceSemantics -% Centres typeset material such that hyphenation is strongly discouraged -% and short lines are allowed. This template is suited to centring arbitrary -% material (such as boxes) rather than centring text. In the later case, the -% |centered| instance should be used. +% Centres typeset material such that hyphenation is discouraged and short +% lines are allowed. % \end{InstanceDescription} % % \begin{TemplateDescription}{justification}{compound} @@ -1149,21 +1135,13 @@ indent-width = 0 pt } % \end{macrocode} -% The other standard justification schemes are for text which is either -% centred or ragged. The settings here are taken from the \LaTeXe{} +% The other standard justification schemes are for text which ragged. +% The settings here are taken from the \LaTeXe{} % \pkg{ragged2e} package, as they maintain a reasonable appearance by % ensuring that \TeX{} will not be too tolerant of very short lines. % To keep the design clear here, no default values are relied on even % though this would make the instance declarations shorter. % \begin{macrocode} -\DeclareInstance { justification } { centered } { std } - { - end-skip = 0 pt , - fixed-word-spacing = true , - indent-width = 0 pt , - left-skip = 0 pt plus 1 em , - right-skip = 0 pt plus 1 em - } \DeclareInstance { justification } { ragged-left } { std } { end-skip = 0 pt , @@ -1181,11 +1159,10 @@ right-skip = 0 pt plus 2 em } % \end{macrocode} -% The \texttt{centering} instance is used to centre material without -% hyphenation: this is used for centring arbitrary material rather -% than text. +% The \texttt{centering} instance is used to center material with minimal +% hyphenation % \begin{macrocode} -\DeclareInstance { justification } { centering } { std } +\DeclareInstance { justification } { center } { std } { end-skip = 0 pt , fixed-word-spacing = true , diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty b/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty index 804c0c2b294..408f52b8bdd 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3dt/l3dt.sty @@ -47,7 +47,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{expl3} -\GetIdInfo$Id: l3dt.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3dt.dtx 4153 2012-08-29 07:18:26Z joseph $ {L3 Experimental data tables} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -57,14 +57,15 @@ \tl_const:Nn \c_empty_dt { { 0 } + { 0 } \q__dt \q_nil \q__dt_header \q__dt_row } -\cs_new_protected:Npn \dt_new:N #1 { \cs_new_eq:NN #1 \c_empty_dt } -\cs_new_protected:Npn \dt_clear:N #1 { \cs_set_eq:NN #1 \c_empty_dt } -\cs_new_protected:Npn \dt_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_dt } +\cs_new_protected:Npn \dt_new:N #1 { \cs_new_eq:NN #1 \c_empty_dt } +\cs_new_protected:Npn \dt_clear:N #1 { \cs_set_eq:NN #1 \c_empty_dt } +\cs_new_protected:Npn \dt_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_dt } \cs_new_protected:Npn \dt_clear_new:N #1 { \cs_if_exist:NTF #1 { \dt_clear:N #1 } { \dt_new:N #1 } } \cs_new_protected:Npn \dt_gclear_new:N #1 @@ -96,10 +97,10 @@ \cs_new_protected:Npn \__dt_split_key_list_aux:NnTF #1#2 { \cs_set_protected:Npn \__dt_split:w - ##1##2 \q__dt #2 \q__dt ##3##4 \q__dt_header ##5 \q_mark ##6 \q_stop + ##1##2##3 \q__dt #2 \q__dt ##4##5 \q__dt_header ##6 \q_mark ##7 \q_stop { - \__dt_split:nnnn ##3 - { { {##1} ##2 \q__dt } { ##3##4 \q__dt_header ##5 } } + \__dt_split:nnnn ##4 + { { {##1} {##2} ##3 \q__dt } { ##4##5 \q__dt_header ##6 } } } \exp_after:wN \__dt_split:w #1 \q_mark \q__dt #2 \q__dt { ? \use_ii:nn { } } \q__dt_header \q_mark \q_stop @@ -130,33 +131,38 @@ } } \cs_new_protected:Npn \__dt_add_key:NNnnn #1#2#3#4#5 + { \__dt_add_key:NNnnnwnn #1 #2 #4 \q_stop {#3} {#5} } +\cs_new_protected:Npn \__dt_add_key:NNnnnwnn #1#2#3#4#5 \q_stop #6#7 { #1 #2 { - \exp_not:n {#4} - \tl_to_str:n {#3} - \exp_not:n { \q__dt \q_nil #5 } + {#3} + { \int_eval:n { #4 + \c_one } } + \exp_not:n {#5} + \tl_to_str:n {#6} + \exp_not:n { \q__dt \q_nil #7 } } } \cs_new_protected_nopar:Npn \dt_add_row:N { \__dt_add_row:NN \tl_set:Nx } \cs_new_protected_nopar:Npn \dt_gadd_row:N { \__dt_add_row:NN \tl_gset:Nx } \cs_new_protected:Npn \__dt_add_row:NN #1#2 - { \exp_args:NNf \__dt_add_row:NnN #1 { \dt_rows:N #2 } #2 } + { \__dt_add_row:NfN #1 { \int_eval:n { \dt_rows:N #2 + \c_one } } #2 } \cs_new_protected:Npn \__dt_add_row:NnN #1#2#3 { #1 #3 { - { \int_eval:n { #2 + \c_one } } + {#2} \exp_after:wN \__dt_add_row:nw #3 \q_stop #2 \exp_not:n { \q__dt \q_nil \q__dt_row } } } +\cs_generate_variant:Nn \__dt_add_row:NnN { Nf } \cs_new:Npn \__dt_add_row:nw #1#2 \q_stop { \exp_not:n {#2} } \cs_new_protected:Npn \dt_put:Nnn #1 - { \dt_put:Nnnn #1 { \dt_rows:N #1 - \c_one } } + { \dt_put:Nnnn #1 { \dt_rows:N #1 } } \cs_new_protected:Npn \dt_gput:Nnn #1 - { \dt_gput:Nnnn #1 { \dt_rows:N #1 - \c_one } } + { \dt_gput:Nnnn #1 { \dt_rows:N #1 } } \cs_new_protected_nopar:Npn \dt_put:Nnnn { \__dt_put:NNNnnn \dt_add_key:Nn \tl_set:Nx } \cs_new_protected_nopar:Npn \dt_gput:Nnnn @@ -197,29 +203,14 @@ } } \cs_new:Npn \__dt_put_add_to_row_aux:w #1 \q_nil {#1} -\cs_new:Npn \dt_keys:N #1 - { \__dt_split_header:NT #1 { \__dt_keys:nn } } -\cs_new:Npn \__dt_keys:nn #1#2 - { - \int_eval:n - { - 0 - \exp_after:wN \__dt_keys:wN \use_none:nn #1 \q_recursion_tail \q__dt - \__prg_break_point:Nn \dt_map_break: { } - } - } -\cs_new:Npn \__dt_keys:wN #1 \q__dt - { - \__quark_if_recursion_tail_break:nN {#1} \dt_map_break: - +1 - \__dt_keys:wN - } +\cs_new:Npn \dt_keys:N #1 { \exp_after:wN \__dt_keys:nnw #1 \q_stop } +\cs_new:Npn \__dt_keys:nnw #1#2#3 \q_stop {#2} \cs_new:Npn \dt_rows:N #1 { \exp_after:wN \use_i_delimit_by_q_stop:nw #1 \q_stop } -\cs_new_protected:Npn \dt_remove:Nn #1 { \dt_remove:Nnn #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_gremove:Nn #1 { \dt_gremove:Nnn #1 - { \dt_rows:N #1 - \c_one } } +\cs_new_protected:Npn \dt_remove:Nn #1 + { \dt_remove:Nnn #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_gremove:Nn #1 + { \dt_gremove:Nnn #1 { \dt_rows:N #1 } } \cs_new_protected_nopar:Npn \dt_remove:Nnn { \dt_remove_aux:NNnn \tl_set:Nn } \cs_new_protected_nopar:Npn \dt_gremove:Nnn { \dt_remove_aux:NNnn \tl_gset:Nn } \cs_new_protected:Npn \dt_remove_aux:NNnn #1#2#3#4 @@ -247,6 +238,8 @@ { } } \cs_new_protected:Npn \dt_remove_key_aux:nNNnn #1#2#3#4#5 + { \dt_remove_key_aux:nNNnnwn {#1} #2 #3 #4 \q_stop {#5} } +\cs_new_protected:Npn \dt_remove_key_aux:nNNnnwn #1#2#3#4#5#6 \q_stop #7 { \cs_set:Npn \dt_remove_key_aux:w ##1 \q__dt #1 \q__dt ##2 ##3 { @@ -254,10 +247,13 @@ \__quark_if_recursion_tail_break:nN {##3} \dt_map_break: \dt_remove_key_aux:w ##3 } + #2 #3 { - \exp_not:n {#4} - \dt_remove_key_aux:w #5 \q__dt #1 \q__dt { } \q_recursion_tail + {#4} + { \int_eval:n { #5 - \c_one } } + \exp_not:n {#6} + \dt_remove_key_aux:w #7 \q__dt #1 \q__dt { } \q_recursion_tail \__prg_break_point:Nn \dt_map_break: { } } } @@ -320,14 +316,14 @@ \tl_set:Nn #1 {#3} \prg_return_true: } -\cs_new_protected:Npn \dt_get:NnN #1 { \dt_get:NnnN #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_get:NnNT #1 { \dt_get:NnnNF #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_get:NnNF #1 { \dt_get:NnnNF #1 - { \dt_rows:N #1 - \c_one } } -\cs_new_protected:Npn \dt_get:NnNTF #1 { \dt_get:NnnNTF #1 - { \dt_rows:N #1 - \c_one } } +\cs_new_protected:Npn \dt_get:NnN #1 + { \dt_get:NnnN #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_get:NnNT #1 + { \dt_get:NnnNF #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_get:NnNF #1 + { \dt_get:NnnNF #1 { \dt_rows:N #1 } } +\cs_new_protected:Npn \dt_get:NnNTF #1 + { \dt_get:NnnNTF #1 { \dt_rows:N #1 } } \int_new:N \g_dt_map_level_int \cs_new_protected:Npn \dt_map_variables:Nnn #1#2#3 { @@ -434,14 +430,14 @@ \fi: \__prg_break: } -\cs_new:Npn \dt_if_in_row_p:Nn #1 { \dt_if_in_row_p:Nnn #1 - { \dt_rows:N #1 - \c_one } } -\cs_new:Npn \dt_if_in_row:NnT #1 { \dt_if_in_row:NnnT #1 - { \dt_rows:N #1 - \c_one } } -\cs_new:Npn \dt_if_in_row:NnF #1 { \dt_if_in_row:NnnF #1 - { \dt_rows:N #1 - \c_one } } -\cs_new:Npn \dt_if_in_row:NnTF #1 { \dt_if_in_row:NnnTF #1 - { \dt_rows:N #1 - \c_one } } +\cs_new:Npn \dt_if_in_row_p:Nn #1 + { \dt_if_in_row_p:Nnn #1 { \dt_rows:N #1 } } +\cs_new:Npn \dt_if_in_row:NnT #1 + { \dt_if_in_row:NnnT #1 { \dt_rows:N #1 } } +\cs_new:Npn \dt_if_in_row:NnF #1 + { \dt_if_in_row:NnnF #1 { \dt_rows:N #1 } } +\cs_new:Npn \dt_if_in_row:NnTF #1 + { \dt_if_in_row:NnnTF #1 { \dt_rows:N #1 } } \__msg_kernel_new:nnnn { dt } { unknown-row } { Data~table~#1~does~not~contain~a~row~'#2'. } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty new file mode 100644 index 00000000000..902d147cd3f --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -0,0 +1,453 @@ +%% +%% This is file `l3str-format.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3str-format.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3str-format.dtx Copyright (C) 2012 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3experimental bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\RequirePackage{expl3} +\GetIdInfo$Id: l3str-format.dtx 3940 2012-07-09 00:41:44Z bruno $ + {L3 Experimental string formatting} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\RequirePackage{l3str} +\cs_generate_variant:Nn \use:nn { nf } +\cs_generate_variant:Nn \use:nnn { fnf } +\cs_generate_variant:Nn \tl_to_str:n { f } +\prg_new_conditional:Npnn \__str_format_if_digit:N #1 { TF } + { + \if_int_compare:w \c_nine < 1 #1 \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new:Npn \__str_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 } +\cs_generate_variant:Nn \__str_format_put:nw { o , f } +\cs_new:Npn \__str_format_parse:n #1 + { + \exp_last_unbraced:Nf \__str_format_parse_i:NN + \__str_to_other:n {#1} \s__stop \s__stop {#1} + } +\cs_new:Npx \__str_format_parse_i:NN #1#2 + { + \exp_not:N \__str_if_contains_char:nNTF { < > = ^ } #2 + { \exp_not:N \__str_format_parse_iii:nN { #1 #2 } } + { + \exp_not:N \__str_format_parse_ii:nN + { \c_catcode_other_space_tl } #1 #2 + } + } +\cs_new:Npn \__str_format_parse_ii:nN #1#2 + { + \__str_if_contains_char:nNTF { < > = ^ } #2 + { \__str_format_parse_iii:nN { #1 #2 } } + { \__str_format_parse_iii:nN { #1 ? } #2 } + } +\cs_new:Npx \__str_format_parse_iii:nN #1#2 + { + \exp_not:N \__str_if_contains_char:nNTF + { + - \c_catcode_other_space_tl } + #2 + { \exp_not:N \__str_format_parse_iv:nwN { #1 #2 } ; } + { \exp_not:N \__str_format_parse_iv:nwN { #1 ? } ; #2 } + } +\cs_new:Npn \__str_format_parse_iv:nwN #1#2; #3 + { + \__str_format_if_digit:NTF #3 + { \__str_format_parse_iv:nwN {#1} #2 #3 ; } + { \__str_format_parse_v:nN { #1 {#2} } #3 } + } +\cs_new:Npn \__str_format_parse_v:nN #1#2 + { + \token_if_eq_charcode:NNTF . #2 + { \__str_format_parse_vi:nwN {#1} 0 ; } + { \__str_format_parse_vii:nN { #1 { } } #2 } + } +\cs_new:Npn \__str_format_parse_vi:nwN #1#2; #3 + { + \__str_format_if_digit:NTF #3 + { \__str_format_parse_vi:nwN {#1} #2 #3 ; } + { \__str_format_parse_vii:nN { #1 {#2} } #3 } + } +\cs_new:Npn \__str_format_parse_vii:nN #1#2 + { + \token_if_eq_meaning:NNTF \s__stop #2 + { \__str_format_parse_end:nwn { #1 ? } #2 } + { \__str_format_parse_end:nwn { #1 #2 } } + } +\cs_new:Npn \__str_format_parse_end:nwn #1 #2 \s__stop \s__stop #3 + { + \tl_if_empty:nF {#2} + { \__msg_kernel_expandable_error:nnn { str } { invalid-format } {#3} } + #1 + } +\cs_new:cpn { __str_format_align_<:nnnN } #1#2#3#4 + { + \use:nf { #2 #1 } + { + \prg_replicate:nn + { \int_max:nn { #3 - \__str_count_unsafe:n { #2 #1 } } { 0 } } + {#4} + } + } +\cs_new:cpn { __str_format_align_>:nnnN } #1#2#3#4 + { + \prg_replicate:nn + { \int_max:nn { #3 - \__str_count_unsafe:n { #2 #1 } } { 0 } } + {#4} + #2 #1 + } +\cs_new:cpn { __str_format_align_^:nnnN } #1#2#3#4 + { + \use:fnf + { + \prg_replicate:nn + { + \int_max:nn \c_zero + { #3 - \__str_count_unsafe:n { #2 #1 } - \c_one } + / \c_two + } + {#4} + } + { #2 #1 } + { + \prg_replicate:nn + { + \int_max:nn \c_zero + { #3 - \__str_count_unsafe:n { #2 #1 } } + / \c_two + } + {#4} + } + } +\cs_new:cpn { __str_format_align_=:nnnN } #1#2#3#4 + { + \use:nf {#2} + { + \prg_replicate:nn + { \int_max:nn { #3 - \__str_count_unsafe:n { #2 #1 } } { 0 } } + {#4} + } + #1 + } +\cs_new_nopar:Npn \tl_format:Nn { \exp_args:No \tl_format:nn } +\cs_generate_variant:Nn \tl_format:Nn { c } +\cs_new:Npn \tl_format:nn #1#2 + { + \tl_to_str:f + { + \exp_last_unbraced:Nf \__str_format_tl:NNNnnNn + { \__str_format_parse:n {#2} } + {#1} + } + } +\cs_new:Npn \__str_format_tl:NNNnnNn #1#2#3#4#5#6 + { + \token_if_eq_charcode:NNTF #2 = + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-align-format } {#2} {tl} + \__str_format_put:nw { #1 < } + } + { + \token_if_eq_charcode:NNTF #2 ? + { \__str_format_put:nw { #1 < } } + { \__str_format_put:nw { #1 #2 } } + } + \token_if_eq_charcode:NNF #3 ? + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-sign-format } {#3} {tl} + } + \__str_format_put:nw { {#4} } + \tl_if_empty:nTF {#5} + { \__str_format_put:nw { \use:n { } } } + { \__str_format_put:nw { \__str_substr_unsafe:nnn { {1} {#5} } } } + \token_if_eq_charcode:NNF #6 s + { + \token_if_eq_charcode:NNF #6 ? + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-style-format } {#6} {tl} + } + } + \__str_format_tl_s:NNnnNNn + \s__stop + } +\cs_new:Npn \__str_format_tl_s:NNnnNNn #1#2#3#4#5#6#7 + { + \exp_args:Nc \exp_args:Nf + { __str_format_align_#6:nnnN } + { \exp_args:Nf #2 { \__str_to_other:n {#7} } #3 } + { } + {#4} #5 + } +\cs_new:Npn \seq_format:Nn #1#2 + { + \tl_to_str:f + { \__str_format_seq:of {#1} { \__str_format_parse:n {#2} } } + } +\cs_generate_variant:Nn \seq_format:Nn { c } +\cs_new:Npn \__str_format_seq:nn #1#2 + { + \__str_format_seq_loop:nnNn { } {#2} + #1 + { ? \__str_format_seq_end:w } { } + } +\cs_generate_variant:Nn \__str_format_seq:nn { of } +\cs_new:Npn \__str_format_seq_loop:nnNn #1#2#3#4 + { + \use_none:n #3 + \exp_args:Nf \__str_format_seq_loop:nnNn + { \use:nf {#1} { \__str_format_tl:NNNnnNn #2 {#4} } } + {#2} + } +\cs_new:Npn \__str_format_seq_end:w #1#2#3#4 { \use_ii:nnn #3 } +\cs_new:Npn \int_format:nn #1 + { \exp_args:Nf \__str_format_int:nn { \int_eval:n {#1} } } +\cs_new:Npn \__str_format_int:nn #1#2 + { + \tl_to_str:f + { + \exp_last_unbraced:Nf \__str_format_int:NNNnnNn + { \__str_format_parse:n {#2} } + {#1} + } + } +\cs_new:Npn \__str_format_int:NNNnnNn #1#2#3#4#5#6#7 + { + \token_if_eq_charcode:NNTF #2 ? + { \__str_format_put:nw { #1 > } } + { \__str_format_put:nw { #1 #2 } } + \int_compare:nNnTF {#7} < \c_zero + { \__str_format_put:nw { - } } + { + \str_case:nnn {#3} + { + { ~ } { \__str_format_put:ow { \c_catcode_other_space_tl } } + { + } { \__str_format_put:nw { + } } + } + { \__str_format_put:nw { { } } } + } + \__str_format_put:nw { {#4} } + \tl_if_empty:nF {#5} + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-precision-format } {#5} {int} + } + \str_case:nnn {#6} + { + { ? } { \__str_format_int:NwnnNNn \use:n } + { d } { \__str_format_int:NwnnNNn \use:n } + { b } { \__str_format_int:NwnnNNn \int_to_binary:n } + { o } { \__str_format_int:NwnnNNn \int_to_octal:n } + { X } { \__str_format_int:NwnnNNn \int_to_hexadecimal:n } + } + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-style-format } {#6} { int } + \__str_format_int:NwnnNNn \use:n + } + \s__stop {#7} + } +\cs_new:Npn \__str_format_int:NwnnNNn #1#2 \s__stop #3#4#5#6#7 + { + \exp_args:Nc \exp_args:Nf + { __str_format_align_#6:nnnN } + { #1 { \int_abs:n {#7} } } + {#4} + {#3} #5 + } +\cs_new:Npn \fp_format:nn #1 + { \exp_args:Nf \__str_format_fp:nn { \__fp_parse:n {#1} } } +\cs_new:Npn \__str_format_fp:nn #1#2 + { + \tl_to_str:f + { + \exp_last_unbraced:Nf \__str_format_fp:NNNnnNw + { \__str_format_parse:n {#2} } + #1 + } + } +\cs_new:Npn \__str_format_fp:NNNnnNw + #1#2#3#4#5#6 \s__fp \__fp_chk:w #7 #8 + { + \token_if_eq_charcode:NNTF #2 ? + { \__str_format_put:nw { #1 > } } + { \__str_format_put:nw { #1 #2 } } + \token_if_eq_meaning:NNTF 2 #8 + { \__str_format_put:nw { - } } + { + \str_case:nnn {#3} + { + { ~ } { \__str_format_put:ow { \c_catcode_other_space_tl } } + { + } { \__str_format_put:nw { + } } + } + { \__str_format_put:nw { { } } } + } + \__str_format_put:nw { {#4} } + \tl_if_empty:nTF {#5} + { \__str_format_put:nw { { 6} } } + { \__str_format_put:nw { {#5} } } + \str_case:nnn {#6} + { + { e } { \__str_format_fp:wnnnNNw \__str_format_fp_e:wn } + { f } { \__str_format_fp:wnnnNNw \__str_format_fp_f:wn } + { g } { \__str_format_fp:wnnnNNw \__str_format_fp_g:wn } + { ? } { \__str_format_fp:wnnnNNw \__str_format_fp_g:wn } + } + { + \__msg_kernel_expandable_error:nnnn + { str } { invalid-style-format } {#6} { fp } + \__str_format_fp:wnnnNNw \__str_format_fp_g:wn + } + \s__stop + \s__fp \__fp_chk:w #7 #8 + } +\cs_new:Npn \__str_format_fp:wnnnNNw + #1 \s__stop #2 #3 #4 #5#6 #7 ; + { + \exp_args:Nc \exp_args:Nf + { __str_format_align_#6:nnnN } + { #1 #7 ; {#2} } + {#4} + {#3} #5 + } +\cs_new:Npn \__str_format_fp_round:wn #1 ; #2 + { \__fp_parse:n { round ( #1; , #2 - \__fp_exponent:w #1; ) } } +\group_begin: +\char_set_catcode_other:N E +\tl_to_lowercase:n + { + \group_end: + \cs_new:Npn \__str_format_fp_e:wn \s__fp \__fp_chk:w #1#2#3 ; #4 + { + \int_case:nnn {#1} + { + {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } e 0 } + {2} { inf } + {3} { nan } + } + { + \exp_last_unbraced:Nf \__str_format_fp_e_ii:wn + \__str_format_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 } + {#4} + } + } + \cs_new:Npn \__str_format_fp_e_ii:wn + \s__fp \__fp_chk:w #1#2 #3 #4#5#6#7 ; #8 + { + \__str_format_put:fw { \int_eval:n { #3 - 1 } } + \__str_format_put:nw { e } + \int_compare:nNnTF {#8} > \c_sixteen + { + \__str_format_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \__str_format_put:fw { \use_none:n #4#5#6#7 } + } + { + \__str_format_put:fw + { \str_substr:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } } + } + \__str_format_put:fw { \use_i:nnnn #4 . } + \use_none:n \s__stop + } + } +\cs_new:Npn \__str_format_fp_f:wn \s__fp \__fp_chk:w #1#2#3 ; #4 + { + \int_case:nnn {#1} + { + {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } } + {2} { inf } + {3} { nan } + } + { + \exp_last_unbraced:Nf \__str_format_fp_f_ii:wwwn + \fp_to_decimal:n + { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) } + . . ; + {#4} + } + } +\cs_new:Npn \__str_format_fp_f_ii:wwwn #1 . #2 . #3 ; #4 + { + \use:nf + { #1 . #2 } + { \prg_replicate:nn { #4 - \__str_count_unsafe:n {#2} } {0} } + } +\cs_new:Npn \__str_format_fp_g:wn \s__fp \__fp_chk:w #1#2 ; #3 + { + \int_case:nnn {#1} + { + {0} { 0 } + {2} { inf } + {3} { nan } + } + { + \exp_last_unbraced:Nf \__str_format_fp_g_ii:wn + \__str_format_fp_round:wn \s__fp \__fp_chk:w #1#2 ; + { \int_max:nn {1} {#3} } + { \int_max:nn {1} {#3} } + } + } +\cs_new:Npn \__str_format_fp_g_ii:wn #1; #2 + { + \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } + { \fp_to_scientific:n } + { + \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} + { \fp_to_scientific:n } + { \fp_to_decimal:n } + } + { \__fp_abs_o:w #1; \prg_do_nothing: } + } +\__msg_kernel_new:nnn { str } { invalid-format } + { Invalid~format~'#1'. } +\__msg_kernel_new:nnn { str } { invalid-align-format } + { Invalid~alignment~'#1'~for~type~'#2'. } +\__msg_kernel_new:nnn { str } { invalid-sign-format } + { Invalid~sign~'#1'~for~type~'#2'. } +\__msg_kernel_new:nnn { str } { invalid-precision-format } + { Invalid~precision~'#1'~for~type~'#2'. } +\__msg_kernel_new:nnn { str } { invalid-style-format } + { Invalid~style~'#1'~for~type~'#2'. } +%% +%% +%% End of file `l3str-format.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty index 3ad97283e3b..05cd375a84d 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{expl3} -\GetIdInfo$Id: l3str.dtx 3940 2012-07-09 00:41:44Z bruno $ +\GetIdInfo$Id: l3str.dtx 4119 2012-08-16 22:35:59Z bruno $ {L3 Experimental strings} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -391,14 +391,13 @@ \prg_new_conditional:Npnn \__str_if_contains_char:NN #1#2 { T , TF } { \exp_after:wN \__str_if_contains_char_aux:NN \exp_after:wN #2 - \etex_detokenize:D \exp_after:wN {#1} { \__prg_break:n { ? \fi: } } + #1 { \__prg_break:n { ? \fi: } } \__prg_break_point: \prg_return_false: } \prg_new_conditional:Npnn \__str_if_contains_char:nN #1#2 { TF } { - \exp_after:wN \__str_if_contains_char_aux:NN \exp_after:wN #2 - \tl_to_str:n {#1} { \__prg_break:n { ? \fi: } } + \__str_if_contains_char_aux:NN #2 #1 { \__prg_break:n { ? \fi: } } \__prg_break_point: \prg_return_false: } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty index 8b90db9c751..0dfd6401fae 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty @@ -361,7 +361,7 @@ \cs_new_protected:Npn \tl_show_analysis:N #1 { \exp_args:No \__tl_analysis:n {#1} - \__msg_show_variable:Nnn #1 + \__msg_show_variable:Nnx #1 { tl-analysis } { \exp_after:wN \__tl_analysis_show_loop:wNw \g__tl_analysis_result_tl diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index ded7ca681b1..30c72196f57 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -48,7 +48,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{xparse} -\GetIdInfo$Id: l3galley.dtx 4009 2012-07-20 18:18:29Z joseph $ +\GetIdInfo$Id: l3galley.dtx 4155 2012-08-29 10:29:58Z joseph $ {L3 Experimental galley code} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty index fa9a8ef1730..5e6a07f9f50 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty @@ -48,7 +48,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3bootstrap} -\GetIdInfo$Id: xgalley.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: xgalley.dtx 4155 2012-08-29 10:29:58Z joseph $ {L3 Experimental galley} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -298,14 +298,6 @@ end-skip = 15 pt plus 1 fil , indent-width = 0 pt } -\DeclareInstance { justification } { centered } { std } - { - end-skip = 0 pt , - fixed-word-spacing = true , - indent-width = 0 pt , - left-skip = 0 pt plus 1 em , - right-skip = 0 pt plus 1 em - } \DeclareInstance { justification } { ragged-left } { std } { end-skip = 0 pt , @@ -322,7 +314,7 @@ left-skip = 0 pt , right-skip = 0 pt plus 2 em } -\DeclareInstance { justification } { centering } { std } +\DeclareInstance { justification } { center } { std } { end-skip = 0 pt , fixed-word-spacing = true , |