Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support verbatim environments in the table #13

Open
albert-github opened this issue May 31, 2021 · 12 comments
Open

Support verbatim environments in the table #13

albert-github opened this issue May 31, 2021 · 12 comments
Labels
feature request New feature or request

Comments

@albert-github
Copy link

As far as I can see the environment:

\begin{tblr*}

does not yet work, any plans for this?

@lvjr lvjr added the feature request New feature or request label May 31, 2021
@lvjr
Copy link
Owner

lvjr commented May 31, 2021

Yes, there will be a tblr* environment in the near future.

@lvjr
Copy link
Owner

lvjr commented Jun 3, 2021

It is much more complicated than what I have thought to support verbatim code.

Because tabularray package collects the whole table body before typesetting the table, and some characters (e.g., comment chars, newline chars and mulitiple spaces) are discarded by TeX in this collecting process. Therefore I need to use the dangerous \catcode command before tblr environment, and it will probably break something.

@albert-github, could you provide some examples that you use, so that I can do some testing while implementing this feature?

@albert-github
Copy link
Author

I don't have a direct example. I saw that in the doxygen manual the longtabu and longtabu* were used and when I did some tests with it I saw that tblr didn't have the tblr* environment (along wit the missing longtblr).

@lvjr
Copy link
Owner

lvjr commented Jun 14, 2021

Maybe you could provide a sample TeX file generated by doxygen? A link for it is also OK.

@lvjr
Copy link
Owner

lvjr commented Jul 15, 2021

Now we can use \verb command inside the table with verb option:

\begin{tblr}{verb}
  20 & 30 & \verb!Hello!40 \\
  50 & \verb!Hello!60 & 70 \\
\end{tblr}

image

@lvjr
Copy link
Owner

lvjr commented Jul 15, 2021

Since there is some fake \write behind \scantokens command we are using, an extra space character is added after every macro inside \verb, such as \verb!\cmd{arg}!. Need to fix this problem.

@lvjr
Copy link
Owner

lvjr commented Jul 17, 2021

The previous commit fixed the problem:

\begin{tblr}{hlines,verb}
  20 & 30 & \verb!\hello{world}!40 \\
  50 & \verb!\hello!60 & 70 \\
\end{tblr}

image

@lvjr
Copy link
Owner

lvjr commented Sep 16, 2021

Since tabularray need to split cells from table body before reading the cell contents, to make sure we will always get a correct table, we may need to force users to write verbatim environments in a specified way, such as:

\begin{tblr*}{ll}
Cell1
&
\begin{verbatim}
code1
\end{verbatim}
\\
\begin{verbatim}
code2
\end{verbatim}
&
Cell2
\\
\end{tblr*}

Update1: Or we can make user list the verbatim environments with verbatim={lstlisting,Verbatim} option for example.

Update2: Maybe we can provide a command \RegisterTblrVerbatim.

@ysalmon
Copy link

ysalmon commented Jan 29, 2023

The "matrix of nodes" part of TikZ has an "ampersand replacement" option that lets the user specify with which character (eg. \&) columns are specified instead of &, which then allows this character to be used inside of nodes. Maybe that would be a solution ?

Also, I agree with the aforementionned, an option to tell tblr what are the verbatim commands would be great, because one often uses packages and shorthands, not always the basic \verb.

An option to change the catcode of % would also be convenient.

@SteffenMeinecke
Copy link

I would be interested in a tblr* / longtblr* not appearing in the list-of-tables, too.

@muzimuzhi
Copy link
Collaborator

What's the expected semantics of tblr* environment?

  • tabular* from the LaTeX2e kernel accepts an extra mandatory argument width.
  • tabu* from tabu library re-tokenizes the table content (by using \scantokens).

Issue author didn't give a precise description, though most part of discussion in this issue is about the re-tokenization purpose, but #13 (comment) talked about a third semantic: caption=text,entry=none.

@lvjr lvjr changed the title Support for tblr* environment Support verbatim environments in the table (similar to tabu*) Feb 22, 2024
@lvjr lvjr changed the title Support verbatim environments in the table (similar to tabu*) Support verbatim environments in the table Feb 22, 2024
@lvjr
Copy link
Owner

lvjr commented Feb 22, 2024

I have edited the title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants