fpantigny / nicematrix

The LaTeX package nicematrix
0 stars 1 forks source link

Adding an option key for images alignment in tables #3

Open Basmah1961 opened 2 weeks ago

Basmah1961 commented 2 weeks ago

image

I think it is also good to add a key so align text baseline to the middle of the image

\documentclass[11pt, a4paper]{article}

\usepackage{adjustbox}

\usepackage{nicematrix}

\begin{document}

\noindent%
\begin{NiceTabularX}{\linewidth}[rules/color=[gray]{0.75}, hvlines, cell-space-limits=0pt]{@{}l X[l, t] X[l, t]@{}}

    \RowStyle[bold]{}
    Header 1
    & Header 2   
    & Header 3
    \\

    Description
    & The quick brown fox jumps over the lazy dog 
    & The quick brown fox jumps over the lazy dog 
    \\

    \smash{{\rlap{\raisebox{0pt}{\rule{\dimexpr \textwidth \relax}{0.1pt}}}}}%
    \Block[t]{1-1}{Text 1 \\ Text 2 \\ Text 3 \\ Text 4}
    & \adjincludegraphics[valign=t, width=\linewidth, margin=0pt 0pt 0pt 0pt]{example-image-a} 
    & \adjincludegraphics[valign=t, width=\linewidth, margin=0pt 0pt 0pt 0pt]{example-image-b}
    \\

\end{NiceTabularX}

\end{document}
fpantigny commented 2 weeks ago

It's possible by using valign=c instead of valign=t in the instructions \adjincludegraphics.