3

Hello I am currently writing a CV and trying to include a picture of myself to the right of a table that shows personal information. However no matter what commands I try I cannot add to the right of the table. Here is the code:

\section{Personal Data}

\begin{tabular}{rl}
    \textsc{Place and Date of Birth:} & Someplace, Italy  | dd Month 1912 \\
    \textsc{Address:}   & CV Inn 19, 20301, Milano, Italy \\
    \textsc{Phone:}     & +39 123 456789\\
    \textsc{email:}     & \href{mailto:alessandro.plasmati@gmail.com}{alessandro.plasmati@gmail.com}
\end{tabular}

Whenever I try to include \includegraphics[scale=0.10]{picture.jpg} it simply brakes the table in the middle. I also tried \hbox{\hspace{2.5cm}\includegraphics[scale=0.10]{picture.jpg}} This will add the picture at approx. the right position to the right but the table is still broken in the middle. My question is then what code should i write to add a picture perfectly to the right of a table and should I include it in the table environment or outside the environment?

Thanks for all answers!

  • What code did you write exactly for this inclusion? – Bernard Sep 20 '16 at 20:49
  • What \documentclass are you using to write your CV? – Werner Sep 20 '16 at 21:02
  • You should include the graphic after \end{tabular} with no blank line (you might throw in a \hfill).. Also use the [b] option for the tabular to align bottoms. – John Kormylo Sep 20 '16 at 21:14
  • sorry about not including it, Im pretty new to latex. I am using the following class: \documentclass[a4paper,10pt]{article} – user114652 Sep 20 '16 at 21:24
  • what does "breaks the table in the middle" mean? a tabular is an unbreakable box. the tabular and the graphic will be positioned just as letters are positioned, XY will make them come side by side X Y makes them have a space between and X <blank line> Y makes them come one above the other. – David Carlisle Sep 20 '16 at 22:00
1

You can include it inside or outside of the table as long as there's room for it on the sale line. Note the bottom of the picture will aligned with the first line of the table, so we have to use \raisebox command in order to align tops.

Here is a simple code:

\documentclass{article}
\usepackage{geometry}
\usepackage[osfI]{garamondx}
\usepackage{graphicx}

\usepackage{hyperref}

\begin{document}

\section{Personal Data}

\begin{tabular}[t]{rl}
  \textsc{Place and Date of Birth:} & Milano, Italy | dd Month 1473                                              \\
  \textsc{Address:}                 & Palazzo Carmagnola, Milano, Italy                                          \\
  \textsc{Phone:}                   & +39 123 456789                                                             \\
  \textsc{email:}                   & \href{mailto:alessandro.plasmati@gmail.com}{alessandro.plasmati@gmail.com}
\end{tabular}
\quad
\raisebox{\dimexpr0.7\baselineskip-\height}{\includegraphics[scale=0.35]{hermine}}

\end{document} 

enter image description here

1

I'd set the entire construction inside a tabularx of width \linewidth and a single X-column (the middle column, since it contains the most data). That will allow the table to stretch out as needed in that column. The image column (far right), will only contain an image in the first row which is lowered into position using \raisebox{.}[0pt][0pt]{<image>}. Using [0pt][0pt] ensures that the image depth/height is removed after moving, otherwise it will increase the row height/depth:

enter image description here

\documentclass{article}

\usepackage[margin=1in]{geometry}
\usepackage{graphicx,tabularx}
\usepackage{hyperref}

\begin{document}

\section{Personal Data}

\noindent
\begin{tabularx}{\linewidth}{ @{} >{\scshape}r X l @{} }
  Place and Date of Birth: & Randomville, Random $\vert$ DD MMM YYYY    &
    \raisebox{\dimexpr-\height+.7\normalbaselineskip}[0pt][0pt]
      {\includegraphics[width=3cm,height=4\normalbaselineskip]{example-image}} \\
  Address:                 & Randombille, Random                        \\
  Phone:                   & +1-234-567-8901                            \\
  email:                   & \href{mailto:who@cares.com}{who@cares.com}
\end{tabularx}

\end{document} 

I specified a fixed width and height for the image, which might not be necessary in your case. This depends on the image you use, of course.

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.