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.

Question is very simple. I want to \includegraphics and align it to the right, while having some text or items on the left. Is there a simple command for this??

Edit Here is what I did from previous answers/comments:

\documentclass{beamer}
\begin{document}
\frame {
      \frametitle{name}
     \noindent
 \parbox{5cm}{some text}
     \hfill
       \rule{2cm}{3cm}
}
\end{document}

This creates a space for the picture on the right and a line of text on the left side, but at the bottom of the picture. I want to align it to start from the top of the picture. Which command should I use?

share|improve this question
1  
Welcome to TeX.sx! You can just use \raggedleft inside the figure` environment. If you're using any packages (despite graphicx) a minimal working example (MWE) would be very helpful. –  Ronny Mar 29 '13 at 20:56
    
@Ronny No, no extra packages, I am learning very basic tricks. Thank you, this thing did it. And where should I insert itemize or how can I have few text lines on the left of the picture, but starting from the top to the bottom, aligned to left? –  Vladimir Mar 29 '13 at 21:06
    
I didn't get your question, can you update the original post above and provide an MWE? I think \caption{} is what you want and for your ideas, have a look at the floatrow package. Also, try not to post Follow-up questions, but formulate your question in one complete post (use edit above for this one ;) ) to clarify your question. –  Ronny Mar 29 '13 at 21:10
    
Now, that you changed your question and it is clear that you'Re not working on a document but on beamer slides - look at the manual concerning the columns and the column environment. –  Ronny Mar 30 '13 at 15:20

3 Answers 3

\noindent
\parbox{2cm}{some words}%
\hfill
\includegraphics{...}

will put some words flush left and an image flush right on the same line.

To adjust the alignment you can use [t] on the \parbox so it aligns on its top row and use \raisebox to adjust the image. Moving it by its natural height moves the alignment to its top edge but that may be too far: on the second frame the alignment point is one baseline skip down from the top

\documentclass{beamer}
\begin{document}
\frame {
      \frametitle{name}
     \noindent
 \parbox[t]{5cm}{some text}
     \hfill
       \raisebox{-\height}{\rule{2cm}{3cm}}

}

\frame {
      \frametitle{name}
     \noindent
 \parbox[t]{5cm}{some text}
     \hfill
       \raisebox{\dimexpr-\height+\baselineskip}{\rule{2cm}{3cm}}
}
\end{document}

enter image description here

share|improve this answer
    
Thank you David. Could you please tell me what \noindent, \parbox{measure} and \hfill mean, so that I can start using them in other occasions? Also is "flush" left/right a common expression for this? –  Vladimir Mar 29 '13 at 21:10
    
\noindent removes the indent at the start of a paragraph (which is usually 2em). The \parbox makes the text 2cm in width and after that hfill fills the horizontal space, before it adds the image at the end of the line. This works great, if the image is not in a figureenvironment (hence floating). –  Ronny Mar 29 '13 at 21:12
    
they are all standard latex commands (apart from \includegraphics which comes from the graphics package) \noindent stops paragraph indentation, \parbox makes a box in which lines are wrapped to the specified width, \hfill is \hspace{\fill} a horizontal space that stretches as much as needed, and \includegraphics includes graphics. –  David Carlisle Mar 29 '13 at 21:14
    
Thanks a lot, @Ronny! –  Vladimir Mar 29 '13 at 21:15
    
@Ronny I am still having problems with the text on the left side of the picture. I can not align it to the left and to the top of the picture. Could you people tell me how to do it? –  Vladimir Mar 30 '13 at 13:41

The OP specified his needs, that the left hand side should be a paragraph and the right hand side a justified right image on a beamer slide. Hence one way to accomplish that would be columns as demonstrated here

\documentclass[demo]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % input encoding of the file
\begin{document}
\begin{frame}{Title}{Subtitle}
    \begin{columns}
        \begin{column}{.5\textwidth}
            Your longish paragraph text here, where you describe stuff and so on
        \end{column}
        \begin{column}{.5\textwidth}\raggedleft
            \includegraphics[width=1cm,height=2cm]{test}
        \end{column}
    \end{columns}
\end{frame}
\end{document}
share|improve this answer

Judging from your comments I looked at floatrow which enables you to globally (for all pictures) define such a layout. The MWE would be

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % input encoding of the file
\usepackage[demo]{graphicx} % Demo includes test images
\usepackage[justification=raggedleft,%
    capposition=beside,%
    capbesideposition=left%
  ]{floatrow}
\begin{document}
\begin{figure}
\includegraphics{test} %your image here
\caption{I am the figure description}
\end{figure}
\end{document}

Where graphicx is loaded with [demo] such that this compiles without an image present. The floatrow is set up, such that the images are justified to the right (first option), the caption is put besides the image to the left.

The result looks like

figure aligned right with caption to the left

To further align the text top left to the figure change the capbesideposition-option to capbesideposition={left,top}which yields

enter image description here

share|improve this answer
    
Thank you Ronny. Sorry if I am not clear enough, I barely can make MWE. I only know what I would like to have and that is: two columns on a frame, one with text and another with a picture. I tried first suggestion and for some reason the text on the left was aligned to the bottom of the picture?? Now your suggestion is to put a caption of the picture to the left, which is not what I need- I want a paragraph of text in the left column. Also, I want this for one frame only, not to affect the whole file. –  Vladimir Mar 30 '13 at 15:16
    
Then tell that in the first post of the question. By editing your post i just learned now, that you use beamer which you also didn't mention before. Please be more precise in the future. –  Ronny Mar 30 '13 at 15:18

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.