How to correct insert an image in some X
cell that its width is determined by cell widths?
\documentclass{article}
\usepackage{geometry}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\setlength\parindent{0pt}
\begin{document}
case 1:
\begin{center}
\adjustboxset{height=0.15\textwidth, % determined by trial
keepaspectratio,
valign=M}
\begin{tblr}{hlines, vlines,
colspec={X[0.6,l,m] *{3}{X[1,c,m]}},
rowsep=4pt,
}
some description of images
& \adjincludegraphics{example-image-duck}
& \adjincludegraphics{example-image-duck}
& \adjincludegraphics{example-image-duck} \\
\end{tblr}
\end{center}
case 2:
\begin{center}
\adjustboxset{width=\linewidth,
keepaspectratio,
valign=M}
\begin{tblr}{hlines, vlines,
colspec={X[0.6,l,m] *{3}{X[1,c,m]}},
rowsep=4pt,
}
some description of images
& \adjincludegraphics{example-image-duck}
& \adjincludegraphics{example-image-duck}
& \adjincludegraphics{example-image-duck} \\
\end{tblr}
\end{center}
\end{document}
In the first case the result is as desired, but in the second case are inserted huge space above and below images. The writing table as shown in the first case (where are explicit determined height of image by guessing) is quite annoying, so the second case (where is width of images defined by width of columns) is preferable way to write of table, but result is terrible. I would like that in the second case the result of MWE is the same as it is at the first case.
So the question is, why at the second case code doesn't gives the same result as at the first case
If in the second case one use tabularx
table, such problem doesn't arise, even more in such a case for nice result some small vertical space should be added. I expect, that similar situation will happen at tabularray
too.
Do I miss something at tabularray
settings or this is bug or it does not yet have this property?
Best Answer
See https://github.com/lvjr/tabularray/issues/80
When at first we meaure cell widths,
\linewidth
is equal to\textwidth
. But when later we typeset cells with\parbox
,\linewidth
is equal to the computed column width. These differences cause the problem. The solution is to reset@row-height
after adjusting widths forX
columns.This bug has been fixed. You may download the latest package file from
https://github.com/lvjr/tabularray/raw/main/tabularray.sty
or wait for the next version
2021N
scheduled on September 1st.