5

I have two images in two different column in a table and in the third table i want to have a text, ideally as a list, but when i write the text it begins at the last row and goes down from there, i want to have the text start from the top. Here is the code

    \begin{tabular}{c c |p{0.30\linewidth}}
    {\includegraphics[width=0.30\linewidth]{BoAwoNO2}}&
    {\includegraphics[width=0.30\linewidth]{BoAwithNO}} &
    Some text 
    \end{tabular}

and the image of output. enter image description here

1
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Jun 2, 2014 at 13:13

4 Answers 4

10

Loading the adjustbox package lets you write valign=c or valign=t etc when doing an \includegraphics{...} command.

Code

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage[export]{adjustbox}

\begin{document}
    \begin{tabular}{c c |p{0.30\linewidth}}
    {\includegraphics[valign=t, width=0.30\linewidth]{BoAwoNO2}}&
    {\includegraphics[valign=t, width=0.30\linewidth]{BoAwithNO}} &
    Some text text text text text text text text text text text text text text
    \end{tabular}
\end{document}

Output

enter image description here

0
3

Use \vspace{0pt} to get an invisible line for the vertical alignment:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{array}
\begin{document}
    \begin{tabular}{*2{>{\vspace{0pt}}p{0.3\linewidth}}|>{\vspace{0pt}}p{0.3\linewidth}}
    \includegraphics[width=\linewidth]{BoAwoNO2}  &
    \includegraphics[width=\linewidth]{BoAwithNO} &
    Some text text text text text text text text text text text text text text
    \end{tabular}
\end{document}

enter image description here

2

One way is to use nested tabular environments within the table, for the graphics files.

\documentclass[paper=a4,12pt]{scrbook}

\usepackage{blindtext}
\usepackage[demo]{graphicx}



\begin{document}


\begin{tabular}{c c |p{0.30\linewidth}}
\begin{tabular}{c}
    {\includegraphics[width=0.30\linewidth]{BoAwoNO2}}
\end{tabular} &
\begin{tabular}{c}
    {\includegraphics[width=0.30\linewidth]{BoAwithNO}} 
\end{tabular} 
& some text \tabularnewline
\end{tabular}


\end{document}

enter image description here

1

I just introduce \tincludegraphics that shifts the image down by its height minus the height of a text strut.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\newcommand\tincludegraphics[2][]{%
  \raisebox{\dimexpr-\height+\ht\strutbox}{\includegraphics[#1]{#2}}%
}
\begin{document}
Smaller than image size:\\
    \begin{tabular}{c c |p{0.30\linewidth}}
    {\tincludegraphics[height=1in, width=0.30\linewidth]{BoAwoNO2}}&
    {\tincludegraphics[width=0.30\linewidth]{BoAwithNO}} &
    Text
    \end{tabular}

Now larger than image size:\\
    \begin{tabular}{c c |p{0.30\linewidth}}
    {\tincludegraphics[height=.5in,width=0.30\linewidth]{BoAwoNO2}}&
    {\tincludegraphics[width=0.30\linewidth]{BoAwithNO}} &
    \scriptsize\lipsum[4]
    \end{tabular}
\end{document}

enter image description here

If centered images were desired, I define \cincludegraphics... And rather than using a p column, I used a \parbox with the [c] centering option. In this way, the text and images will always be centered relative to each other.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\newcommand\cincludegraphics[2][]{%
  \raisebox{\dimexpr-.5\height+.5\ht\strutbox}{\includegraphics[#1]{#2}}%
}
\begin{document}
Smaller than image size:\\
    \begin{tabular}{c c |c}
    {\cincludegraphics[height=1in, width=0.30\linewidth]{BoAwoNO2}}&
    {\cincludegraphics[width=0.30\linewidth]{BoAwithNO}} &
    \parbox{0.30\linewidth}{Text}
    \end{tabular}

Now larger than image size:\\
    \begin{tabular}{c c |c}
    {\cincludegraphics[height=.5in,width=0.30\linewidth]{BoAwoNO2}}&
    {\cincludegraphics[width=0.30\linewidth]{BoAwithNO}} &
    \parbox{0.30\linewidth}{\scriptsize\lipsum[4]}
    \end{tabular}
\end{document}

enter image description here

You must log in to answer this question.