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.

I have a tikzpicture, rounded by a fbox, and embedded in a minipage. Is it possible to change the position of the whole picture inside the minipage? for instance, move the picture 1 unit higher and 1 unit on the right? I know that we could always change the coordinates of each elements in the picture (e.g., change (2,3) to (1,2)), but it is obviously not a good solution.

share|improve this question
1  
Changing the coordinates wouldn't help anyway, because as far as TeX is concerned for the placement on the page only the bounding box (=outline) of the picture is taken into account. –  Caramdir Aug 17 '11 at 1:58

1 Answer 1

up vote 12 down vote accepted

Horizontal displacement is easily obtained via \hspace[*]{<length>}, while vertical displacement can be managed using \raisebox{<length>}{<stuff>} from the graphicx package. As is clear from the following minimal example, the image on the left has been translated (+3em,+4em), while the duplicate figure on the left has been left unchanged in terms of positioning/translation:

\documentclass{article}
\usepackage{tikz}%
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{caption,subcaption}%
\usepackage{calc}% http://ctan.org/pkg/calc

​\begin{document}
\noindent\begin{minipage}[t]{0.48\linewidth}%
  \centering
  \fbox{%
    \begin{minipage}[t]{\linewidth-2\fboxsep-2\fboxrule}% Remove fbox rule/sep width
      \hspace*{3em}\raisebox{4em}{\begin{tikzpicture}% Moved (+3em,+4em)
        \draw (-1.5,0) -- (1.5,0);
        \draw (0,-1.5) -- (0,1.5);
        \draw (0,0) circle (1cm);
      \end{tikzpicture}}
    \end{minipage}}
  \captionof{figure}{picture1}\label{fig:picture1}
\end{minipage}\hfill
\begin{minipage}[t]{0.48\linewidth}%
  \centering
  \fbox{%
    \begin{minipage}[t]{\linewidth-2\fboxsep-2\fboxrule}% Remove fbox rule/sep width
      \begin{tikzpicture}
        \draw (-1.5,0) -- (1.5,0);
        \draw (0,-1.5) -- (0,1.5);
        \draw (0,0) circle (1cm);
      \end{tikzpicture}
    \end{minipage}}
  \captionof{figure}{picture2}\label{fig:picture2}
\end{minipage}

​\end{document}​​​​​​​​​​​​​

Pictures moved around

share|improve this answer
    
Amazing, that works, thank you again... –  SoftTimur Aug 16 '11 at 23:42

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.