# Align Fbox to the left and text to the right

I m a beginner with LaTex and I don't really understand how to align an FBox to the left with an image inside and some text to the right.

Current implementation without boxing:

\noindent\begin{minipage}{0.8\textwidth}
\includegraphics[width = 0.5\linewidth]{graph_southampton.PNG}
\end{minipage}

\hfill

\begin{minipage}{0.9\textwidth}\raggedleft

Yesasd asdjkasdk jakdsajkd\\
alsdjaojzxkc \\
asdjkasm

\end{minipage}


Output:

As you may notice they are not properly aligned, I just sent you a bit from what I have before and after to get a glimpse of my page format.

Now with Boxing

\noindent\fbox{

\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
\lefting
\includegraphics[width = 0.5\linewidth]{graph_southampton.PNG}
\end{minipage}

\hfill

\begin{minipage}{0.001\textwidth}

\end{minipage}

}


Output

The box size is perfect but the text outruns the boundaries.

• Welcome to TeX SX! What is the \lefting command? – Bernard May 12 '19 at 13:31
• @Bernard Oh..Don't mind that, I was just playing around thinking that \lefting is the same as begin{left} -> end{left} – user181475 May 12 '19 at 13:34

an empty line starts a new paragraph

\documentclass{article}
\usepackage{graphicx}
\begin{document}

\noindent
\begin{minipage}{0.6\textwidth}
\fbox{\includegraphics[width=\linewidth]{tiger}}
\end{minipage}
\hfill
\begin{minipage}{0.35\textwidth}\raggedleft
Yesasd asdjkasdk jakdsajkd\\
alsdjaojzxkc \\
asdjkasm
\end{minipage}

\end{document}


For an image with a caption use

\documentclass{article}
\usepackage{hvfloat}
\begin{document}

\hvFloat[capPos=right,capVPos=bottom,objectFrame]{figure}%
{\includegraphics[width=0.6\linewidth]{tiger}}%
{The caption of the figure which is on the right bottom
of the page.}%
{fig-label}

\end{document}


• Thank you, this worked fine but why mine didn't? – user181475 May 12 '19 at 13:42
• If I want to add a caption to the image, should I use begin{figure} instead of just \includegraphics – user181475 May 12 '19 at 13:46
• As I already wrote: An empty line starts a new paragraph, so your \hfill is useless. See edited answer for a caption. – user187802 May 12 '19 at 13:54

This is probably the simplest possible code, with the valign key from adjustbox (and no blank lines):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx, xcolor}
\usepackage{caption}

\begin{document}

Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.\bigskip


• \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} For this code I get a big white space above my text. – user181475 May 12 '19 at 14:06
• What do you suggest me to do in order to get rid of that big white space ? Is it because of that valign=c. Thank you! – user181475 May 12 '19 at 14:17
• Try valign=tfor include graphics and also write \begin{minipage[t]{0.40\textwidth}. But maybe it is due to a blank upper part in your graphic file. – Bernard May 12 '19 at 14:26