diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-13 21:14:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-13 21:14:08 +0000 |
commit | f7daf89cf94724d103e1f3a9c992553359f8449c (patch) | |
tree | ab8232a12897ee52c17ce90010a9e4dcf09d8d21 /Master/texmf-dist/doc/latex/tabularray | |
parent | 6a388cdf8e758efeeeb4d614735137e275dd22de (diff) |
tabularray (13may21)
git-svn-id: svn://tug.org/texlive/trunk@59183 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/tabularray')
-rw-r--r-- | Master/texmf-dist/doc/latex/tabularray/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tabularray/tabularray.pdf | bin | 0 -> 379316 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tabularray/tabularray.tex | 751 |
3 files changed, 755 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/tabularray/README b/Master/texmf-dist/doc/latex/tabularray/README new file mode 100644 index 00000000000..b4714bd0a70 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tabularray/README @@ -0,0 +1,4 @@ +Package: Typeset tabulars and arrays with LaTeX3 +Author: Jianrui Lyu <tolvjr@163.com> +Repository: https://github.com/lvjr/tabularray +License: The LaTeX Project Public License 1.3 diff --git a/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf b/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf Binary files differnew file mode 100644 index 00000000000..f367583b1b4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tabularray/tabularray.pdf diff --git a/Master/texmf-dist/doc/latex/tabularray/tabularray.tex b/Master/texmf-dist/doc/latex/tabularray/tabularray.tex new file mode 100644 index 00000000000..41aa2ab9f6b --- /dev/null +++ b/Master/texmf-dist/doc/latex/tabularray/tabularray.tex @@ -0,0 +1,751 @@ +% -*- coding: utf-8 -*- +\documentclass[oneside]{book} +\usepackage[a4paper,margin=2.5cm]{geometry} + +\usepackage{codehigh} % https://github.com/lvjr/codehigh +%\usepackage{arev} +\usepackage{tabularray} +\usepackage{array,multirow,amsmath} + +\usepackage{hyperref} +\hypersetup{ + colorlinks=true, + urlcolor=blue3, + linkcolor=red3, +} +\renewcommand*{\thefootnote}{*} + +\newcommand*{\myversion}{2021H} +\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)\\\myrepo} +\newcommand*{\myrepo}{\url{https://github.com/lvjr/tabularray}} +\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} + +\colorlet{highback}{\ifcase\month\or + red9\or brown9\or yellow9\or cyan9\or azure9\or blue9\or + red9\or brown9\or yellow9\or cyan9\or azure9\or blue9\fi +} +\CodeHigh{language=latex/table,style/main=highback,style/code=highback} +\NewCodeHighEnv{code}{style/main=gray9,style/code=gray9} +\NewCodeHighEnv{demo}{style/main=gray9,style/code=gray9,demo} + +%\CodeHigh{lite} + +\begin{document} + +\title{\sffamily\color{red3}Tabularray: Typeset Tabulars and Arrays with \LaTeX3} +\author{Jianrui Lyu (tolvjr@163.com)} +\date{\mydate} +\maketitle + +\tableofcontents + +\chapter{From Old to New} + +\section{Vertical Space} + +After loading \verb!tabularrray! package in the preamble, +we can use \verb!tblr! environments to typeset tabulars and arrays. +The name \verb!tblr! is short for \verb!tabularray! or \verb!top-bottom-left-right!. +The following is our first example: + +\begin{demo} +\begin{tabular}{lccr} +\hline + Alpha & Beta & Gamma & Delta \\ +\hline + Epsilon & Zeta & Eta & Theta \\ +\hline + Iota & Kappa & Lambda & Mu \\ +\hline +\end{tabular} +\end{demo} + +\begin{demohigh} +\begin{tblr}{lccr} +\hline + Alpha & Beta & Gamma & Delta \\ +\hline + Epsilon & Zeta & Eta & Theta \\ +\hline + Iota & Kappa & Lambda & Mu \\ +\hline +\end{tblr} +\end{demohigh} + +You may notice that there is extra space above and below the table rows with \verb!tblr! envirenment. +This space makes the table look better. +If you don't like it, you could use \verb!\SetTblrDefault! command: + +\begin{demohigh} +\SetTblrDefault{rowsep=0pt} +\begin{tblr}{lccr} +\hline + Alpha & Beta & Gamma & Delta \\ +\hline + Epsilon & Zeta & Eta & Theta \\ +\hline + Iota & Kappa & Lambda & Mu \\ +\hline +\end{tblr} +\end{demohigh} + +But in many cases, this rowsep is useful: + +\begin{demo} +$\begin{array}{rrr} +\hline + \dfrac{2}{3} & \dfrac{2}{3} & \dfrac{1}{3} \\ + \dfrac{2}{3} & -\dfrac{1}{3} & -\dfrac{2}{3} \\ + \dfrac{1}{3} & -\dfrac{2}{3} & \dfrac{2}{3} \\ +\hline +\end{array}$ +\end{demo} + +\begin{demohigh} +$\begin{tblr}{rrr} +\hline + \dfrac{2}{3} & \dfrac{2}{3} & \dfrac{1}{3} \\ + \dfrac{2}{3} & -\dfrac{1}{3} & -\dfrac{2}{3} \\ + \dfrac{1}{3} & -\dfrac{2}{3} & \dfrac{2}{3} \\ +\hline +\end{tblr}$ +\end{demohigh} + +Note that you can use \verb!tblr! in both text and math modes. + +\section{Multiline Cells} + +It's quite easy to write multiline cells without fixing the column width in \verb!tblr! environments: +just enclose the cell text with braces and use \verb!\\! to break lines: + +\begin{demohigh} +\begin{tblr}{|l|c|r|} +\hline + Left & {Center \\ Cent \\ C} & {Right \\ R} \\ +\hline + {L \\ Left} & {C \\ Cent \\ Center} & R \\ +\hline +\end{tblr} +\end{demohigh} + +\section{Cell Alignment} + +From time to time, +you may want to specify the horizontal and vertical alignment of cells at the same time. +\verb!Tabularray! package provides a \verb!Q! column for this +(In fact, \verb!Q! column is the only primitive column, +other columns are defined as \verb!Q! columns with some options): + +\begin{demohigh} +\begin{tblr}{|Q[l,t]|Q[c,m]|Q[r,b]|} +\hline + {Top Baseline \\ Left Left} & Middle Center & {Right Right \\ Bottom Baseline} \\ +\hline +\end{tblr} +\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, +these \verb!t! and \verb!b! columns are counter-intuitive. +In \verb!tabularray! package, there are another two column types \verb!h! and \verb!f!, +which will align cell text at row head and row foot, respectively: + +\begin{demohigh} +\begin{tblr}{Q[h,4em]Q[t,4em]Q[m,4em]Q[b,4em]Q[f,4em]} +\hline + {row\\head} & {top\\line} & {middle} & {line\\bottom} & {row\\foot} \\ +\hline + {row\\head} & {top\\line} & {11\\22\\mid\\44\\55} & {line\\bottom} & {row\\foot} \\ +\hline +\end{tblr} +\end{demohigh} + +\section{Multirow Cells} + +The above \verb!h! and \verb!f! columns are necessary for multirow cells. +In \verb!tabularray!, the \verb!t! and \verb!b! in the optional argument of \verb!\multirow! commands +will be treated as \verb!h! and \verb!f!, respectively: + +\begin{demo} +\begin{tabular}{|l|l|l|l|} +\hline + \multirow[t]{4}{1.5cm}{Multirow Cell One} & Alpha & + \multirow[b]{4}{1.5cm}{Multirow Cell Two} & Alpha \\ + & Beta & & Beta \\ + & Gamma & & Gamma \\ + & Delta & & Delta \\ +\hline +\end{tabular} +\end{demo} + +\begin{demohigh} +\begin{tblr}{|l|l|l|l|} +\hline + \multirow[t]{4}{1.5cm}{Multirow Cell One} & Alpha & + \multirow[b]{4}{1.5cm}{Multirow Cell Two} & Alpha \\ + & Beta & & Beta \\ + & Gamma & & Gamma \\ + & Delta & & Delta \\ +\hline +\end{tblr} +\end{demohigh} + +Note that you don't need to load \verb!multirow! package first, +since \verb!tabularrray! doesn't depend on it. +Furthermore, \verb!tabularray! will always typeset descent multirow cells. +First, it will set correct vertical \verb!c! alignment, +even though some rows have large height: + +\begin{demo} +\begin{tabular}{|l|m{4em}|} +\hline + \multirow[c]{4}{1.5cm}{Multirow} & Alpha \\ + & Beta \\ + & Gamma \\ + & Delta Delta Delta \\ +\hline +\end{tabular} +\end{demo} + +\begin{demohigh} +\begin{tblr}{|l|m{4em}|} +\hline + \multirow[c]{4}{1.5cm}{Multirow} & Alpha \\ + & Beta \\ + & Gamma \\ + & Delta Delta Delta \\ +\hline +\end{tblr} +\end{demohigh} + +Second, it will enlarge row heights if the multirow cells have large height, +therefore it always avoids vertical overflow: + +\begin{demo} +\begin{tabular}{|l|m{4em}|} +\hline + \multirow[c]{2}{1cm}{Line \\ Line \\ Line \\ Line} & Alpha \\ +\cline{2-2} + & Beta \\ +\hline +\end{tabular} +\end{demo} + +\begin{demohigh} +\begin{tblr}{|l|m{4em}|} +\hline + \multirow[c]{2}{1cm}{Line \\ Line \\ Line \\ Line} & Alpha \\ +\cline{2} + & Beta \\ +\hline +\end{tblr} +\end{demohigh} + +\section{Multi Rows and Columns} + +It was a hard job to typeset cells with multiple rows and multiple columns. For example: + +\begin{demo} +\begin{tabular}{|c|c|c|c|c|} +\hline + \multirow{2}{*}{2 Rows} + & \multicolumn{2}{c|}{2 Columns} + & \multicolumn{2}{c|}{\multirow{2}{*}{2 Rows 2 Columns}} \\ +\cline{2-3} + & 2-2 & 2-3 & \multicolumn{2}{c|}{} \\ +\hline + 3-1 & 3-2 & 3-3 & 3-4 & 3-5 \\ +\hline +\end{tabular} +\end{demo} + +With \verb!tabularray! package, you can set spanned cells with \verb!\SetCell! command: +within the optional argument of \verb!\SetCell! command, +option \verb!r! is for rowspan number, and \verb!c! for colspan number; +within the mandatory argument of it, horizontal and vertical alignment options are accepted. +Therefore it's much simpler to typeset spanned cells: + +\begin{demohigh} +\begin{tblr}{|c|c|c|c|c|} +\hline + \SetCell[r=2]{c} 2 Rows + & \SetCell[c=2]{c} 2 Columns + & & \SetCell[r=2,c=2]{c} 2 Rows 2 Columns & \\ +\hline + & 2-2 & 2-3 & & \\ +\hline + 3-1 & 3-2 & 3-3 & 3-4 & 3-5 \\ +\hline +\end{tblr} +\end{demohigh} + +Using \verb!\multicolumn! command, the omitted cells \textcolor{red3}{must} be removed. +On the contrary, +using \verb!\multirow! command, the omitted cells \textcolor{red3}{must not} be removed. +\verb!\SetCell! command behaves the same as \verb!\multirow! command in this aspect. + +With \verb!tblr! environment, any \verb!\hline! segments inside a spanned cell will be ignored, +therefore we're free to use \verb!\hline! in the above example. +Also, any omitted cell will definitely be ignored when typesetting, +no matter it's empty or not. +With this feature, we could put row and column numbers into the omitted cells, +which will help us to locate cells when the tables are rather complex: + +\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 \\ + 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 \\ +\hline + \SetCell[r=2,c=3]{l} r=2 c=3 & 4-2 & 4-3 & 4-4 & 4-5 \\ + 5-1 & 5-2 & 5-3 & 5-4 & 5-5 \\ +\hline +\end{tblr} +\end{demohigh} + +\section{Column Types} + +\verb!Tabularray! package supports all normal column types, as well as +the extendable \verb!X! column type, +which first occured in \verb!tabularx! package and was largely improved by \verb!tabu! package: + +\begin{demohigh} +\begin{tblr}{|X[2,l]|X[3,l]|X[1,r]|X[r]|} +\hline + Alpha & Beta & Gamma & Delta \\ +\hline +\end{tblr} +\end{demohigh} + +Also, \verb!X! columns with negative coefficients are possible: + +\begin{demohigh} +\begin{tblr}{|X[2,l]|X[3,l]|X[-1,r]|X[r]|} +\hline + Alpha & Beta & Gamma & Delta \\ +\hline +\end{tblr} +\end{demohigh} + +We need the width to typeset a table with \verb!X! columns. +If unset, the default is \verb!\linewidth!. +To change the width, we have to first put all column specifications into \verb!colspec={...}!: + +\begin{demohigh} +\begin{tblr}{width=0.8\linewidth,colspec={|X[2,l]|X[3,l]|X[-1,r]|X[r]|}} +\hline + Alpha & Beta & Gamma & Delta \\ +\hline +\end{tblr} +\end{demohigh} + +You can define new column types with \verb!\NewColumnType! command. +For example, in \verb!tabularray! package, +\verb!b! and \verb!X! columns are defined as special \verb!Q! columns: +\begin{codehigh} +\NewColumnType{b}[1]{Q[b,wd=#1]} +\NewColumnType{X}[1][]{Q[co=1,#1]} +\end{codehigh} + +\section{Row Types} + +Now that we have column types and \verb!colspec! option, +you may ask for row types and \verb!rowspec! option. +Yes, they are here: + +\begin{demohigh} +\begin{tblr}{colspec={Q[l]Q[c]Q[r]},rowspec={|Q[t]|Q[m]|Q[b]|}} + {Alpha \\ Alpha} & Beta & Gamma \\ + Delta & Epsilon & {Zeta \\ Zeta} \\ + Eta & {Theta \\ Theta} & Iota \\ +\end{tblr} +\end{demohigh} + +Same as column types, \verb!Q! is the only primitive row type, +and other row types are defined as \verb!Q! types with different options. +It's better to specify horizontal alignment in \verb!colspec!, +and vertical alignment in \verb!rowspec!, respectively. + +Inside \verb!rowspec!, \verb!|! is the hline type. +Therefore we need not to write \verb!\hline! commnad, which makes table code cleaner. + +\section{Hlines and Vlines} + +Hlines and vlines have been improved too. You can specify the widths and styles of them: + +\begin{demohigh} +\begin{tblr}{|l|[dotted]|[2pt]c|r|[solid]|[dashed]|} +\hline +One & Two & Three \\ +\hline\hline[dotted]\hline +Four & Five & Six \\ +\hline[dashed]\hline[1pt] +Seven & Eight & Nine \\ +\hline +\end{tblr} +\end{demohigh} + +\section{Colorful Tables} + +To add colors to your tables, you need to load \verb!xcolor! package first. +\verb!Tabularray! package will also load \verb!ninecolors! package for proper color contrast. +First you can specify background option for \verb!Q! rows/columns inside \verb!rowspec!/\verb!colspec!: + +\begin{demohigh} +\begin{tblr}{colspec={lcr},rowspec={|Q[cyan7]|Q[azure7]|Q[blue7]|}} + Alpha & Beta & Gamma \\ + Epsilon & Zeta & Eta \\ + Iota & Kappa & Lambda \\ +\end{tblr} +\end{demohigh} + +\begin{demohigh} +\begin{tblr}{colspec={Q[l,brown7]Q[c,yellow7]Q[r,olive7]},rowspec={|Q|Q|Q|}} + Alpha & Beta & Gamma \\ + Epsilon & Zeta & Eta \\ + Iota & Kappa & Lambda \\ +\end{tblr} +\end{demohigh} + +Also you can use \verb!\SetRow! or \verb!\SetColumn! command to specify row or column colors: + +\begin{demohigh} +\begin{tblr}{colspec={lcr},rowspec={|Q|Q|Q|}} + \SetRow{cyan7} Alpha & Beta & Gamma \\ + \SetRow{azure7} Epsilon & Zeta & Eta \\ + \SetRow{blue7} Iota & Kappa & Lambda \\ +\end{tblr} +\end{demohigh} + +\begin{demohigh} +\begin{tblr}{colspec={lcr},rowspec={|Q|Q|Q|}} + \SetColumn{brown7} + Alpha & \SetColumn{yellow7} + Beta & \SetColumn{olive7} + Gamma \\ + Epsilon & Zeta & Eta \\ + Iota & Kappa & Lambda \\ +\end{tblr} +\end{demohigh} + +Hlines and vlines can also have colors: + +\begin{demohigh} +\begin{tblr}{colspec={lcr},rowspec={|[2pt,green7]Q|[teal7]Q|[green7]Q|[3pt,teal7]}} + Alpha & Beta & Gamma \\ + Epsilon & Zeta & Eta \\ + Iota & Kappa & Lambda \\ +\end{tblr} +\end{demohigh} + +\begin{demohigh} +\begin{tblr}{colspec={|[2pt,violet5]l|[2pt,magenta5]c|[2pt,purple5]r|[2pt,red5]}} + Alpha & Beta & Gamma \\ + Epsilon & Zeta & Eta \\ + Iota & Kappa & Lambda \\ +\end{tblr} +\end{demohigh} + +\section{New Table Commands} + +All commands which change the specifications of tables \textcolor{red3}{must} be defined with \verb!\NewTableCommand!. +The following example demonstrates how to define similar rules as in \verb!booktabs! package: + +\begin{demohigh} +\NewTableCommand\toprule{\hline[0.08em]} +\NewTableCommand\midrule{\hline[0.05em]} +\NewTableCommand\bottomrule{\hline[0.08em]} +\begin{tblr}{llll} +\toprule + Alpha & Beta & Gamma & Delta \\ +\midrule + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ +\bottomrule +\end{tblr} +\end{demohigh} + +\chapter{New Interface} + +With \verb!tabularray! package, you can separate style and content totally in tables. + +\section{Hlines and Vlines} + +Options \verb!hlines! and \verb!vlines! are for setting all hlines and vlines, respectively. +With empty value, all hlines/vlines will be solid. + +\begin{demohigh} +\begin{tblr}{hlines,vlines} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +With values inside one pair of braces, all hlines/vlines will be styled. + +\begin{demohigh} +\begin{tblr}{ + hlines = {1pt,solid}, + vlines = {red3,dashed}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +Another pair of braces before will select segments in all hlines/vlines. + +\begin{demohigh} +\begin{tblr}{ + vlines = {1,3,5}{dashed}, + vlines = {2,4,6}{solid}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +The above example can be simplified with \verb!odd! and \verb!even! values. +(More child selectors can be defined with \verb!\NewChildSelector! command. +Advanced users could read the source code for this.) + +\begin{demohigh} +\begin{tblr}{ + vlines = {odd}{dashed}, + vlines = {even}{solid}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +Another pair of braces before will draw more hlines/vlines (in which \verb!-! stands for all line segments). + +\begin{demohigh} +\begin{tblr}{ + hlines = {1}{-}{dashed}, + hlines = {2}{-}{solid}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +Options \verb!hline{i}! and \verb!vline{j}! are for setting some hlines and vlines, respectively. + +\begin{demohigh} +\begin{tblr}{ + hline{1,7} = {1pt,solid}, + hline{3-5} = {blue3,dashed}, + vline{1,5} = {3-4}{dotted}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +\section{Cells and Spancells} + +Option \verb!cells! is for setting all cells. + +\begin{demohigh} +\begin{tblr}{hlines={white},cells={c,blue7}} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +Option \verb!cell{i}{j}! is for setting some cells. + +\begin{demohigh} +\begin{tblr}{ + hlines = {white}, + vlines = {white}, + cell{1,6}{odd} = {teal7}, + cell{1,6}{even} = {green7}, + cell{2,4}{1,4} = {red7}, + cell{3,5}{1,4} = {purple7}, + cell{2}{2} = {r=4,c=2}{c,azure7}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +\section{Rows and Columns} + +Options \verb!rows! and \verb!columns! are for setting all rows and columns, respectively. + +\begin{demohigh} +\begin{tblr}{ + hlines, + vlines, + rows = {7mm}, + columns = {15mm,c}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ +\end{tblr} +\end{demohigh} + +Options \verb!row{i}! and \verb!column{j}! are for setting some rows and columns, respectively. + +\begin{demohigh} +\begin{tblr}{ + hlines = {1pt,white}, + row{odd} = {blue7}, + row{even} = {azure7}, + column{1} = {purple7,c}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \\ + Phi & Chi & Psi & Omega \\ +\end{tblr} +\end{demohigh} + +\section{Space in Tables} + +Options \verb!rowsep! and \verb!colsep! are for setting padding for rows and columns, respectively. + +\begin{demohigh} +\SetTblrDefault{rowsep=2pt,colsep=2pt} +\begin{tblr}{hlines,vlines} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ +\end{tblr} +\end{demohigh} + +Also \verb!abovesep!, \verb!belowsep!, \verb!leftsep!, \verb!rightsep! options are available: + +\begin{demohigh} +\begin{tblr}{ + hlines, + vlines, + rows = {abovesep=1pt,belowsep=5pt}, + columns = {leftsep=1pt,rightsep=5pt}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ +\end{tblr} +\end{demohigh} + +And \verb!\\[dimen]! can be replaced by \verb!belowsep+! option: + +\begin{demohigh} +\begin{tblr}{ + hlines, row{2} = {belowsep+=5pt}, +} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ +\end{tblr} +\end{demohigh} + +Also \verb!\arraystretch! parameter can be replaced by \verb!stretch! option: + +\begin{demohigh} +\begin{tblr}{hlines,stretch=1.5} + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & Lambda & Mu \\ +\end{tblr} +\end{demohigh} + +\section{Counters in Tables} + +Counters \verb!rownum!, \verb!colnum!, \verb!rowcount!, \verb!colcount! can be used in cell text: + +\begin{demohigh} +\begin{tblr}{hlines} + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] & + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\ + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] & + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\ + Row=\arabic{rowcount}, Col=\arabic{colcount} & + Row=\arabic{rowcount}, Col=\arabic{colcount} & + Row=\arabic{rowcount}, Col=\arabic{colcount} & + Row=\arabic{rowcount}, Col=\arabic{colcount} \\ + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] & + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\ + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] & + Cell[\arabic{rownum}][\arabic{colnum}] & Cell[\arabic{rownum}][\arabic{colnum}] \\ +\end{tblr} +\end{demohigh} + +\section{Experimental Interface} + +Everything described in this section is in \underline{\textcolor{red3}{\textbf{experimental}}} status. +Don’t use it in important documents, unless you have time +to update them for the newer versions of \verb!tabularray! package in the future. + +By default \verb!tabularray! package will compute column widths from span widths. +By setting option \verb!hspan=minimal!, it will compute span widths from column widths. +The following two examples show this difference: + +\begin{demohigh} +\SetTblrDefault{hlines,vlines} +\begin{tblr}{cell{2}{1}={c=2}{l},cell{3}{1}={c=3}{l},cell{4}{2}={c=2}{l}} + 111 111 & 222 222 & 333 333 \\ + 12 Multi Columns Multi Columns 12 & & 333 \\ + 13 Multi Columns Multi Columns Multi Columns 13 & & \\ + 111 & 23 Multi Columns Multi Columns 23 & \\ +\end{tblr} +\end{demohigh} + +\begin{demohigh} +\SetTblrDefault{hlines,vlines,hspan=minimal} +\begin{tblr}{cell{2}{1}={c=2}{l},cell{3}{1}={c=3}{l},cell{4}{2}={c=2}{l}} + 111 111 & 222 222 & 333 333 \\ + 12 Multi Columns Multi Columns 12 & & 333 \\ + 13 Multi Columns Multi Columns Multi Columns 13 & & \\ + 111 & 23 Multi Columns Multi Columns 23 & \\ +\end{tblr} +\end{demohigh} + +\chapter{Source Code} + +%\CodeHigh{lite} +\dochighinput[language=latex/latex3]{tabularray.sty} + +\end{document} |