2

I am trying to align an image and text horizontally on a page.

This is an extra question for what I have asked here. I got some suggestions in comments: like add [t] to the minipage, but it does not seem to work.

Thanks in advance!

My code:

\noindent\fbox{\includegraphics[width = 0.5\linewidth, valign=c]{graph_southampton.PNG}}\hfill
\begin{minipage}{0.40\textwidth}\centering    
        The picture on the left represents \\
        a \textcolor{blue}{graph}. The \textcolor{blue}{source} point is \\
        corresponds to Southampton whereas \\ 
        the \textcolor{blue}{destinations} are the other cities. \newline
        The edges are also labeled with the shortest path between the cities.
\end{minipage} 

enter image description here

closed as unclear what you're asking by Zarko, user156344, Stefan Pinnow, Raaja, dexteritas May 15 at 8:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    showed result has not been generated with showed code (why you use it from Bernard answer, which you not accept?). it gives perfect result. so your question is not clear. – Zarko May 15 at 1:36
2

For just that alignment you do not need anything special. (I am not sure though if I would go for this layout, but that's your choice.)

\documentclass{article}
\usepackage{graphicx,xcolor}
\begin{document}
$\vcenter{\hbox{\fbox{\includegraphics[width=4cm]{example-image-duck}}}}%
\vcenter{\begin{minipage}{0.5\textwidth}\centering    
        The picture on the left represents \\
        a \textcolor{blue}{graph}. The \textcolor{blue}{source} point is \\
        corresponds to Southampton whereas \\ 
        the \textcolor{blue}{destinations} are the other cities. \newline
        The edges are also labeled with the shortest path between the cities.
\end{minipage} }$
\end{document}

enter image description here

Personally I would use a tcolorbox because then you will most likely have a tool that can be used to address all layout wishes.

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