Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I got a problem with the alignment of an image within the tabular environment. I want to align the image within the table in such a way, that it is located to the very right of the layout and the text to the left of the image. The problem is, that this is a two column table and I am bound to placing the image in a cell.

Is it possible to move the image to the right, so that the image does not use the vertical space and is located alongside the text, without altering the table structure itself?

Thanks in advance!

See MWE below:

\documentclass{article}

\usepackage[a4paper,top=1.27cm,left=1cm,right=1cm,bottom=2cm]{geometry}
\usepackage{ifpdf}
\usepackage[demo]{graphicx}
\usepackage[utf8x]{inputenc}
\usepackage{longtable}

\begin{document}

\begin{tabular}{p{4cm}|p{7cm}}
\textbf{Heading} & \tabularnewline
 & \includegraphics[width=3cm,height=5cm]{picture} \tabularnewline
Description & \begin{itemize}  \item Lorem ipsum  \item ...\end{itemize}\tabularnewline
Text & \begin{itemize}  \item Further stuff  \item ...\end{itemize}\tabularnewline
\end{tabular}

\end{document}
share|improve this question
    
It's not completely clear to me what the desired output should look like. Perhaps you can make a drawing showing the intended output? –  Gonzalo Medina Jul 19 '13 at 18:51

1 Answer 1

up vote 1 down vote accepted

Why not alter the table structure? I think that a 3th column with a \multirow cell could be a more elegant solution. In any case, a simple solution is move the image and the following as you need with \vspace and \hspace:

MWE

\documentclass{article}

\usepackage[a4paper,top=1.27cm,left=1cm,right=1cm,bottom=2cm]{geometry}
\usepackage{ifpdf}
\usepackage[demo]{graphicx}
\usepackage[utf8x]{inputenc}
\usepackage{longtable}

\begin{document}

\begin{tabular}{p{4cm}|p{7cm}}
\textbf{Heading} &  \tabularnewline
 & \vspace{-0cm}\hspace{5cm}\includegraphics[width=3cm,height=5cm]{picture}\vspace{-13cm}\tabularnewline
Description & \begin{itemize}  \item Lorem ipsum  \item ...\end{itemize}\tabularnewline
Text & \begin{itemize}  \item Further stuff  \item ...\end{itemize}\tabularnewline
\end{tabular}

\end{document}

Another option is the package textpos and insert the image in a textblock environment with an absolute position (therefore it could be before of the table code (it should be, in order to maintain the table contents clearer):

\usepackage[absolute]{textpos}
.....
\begin{textblock}{1}(9,1)
\includegraphics[width=3cm,height=5cm]{picture}
\end{textblock}
share|improve this answer
    
Thanks for your answer. Your vspace approach works for a table environment, but not for an longtable environment. Is this also possibel anyhow? –  the_max Jul 20 '13 at 10:05
    
@the_max, using textpos must work in any case. If you have problems with this, post a more complete working example, including the longtable environment. –  Fran Jul 20 '13 at 12:09
    
Yes, textpos works also here, thanks ;) –  the_max Jul 20 '13 at 16:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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