# Setting image in same line as text

I have the line

\noindent\parbox{\textwidth}{{\LARGE\textbf{\name}}}\hfill\begin{figure}[ht!]\includegraphics[width=2cm,height=2cm]{MyPic.jpg}\end{figure}


I want the "name" variable to be on the left, and the image to be on the right of the page. But it turns out the image goes on the left of the next line. How can I make it be in the same line as the "name", but to the right?

EDIT: Removing the begin{figure}

{\noindent\parbox{\textwidth}{{\LARGE\textbf{\name}}}\hfill\includegraphics[width=2cm,height=2cm]{MyPic.jpg}


yields the same result.

• Your \parbox is set to fill \textwidth, which leaves no room to place the image against the right margin. Just set \noindent{\LARGE\textbf{\name}}\hfill\includegraphics[..]{...}%. – Werner Oct 29 '13 at 5:16

You don't need figure environment if not using caption. figure is a float and moves around. You don't need \parbox too.
\documentclass{article}