0

I am having trouble vertically centering the first row to be in the middle of the pictures. I have tried:

  1. \raisebox{-.5\height}{\includegraphics
  2. raisebox{\dimexpr-.5\height+.5\ht\strutbox\relax} {\includegraphics
  3. \adjustbox{valign=m}

Problem with these were that they had no vertical empty space left between the rows...do you know how to fix this?

Or should I use another tactic to center the first row?

Thanks a lot guys!

a picture of my output

\begin{longtable}{@{\extracolsep{\fill}}c c c c c r@{}}\toprule

Var. & Aufnahme & Positionierung & Ausrichtung-Drehung Y & Führung X&Y & Anschlag X&Y \ \midrule\[3pt]

1 & {\includegraphics[width=1in]{Projekte/LV1.jpeg}} & {\includegraphics[width=1in]{Projekte/IMG_6228.jpg}}
&
&
& \

2 & {\includegraphics[width=1in]{Projekte/LV2.jpeg}} & {\includegraphics[width=1in]{Projekte/IMG_6235.jpg}} &
&
& \

3 & {\includegraphics[width=1in]{Projekte/LV3.jpeg}} & {\includegraphics[width=1in]{Projekte/IMG_6236.jpg}} &
&
& \

4 & {\includegraphics[width=1in]{Projekte/LV4.jpeg}} &
&
&
& \

5 & {\includegraphics[width=1in]{Projekte/LV5.jpeg}} &
&
&
& \

6 & {\includegraphics[width=1in]{Projekte/LV6.jpeg}} &
&
&
& \

7 & {\includegraphics[width=1in]{Projekte/LV7.jpeg}}& & & & \ 8 & {\includegraphics[width=1in]{Projekte/LV8.jpeg}}& & & & \

  \hline

\end{longtable}

  • Welcome to TeX SX! Try with the cellspacepackage, which lets you define minimal vertical spacing at the top and bottom of cells in columns with specifier prefixed with the letter S (or C if you load siunitx). – Bernard Nov 20 '20 at 23:29
  • @GiovanniGorza -- please see if the answer meets the requirement -- you could off course experiment with the textwidth and linewidth to taste – js bibra Nov 21 '20 at 01:37

2 Answers2

1

With use of adjustbox packages is just fine. Assuming that all columns except the first contain images of the same width, then your table can be written as follows:

\documentclass[a4paper]{scrreprt}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage[T1]{fontenc} \usepackage[ngerman,english]{babel} \usepackage{booktabs, longtable, makecell} \usepackage[export]{adjustbox} % it load graphicx too

\begin{document}

\begingroup \setlength\tabcolsep{3pt} \adjustboxset{width=0.17\linewidth,valign=c, margin=0pt 3pt 0pt 3pt} \begin{longtable}{@{} *{6}{c} @{}} Var. & Aufnahme & Positionierung & \makecell{Ausrichtung-\Drehung Y} & \makecell{Führung\ X&Y} & \makecell{Anschlag\ X&Y} \ \toprule 1 & \adjustimage{}{example-image-a} & \adjustimage{}{example-image-b} & \adjustimage{}{example-image-c} & %\adjustimage{}{example-image}
& %\adjustimage{}{example-image}
\ 2 & \adjustimage{}{example-image-a} & \adjustimage{}{example-image-b} & \adjustimage{}{example-image-c} & \adjustimage{}{example-image} & \adjustimage{}{example-image} \ \bottomrule \end{longtable} \endgroup \end{document}

which gives:

enter image description here

(red lines indicate page layout)

In cases, when last five columns in the table not contain images, those columns will adopt to cells content.

Zarko
  • 296,517
0

Does this serve the purpose -- as adapted from --

https://tex.stackexchange.com/a/457216/197451

enter image description here

\documentclass[a4paper]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{graphicx}

\newcommand{\lowincludegraphics}[2][]{% \raisebox{-0.7\dp\strutbox}{\includegraphics[#1]{#2}}% }

\begin{document}

\begin{longtable}{ c m{0.4\textwidth} m{0.4\textwidth} } Index & \multicolumn{1}{c}{Figure1} & \multicolumn{1}{c}{Figure2} \ \toprule 1 & \lowincludegraphics[width=\linewidth]{example-image-a} & \lowincludegraphics[width=\linewidth]{example-image-a} \ \bottomrule \end{longtable}

\end{document}

js bibra
  • 21,280