1

I have three tikz/pgf pictures which I want to overlay using something like that

\subfloat[]{
\begin{tikzpicture}
\draw [yshift=5cm](0,0) rectangle (5,5);
\end{tikzpicture}
\scalebox{0.71}{\input{figures/hahn_long.pgf}}
\scalebox{0.4}{\input{figures/hahn_short.pgf}}

but that doesn't work, since it draws the three pictures, one after another (even the yshift has no effect). How can I do that?

2
  • Did you try putting only the draw commands in the files and inputing them in the same TikZ-picture? Like \begin{tikzpicture} \draw...; \input{} }input{} \input{figures/hahn_long.pgf}? Commented Nov 11, 2013 at 14:52
  • yeah, not really, because the two .pgf pictures are created with python-matplotlib, and are therefore quite complicated, and not just simple \draw... commands...
    – wa4557
    Commented Nov 11, 2013 at 15:04

1 Answer 1

1

Without a minimal working example (MWE) it is a bit difficult to know what exactly shall be achieved here. However, if your goal is to horizontally overprint the context of your three figures, this can be achieved either using low-level TeX commands (\llap{<content>}, \rlap{<content>}) or, a bit more generic and less error-prone, LaTeX's \makebox[<width>][<align>]{<content>} command, with a zero value for the <width> parameter.

This TUBboat article provides a bit of background on these (and more) commands. In the following, I will use \makebox; in the last example additionally \raisebox{<yshift>}{<content>} to implement a vertical shift:

  \documentclass{article}
  \usepackage{xcolor}

  \newcommand{\figone}{{\color{black}\rule{4cm}{4cm}}}
  \newcommand{\figtwo}{{\color{red}\rule{3cm}{3cm}}}
  \newcommand{\figthree}{{\color{blue}\rule{2cm}{2cm}}}

  \begin{document}
    Text starts here:

    \makebox[0pt][l]{\figone}%
    \makebox[0pt][l]{\figtwo}%
    \figthree%

    \makebox[0pt][r]{\figone}%
    \makebox[0pt][r]{\figtwo}%
    \makebox[0pt][r]{\figthree}%

    Text ends here:

    \begin{center}
      Centered:

      \makebox[0pt][c]{\figone}%
      \makebox[0pt][c]{\figtwo}%
      \makebox[0pt][c]{\figthree}%

      Centered, y-shifted:

      \makebox[0pt][c]{\figone}%
      \raisebox{0.5cm}{\makebox[0pt][c]{\figtwo}}%
      \raisebox{1cm}{\makebox[0pt][c]{\figthree}}%

      And so on...
    \end{center}

  \end{document}

Lacking the real figures, I have substituted the tree figures by colored squares of different size. The output looks like following:

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .