1

I am currently writing an internship report, and trying to sum up some information in a wide table. So far, I got this (table is wider in my doc, but width is not an issue here) :

\documentclass[11pt,fleqn,english]{report}
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{lscape,pdflscape,rotating}
\usepackage{tabularx,float,makecell,hhline,longtable}
\usepackage[longtable]{multirow}

\usepackage{cellspace} \setlength\cellspacetoplimit{4pt} \setlength\cellspacebottomlimit{4pt}

\begin{document}

\begin{landscape} \begin{longtable}{||c|c|l|l|l||} \hhline{|t:=====:t|} \textit{\textbf{V}} & \textbf{Photo} & \multicolumn{1}{c|}{\textbf{Specifications}} & \multicolumn{1}{c|}{\textbf{Pros}} & \multicolumn{1}{c||}{\textbf{Cons}} \endfirsthead \hline \textit{1} & \includegraphics[height=0.11\textheight]{SQUARE.PNG} & \begin{tabular}[c]{@{}l@{}}Spec. 1\Moderately long description\end{tabular} & \begin{tabular}[c]{@{}l@{}}Simple\Easy to make and build\end{tabular} & \begin{tabular}[c]{@{}l@{}}Sharp edges\Basic\end{tabular} \ \hline \textit{2} & \includegraphics[height=0.15\textwidth]{LONG.PNG} & \begin{tabular}[c]{@{}l@{}}Blablabla\blablablablabla\end{tabular} & \begin{tabular}[c]{@{}l@{}}Blablabla\Blablabla\Blablablablabla\end{tabular} & \begin{tabular}[c]{@{}l@{}}Short bla\Not working\end{tabular} \ \hline \textit{3} & \includegraphics[width=0.1\textheight]{WIDE.PNG} & Tested : size, shape, other feature & \begin{tabular}[c]{@{}l@{}}Very nice shape\2 is barely enough\end{tabular} & \begin{tabular}[c]{@{}l@{}}Wrong shape tho\Goodn't\end{tabular} \ \hline \multicolumn{1}{||l|}{\textit{4}} & \multicolumn{1}{l|}{\includegraphics[width=0.1\textheight]{SQUARE.PNG}} & \begin{tabular}[c]{@{}l@{}}Tested : new shape\Big thingie\end{tabular} & \begin{tabular}[c]{@{}l@{}}Optimized funct.\Stronk part\Very good color\end{tabular} & Wrong scale \ \hline \multicolumn{1}{||l|}{\textit{5}} & \multicolumn{1}{l|}{\includegraphics[width=0.1\textheight]{WIDE.PNG}} & Tested : Adam Savage & Idem & Oversized \ \hline \multicolumn{1}{||l|}{\textit{6}} & \multicolumn{1}{l|}{\includegraphics[width=0.1\textheight]{WIDE.PNG}} & Meant to be last try & Idem & Actual failure \ \hline \multicolumn{1}{||l|}{\textit{7}} & \multicolumn{1}{l|}{\includegraphics[width=0.1\textheight]{SQUARE.PNG}} & Opening mecanism & Soft opening & Unable to be built \ \hhline{|b:=====:b|} \caption{Part versioning.} \label{tab:PartTable} \end{longtable} \end{landscape}

\end{document}

Giving us :

Code result

We can see that :

  • When we use the tabular environment in a cell to be able to write on several lines, the content in the cell of the 2nd column (on the same line than the tabular usage) cannot be vertically centered in the cell. It looks like it is only being display on the first line of the tabular environment ;
  • Those pictures are overlapping the cell's horizontal lines ;
  • Again, when we use the tabular environment, the text does not vertically center ;

What I precisely want is described as below :

  • Headline to be horizontally centered ;
  • First two columns (number and picture) to be horizontally (and vertically) centered ;
  • All the other text (from line 2, col 3 "Spec. 1" to bottom right "Unable to be built") to be vertically centered and aligned on the left ;
  • Picture not to get over the table's lines ;
  • If possible, I would love to see the same margin over and under each picture, speaking about dimensions.

I have been looking through quite a lot of (already asked) questions, including those from NAASI, Michael, Jsg91, etc. and did not find a suitable solution to my problem.

I am fully aware that I might have missed a lot of things, either on the forum or on the internet in general, so I would totally understand a simple redirection to a related and very similar question. Any help would be highly appreciated, whether it is a suggestion, a full correction, a short comment or just a full another code compiling into the described result.

Thanks in advance, and have a lovely day. <3

Marck

Marck
  • 147
  • 7

1 Answers1

0

The following may serve as a point to start from:

enter image description here

\documentclass[11pt]{report}
\usepackage{pdflscape}
\usepackage{makecell,hhline,longtable}

\usepackage[column=0]{cellspace} \newcommand{\imageborder}{2pt} \setlength\cellspacetoplimit{\imageborder} \setlength\cellspacebottomlimit{\imageborder}

\usepackage[export]{adjustbox} \usepackage{xltabular} \renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}

\begin{landscape} \begin{xltabular}{\linewidth}{||c|@{\hspace{\imageborder}}0c@{\hspace{\imageborder}}|X|X|X||} \hhline{|t:=====:t|} \textit{\textbf{V}} & \textbf{Photo} & \multicolumn{1}{c|}{\textbf{Specifications}} & \multicolumn{1}{c|}{\textbf{Pros}} & \multicolumn{1}{c||}{\textbf{Cons}} \endfirsthead \hline \textit{1} & \includegraphics[width=2cm, valign=c]{example-image} & Spec. 1\newline Moderately long description & Simple Easy to make and build & Sharp edges\newline Basic \ \hline \textit{2} & \includegraphics[width=2cm, valign=c]{example-image-10x16} & Blablabla blablablablabla & Blablabla\newline blablablablabla & Short bla\newline Not working \ \hhline{|b:=====:b|} \caption{Part versioning.} \label{tab:PartTable} \end{xltabular} \end{landscape}

\end{document}

leandriis
  • 62,593
  • Thank you very much @leandriis ! I believe I do not need my tabularx package anymore then, right ? And if I have some other tables in the document, do I have to change them all to xltabular instead of having longtable or tabular ? – Marck May 31 '23 at 07:45
  • ok so I have been dealing with a bunch of errors while compiling your code, but it's finally working now, so thanks a lot ! I do not know what I did wrong : I was having a lot of Extra alignment tab has been changed to \cr.<recently read> \endtemplate errors, but managed to get rid of them all anyway. – Marck Jun 01 '23 at 15:22