GithubHelp home page GithubHelp logo

lvjr / tabularray Goto Github PK

View Code? Open in Web Editor NEW
246.0 18.0 22.0 11.09 MB

Typeset tabulars and arrays with LaTeX3

Home Page: https://ctan.org/pkg/tabularray

TeX 95.33% Lua 0.41% Roff 1.00% HTML 3.26%
latex3 table latex

tabularray's People

Contributors

dbitouze avatar isaacoscar avatar krlmlr avatar lvjr avatar muzimuzhi avatar pkl97 avatar qinglee avatar sainonamkho avatar yodude2002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tabularray's Issues

Setting multiple environments at the same time

Discussed in #35

Originally posted by zandivx July 13, 2021
When defining new tabularray environments with \NewTblrEnviron I often find myself copying and pasting existing definitions of other environments I've created earlier. I think it would be a great option to be able to refer to existing environments and inherit their options (something like \UseTblrTemplate but for environments).

Changing font series/shape in multiline cells results in wrong column width

The documentation mentions creating multiline cells using the following syntax: {text \\ in \\ multiple \\ lines}.

Doing so works perfectly fine, but how can I change the font series/shape to bold, italics or small caps in such a multiline cell? The following MWE, that was tested using version 2021J and 2021K shows some attempts and their outcomes:

\documentclass{article}
\usepackage{tabularray}

\begin{document}

Use of \verb|\\| inside of \verb|\textit| leads to overly wide column:

\begin{tblr}{|l|l|}
text & {\textit{text  \\ in \\ multiple \\ lines}} \\ 
\end{tblr}

Without \verb|\textit| the column width is calculated correctly:

\begin{tblr}{|l|l|}
text & {text  \\ in \\ multiple \\ lines} \\ 
\end{tblr}

Using \verb|\itshape| instead of \verb|\textit| seems to solve the issue:

\begin{tblr}{|l|l|}
text & {\itshape text \\ in \\ multiple \\ lines} \\ 
\end{tblr}

Using \verb|\bfseries| or \verb|\scshape| results in overfull box warnings and wrong widths:

\begin{tblr}{|l|l|}
text & {\scshape text \\ in \\ multiple \\ lines} \\ 
\end{tblr}
\quad
\begin{tblr}{|l|l|}
text & {\bfseries text \\ in \\ multiple \\ lines} \\ 
\end{tblr}

Using \verb|\textbf|\ on each line individually does result in the expected output, but is somewhat inconvenient:

\begin{tblr}{|l|l|}
text & {\textbf{text} \\ \textbf{in} \\ \textbf{multiple} \\ \textbf{lines}} \\ 
\end{tblr}

\end{document}

tabularray-colwidths

Use intarrays to store internal data

In tabularray version 2021H, intermal data is stored in several prop lists. It's slow to read from and write to prop lists when the table is large.

To make tabularray run faster, we need to replace prop lists with intarrays in the future.
At present, we can try the faster intarrays by the following code:

\ExplSyntaxOn
\bool_set_true:N \g__tblr_use_intarray_bool
\ExplSyntaxOff

Still need much more work.

error when trying with texlive-2020 as delivered by Fedora 34

Hi,
I am trying to get the minimal program from the homepage to run under texlive-2020:

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{|lc|r|}
\hline
One    & Two   & Three \\
Four   & Five  & Six \\
\hline
Seven  & Eight & Nine \\
\hline
\end{tblr}
\end{document}

Running this results in the following error on loading tabularray:

ERROR: Undefined control sequence.

--- TeX said ---
l.191 \NewDocumentCommand
                        \NewChildSelector { m O{0} o m }
--- HELP ---
TeX encountered an unknown command name. You probably misspelled the
name. If this message occurs when a LaTeX command is being processed,
the command is probably in the wrong place---for example, the error
can be produced by an \item command that's not inside a list-making
environment. The error can also be caused by a missing \documentclass
command.

Improve support for \diagbox command

At this moment, you can use \diagbox command of diagbox package. But when rowsep is larger than zero, the diagonal lines are in wrong positions. Furthermore we can not use \diagbox command in math mode.

Once you have set a cmd for a column, there is no way to disable it for a single row

Suppose that you have a table where column 3 should be made of images. So you set cmd=\includegraphids for column{3}, so that you only have to type in the file name. Now, obviously, the table header(the 1st row) should have regular text in column 3. However there seems to be no way to get rid of the default command defined before. For instance row{1}={cmd={}} does not help.

\pagebreak and \nopagebreak for long tables

At this moment, tabularray is able to recognize a \\* command, but doesn't forbid a page break there. And It doesn't support \nopagebreak and \pagebreak commands. We need to implement these. But the optional arguments of \nopagebreak and \pagebreak commands seem useless in tabularray, since we manually break long tables.

Support for headers and footers

In issue #8 I read:

At this moment, we can typeset long tables without heads or foots by setting long option in tblr environment.

are there any plans to support commands like \endhead, \endfoot, \endfirsthead, \endlastfoot?

longtblr:Overflow when changing to the next page

image

        %!TeX encoding = UTF-8
        %!TEX program  = xelatex
        \documentclass[]{article}
        \usepackage{geometry}
        \geometry{a4paper,left=1.9cm,right=1.9cm,bottom=2.5cm,top=3cm}
        \usepackage{xeCJK}
        \usepackage{tabularray}
        \usepackage[table]{xcolor}
        \begin{document}

\begin{flushleft}
    \begin{longtblr}{colspec={Q[c,m,3.4cm]Q[m,13cm]},
    column{1}={orange},
    hlines,vlines,rowhead=1}
        title1&title2\\
            \SetCell[r=4]{c} title3 & As a matter of fact, the symbolic meaning the picture conveys is deep and profound. Naturally and necessarily, there are two major ways coping with this problem. \\
            & The first way to tackle it is to appeal to authorities to take measures. Once achieving the success of solving the problem, the whole society also thrives/makes progress. \\
            & Solving the problem can accelerate better individuals’development. The other way that is worth adopting is to work out new laws. \\
            & Where there are better laws, there are more hopes, vitality and development. These advisable laws eventually brings economic prosperity and social harmony. Finally, I can safely come to the conclusion that it is high time we enhanced the awareness of people that is every vital to us. Only by these means can we succeed in solving the problem in the near future.(1 Therefore, measures should be taken to terminate the ridiculous affair. First and foremost, governments should establish some regulations to prohibit enterprises and people from making such misdeeds. What’s more, people should get ready to pass criticism upon such misdeeds anytime and anywhere. After all, it is necessary to develop our society by performing hard work instead of talking nonsense. \\
            \SetCell[r=4]{c} title3 & As a matter of fact, the symbolic meaning the picture conveys is deep and profound. Naturally and necessarily, there are two major ways coping with this problem. \\
            & The first way to tackle it is to appeal to authorities to take measures. Once achieving the success of solving the problem, the whole society also thrives/makes progress. \\
            & Solving the problem can accelerate better individuals’development. The other way that is worth adopting is to work out new laws. \\
            & Where there are better laws, there are more hopes, vitality and development. These advisable laws eventually brings economic prosperity and social harmony. Finally, I can safely come to the conclusion that it is high time we enhanced the awareness of people that is every vital to us. Only by these means can we succeed in solving the problem in the near future.(1 Therefore, measures should be taken to terminate the ridiculous affair. First and foremost, governments should establish some regulations to prohibit enterprises and people from making such misdeeds. What’s more, people should get ready to pass criticism upon such misdeeds anytime and anywhere. After all, it is necessary to develop our society by performing hard work instead of talking nonsense. \\
            \SetCell[r=4]{c} title3 & As a matter of fact, the symbolic meaning the picture conveys is deep and profound. Naturally and necessarily, there are two major ways coping with this problem. \\
            & The first way to tackle it is to appeal to authorities to take measures. Once achieving the success of solving the problem, the whole society also thrives/makes progress. \\
            & Solving the problem can accelerate better individuals’development. The other way that is worth adopting is to work out new laws. \\
            & Where there are better laws, there are more hopes, vitality and development. These advisable laws eventually brings economic prosperity and social harmony. Finally, I can safely come to the conclusion that it is high time we enhanced the awareness of people that is every vital to us. Only by these means can we succeed in solving the problem in the near future.(1 Therefore, measures should be taken to terminate the ridiculous affair. First and foremost, governments should establish some regulations to prohibit enterprises and people from making such misdeeds. What’s more, people should get ready to pass criticism upon such misdeeds anytime and anywhere. After all, it is necessary to develop our society by performing hard work instead of talking nonsense. \\
    \end{longtblr}
\end{flushleft}
\end{document}

Borders of a "corner cell" (first cell blank)

Hi, very nice package, with big alignement enhancements !!!!
I'd like to make a table with the first cell blank

2021-05-27_22-13-55

I've tried cline/hline but I'm getting issue with vlines... it's possible to do the same with tblr (like with a multicols{1}{c|} ?)

Tks --

NewDocumentCommand to generate row content

I would like to be able to define a new command to generate table row content according to a defined scheme. In the old days I would do something like this in my class file:

\newcommand{\tabentry}[4]{
  \printdate{#1} & #2 & (#3) & #4 \\
}

And in my documents:

\begin{tabu}   % or whatever table package you were using
   \tabentry{2021-05-12}{Alpha}{Beta}{Gamma Delta}
   \tabentry{2021-06-01}{Epsilon}{Rho}{Phi Nu Mu}
\end{tabu}

But with tblr I get a "misplaced alignment tab character &" error.

I tried my luck with \NewTableCommand, but it seems that whatever I define is inserted at the beginning, or at the end of a row only. It seems \NewTableCommand is for hline-type use cases only?

When I escape the alignment tab as \& or \string& I get literal ampersands in the rendered output.

Also, the way of specifying the arguments to \NewTableCommand seems to be quite specific to how it is used in tabularray itself.

So I guess my ideal solution would be a way of using the standard \NewDocumentCommand (or \NewExpandableDocumentCommand if need be), and enjoy the power of xparse, to define a function producing table row content.

I would not mind whether the \\ is inserted by the newly defined command (as shown i the example above), or in the table, btw.

Heading and text alignment incorrect when using siunitx

Heading A, B ,C below as well as "-" in the second row should be centred as in the example with tabular. Note: table-text-alignment option doesn't seem to have any effect.

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\UseTblrLibrary{siunitx}

\begin{document}

\section{Wrong alignment}
\begin{tblr}{
 colspec={
 S[table-format=2.2]
 S[table-format=2.2, table-text-alignment=right]
 S[table-format=2.2]
 }
}
{{{A}}} & {{{B}}} & {{{C}}} \\
 11 & 11 & 11 \\
 2.1 & 2.2 & {{{-}}} \\
 33.11 & 33.22 & 33.33 \\
\end{tblr}

\section{Correct alignment}
\begin{tabular}{
 S[table-format=2.2]
 S[table-format=2.2, table-text-alignment=right]
 S[table-format=2.2]
}
{A} & {B} & {C} \\
 11 & 11 & 11 \\
 2.1 & 2.2 & {-} \\
 33.11 & {{{-}}} & 33.33 \\
\end{tabular}
\end{document}

remove \par tokens at the beginning and at the end of cell text

My long table has only 2 rules. One at the top and one at the bottom. On page breaks, the top rule is repeated on every pages which is great. however the bottom is not. It would be great if the bottom rule could be repeated on every pages as for the top rule. Is there a way to achieve that (like a end row with only a rule)?

Trouble with colsep

In the following MCE, the first tabular is said to have a too small width: "need 16.45273pt more!" and, indeed, the second one is OK.

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\noindent%
\begin{tblr}{colspec={p{\linewidth-2\rulewidth-2\tabcolsep}},vlines,colsep=5mm}
  Foobar
\end{tblr}

\noindent%
\begin{tblr}{colspec={p{\linewidth-2\rulewidth-2\tabcolsep-16.45273pt}},vlines,colsep=5mm}
  Foobar
\end{tblr}
\end{document}

But I cannot understand where this 16.45273pt is coming from and the following attempt to retrieve the colsep dimension fails (in the second tabular, leftsep and rightsep are claimed to be 14.22636pt and @vline-width is claimed to be 0.4pt).

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\noindent%
\ExplSyntaxOn
\dim_new:N \l_leftsep_dim
\dim_new:N \l_rightsep_dim
\dim_new:N \l_vline_width_dim
\begin{tblr}{rowspec={Q[c,m]},colspec={p{\linewidth-2\rulewidth-2\tabcolsep}},vlines,hlines}
  \dim_set:Nn \l_leftsep_dim {
    \__tblr_prop_item:ne {column} { [\l__tblr_j_tl] / leftsep}
  }
  \dim_show:N \l_leftsep_dim
  \dim_set:Nn \l_rightsep_dim {
    \__tblr_prop_item:ne {column} { [\l__tblr_j_tl] / rightsep}
  }
  \dim_show:N \l_rightsep_dim
  \dim_set:Nn \l_vline_width_dim {
    \__tblr_prop_item:ne {vline} { [\l__tblr_j_tl] / @vline-width }
  }
  \dim_show:N \l_vline_width_dim
  Foobar
\end{tblr}
\par
\noindent%
\begin{tblr}{rowspec={Q[c,m]},colspec={p{\linewidth-2\rulewidth-2\tabcolsep-16.45273pt}},vlines,hlines,colsep=5mm}
  \dim_set:Nn \l_leftsep_dim {
    \__tblr_prop_item:ne {column} { [\l__tblr_j_tl] / leftsep}
  }
  \dim_show:N \l_leftsep_dim
  \dim_set:Nn \l_rightsep_dim {
    \__tblr_prop_item:ne {column} { [\l__tblr_j_tl] / rightsep}
  }
  \dim_show:N \l_rightsep_dim
  \dim_set:Nn \l_vline_width_dim {
    \__tblr_prop_item:ne {vline} { [\l__tblr_j_tl] / @vline-width }
  }
  \dim_show:N \l_vline_width_dim
  Foobar
\end{tblr}
\ExplSyntaxOff
\end{document}

Is it possible, when colsep (or either leftsep or rightsep) is set, to get the dimension which has to be subtracted to the tabular width in order to get the same width as when colsep is not used?

Symmetrically spread extra row height in cells adjacent to a tall multirow cell

tabularray seems to avoid overflowing contents of tall \multirow cells by enlarging the height of the last row that the \multirow cell spans. Is there already a way to instead evenly distribute the extra row height over all rows that the \multirow cell spans or is such a feature planned?

Here is a MWE comparing the current output using tabularray as well as two mock-up versions showing such an evenly distributed additional row height:

tabularray-example3

\documentclass{article}
\usepackage{tabularray}
\usepackage{multirow}

\begin{document}

\begin{tblr}{hlines,vlines, colspec={lp{3.25cm}}}
  Column1 & Column2  \\
  Row1 & \multirow{3}{=}{Long text that needs multiple lines. Long text that needs multiple lines.  Long text that needs multiple lines.}  \\ 
  Row2 &  \\  
  Row3 &  \\ 
  Row4 &  short text  \\ 
\end{tblr}

\bigskip
\begin{tabular}{|l|p{3.25cm}|}
  \hline
  Column1 & Column2  \\ 
  \hline
  Row1 & \multirow{6}{=}{Long text that needs multiple lines. Long text that needs multiple lines. Long text that needs multiple lines.} \\
  &\\ 
  \cline{1-1}
  Row2 &  \\
  &\\
  \cline{1-1}
  Row3 &  \\
  &\\
  \hline  
  Row4 &  short text  \\
  \hline
\end{tabular}
\quad
\begin{tabular}{|l|p{3.25cm}|}
  \hline
  Column1 & Column2  \\ 
  \hline
  \multirow{2}{*}{Row1} & \multirow{6}{=}{Long text that needs multiple lines. Long text that needs multiple lines. Long text that needs multiple lines.} \\
  &\\  
  \cline{1-1}
  \multirow{2}{*}{Row2} &  \\
  &\\
  \cline{1-1}
  \multirow{2}{*}{Row3} &  \\
  &\\ 
  \hline 
  Row4 &  short text  \\ 
  \hline
\end{tabular}

\end{document} 

Some related questions/comments:

https://tex.stackexchange.com/q/581298
https://tex.stackexchange.com/q/359003
https://tex.stackexchange.com/questions/343779/multirow-cell-content-overflows#comment843635_343779

Clear floats before building long tables

Although I haven't done enough tests, I think floats will interfere with longtblr in some situations. Also floats in the middle of a long tables look weird.

Maybe it is a good choice to clear all floats (but not create a new page) before building long tables? Or could we disable floats temporarily in the building process of long tables? Need decision.

Setting fonts?

Is there a way to set the font for any given row, column, or cell?

My use-case is that I want to set

\tableheaderfont\color{white}

for the first row.

Restore table commands before building cells

At present, tabularray package redefines table commands such as \hline inside the tblr environment. But it causes potential problems if there is a nesting tabular or array environment inside it. For example:

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{c}
\hline
  Cell Text \\
\hline
  $\begin{array}{c}
  \hline
    a+b \\
  \hline
  \end{array}$ \\
\hline
\end{tblr}
\end{document}

Maybe it is better to restore the definitions of table commands before building cell text.

[longtblr] parts of the table missing (blank page instead)

When I run the following example, parts "row subheading 2.1" and "row subheading 3.1" are missing and I got a blank page instead.

\documentclass{article}
\usepackage{tabularray}
\usepackage{blindtext}
\begin{document}

\par\vspace{4cm}

\begin{longtblr}[
caption = {Table caption},
note{*} = {To be noted},
]{
colspec = {lcX},
}
%
\multicolumn{3}{l}{Row heading 1}\\
& Row subheading 1.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
& Row subheading 1.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
%
\multicolumn{3}{l}{Row heading 2}\\
& Row subheading 2.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
& Row subheading 2.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
%
\multicolumn{3}{l}{Row heading 3}\\
& Row subheading 3.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
& Row subheading 3.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
\end{longtblr}
\end{document}

crossing and trimming options for hlines and vlines

To implement trim option for \cmidrule of booktabs library (see #41) and the functionality of hhline package, we need to design new options leftpos and rightpos for hlines, abovepos and belowpos for vlines.

Each of the four new options will have three possible values (take hlines as an example):

-1: the hline doesn't touch any vlines;
0: the hline only touches the first vline;
1: the hline touches all the vlines.

\relax after \\ or \hline creates column bunching

For tblr and other tabular environments, adding square brackets to cells makes latex think you're passing an argument to line breaks \\ or to hline. This can be avoided by adding \relax, but doing this in tblr makes the first column cells appear merged together into one long cell for some reason. For example,

\begin{tblr}{c|cccc}
	\times & [1] & [2] & [3] & [4]\\\relax
	\hline\relax
	[1] & [1] & [2] & [3] & [4]\\\relax
	[2] & [2] & [4] & [1] & [3]\\\relax
	[3] & [3] & [1] & [4] & [2]\\\relax
	[4] & [4] & [3] & [2] & [1]
\end{tblr}

causes the first column to be bunched up like [1][2][3][4]. Is there a better workaround for this situation for tabularrays?

Drop support for \multicolumn and \multirow and remove them in version 2022

Tabularray package tried its best to support legacy \multicolumn and \multirow commands by doing some dirty hack. But from a question in tex.sx, it turns out that it's impossible to provide full support for these two commands, since these two commands conflict with the design of tabularray package.

Therefore I have decided to mark \multicolumn and \multirow as obsolete, and will remove them in version 2022. To make multicolumn or multirow cells, it's better to use \SetCell command in old interfaces, or cell{i}{j} in new interfaces.

Also, for backwards compatibility, I will include the last 2021 version of tabularray as tabularray-2021.sty in future releases for many years. Users could still use it for their old documents by \usepackage{tabularray-2021}.

[longtblr] blank page after \section starts at the top of a page

May be related with issue #39.

\documentclass{article}
\usepackage{tabularray}
%\UseTblrLibrary{booktabs}
\usepackage{blindtext}

\begin{document}

Blabla

% Whitespace in order to get section title on the top of the next page
% Issue: table is moved to page 3, leaving blank most of page 2
\par\vspace{18cm}

\section{Section 1}

\begin{longtblr}[
caption = {Table caption},
note{*} = {To be noted},
]{
colspec = {lcX},
}
%\toprule
%
\multicolumn{3}{l}{Row heading 1}\\
& Row subheading 1.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
& Row subheading 1.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
%
\multicolumn{3}{l}{Row heading 2}\\
& Row subheading 2.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[15]
\end{minipage} \\
& Row subheading 2.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[11]
\end{minipage} \\
\end{longtblr}

\end{document}

image

Keep column widths even if all cells in them are spanned

At this moment tabularray will keep row heights even if all cells in them are spanned, but it's not true for column widths. See the following example based on a question in tex.se:

\documentclass[11pt]{article}
\usepackage{tabularray}
\begin{document}
\noindent
\begin{tblr}{width=\textwidth,colsep=2pt,colspec={|*{16}{X[c]|}}}
\hline
  \multicolumn{4}{|r|}{4} 
& \multicolumn{4}{r|}{8} 
& \multicolumn{4}{r|}{12}
& \multicolumn{4}{r|}{16}\\
\hline
  \multicolumn{1}{|c|}{B/R}
& \multicolumn{5}{c|}{Msg-Type}
& \multicolumn{5}{c|}{Src-Addr}
& \multicolumn{5}{c|}{Dest-Addr}\\
\hline
  \multicolumn{16}{|c|}{Fletcher-16 Checksum}\\
\hline
  \multicolumn{8}{|c|}{Payload-Length in Bits}
& \multicolumn{8}{c|}{Payload max. 28 Byte}\\
\hline
\end{tblr}
\end{document}

image

This bug should be fixed before the next release.

long tables: customization of rule width/thickness

For long tables, it would be great if I could make the width/thickness of the rules encompassing the first header different from those of the repeated headers. Also, the same is desired for the repeated footers and last footer.

Unwanted line break for some cell text

In fixing issue #15, I found another issue:

\documentclass[11pt]{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{ll}
\hline
Src-Addr & Dest-Addr \\
\hline
\end{tblr}
\end{document} 

image

The result is correct if we change font size to 10pt or 12pt.

Support \caption[]{text} and \caption*{text}

When we specify entry=none, no entry will be write to the List of Tables. And when we specify label=none, the package will set caption-tag template to empty, not create hyper target, and not increase the table counter.

Therefore entry=none is the same as \caption[]{text} in longtable package, and entry=none,label=none is the same as \caption*{text} except for the counter.

graphics and tblr

I want to include some graphics in tblr. I'd like to put a figure and the text in 2 rows and let them align at center vertically. My English is poor, so here is the mwe:

\documentclass{article}
\usepackage{tabularray}
\usepackage{graphicx}
\begin{document}
    \begin{tblr}{
        vline{2},
        hlines,
        row{1}      =   {c, m},
        cell{1}{2}  =   {h},
        cell{2}{2}  =   {m}
    }
        text & \includegraphics[width = 2cm]{example-image-a}\\ 
        text & \includegraphics[width = 2cm]{example-image-b}\\     
    \end{tblr}
\end{document}

image

I want something like the image-a, but image-a's top and bottom's sep seems not same. How can I do this?

Suggestion - TikZ naming of cells and borders

nicematrix use of names of the cells to play with TikZ for (even if this fine-tunings is used in some rare situations).

This could be a feature proposed only when using \UseTblrLibrary{tikz}.

add space in multiline cell will raise an error or extra space

Here is my demand:
image
I use code below to make it:

\documentclass{article}
\begin{document}
    \begin{tabular}{l}\hline
        (1) a \\
        \phantom{(1) }b\\\hline
    \end{tabular}
\end{document}

I want to use tabularray's multiline cell, so I type

\documentclass{article}
\usepackage{tabularray}
\begin{document}
    \begin{tblr}{l}\hline
        {(1) a \\ \phantom{(1)} b}  \\\hline
    \end{tblr}
\end{document}

It raised an error:

! Missing number, treated as zero.
<to be read again>
                   \protect
l.8     \end
            {tblr}
?

After much try, I found that adding a space after b can give an output without error. However there is extra space below b:

\documentclass{article}
\usepackage{tabularray}
\begin{document}
    \begin{tblr}{l}\hline
        {(1) a \\ \phantom{(1)} b }  \\\hline
    \end{tblr}
\end{document}

image
Morevoer, an \hspace(*) also leads to this error or space.

\documentclass{article}
\usepackage{tabularray}
\begin{document}
    \begin{tblr}{l}\hline
        {(1) a \\ b} \\\hline
        {(1) a \\ \phantom{(1)} b }  \\\hline
        {(1) a \\ \hspace*{1em} b } \\\hline
        {(1) a \\ \hspace{1em} b } \\\hline
    \end{tblr}
\end{document}

image

Here is the listfiles:

 *File List*
 article.cls    2021/02/12 v1.4n Standard LaTeX document class
  size10.clo    2021/02/12 v1.4n Standard LaTeX file (size option)
tabularray.sty    2021-06-05 v2021K Typeset tabulars and arrays with LaTeX3
   expl3.sty    2021-07-12 L3 programming layer (loader) 
l3backend-pdftex.def    2021-07-12 L3 backend support: PDF output (pdfTeX)
  xparse.sty    2021-06-18 L3 Experimental document command parser
 ***********

tabularray and shortverb |

The doc package (also also the fancyvrb package) allows to define | as a short hand for the \verb command.

This is used quite a lot e.g. in the LaTeX documentation.

If the array package is used this doesn't disturb uses of | in tabular preambles, but tblr errors:

\documentclass{article}
\usepackage{doc,array}
\usepackage{tabularray}
\begin{document}

\MakeShortVerb| %from doc package

|\section|

\begin{tabular}{|l} %works
abc\\
\end{tabular}


\begin{tblr}{|l} %errors
abc \\
\end{tblr}

\end{document}

tagpdf support

We are working on a project to enhance LaTeX so that it can produce tagged pdf.
https://www.latex-project.org/news/2020/11/30/tagged-pdf-FS-study/

For a tabular this means that one need to add commands quite similar to html-table commands to cells and rows.

So to successfully tag a tabular, one needs at least

  • places to inject tagging code at the begin and end of a cell and of a row (at the end even if the row it not fully filled)
  • a way to identify header rows and header columns as the code is different there.
  • a way to mark decorative elements like lines as "artifacts".

The code for the cells and rows should at best have access to data like the current row/column number.

It would be nice if tabularray would add suitable hooks for this.

[longtblr] blank page when using \newpage

May be not related to tabulararry but when the table is ending at the bottom of a page, \newpage add a not desired blank page (see example below).

\documentclass{article}
\usepackage{tabularray}
%\UseTblrLibrary{booktabs}
\usepackage{blindtext}

\begin{document}

\par\vspace{4cm}

\begin{longtblr}[
caption = {Table caption},
note{*} = {To be noted},
]{
colspec = {lcX},
}
%\toprule
%
\multicolumn{3}{l}{Row heading 1}\\
& Row subheading 1.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
& Row subheading 1.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[20]
\end{minipage} \\
%
\multicolumn{3}{l}{Row heading 2}\\
& Row subheading 2.1 &
\begin{minipage}[t]{\linewidth}
\blinditemize[15]
\end{minipage} \\
& Row subheading 2.2 &
\begin{minipage}[t]{\linewidth}
\blinditemize[11]
\end{minipage} \\
\end{longtblr}

\newpage

Line after \verb+\newpage+.

\end{document}

support for \caption

As far as I can see the following is not yet possible

\begin{tblr}{*{3}{|X[-1]}|}
\caption{Complex table}
...

with the tabu package this was possible like:

\begin{longtabu}spread 0pt [c]{*{3}{|X[-1]}|}
\caption{Complex table}
...

Inconsistent local/global assignments and variables not declared

The compilation of the following file highlights several expl3 problems in the tabularray's code (inconsistent local/global assignments and variables not declared).

\RequirePackage[check-declarations,enable-debug]{expl3}
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\end{document}

Problem with hline and table with more than 10 columns

Hi-, I've notices a problem with hlines in a tabular with more than 10 columns... the hline fills only the 1st column.
With brackets in the hline param it's ok 👍

\begin{tblr}{hlines={0.45pt},vlines={0.45pt},hline{1-3}={1-{12}}{solid},columns={9mm,c}}
    $s_i$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ & $11$ & $12$ \\
    $p_i$ & $\frac{1}{36}$ & $\frac{2}{36}$ & $\frac{3}{36}$ & $\frac{4}{36}$ & $\frac{5}{36}$ & $\frac{6}{36}$ & $\frac{5}{36}$ & $\frac{4}{36}$ & $\frac{3}{36}$ & $\frac{2}{36}$ & $\frac{1}{36}$ \\
\end{tblr}

Can't work with expl3 int loop or macro which is tblr contents.

A great job, thank you very much.

The tblr works for tabular/array very well. But it doesn't work for expl3 int loop or macro which is tablr contents.

The MWE:

\documentclass{ctexart}

\usepackage{expl3}
\usepackage{tabularray}

\newcommand\tabcontents{
  20 & 30 & 40\\
  50 & 60 & 70\\
}

\begin{document}

% Work Well!
\ExplSyntaxOn
\begin{tabular}{|c|c|c|}
  \hline
  \int_step_inline:nn {3}{
    \int_step_inline:nn {3}{
      a(#1,~##1)
      \int_compare:nNnT {##1} < {3}{ & }
    }
    \int_compare:nNnT {#1} < {3}{\\ \hline}
  }
  \\ \hline
\end{tabular}
\ExplSyntaxOff

% Doesn't Work!
% \ExplSyntaxOn
% \begin{tblr}{|c|c|c|}
%   \hline
%   \int_step_inline:nn {3}{
%     \int_step_inline:nn {3}{
%       a(#1,~##1)
%       \int_compare:nNnT {##1} < {3}{ & }
%     }
%     \int_compare:nNnT {#1} < {3}{\\ \hline}
%   }
%   \\ \hline
% \end{tblr}
% \ExplSyntaxOff

% Work Well!
\begin{tabular}{|c|c|c|}
  \hline
  \tabcontents
  \hline
\end{tabular}

% Work Well!
\begin{tblr}{|c|c|c|}
  \hline
  20 & 30 & 40\\
  50 & 60 & 70\\
  \hline
\end{tblr}

% Doesn't Work!
% \begin{tblr}{|c|c|c|}
%   \hline
%   \tabcontents
%   \hline
% \end{tblr}
\end{document}

hyperref without pdfborder

目录中标题默认带的hyperref超链接边框没了,这可能是ninecolors宏包引起的,请问能否对这个小问题进行调整

\documentclass{ctexbook}

\usepackage{tabularray}
\usepackage{hyperref}

\begin{document}
\tableofcontents
\chapter{chapter}

\end{document} 

图片
图片

Short tables with heads and foots

Now we have long option for long tables similar to those in threeparttablex package. We need another option tall for short tables similar to those in threeparttable package.

enumerate inside cell text

We use \hbox to measure the widths of cells before building the whole table. But it seems enumerate inside a cell would cause an error. Need to find out if there are any solutions for it.

hlines/vlines index order

Discussed in #52

Originally posted by cdacl August 3, 2021
According to the documentation of tabularray package, we can use hlines={}{}{} in mandatory argument to type more hlines/vlines. But I can't change the index order, for example:

\begin{tblr}{
		hlines = {2}{-}{red5},
		hlines = {1}{-}{blue5},
}
 Alpha & Beta & Gamma & Delta \\
 Epsilon & Zeta & Eta & Theta \\
 Iota & Kappa & Lambda & Mu \\
\end{tblr}

I got this:
1

The red line was missed.

tabularray and beamer overlays

To get nice and clean table overlays in beamer documents, we'd better also separate overlays code from table contents.

My current idea is to define a beamer library for tabularray, which modifes tblr environment and adds an overlay argument:

\begin{tblr}[outer]{inner}<overlay>
  BODY
\end{tblr}

And then we can write pause=rows or pause=columns in the overlay argument.

And furthermore we can write
onsilde{2-}={row{1}=gray8,cell{2}{3}=omit,hline{4}=omit}.

We already have an undocumented omit option with cells and hlines/vlines for multispan cells, and we can reuse it.

Not easy to implement this. Maybe in the future.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.