0

This information probably exists in many places but unfortunately I couldn't find it.

In a table's format (using tabular and the array package) I can specify @{\kern5pt} if I wish to modify space added between cells.

But how can I do this by maintaining the vertical rule?

Is there some way to insert the equivalent of the vertical rule | inside @{…} so that I do get a vertical rule between the two cells, and such that it works just like |? (arbitrary height fitting the cell's height).

When I write

\begin{tabular}{c@{\kern3pt$|$\kern3pt}c|c}\hline
$\displaystyle\int f(x)dx$ blabla & blabla & blabla\\
$\displaystyle\int f(x)dx$ blabla & blabla & blabla\\\hline
\end{tabular}

enter image description here

I do get vertical rules between the 1st and the 2nd column, but they are small rules, not flexible ones like between the second and the third column, which fill the whole height of the table.

Is there some command that I can insert inside the @{…} so that I get the same result between column 1 and column 2, as between column 2 and column 3?

2
  • 1
    \vline instead of | ? Why you should do this? Defining common \tabcolsep is not an option?
    – Zarko
    Feb 3, 2022 at 11:56
  • Great Zarko, that's the command I was looking for. Thanks!
    – yannis
    Feb 3, 2022 at 12:04

3 Answers 3

2

There is no need to do it inside the @{} as you can add more than one declaration between tabular columns:

\documentclass{article}
\begin{document}
\begin{tabular}{c@{\kern3pt}|@{\kern3pt}c|c}\hline
$\displaystyle\int f(x)dx$ blabla & blabla & blabla\\
$\displaystyle\int f(x)dx$ blabla & blabla & blabla\\\hline
\end{tabular}
\end{document}

enter image description here

2
  • I haven't thought of that (always thought that @{} is replacing space between cells, not that it could be combined with |), thanks!
    – yannis
    Feb 3, 2022 at 12:03
  • 1
    @yannis, you can upvote answer too :-)
    – Zarko
    Feb 3, 2022 at 12:14
2

Reduce \tabcolsep on one side of column is simple to achieve by use of the tabularray package. Using it you will have benefit with spacing nodes' contents too:

\documentclass[border=3.141592]{standalone}
\usepackage{tabularray}   % <--- new
\UseTblrLibrary{amsmath}

\begin{document}
\begin{tblr}{colspec = {Q[r,$$]| c | c},
             column{1} = {rightsep+=-3pt},
             column{2} = {leftsep+ =-3pt},
             }
    \hline
\int f(x)dx \text{ blabla} & blabla & blabla\\
\int f(x)dx \text{ blabla} & blabla & blabla\\
    \hline
\end{tblr}
\end{document}

enter image description here

However, you can change your code fragment to:

\documentclass[border=3.141592]{standalone}

\begin{document}
\begin{tabular}{c@{\kern3pt \vline \kern3pt}c|c}\hline
$\displaystyle\int f(x)dx$ blabla & blabla & blabla\\
$\displaystyle\int f(x)dx$ blabla & blabla & blabla\\\hline
\end{tabular}
\end{document}

and get

enter image description here

2

For tabularray package, there is a secret optional argument for column type < and > to set rightsep and leftsep, respectively.

\documentclass{article}

\usepackage{tabularray}

\begin{document}

\begin{tblr}{c <[3pt]{} | >[3pt]{} c | c}
\hline
  $\displaystyle\int f(x)dx$ blabla & blabla & blabla \\
  $\displaystyle\int f(x)dx$ blabla & blabla & blabla \\
\hline
\end{tblr}

\end{document}

enter image description here

2
  • I hate secrets 😜, however thank you very much for info. +1, but please add this secrets in package documentation for version 2022A.
    – Zarko
    Feb 3, 2022 at 14:07
  • maybe not in next version, but definitely I will add it some day.
    – L.J.R.
    Feb 4, 2022 at 1:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .