From fb5bbe984a59469521f34f7827228c64fe90dbb2 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 17 Oct 2023 07:20:24 +0800 Subject: [PATCH 1/5] docs(booktabs): list and mention missing table commands --- manual/manual-5.tex | 14 +++++++++---- tabularray.tex | 50 +++++++++++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/manual/manual-5.tex b/manual/manual-5.tex index 846d9e7..989394e 100644 --- a/manual/manual-5.tex +++ b/manual/manual-5.tex @@ -60,8 +60,11 @@ \section{Library \texttt{booktabs}} With \verb!\UseTblrLibrary{booktabs}! in the preamble of the document, \verb!tabularray! will load \verb!booktabs! package, -and define \verb!\toprule!, \verb!\midrule!, -\verb!\bottomrule! and \verb!\cmidrule! inside \verb!tblr! environment. +and define + \verb!\toprule!, \verb!\midrule!, \verb!\bottomrule!, + \verb!\cmidrule!, \verb!\cmidrulemore!, \verb!\morecmidrules!, + \verb!\specialrule!, \verb!\addrowspace!, and \verb!\addlinespace! +as table commands. \begin{demohigh} \begin{tblr}{llll} @@ -92,7 +95,9 @@ \section{Library \texttt{booktabs}} \end{tblr} \end{demohigh} -If you need more than one \verb!\cmidrule!s, you can use \verb!\cmidrulemore! command. +If you need more than one \verb!\cmidrule!s, you can use \verb!\cmidrulemore! +command, which is simpler than the \verb!booktabs! usage +\verb!\morecmidrules\cmidrule!. \begin{demohigh} \begin{tblr}{llll} @@ -166,7 +171,8 @@ \section{Library \texttt{booktabs}} \end{booktabs} \end{demohigh} -At last, there is also an \verb!\addlinespace! command. +At last, there is also an \verb!\addlinespace! command, with an alternative +name \verb!\addrowspace!. You can specify the size of vertical space to be added in its optional argument, and the default size is \verb!0.5em!. This command adds one half of the space to \verb!belowsep! of previous row, diff --git a/tabularray.tex b/tabularray.tex index 3a14043..df3e417 100644 --- a/tabularray.tex +++ b/tabularray.tex @@ -607,7 +607,7 @@ \section{Old and New Interfaces} \verb!\SetColumn! & \K{column}, \K{colspec} \\ \end{newtblr} -\section{Hlines and Vlines} +\section{Hlines and Vlines}\label{sec:hlines-vlines} All available keys for hlines and vlines are described in Table \ref{key:hline} and Table \ref{key:vline}. @@ -623,6 +623,9 @@ \section{Hlines and Vlines} \underline{\K{fg}} & rule color name & \None \\ \K{leftpos} & crossing or trimming position at the left side & \V{1} \\ \K{rightpos} & crossing or trimming position at the right side & \V{1} \\ + \K{l} & same as \K{leftpos}, default \V{-0.8} & \V{1} \\ + \K{r} & same as \K{rightpos}, default \V{-0.8} & \V{1} \\ + \K{lr} & crossing or trimming positions at both sides, default \V{-0.8} & \V{1} \\ \K{endpos} & adjust leftpos/rightpos for only the leftmost/rightmost column & \V{false} \\ \end{spectblr} \vspace{-2em} @@ -2471,8 +2474,11 @@ \section{Library \texttt{booktabs}} With \verb!\UseTblrLibrary{booktabs}! in the preamble of the document, \verb!tabularray! will load \verb!booktabs! package, -and define \verb!\toprule!, \verb!\midrule!, -\verb!\bottomrule! and \verb!\cmidrule! inside \verb!tblr! environment. +and define + \verb!\toprule!, \verb!\midrule!, \verb!\bottomrule!, + \verb!\cmidrule!, \verb!\cmidrulemore!, \verb!\morecmidrules!, + \verb!\specialrule!, \verb!\addrowspace!, and \verb!\addlinespace! +as table commands. \begin{demohigh} \begin{tblr}{llll} @@ -2489,7 +2495,14 @@ \section{Library \texttt{booktabs}} \end{demohigh} Just like \verb!\hline! and \verb!\cline! commands, -you can also specify rule width and color in the optional argument of any of these commands. +you can also specify rule width and color by using hline keys in the optional +argument of any of these commands. + +Like in \verb!booktabs!, by default + width of \verb!\toprule! and \verb!\bottomrule! are determined by \verb!\heavyrulewidth!, + width of \verb!\midrule! is determined by \verb!\lightrulewidth!, and + width of \verb!\cmidrule! and \verb!\cmidrulemore! are determined by \verb!\cmidrulewidth!, respectively. +All three \verb!\...rulewidth! are dimensions. \begin{demohigh} \begin{tblr}{llll} @@ -2503,7 +2516,10 @@ \section{Library \texttt{booktabs}} \end{tblr} \end{demohigh} -If you need more than one \verb!\cmidrule!s, you can use \verb!\cmidrulemore! command. +If you need more than one \verb!\cmidrule!s, you can use \verb!\cmidrulemore! +command, which is simpler than the \verb!booktabs! usage +\verb!\morecmidrules\cmidrule!. +\verb!\cmidrulemore! can receive hline keys in an optional argument too. \begin{demohigh} \begin{tblr}{llll} @@ -2517,8 +2533,11 @@ \section{Library \texttt{booktabs}} \end{tblr} \end{demohigh} -From version 2021N (2021-09-01), trim options (\verb!l!, \verb!r!, \verb!lr!) -for \verb!\cmidrule! command are also supported. +From version 2021N (2021-09-01), you can set trimming positions of +\verb!\cmidrule! and \verb!\cmidrulemore!, using newly introduced trimming +options (\verb!leftpos!, \verb!rightpos!, \verb!endpos!, \verb!l!, \verb!r!, +and \verb!lr!) (see Section~\ref{sec:hlines-vlines}). +Option \verb!endpos! is already applied to these two commands. \begin{demohigh} \begin{tblr}{llll} @@ -2532,11 +2551,10 @@ \section{Library \texttt{booktabs}} \end{tblr} \end{demohigh} -Note that you need to put \verb!l!, \verb!r! or \verb!lr! option into -the \underline{\color{red3}square brackets}. -and the possible values are decimal numbers between \verb!-1! and \verb!0!, -where \verb!-1! means trimming the whole colsep, and \verb!0! means no trimming. -The default value is \verb!-0.8!, which makes similar result as \verb!booktabs! package does. +Since \verb!booktabs! tables usually don't have vlines, the meaningful values +here are decimal numbers between \verb!-1! and \verb!0!. +The default value \verb!-0.8! for \verb!l!, \verb!r!, and \verb!lr! is chosen to +make similar result as \verb!booktabs! package does. There is also a \verb!booktabs! environment for you. With this environment, the default \verb!rowsep=0pt!, but extra vertical space will be added by @@ -2577,9 +2595,11 @@ \section{Library \texttt{booktabs}} \end{booktabs} \end{demohigh} -At last, there is also an \verb!\addlinespace! command. -You can specify the size of vertical space to be added in its optional argument, -and the default size is \verb!0.5em!. +At last, there is also an \verb!\addlinespace! command, with an alternative +name \verb!\addrowspace!. +You can specify the size of vertical space to be added in its optional +argument, and the default size is determinted by \verb!\defaultaddspace! +dimension, initially \verb!0.5em!. This command adds one half of the space to \verb!belowsep! of previous row, and the other half to \verb!abovesep! of current row. From fabc76c16a7ab6bbac2f6a2f6d0c299d933b7cdb Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 17 Oct 2023 07:27:58 +0800 Subject: [PATCH 2/5] docs(booktabs): mention all used `booktabs` dimensions --- manual/manual-5.tex | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/manual/manual-5.tex b/manual/manual-5.tex index 989394e..81cb1ed 100644 --- a/manual/manual-5.tex +++ b/manual/manual-5.tex @@ -83,6 +83,12 @@ \section{Library \texttt{booktabs}} Just like \verb!\hline! and \verb!\cline! commands, you can also specify rule width and color in the optional argument of any of these commands. +Like in \verb!booktabs!, by default + width of \verb!\toprule! and \verb!\bottomrule! are determined by \verb!\heavyrulewidth!, + width of \verb!\midrule! is determined by \verb!\lightrulewidth!, and + width of \verb!\cmidrule! and \verb!\cmidrulemore! are determined by \verb!\cmidrulewidth!, respectively. +All three \verb!\...rulewidth! are dimensions. + \begin{demohigh} \begin{tblr}{llll} \toprule[2pt,purple3] @@ -173,8 +179,9 @@ \section{Library \texttt{booktabs}} At last, there is also an \verb!\addlinespace! command, with an alternative name \verb!\addrowspace!. -You can specify the size of vertical space to be added in its optional argument, -and the default size is \verb!0.5em!. +You can specify the size of vertical space to be added in its optional +argument, and the default size is determinted by \verb!\defaultaddspace! +dimension, initially \verb!0.5em!. This command adds one half of the space to \verb!belowsep! of previous row, and the other half to \verb!abovesep! of current row. From 3fb8fab384f3b1d9ea2445811b3e031745f7b607 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 17 Oct 2023 07:29:13 +0800 Subject: [PATCH 3/5] docs: docu trimming options `l/r/lr` as general hline keys --- manual/manual-2.tex | 5 ++++- manual/manual-5.tex | 16 +++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/manual/manual-2.tex b/manual/manual-2.tex index 762b1fe..ab08e44 100644 --- a/manual/manual-2.tex +++ b/manual/manual-2.tex @@ -42,7 +42,7 @@ \section{Old and New Interfaces} \verb!\SetColumn! & \K{column}, \K{colspec} \\ \end{newtblr} -\section{Hlines and Vlines} +\section{Hlines and Vlines}\label{sec:hlines-vlines} All available keys for hlines and vlines are described in Table \ref{key:hline} and Table \ref{key:vline}. @@ -58,6 +58,9 @@ \section{Hlines and Vlines} \underline{\K{fg}} & rule color name & \None \\ \K{leftpos} & crossing or trimming position at the left side & \V{1} \\ \K{rightpos} & crossing or trimming position at the right side & \V{1} \\ + \K{l} & same as \K{leftpos}, default \V{-0.8} & \V{1} \\ + \K{r} & same as \K{rightpos}, default \V{-0.8} & \V{1} \\ + \K{lr} & crossing or trimming positions at both sides, default \V{-0.8} & \V{1} \\ \K{endpos} & adjust leftpos/rightpos for only the leftmost/rightmost column & \V{false} \\ \end{spectblr} \vspace{-2em} diff --git a/manual/manual-5.tex b/manual/manual-5.tex index 81cb1ed..371dc69 100644 --- a/manual/manual-5.tex +++ b/manual/manual-5.tex @@ -117,8 +117,11 @@ \section{Library \texttt{booktabs}} \end{tblr} \end{demohigh} -From version 2021N (2021-09-01), trim options (\verb!l!, \verb!r!, \verb!lr!) -for \verb!\cmidrule! command are also supported. +From version 2021N (2021-09-01), you can set trimming positions of +\verb!\cmidrule! and \verb!\cmidrulemore!, using newly introduced trimming +options (\verb!leftpos!, \verb!rightpos!, \verb!endpos!, \verb!l!, \verb!r!, +and \verb!lr!) (see Section~\ref{sec:hlines-vlines}). +Option \verb!endpos! is already applied to these two commands. \begin{demohigh} \begin{tblr}{llll} @@ -132,11 +135,10 @@ \section{Library \texttt{booktabs}} \end{tblr} \end{demohigh} -Note that you need to put \verb!l!, \verb!r! or \verb!lr! option into -the \underline{\color{red3}square brackets}. -and the possible values are decimal numbers between \verb!-1! and \verb!0!, -where \verb!-1! means trimming the whole colsep, and \verb!0! means no trimming. -The default value is \verb!-0.8!, which makes similar result as \verb!booktabs! package does. +Since \verb!booktabs! tables usually don't have vlines, the meaningful values +here are decimal numbers between \verb!-1! and \verb!0!. +The default value \verb!-0.8! for \verb!l!, \verb!r!, and \verb!lr! is chosen to +make similar result as \verb!booktabs! package does. There is also a \verb!booktabs! environment for you. With this environment, the default \verb!rowsep=0pt!, but extra vertical space will be added by From 80f6115f27f151d57563ec24db22eb8acf9c849b Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Tue, 17 Oct 2023 07:50:45 +0800 Subject: [PATCH 4/5] docs(booktabs): improve doc of opt-arg of `\toprule` and friends --- manual/manual-5.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manual/manual-5.tex b/manual/manual-5.tex index 371dc69..fd87aed 100644 --- a/manual/manual-5.tex +++ b/manual/manual-5.tex @@ -81,7 +81,8 @@ \section{Library \texttt{booktabs}} \end{demohigh} Just like \verb!\hline! and \verb!\cline! commands, -you can also specify rule width and color in the optional argument of any of these commands. +you can also specify rule width and color by using hline keys in the optional +argument of any of these commands. Like in \verb!booktabs!, by default width of \verb!\toprule! and \verb!\bottomrule! are determined by \verb!\heavyrulewidth!, @@ -102,8 +103,9 @@ \section{Library \texttt{booktabs}} \end{demohigh} If you need more than one \verb!\cmidrule!s, you can use \verb!\cmidrulemore! -command, which is simpler than the \verb!booktabs! usage +command, which is simpler than the \verb!booktabs! usage \verb!\morecmidrules\cmidrule!. +\verb!\cmidrulemore! can receive hline keys in an optional argument too. \begin{demohigh} \begin{tblr}{llll} From acaa2ec7be4a6660d29c55d3a5e79187b9c0a640 Mon Sep 17 00:00:00 2001 From: Yukai Chou Date: Thu, 22 Feb 2024 05:38:11 +0800 Subject: [PATCH 5/5] style: drop end-of-line whitespaces --- manual/manual-1.tex | 8 +++---- manual/manual-2.tex | 2 +- manual/manual-5.tex | 2 +- tabularray.tex | 10 ++++----- testfiles/cell-001.tex | 2 +- testfiles/hvline-003.tex | 2 +- testfiles/library-013.tex | 2 +- testfiles/library-014.tex | 4 ++-- testfiles/long-003.tex | 2 +- testfiles/rowcol-004.tex | 2 +- testfiles/table-006.tex | 6 ++--- testfiles/table-010.tex | 46 +++++++++++++++++++-------------------- testfiles/table-013.tex | 2 +- 13 files changed, 45 insertions(+), 45 deletions(-) diff --git a/manual/manual-1.tex b/manual/manual-1.tex index 082998e..2578070 100644 --- a/manual/manual-1.tex +++ b/manual/manual-1.tex @@ -62,7 +62,7 @@ \section{Vertical Space} Iota & Kappa & Lambda & Mu \\ \hline \end{tblr} -\end{demohigh} +\end{demohigh} But in many cases, this \verb!rowsep! is useful: @@ -101,7 +101,7 @@ \section{Multiline Cells} {L \\ Left} & {C \\ Cent \\ Center} & R \\ \hline \end{tblr} -\end{demohigh} +\end{demohigh} \section{Cell Alignment} @@ -117,7 +117,7 @@ \section{Cell Alignment} {Top Baseline \\ Left Left} & Middle Center & {Right Right \\ Bottom Baseline} \\ \hline \end{tblr} -\end{demohigh} +\end{demohigh} Note that you can use more meaningful \verb!t! instead of \verb!p! for top baseline alignment. For some users who are familiar with word processors, @@ -271,7 +271,7 @@ \section{Multi Rows and Columns} \begin{demohigh} \begin{tblr}{|ll|c|rr|} \hline - \SetCell[r=3,c=2]{h} r=3 c=2 & 1-2 & \SetCell[r=2,c=3]{r} r=2 c=3 & 1-4 & 1-5 \\ + \SetCell[r=3,c=2]{h} r=3 c=2 & 1-2 & \SetCell[r=2,c=3]{r} r=2 c=3 & 1-4 & 1-5 \\ 2-1 & 2-2 & 2-3 & 2-4 & 2-5 \\ \hline 3-1 & 3-2 & MIDDLE & \SetCell[r=3,c=2]{f} r=3 c=2 & 3-5 \\ diff --git a/manual/manual-2.tex b/manual/manual-2.tex index ab08e44..f5d5e9d 100644 --- a/manual/manual-2.tex +++ b/manual/manual-2.tex @@ -307,7 +307,7 @@ \subsection{Hlines and Vlines in Old Interfaces} \end{demohigh} Commands \verb!\SetHline! combines the usages of \verb!\hline! and \verb!\cline!: - + \begin{demohigh} \begin{tblr}{llll} \SetHline{1-3}{blue5,1pt} diff --git a/manual/manual-5.tex b/manual/manual-5.tex index fd87aed..a625efd 100644 --- a/manual/manual-5.tex +++ b/manual/manual-5.tex @@ -103,7 +103,7 @@ \section{Library \texttt{booktabs}} \end{demohigh} If you need more than one \verb!\cmidrule!s, you can use \verb!\cmidrulemore! -command, which is simpler than the \verb!booktabs! usage +command, which is simpler than the \verb!booktabs! usage \verb!\morecmidrules\cmidrule!. \verb!\cmidrulemore! can receive hline keys in an optional argument too. diff --git a/tabularray.tex b/tabularray.tex index df3e417..114c0bc 100644 --- a/tabularray.tex +++ b/tabularray.tex @@ -209,7 +209,7 @@ \section{Vertical Space} Iota & Kappa & Lambda & Mu \\ \hline \end{tblr} -\end{demohigh} +\end{demohigh} But in many cases, this \verb!rowsep! is useful: @@ -248,7 +248,7 @@ \section{Multiline Cells} {L \\ Left} & {C \\ Cent \\ Center} & R \\ \hline \end{tblr} -\end{demohigh} +\end{demohigh} \section{Cell Alignment} @@ -264,7 +264,7 @@ \section{Cell Alignment} {Top Baseline \\ Left Left} & Middle Center & {Right Right \\ Bottom Baseline} \\ \hline \end{tblr} -\end{demohigh} +\end{demohigh} Note that you can use more meaningful \verb!t! instead of \verb!p! for top baseline alignment. For some users who are familiar with word processors, @@ -418,7 +418,7 @@ \section{Multi Rows and Columns} \begin{demohigh} \begin{tblr}{|ll|c|rr|} \hline - \SetCell[r=3,c=2]{h} r=3 c=2 & 1-2 & \SetCell[r=2,c=3]{r} r=2 c=3 & 1-4 & 1-5 \\ + \SetCell[r=3,c=2]{h} r=3 c=2 & 1-2 & \SetCell[r=2,c=3]{r} r=2 c=3 & 1-4 & 1-5 \\ 2-1 & 2-2 & 2-3 & 2-4 & 2-5 \\ \hline 3-1 & 3-2 & MIDDLE & \SetCell[r=3,c=2]{f} r=3 c=2 & 3-5 \\ @@ -872,7 +872,7 @@ \subsection{Hlines and Vlines in Old Interfaces} \end{demohigh} Commands \verb!\SetHline! combines the usages of \verb!\hline! and \verb!\cline!: - + \begin{demohigh} \begin{tblr}{llll} \SetHline{1-3}{blue5,1pt} diff --git a/testfiles/cell-001.tex b/testfiles/cell-001.tex index ca2674f..ea1ba25 100644 --- a/testfiles/cell-001.tex +++ b/testfiles/cell-001.tex @@ -74,7 +74,7 @@ \bigskip\hrule\bigskip -%% h and t cells could align with t/m/b cells with strut +%% h and t cells could align with t/m/b cells with strut \BEGINTEST{normal cells: h/t/m/b/f cells with strut} \begin{tblr}{|Q[h]|Q[t]|Q[m]|Q[b]|Q[f]|} \hline diff --git a/testfiles/hvline-003.tex b/testfiles/hvline-003.tex index 2366f43..a3209d1 100644 --- a/testfiles/hvline-003.tex +++ b/testfiles/hvline-003.tex @@ -89,7 +89,7 @@ vline{4} = {2}{abovepos=0,belowpos=1}, } AAAAAA & BBBBB & CCCCC \\ - AAAAA & BBBBBB & CCCCCC + AAAAA & BBBBBB & CCCCCC \end{tblr} \quad \begin{tblr}{ diff --git a/testfiles/library-013.tex b/testfiles/library-013.tex index 11b8e36..ccb74ec 100644 --- a/testfiles/library-013.tex +++ b/testfiles/library-013.tex @@ -22,7 +22,7 @@ \zref@addprop{main}{table} \zref@addprop{main}{section} \zref@addprop{main}{subsection} -\makeatother +\makeatother \begin{document} diff --git a/testfiles/library-014.tex b/testfiles/library-014.tex index 7836eae..b610488 100644 --- a/testfiles/library-014.tex +++ b/testfiles/library-014.tex @@ -22,14 +22,14 @@ \BEGINTEST{testing delimiters} % issue #300 Hello$\begin{tblr}{} alpha & beta \\ - delta & gamma \\ + delta & gamma \\ \end{tblr}$World \qquad Hello$\begin{tblr}{ delimiter = {left=[,right=]} } alpha & beta \\ - delta & gamma \\ + delta & gamma \\ \end{tblr}$World \ENDTEST diff --git a/testfiles/long-003.tex b/testfiles/long-003.tex index 6e576f4..ccf2c01 100644 --- a/testfiles/long-003.tex +++ b/testfiles/long-003.tex @@ -30,7 +30,7 @@ \hline \SetRow{purple7} Head & Head & Head \\ -\hline +\hline \SetRow{purple7} Head & Head & Head \\ \hline diff --git a/testfiles/rowcol-004.tex b/testfiles/rowcol-004.tex index 3545473..1aed889 100644 --- a/testfiles/rowcol-004.tex +++ b/testfiles/rowcol-004.tex @@ -26,7 +26,7 @@ \BEGINTEST{normal columns with large widths} \begin{tblr}{width=300pt,colspec=|l|Q[-1]|Q[-2]|Q[-5]|Q[-2]|l|Q[2]|Q[3]|l|} \hline -\replicate{6}{\rule{10pt}{2pt}\hfil} & \rule{6pt}{2pt} & \rule{10pt}{2pt} & +\replicate{6}{\rule{10pt}{2pt}\hfil} & \rule{6pt}{2pt} & \rule{10pt}{2pt} & \rule{6pt}{2pt} & \rule{10pt}{2pt} & \replicate{7}{\rule{10pt}{2pt}\hfil} & \rule{10pt}{2pt} & \rule{6pt}{2pt} & \replicate{8}{\rule{10pt}{2pt}\hfil} \\ \hline diff --git a/testfiles/table-006.tex b/testfiles/table-006.tex index 8e91ff3..19d8f94 100644 --- a/testfiles/table-006.tex +++ b/testfiles/table-006.tex @@ -17,16 +17,16 @@ \BEGINTEST{testing \SetTblrDefault} \begin{tblr}{} - A & B \\ C & D + A & B \\ C & D \end{tblr} \begingroup \SetTblrDefault{hlines,vlines,stretch=2} \begin{tblr}{} - A & B \\ C & D + A & B \\ C & D \end{tblr} \endgroup \begin{tblr}{} - A & B \\ C & D + A & B \\ C & D \end{tblr} \ENDTEST diff --git a/testfiles/table-010.tex b/testfiles/table-010.tex index 2dc9d9b..f850796 100644 --- a/testfiles/table-010.tex +++ b/testfiles/table-010.tex @@ -23,43 +23,43 @@ \begin{tblr}{lll} \hline - + One - + & - + Two - + & - + Three - - \\ - + + \\ + Four - - & - + + & + Five - + & - + Six - - \\ - + + \\ + Seven - + & - + Eight - + & - + Nine - - \\ - + + \\ + \hline \end{tblr} diff --git a/testfiles/table-013.tex b/testfiles/table-013.tex index 160e15e..d73de22 100644 --- a/testfiles/table-013.tex +++ b/testfiles/table-013.tex @@ -31,7 +31,7 @@ \caption{Short Table} \begin{tblr}{hlines} \tblrbody -\end{tblr} +\end{tblr} \end{table} \begin{table}[!htpb] \centering