2

While trying to compose some kind of "wanted poster" (Steckbrief), I could not get rid of the vertical spacing LaTeX automatically introduces! Here's an MWE, which should work on Linux/Mac OS with --shell-escape enabled, though I needed to run it twice. I chose this variant since I didn't want to, and even couldn't upload personal photos.

% arara: pdflatex: {shell: yes}
% arara: pdflatex: {synctex: yes}

%% MWE to show a problem with pictures and text in tabu
\documentclass[paper=a4, oneside, fontsize=12pt]{scrartcl}

\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[ngerman, english]{babel}
\parindent3mm

%% page geometry
\usepackage[a4paper, left=30mm, right=30mm,
 top=25mm, bottom=30mm]{geometry}

%% Selection of the fonts
\usepackage{bookman}
\usepackage[final]{microtype}
\overfullrule=1mm

%% to get 1.5 line spacing (Actually 1.25)
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{5mm}

%% For the tables!
\usepackage{tabu, longtable, booktabs}
%\usepackage{multirow}
\usepackage{graphicx}

\begin{document}

\title{MWE to show a problem with pictures and text in tabu}
\author{rotton}
\date{\today}

\maketitle

%% load the pictures from the web, if necessary
\IfFileExists{./DonEK.jpg}
{}
{
    \write18{wget -O ./DonEK.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/KnuthAtOpenContentAlliance.jpg/406px-KnuthAtOpenContentAlliance.jpg?download}
}
\IfFileExists{./LeslieL.jpg}
{}
{
    \write18{wget -O ./LeslieL.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Leslie_Lamport.jpg/377px-Leslie_Lamport.jpg?download}
}

%% Construction of the table itself
\tabulinesep=2pt
\extrarowsep=2pt
\begin{tabu}{X[c] X[2,l] X[2,l]}  %% 3 columns, width ratio 1:2:2
\toprule
\includegraphics[width=0.16\textwidth]{DonEK} Donald E. Knuth &
%\vspace{-6em}
\underline{Deutsch}
\begin{itemize}
\item Erfinder \textit{(und etwas mehr Text)}
\item von
\item \TeX
\end{itemize} &
\underline{English}
\begin{itemize}
\item Inventor \textit{(and some more text)}
\item of
\item \TeX
\end{itemize} \\
\midrule
\includegraphics[width=0.16\textwidth]{LeslieL} Leslie Lamport &
\underline{Deutsch}
\begin{itemize}
\item veröffentlichte Makros und Hilfsprogramme zum einfachen Umgang mit \TeX
\item ==> \LaTeX
\end{itemize} &
\underline{English}
\begin{itemize}
\item published macros and auxiliary programs for easy handling of \TeX
\item ==> \LaTeX
\end{itemize} \\
\bottomrule
\end{tabu}

\end{document}

The output looks like this: The red arrows (added manually) highlight the vertical space which I want to get rid of

As you can see, there's a large vertical offset between the text in the second and third column, compared to the photos. I manually added some red arrows to highlight this. How to get rid of that space? I know I can manually introduce a negative vertical space (line 58, commented out), but that seems very unTeXnical to me! (An alternative would be to use TikZ, but that's really another story.)

2

Add \usepackage[export]{adjustbox} and use

\includegraphics[width=0.16\textwidth,valign=t]{DonEK}

Example:

\documentclass[paper=a4, oneside, fontsize=12pt]{scrartcl}

\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[ngerman, english]{babel}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\parindent3mm

%% page geometry
\usepackage[a4paper, left=30mm, right=30mm,
 top=25mm, bottom=30mm]{geometry}

%% Selection of the fonts
\usepackage{bookman}
\usepackage[final]{microtype}
\overfullrule=1mm

%% to get 1.5 line spacing (Actually 1.25)
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{5mm}

%% For the tables!
\usepackage{tabu, longtable, booktabs}
%\usepackage{multirow}

\begin{document}

\title{MWE to show a problem with pictures and text in tabu}
\author{rotton}
\date{\today}

\maketitle

%% load the pictures from the web, if necessary
\IfFileExists{./DonEK.jpg}
{}
{
    \write18{wget -O ./DonEK.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/KnuthAtOpenContentAlliance.jpg/406px-KnuthAtOpenContentAlliance.jpg?download}
}
\IfFileExists{./LeslieL.jpg}
{}
{
    \write18{wget -O ./LeslieL.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Leslie_Lamport.jpg/377px-Leslie_Lamport.jpg?download}
}

%% Construction of the table itself
\tabulinesep=2pt
\extrarowsep=2pt
\begin{tabu}{X[c] X[2,l] X[2,l]}  %% 3 columns, width ratio 1:2:2
\toprule
\includegraphics[width=0.16\textwidth,valign=t]{DonEK} Donald E. Knuth &
%\vspace{-6em}
\underline{Deutsch}
\begin{itemize}
\item Erfinder \textit{(und etwas mehr Text)}
\item von
\item \TeX
\end{itemize} &
\underline{English}
\begin{itemize}
\item Inventor \textit{(and some more text)}
\item of
\item \TeX
\end{itemize} \\
\midrule
\includegraphics[width=0.16\textwidth,valign=t]{LeslieL} Leslie Lamport &
\underline{Deutsch}
\begin{itemize}
\item veröffentlichte Makros und Hilfsprogramme zum einfachen Umgang mit \TeX
\item ==> \LaTeX
\end{itemize} &
\underline{English}
\begin{itemize}
\item published macros and auxiliary programs for easy handling of \TeX
\item ==> \LaTeX
\end{itemize} \\
\bottomrule
\end{tabu}

\end{document}

enter image description here

1

You can do that with a simple \raisebox command:

\documentclass[paper=a4, oneside, fontsize=12pt]{scrartcl}

\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[ngerman, english]{babel}
\parindent3mm

%% page geometry
\usepackage[a4paper, left=30mm, right=30mm,
 top=25mm, bottom=30mm]{geometry}

%% Selection of the fonts
\usepackage{bookman}
\usepackage[final]{microtype}
\overfullrule=1mm

%% to get 1.5 line spacing (Actually 1.25)
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{5mm}

%% For the tables!
\usepackage{tabu, longtable, booktabs}
%\usepackage{multirow}
\usepackage[demo]{graphicx}
\usepackage{multirow, makecell}

\begin{document}

\title{MWE to show a problem with pictures and text in tabu}
\author{rotton}
\date{\today}

\maketitle

%% load the pictures from the web, if necessary
\IfFileExists{./DonEK.jpg}
{}
{
    \write18{wget -O ./DonEK.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/KnuthAtOpenContentAlliance.jpg/406px-KnuthAtOpenContentAlliance.jpg?download}
}
\IfFileExists{./LeslieL.jpg}
{}
{
    \write18{wget -O ./LeslieL.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Leslie_Lamport.jpg/377px-Leslie_Lamport.jpg?download}
}

%% Construction of the table itself
\tabulinesep=2pt
\extrarowsep=2pt
\begin{tabu}{X[c] X[2,l] X[2,l]} %% 3 columns, width ratio 1:2:2
\toprule
\raisebox{-\height}[0pt][1.1\height]{\includegraphics[width=0.16\textwidth]{DonEK}} Donald E. Knuth &
%\vspace{-6em}
\underline{Deutsch}
\begin{itemize}
\item Erfinder \textit{(und etwas mehr Text)}
\item von
\item \TeX
\end{itemize} &
\underline{English}
\begin{itemize}
\item Inventor \textit{(and some more text)}
\item of
\item \TeX
\end{itemize} \\
\midrule
\raisebox{-\height}[0pt][1.1\height]{\includegraphics[width=0.16\textwidth]{LeslieL}} Leslie Lamport &
\underline{Deutsch}
\begin{itemize}
\item veröffentlichte Makros und Hilfsprogramme zum einfachen Umgang mit \TeX
\item ==> \LaTeX
\end{itemize} &
\underline{English}
\begin{itemize}
\item published macros and auxiliary programs for easy handling of \TeX
\item ==> \LaTeX
\end{itemize} \\
\bottomrule
\end{tabu}

\end{document} 

enter image description here

0

Although the provided answers generally work, I ended up using TikZ for it's greater flexibility. The somehow complicated-looking part with the \mycasenode command was necessary to get the text top-aligned. Here's the code:

% arara: pdflatex: {shell: yes}
% arara: pdflatex: {synctex: yes}

%% MWE to show an alternative solution for a problem with pictures and text in tabu
\documentclass\[paper=a4, oneside, fontsize=12pt\]{scrartcl}

%% da Bericht auf Deutsch:
\usepackage\[utf8\]{inputenx}
\usepackage\[T1\]{fontenc}
\usepackage{textcomp}
\usepackage\[ngerman\]{babel}

%% page geometry
\usepackage\[a4paper, left=30mm, right=30mm,
 top=20mm, bottom=30mm\]{geometry}
%\usepackage{showframe}

%% Selection of the fonts
\usepackage{bookman}
\usepackage\[final\]{microtype}
\overfullrule=1mm

%% to get 1.5 line spacing (Actually 1.25)
\usepackage{setspace}
\onehalfspacing
\parindent0mm

%% For the tables!
\usepackage{tabu, longtable, booktabs}
%\usepackage{multirow}
\usepackage{graphicx}
\usepackage\[export\]{adjustbox}

%% for the whole Tikz stuff
\usepackage{multicol}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart, shapes.misc, matrix, positioning}

\tikzstyle{fotobox}=\[
    rectangle, rounded corners=1mm,
    draw=black, very thick,
    text centered, text width=\textwidth*1/5\]

\tikzstyle{textbox}=\[
    rectangle, rounded corners=1mm,
    draw=black, very thick,
    text width=\textwidth*2/5-8mm\]

\tikzstyle{textbox2}=\[
    rectangle, rounded corners=1mm,
    draw=black, very thick,
    text width=\textwidth*2/5-6mm,
    append after command={node\[anchor=north west, minimum height=5mm, text width=\textwidth*2/5-6mm\]
    at (\tikzlastnode.north west){#1}}\]

\def\mycasenode(#1)\[#2\]#3;{\node (#1) \[textbox2={#3}, #2\] {};}

\newcommand*{\knuthDe}{
\underline{Deutsch}
\begin{itemize}
\item Erfinder \textit{(und etwas mehr Text)}
\item von
\item \TeX
\item TW: \the\textwidth
\end{itemize}
}

\newcommand*{\knuthEng}{
\underline{English}
\begin{itemize}
\item Inventor \textit{(and some more text)}
\item of
\item \TeX
\end{itemize}
}

\newcommand*{\lamportDe}{
\underline{Deutsch}
\begin{itemize}
\item veröffentlichte Makros und Hilfsprogramme zum einfachen Umgang mit \TeX
\item $\Longrightarrow$ \LaTeX
%\item Erhielt 2013 den Turing Award für seine Beiträge zur Theorie und Praxis verteilter und nebenläufiger Systeme
\end{itemize}
}

\newcommand*{\lamportEng}{
\underline{English}
\begin{itemize}
\item published macros and auxiliary programs for easy handling of \TeX
\item $\Longrightarrow$ \LaTeX
\end{itemize}
}

\begin{document}

\title{An alternative solution (using TikZ) for a problem with pictures and text in tabu}
\author{rotton}
\date{\today}

\maketitle

%% load the pictures from the web, if necessary
\IfFileExists{./DonEK.jpg}
{}
{
    \write18{wget -O ./DonEK.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/KnuthAtOpenContentAlliance.jpg/406px-KnuthAtOpenContentAlliance.jpg?download}
}
\IfFileExists{./LeslieL.jpg}
{}
{
    \write18{wget -O ./LeslieL.jpg https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Leslie_Lamport.jpg/377px-Leslie_Lamport.jpg?download}
}

%% Don E Knuth
\begin{tikzpicture}\[minimum height=55mm, node distance=5mm and 5mm\]
\node(bild1)\[fotobox, \] at (0,0)
{\includegraphics\[width=30mm\]{DonEK} \\ Donald E.\ Knuth};
%\node(knuthDe)\[textbox, text width=\textwidth-53mm, right=1mm of bild1.north east, anchor=north west\]{\knuthDe};
\mycasenode(knuthDe)\[right=1mm of bild1.north east, anchor=north west\]{\knuthDe};
\mycasenode()\[right=1mm of knuthDe.north east, anchor=north west\]{\knuthEng};
%\node()\[textbox, right=1mm of bende.north east, anchor=north west\]{\knuthEng};
%\end{tikzpicture}
%
%% Leslie Lamport
%\begin{tikzpicture}\[minimum height=55mm, node distance=0mm and 5mm\]
\node(bild2)\[fotobox, below=of bild1.south west, anchor=north west\]
{\includegraphics\[width=30mm\]{LeslieL} \\ Leslie Lamport};
\mycasenode(lamportDe)\[right=1mm of bild2.north east, anchor=north west\]{\lamportDe};
\mycasenode()\[right=1mm of lamportDe.north east, anchor=north west\]{\lamportEng};
\end{tikzpicture}

\end{document}

Alternative solution using TikZ

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.