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.

For images we can use \centering is there anything to position the image to right side or left side of the page.

share|improve this question
    
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). –  Claudio Fiandrino Jan 13 '13 at 11:41

3 Answers 3

up vote 9 down vote accepted

For general text you can use \raggedright and \raggedleft to align the material to the left and right, respectively. To align images inside a figure easily you can use the adjustbox package which allows you to add alignment keys to \includegraphics:

\documentclass{article}
\usepackage[export]{adjustbox}

\begin{document}

\begin{figure}
    \includegraphics[width=.6\textwidth,center]{example-image}
    \caption{centered image}
\end{figure}

\begin{figure}
    \includegraphics[width=.6\textwidth,left]{example-image}
    \caption{left aligned image}
\end{figure}

\begin{figure}
    \includegraphics[width=.6\textwidth,right]{example-image}
    \caption{right aligned image}
\end{figure}

\end{document}
share|improve this answer

Consider the following examples:

\documentclass[12pt]{article}
\usepackage{showframe}
\usepackage[demo]{graphicx}
\begin{document}

\begin{figure}
 \includegraphics{n}
 \caption{\texttt{none}}
\end{figure}

\begin{figure}
 \hfill\includegraphics{n}
 \caption{\texttt{hfill}}
\end{figure}

\begin{figure}
 \begin{flushright}% or better \raggedleft see comments below
  \includegraphics{n}
  \caption{\texttt{flushright}}
 \end{flushright}
\end{figure}

\begin{figure}
 \hfill\begin{minipage}{.5\textwidth}\centering
  \includegraphics{n}
  \caption{\texttt{minipage}}
 \end{minipage}
\end{figure}

\end{document}

You can choose now. I personally prefer the minipage approach.

enter image description here enter image description here

share|improve this answer
    
I don't think you should use the flushright environment inside a figure for the same reason as you shouldn't use center. The vertical spacing might be wrong. –  Martin Scharrer Jan 13 '13 at 12:23
    
I agree, particularly because it is not necessary since hfill is sufficient. I just wanted to show a few more possibilities. I added a comment... –  bloodworks Jan 13 '13 at 12:28

If it isn't a floating images you can use \flushright or \flushleft. Also you may put \hfil from the right or left of image block.

share|improve this answer
1  
flushright and flushleft are intended as environments cf center the analogues of \centering are \raggedright and \raggedleft –  David Carlisle Jan 13 '13 at 11:09

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.