4

In order to include a small sub-figure in my main figure, I tried to use scaled scope. However, when I try to refer to a node out of the scaled scope, the node pointed is at the position of the old non-scaled node... Here is a picture :

enter image description here

Do you know how to avoid that ?

Thank you !

PS : Here is my WME.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}     
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows}
\usetikzlibrary{mindmap,backgrounds,positioning}
\usetikzlibrary{automata,positioning,fit,backgrounds}
\usetikzlibrary{positioning,arrows,matrix,calc}

\begin{document}

\begin{figure}[H]
  \centering
  \begin{tikzpicture}
    \begin{scope}[transform canvas={scale=1},overlay]
      \node[fill=green]   (a) {A};
      \node[fill=green,right=of a] (b) {B};
    \end{scope}
    \node[draw,below=5mm of b] (c) {C};
    \draw[<->] (c) -- (b);
  \end{tikzpicture}%
  \hspace{3cm}%
  \begin{tikzpicture}
    \begin{scope}[transform canvas={scale=0.2},overlay]
      \node[fill=green]   (a) {A};
      \node[fill=green,right=of a] (b) {B};
    \end{scope}
    \node[draw,below=5mm of b] (c) {C};
    \draw[<->] (c) -- (b);
  \end{tikzpicture}%
\end{figure}

\end{document}
  • 1
    pgf manual extract: Canvas transformations should be used with great care. In most circumstances you do not want line widths to change in a picture as this creates visual inconsistency. Just as important, when you use canvas transformations pgf loses track of positions of nodes and of picture sizes since it does not take the effect of canvas transformations into account when it computes coordinates of nodes (do not, however, rely on this; it may change in the future). – Paul Gaborit Jan 23 '17 at 23:43
  • @PaulGaborit : So what is the good way to proceed ? Tikzpicture ? Savebox ? Other things ? – tobiasBora Jan 24 '17 at 0:27
  • 1
    Try scale=.5 instead of transform canvas={scale=.5}. – Paul Gaborit Jan 24 '17 at 1:01
  • Nothing happened with "scale=0.5"... – tobiasBora Jan 24 '17 at 1:13
  • None of your nodes use numeric coordinates. However, the scale option applies only to numeric coordinates. – Paul Gaborit Jan 24 '17 at 1:22
3

Perhaps you want this?

scaled and unscaled

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning,babel}

\begin{document}

\begin{figure}
  \centering
  \begin{tikzpicture}
    \node[fill=green]   (a) {A};
    \node[fill=green,right=of a] (b) {B};
    \node[draw,below=5mm of b] (c) {C};
    \draw[<->] (c) -- (b);
  \end{tikzpicture}
  \hspace{3cm}
  \begin{tikzpicture}
    \begin{scope}[scale=0.2, every node/.append style={transform shape}]
      \node [fill=green]   (a) {A};
      \node [fill=green,right=of a] (b) {B};
    \end{scope}
    \node [draw,below=5mm of b] (c) {C};
    \draw [<->] (c) -- (b);
  \end{tikzpicture}
\end{figure}

\end{document}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.