TeX - LaTeX Asked by Moreblue on December 1, 2020
I am currently writing a table with longtable
environment, and would like to insert a picture within a cell and vertically center-align it. However, my try ends up as follows:
So what I would like to do is as follows:
—
The above table was generated using the following code:
documentclass[fontsize=12bp]{article}
usepackage[table,xcdraw]{xcolor}
usepackage{multirow}
usepackage{lipsum}
usepackage{longtable}
usepackage{graphicx}
usepackage{geometry}
usepackage{float}
usepackage{helvet}
renewcommand{familydefault}{sfdefault}
begin{document}
begin{longtable}{|ccc|}
hline
rowcolor[HTML]{C0C0C0}
multicolumn{1}{c}{large textbf{Column1} } & multicolumn{1}{c}{large textbf{Column2}} & multicolumn{1}{c}{large textbf{Column3}} hline endhead
multicolumn{1}{|c|}{} & multicolumn{1}{l|}{begin{minipage}{0.5textwidth} medskip scriptsize lipsum[4] medskip end{minipage}} & cline{2-2}
multicolumn{1}{|c|}{multirow{-4}{*}{Large Name1}} &
multicolumn{1}{l|}{begin{minipage}{0.5textwidth} medskip scriptsize lipsum[2] medskip end{minipage}} &
multirow{-10}{*}{begin{minipage}{0.4textwidth}
begin{figure}[H]{center includegraphics[keepaspectratio=true, width=linewidth]{figures/human.png}} end{figure} end{minipage}} hline
end{longtable}
end{document}
How should I put this boy within the cell while keeping his aspect? Any help will be appreciated.
Something like this?
minipage
or similar box environmentincludegraphics[width=<length>]{<image-file>}
is keeps own aspect ratiominipage
in cells is better to define column type p{<width>}
multirow
in the last column you can use option defined in recent multirow
package: {=}
documentclass[fontsize=12bp]{article}
usepackage{geometry}
usepackage{helvet}
renewcommand{familydefault}{sfdefault}
usepackage[table,xcdraw]{xcolor}
usepackage{array, multirow, longtable}
usepackage{lipsum}
usepackage{graphicx}
begin{document}
begin{longtable}{|c
|>{scriptsize}p{0.4textwidth}
|p{0.5textwidth}|}
hline
rowcolor[HTML]{C0C0C0}
multicolumn{1}{c}{large textbf{Column1} }
& multicolumn{1}{c}{large textbf{Column2}}
& multicolumn{1}{c}{large textbf{Column3}}
hline
endhead
multicolumn{1}{|c|}{}
& lipsum[4]
&
cline{2-2}
multirow{-1}{*}{Large Name1}
& scriptsize lipsum[2]
& multirow{-6.2}{=}{includegraphics[width=linewidth]{example-image-duck}}
hline
end{longtable}
end{document}
Correct answer by Zarko on December 1, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP