TeX - LaTeX Asked on September 27, 2021
I am still learning about nicematrix package. In this case, I want insert figures inside a NiceTabular and if it is possible, they have vertical centering and be at the same level to the text of the cell.
I tried with NiceTabular and pNiceArray but I don’t obtain elegant results. Or I should use another packages? Thanks for your attention!
I attach my code and a couple of images.
Code:
documentclass[10pt,a4paper]{report}
usepackage[utf8]{inputenc}
usepackage[spanish]{babel}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
usepackage[svgnames,x11names]{xcolor}
usepackage{makecell}
usepackage{nicematrix} %Paquete bonito para tablas, matrices y arreglos
usepackage{tikz} %Permite usar block (multicolumnas o multirenglones en este paquete)
usepackage{booktabs} %Para utilizar comandos de tablas elegantes
begin{table}
centering
%NiceMatrixOptions{cell-space-top-limit=4pt, cell-space-bottom-limit=4pt}
begin{NiceTabular}{Wc{2cm}ll}
toprule
Block{2-3}{smallskip makecell{Área deIconos} includegraphics[scale=0.3]{barra_icn.png} } & &
& &
midrule
Block{4-1}{Función} & &
&includegraphics[scale=0.5]{nuevo.png} Nuevo & includegraphics[scale=0.5]{abrir.png} Abrir
&includegraphics[scale=0.5]{guardar_como.png} Guardar como & includegraphics[scale=0.5]{guardar.png} Guardar
& includegraphics[scale=0.5]{borrar.png} Borrar & includegraphics[scale=0.5]{deshacer.png} Deshacer/Cancelar
& includegraphics[scale=0.5]{rehacer.png} Rehacer/Revisar & includegraphics[scale=0.5]{ajustes.png} Ajustes
bottomrule
end{NiceTabular}
end{table}
NiceTabular
?adjustimage
defined in the adjustbox
package you can obtain the following table:documentclass[a4paper]{report}
usepackage[spanish]{babel}
usepackage{amsmath, amssymb}
usepackage[margin=2cm]{geometry}
usepackage[demo, % in real document remove "demo" option
export]{adjustbox} % for vertical centering ofimages
usepackage[svgnames,x11names]{xcolor}
usepackage{booktabs, makecell, multirow}
usepackage{nicematrix} %Paquete bonito para tablas, matrices y arreglos
usepackage{tikz} %Permite usar block (multicolumnas o multirenglones en este paquete)
begin{document}
begin{table}
centering
adjustboxset{height=2cm, width=2cm, % adjust images size according to your needs
valign=c, margin=3pt}
begin{tabular}{>{bfseries}Wc{2cm} l l }
toprule
makecell{Área deIconos} & multicolumn{2}{c}{adjustimage{width=8cm, height=1cm}{barra_icn}}
midrule
multirow{17}{*}{Función}
& adjustimage{}{nuevo} Nuevo
& adjustimage{}{abrir} Abrir
%addlinespace
& adjustimage{}{guardar_como} Guardar como
& adjustimage{}{guardar} Guardar
%addlinespace
& adjustimage{}{borrar} Borrar
& adjustimage{}{deshacer} Deshacer/Cancelar
%addlinespace
& adjustimage{}{rehacer} Rehacer/Revisar
& adjustimage{}{ajustes} Ajustes
bottomrule
end{tabular}
end{table}
end{document}
Addendum
Similar result you can obtain with se of the recent version of the nicematrix
package, however with it you need to compile MWE twice:
documentclass[a4paper]{report}
usepackage[spanish]{babel}
usepackage{amsmath, amssymb}
usepackage[margin=2cm]{geometry}
usepackage[demo,
export]{adjustbox}
usepackage[svgnames,x11names]{xcolor}
usepackage{booktabs, makecell}
usepackage{nicematrix} %Paquete bonito para tablas, matrices y arreglos
%usepackage{tikz} %Permite usar block (multicolumnas o multirenglones en este paquete)
begin{document}
begin{table}
centering
setkeys{Gin}{height=2cm, width=2cm}
NiceMatrixOptions{cell-space-top-limit=3pt, cell-space-bottom-limit=3pt}
begin{NiceTabular}{>{bfseries}Wc{2cm} l l }
toprule
makecell{Área deIconos} & multicolumn{2}{c}{includegraphics[width=8cm, height=1cm,
valign=c]{barra_icn}}
midrule
Block{4-1}{textbf{Función}}
& includegraphics[valign=c]{nuevo} Nuevo
& includegraphics[valign=c]{abrir} Abrir
%addlinespace
& includegraphics[valign=c]{guardar_como} Guardar como
& includegraphics[valign=c]{guardar} Guardar
%addlinespace
& includegraphics[valign=c]{borrar} Borrar
& includegraphics[valign=c]{deshacer} Deshacer/Cancelar
%addlinespace
& includegraphics[valign=c]{rehacer} Rehacer/Revisar
& includegraphics[valign=c]{ajustes} Ajustes
bottomrule
end{NiceTabular}
end{table}
end{document}
Correct answer by Zarko on September 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP