1

I want text in bullet-form next to figures showing what's going on. I thought creating a table, was the easiest way to do so. When entering text in the first column and inserting figures in the second column, the figures start from the top and the text starts from the bottom. I want the text to also start from the top. Now it looks like this:

enter image description here

I have tried to look elsewhere for solutions, but didn't find anything useful: https://en.wikibooks.org/wiki/LaTeX/Tables
http://www.andy-roberts.net/writing/latex/tables

or understandable:

How to vertically and horizontally centre text and images in (different) table cells?

I think this last one comes close, but I can't make it work for me. What I end up with is this:

enter image description here
Which is close, but then there is this giant gap at the bottom to the next row.

My preamble looks something like this:

\documentclass[a4paper,11pt,oldfontcommands]{memoir} 
\setlrmarginsandblock{2.5cm}{1.5cm}{1} 
\setulmarginsandblock{2.5cm}{*}{1} 
\setheadfoot{2\onelineskip}{\footskip}
\checkandfixthelayout
\usepackage{pdfpages}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{float} % Sættes efter figure, så det ser sådan ud --> \begin{figure}[H]

%%
% test - start
%%
\usepackage[export]{adjustbox}  %Så figurer kan have en anden position.
\usepackage{wrapfig}            %Tillader in-line billeder
\usepackage{array}              % Allows to vertically align content in tables.
\usepackage{booktabs,adjustbox} % Maybe also allows for better tables. 

\newcommand{\finalcells}[2]{%
  \begingroup\sbox0{\begin{minipage}{3cm}\raggedright#1\end{minipage}}%
  \sbox2{\begin{minipage}{3cm}\raggedright#2\end{minipage}}%
  \xdef\finalheight{\the\dimexpr\ht0+\dp0+\smallskipamount\relax}%
  \xdef\finalheightB{\the\dimexpr\ht2+\dp2+\smallskipamount\relax}%
  \ifdim\finalheightB>\finalheight
    \global\let\finalheight\finalheightB
  \fi\endgroup
  \begin{minipage}[t][\finalheight][t]{8cm}\raggedright#1\end{minipage}&
  \begin{minipage}[t][\finalheight][t]{6cm}\raggedright#2\end{minipage}}


%%
% test - stop
%%

%%%%%%
% CHAPTER STYLES
%%%%%%
\makechapterstyle{simple}{
  \renewcommand*{\printchaptername}{}
  \setlength{\afterchapskip}{1cm}       %Bestemmer hvor tæt teksten til kapitlet kommer på kapiteloverskriften.
  \renewcommand*{\printchaptertitle}[1]{\flushleft\chaptitlefont##1}
  }

\makechapterstyle{box}{%
  \setlength{\midchapskip}{-58pt}       %
  \setlength{\afterchapskip}{10mm}      %Bestemmer hvor tæt teksten til kapitlet kommer på kapiteloverskriften.
  \renewcommand*{\printchaptername}{}   %
  \renewcommand*{\printchapternum}{     %
    \flushleft
    \begin{tikzpicture}
      \draw [fill=black] (0,0) rectangle (2cm,2cm);
      \node [text=white] at (1cm,1cm) { \chapnumfont\thechapter };
    \end{tikzpicture}}%
  \renewcommand{\printchaptertitle}[1]{%
        \hspace*{30mm}\chaptitlefont\MakeUppercase{##1}}} %Bestemmer hvor tæt kapiteltitlen kommer på venstre side. Husk at den sorte kasse er 2x2 cm.

\makeatletter
\settocpreprocessor{chapter}{%
  \let\tempf@rtoc\f@rtoc%
  \def\f@rtoc{%
  \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}%
}
\makeatother

\setsecnumdepth{subsection}
\usepackage{parskip}    %Bruges til at lave større mellemrum mellem afsnit
\usepackage{graphicx}   %Bruges for at indsætte "grafik", såsom billeder
\usepackage{lastpage}   %Bruges til sidetal
\usepackage{framed}     %Laver boxe 
\usepackage{setspace}   %Kan lave forskellige mellemrum mellem linjerne
\usepackage[utf8x]{inputenc}    %Hvis du benytter windows i stedet for linux, så skift utf8 ud med latin1. Tillader danske tegn.
\usepackage{mathtools}  %Ekstra matematik... bare lad den være, du får muligvis brug for den.
\usepackage{siunitx}    %Bruges til at indsætte SI enheder med makroer. Sørger for at de kommer til at stå med rigtig skrifttype (normal skrift i matematik). Brug den, eller lad være. ² indsættes med \squaren for at undgå sammenfald med \square fra ams.
\usepackage[english]{babel}  %Giver mulighed for dansk orddeling. Slet kun hvis du VED hvad du laver, eller skal skrive noget på engelsk.
\usepackage[colorlinks=true]{hyperref}  % Bruges til at indsætte URL's og farver
\usepackage{url}            %Burde gerne lave linjeskift for url
\renewcommand{\UrlBreaks}{\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z}

\usepackage{microtype}      % Pakke der prøver at fikse badbox problemer. Kun kompatibel med pdflatex.
\usepackage{lipsum}         % Bruges til at indsætte dummy 'Lorem ipsum' tekst.
\linespread{1.2}            % Line spacing = afstand mellem linjerne.
\graphicspath{{Pictures/}} %Specifies the directory where pictures are stored

%%%%%%
% \par
%%%%%%
\setlength{\parindent}{0cm} %Bestemmer indrykkets størrelse for "\par"
\setlength{\parskip}{0.2cm plus 0.1cm minus 0.1cm} % Bruges til at lave mellemrum mellem afsnit ved brug af "\par"

%%%%%%
% PAGESTYLE
%%%%%%
\copypagestyle{chapter}{plain} %Dette kopierer "plain"-stilen, så den kan overskrives, og sætte sidetal på højre/venstre side ved kapitelstart.
\makeoddfoot{chapter}
  {}% Venstre side.
  {}% Midten.
  {\thepage}% Højre side.
\makeevenfoot{chapter}
  {\thepage}% Venstre side.
  {}% Midten.
  {}% Højre side.

\makepagestyle{bachelor}
\makepsmarks{bachelor}{
  \createmark{chapter}      {both}{shownumber}{}{. \ }
  \createmark{section}      {both}{shownumber}{}{ -\ } %kan skrives med {. \ }
}
\makeoddhead{bachelor}%
  {}%
  {}%
  {\rightmark}%
\makeevenhead{bachelor}%
  {\leftmark}%
  {}%
  {}
% sidens fod: sidetal/sidste side
\makeoddfoot{bachelor}
  {} %venstre side.
  {} %midten.
  {\thepage} %højre side.
\makeevenfoot{bachelor}
  {\thepage} %venstre side.
  {} %midten.
  {} %højre side.
% smid en linje under
\makeheadrule{bachelor}{\textwidth}{\normalrulethickness}

%%%%%%
% Ændring af Tabeller
%%%%%%
\usepackage{booktabs}
\setlength{\heavyrulewidth}{0.15em}
\setlength{\lightrulewidth}{0.08em}

\nouppercaseheads
\pagestyle{bachelor}

And my document looks something like this:

\begin{document}
\chapterstyle{box}
\pagenumbering{arabic}  %Bruger romertal til nummereringen. 
\title{TEST}            %Navnet på dokumentet.

\pagenumbering{arabic}
%%---------------------------------
\chapter{Intro}
%%---------------------------------
\lipsum[1-1]

%%---------------------------------
\chapter{TEST 2}
%%---------------------------------
\begin{table}[!ht]
\centering
\begin{tabular}{|m{8cm}|c|}\hline
\textbf{Exercise 1} 
\begin{itemize}
\item Instruction 1.
\item Instruction 2.
\item Instruction 3.
\item Very very very long Instruction 4.
\item Very very very blah blah blah blah blah blah blah long Instruction 5.
\end{itemize}
& \includegraphics[width=0.4\textwidth, angle=90]{frog.jpg} \\ \hline

\textbf{Exercise 2} 
\begin{itemize}
\item Instruction 1.
\item Instruction 2.
\item Instruction 3.
\item Very very very long Instruction 4.
\item Very very very blah blah blah blah long Instruction 5.
\end{itemize}
& \includegraphics[width=0.3\textwidth, angle=90]{frog.jpg} \\ \hline

\textbf{Exercise 3} 
\begin{itemize}
\item TEST.
\item TEST.
\end{itemize}
& \includegraphics[width=0.2\textwidth, angle=90]{frog.jpg} \\ \hline
\end{tabular}
\end{table}

%%---------------------------------
\chapter{Ny}
%%---------------------------------

\begin{tabular}{| m{8cm} | m{6cm} |} 
\midrule
\finalcells{
\textbf{Exercise 1} 
\begin{itemize}
\item Instruction 1.
\item Instruction 2.
\item Instruction 3.
\item Very very very long Instruction 4.
\item Very very very blah blah blah blah long Instruction 5.
\end{itemize}
}
{\includegraphics[width=0.9\textwidth, angle=90]{frog.jpg}} \\ \hline
\finalcells{
\textbf{Exercise 2} 
\begin{itemize}
\item Instruction 1.
\item Instruction 2.
\item Instruction 3.
\item Very very very long Instruction 4.
\item Very very very blah blah blah blah long Instruction 5.
\end{itemize}
}
{\includegraphics[width=0.5\textwidth, angle=90]{frog.jpg}} \\
\end{tabular}


\end{document}
  • 1
    This is a common problem. Images have their baseline at the bottom and minipages default to the center. Saveboxes should preserve the baseline of what is inside. Any way you can move the baseline using \raisebox. Check the related questions. – John Kormylo Oct 1 '15 at 16:06
  • Try solutions from tex.stackexchange.com/q/19080/1952 – Ignasi Oct 1 '15 at 17:37
3

Many solutions exist for such a common issue. In your case, since you use the adjustbox package, the easiest would be to replace all your images in the table by this, for example:

\includegraphics[width=0.4\textwidth, angle=90]{frog.jpg} 

would be:

\includegraphics[width=0.4\textwidth, angle=90, valign=m, margin=.7em]{frog.jpg} 

This valign is from the adjustbox package, of course, and the margin is that white space above and below the image.

Then, you can get some thing like this:

enter image description here

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.