I need to wrap the text around my tikz picture. But as you can see, scaling the picture give me problems about the position of the shaded axis between "pompa" and "turbina". How can i fix this problem?
\documentclass[a4paper,12pt]{report} \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} \usepackage[italian]{babel}
\usepackage{wrapfig} \usepackage{bm}
\usepackage{tikz}
\usetikzlibrary{positioning,intersections,shapes.geometric,decorations.pathmorphing,decorations.pathreplacing,decorations.shapes,decorations.markings,patterns,calc,fit,arrows,backgrounds}
\begin{document}
\begin{wrapfigure}{r}{0.5\textwidth} \vspace{-1cm}
\centering \begin{tikzpicture}[>=latex',auto,inner sep=2mm,node
distance=2cm and 3cm,transform canvas={scale=0.85}]
%setting styles
\tikzset{box1/.style={draw,minimum width=2cm,rectangle,thick}}
\tikzset{deco/.style={decoration={markings, mark=at position #1 with
{\arrow{>} }},postaction={decorate}}}
\tikzset{turb/.style={draw,trapezium,shape border rotate=90,inner
sep=1pt,minimum width=2.5cm,trapezium stretches=true,trapezium
angle=80,on grid,below right= of evaporatore}}
\tikzset{every pin edge/.style={<-,shorten
>=-0.2cm,decorate,decoration={bent,amplitude=-2,aspect=0.3}}}
%define nodes and labels
\node[box1] (setA) [label=right:$T_A$]
{\textit{SET A}}; \node[box1,below=1cm of setA] (evaporatore)
{\textit{Evaporatore}}; \node[turb,fill=white] (turbina)
{\textit{Turbina}}; \node[box1,right=1cm of turbina] (sem)
{\textit{SEM}}; \node[box1,on grid,below left=of turbina]
(condensatore) {\textit{Condensatore}};
\node[draw,circle,fill=white,on grid,below left= of evaporatore,inner
sep=1mm] (pompa) {\textit{Pompa}}; \node[box1] (setB) [below=1 cm of
condensatore] [label=right:$T_B$] {\textit{SET B}};
%the "IMT" dashed box and label
\node (imt) [draw,dashed,inner
sep=3pt,fit = (evaporatore) (turbina) (condensatore)(pompa),pin={[pin
distance=10mm] 30:\textit{IMT}}] {};
%drawing connections between components
\begin{scope}[>=triangle 60]
\draw [deco=0.6] (evaporatore) -| node[pos=0.6]{2}
(turbina.top right corner); \draw [deco=0.6] (turbina.bottom left
corner) |- node[above=1mm,pos=0.71]{3} (condensatore); \draw
[deco=0.4] (condensatore) -|
node[above=1mm,pos=0.31]{4} (pompa); \draw [deco=0.6] (pompa)
|- node[below=1mm,pos=0.63]{1} (evaporatore); \end{scope}
%drawing the arrows
\begin{scope}[>=stealth', shorten >=-0.0cm,shorten <=-0.0cm,->]
\path[thick] (setA) edge node[] {$\bm{q_A}$} (evaporatore)
(turbina) edge node[] {$\bm{l}$} (sem)
(condensatore) edge node[] {$\bm{q_B}$} (setB); \end{scope}
% drawing the shaded axis between "pompa" and "turbina"
\begin{scope}[on background layer] \draw[shading=axis]
($(pompa.center)+(0,-3pt)$) rectangle ($(turbina.center)+(0,3pt)$);
\end{scope} \end{tikzpicture}
\vspace{6cm} \end{wrapfigure}
Il funzionamento di tutti gli impianti motori termici si basa sul
ciclo diretto di Carnot: chiaramente l'impianto motore dovrà essere
formato da più macchine, o componenti, in grado di realizzare tali
trasformazioni sul fluido di lavoro. Tipicamente gli scambi di energia
termica \textit{1-2} e \textit{3-4} si ottengono mediante scambiatori
di calore ; l’espansione \textit{2-3} è ottenuta mediante una turbina
(a gas o a vapore); la compressione \textit{4-1} è ottenuta mediante
un compressore (se il fluido di lavoro si trova in fase gassosa) o una
pompa (liquido).
In figura riportiamo lo schema di funzionamento di un impianto motore
termico con turbina a vapore.
\end{document}
This is the original picture:
\documentclass{article} \usepackage{tikz}
\usetikzlibrary{positioning,
intersections,
shapes.geometric,
decorations.pathmorphing,
decorations.pathreplacing,
decorations.shapes,
decorations.markings,
patterns,
calc,
fit,
arrows,
backgrounds}
\usepackage{bm}
\begin{document}
\begin{tikzpicture}[>=latex',auto,inner sep=2mm,node distance=2cm and
3cm]
%setting styles
\tikzset{box1/.style={draw,minimum width=2cm,rectangle,thick}}
\tikzset{deco/.style={decoration={markings, mark=at position #1 with
{\arrow{>} }},postaction={decorate}}}
\tikzset{turb/.style={draw,trapezium,shape border rotate=90,inner
sep=1pt,minimum width=2.5cm,trapezium stretches=true,trapezium
angle=80,on grid,below right= of evaporatore}}
\tikzset{every pin edge/.style={<-,shorten
>=-0.2cm,decorate,decoration={bent,amplitude=-2,aspect=0.3}}}
%define nodes and labels
\node[box1] (setA) [label=right:$T_A$]
{\textit{SET A}}; \node[box1,below=1cm of setA] (evaporatore)
{\textit{Evaporatore}}; \node[turb,fill=white] (turbina)
{\textit{Turbina}}; \node[box1,right=1cm of turbina] (sem)
{\textit{SEM}}; \node[box1,on grid,below left=of turbina]
(condensatore) {\textit{Condensatore}};
\node[draw,circle,fill=white,on grid,below left= of evaporatore,inner
sep=1mm] (pompa) {\textit{Pompa}}; \node[box1] (setB) [below=1 cm of
condensatore] [label=right:$T_B$] {\textit{SET B}};
%the "IMT" dashed box and label
\node (imt) [draw,dashed,inner
sep=3pt,fit = (evaporatore) (turbina) (condensatore)(pompa),pin={[pin
distance=10mm] 30:\textit{IMT}}] {};
%drawing connections between components
\begin{scope}[>=triangle 60]
\draw [deco=0.6] (evaporatore) -| node[pos=0.6]{2}
(turbina.top right corner); \draw [deco=0.6] (turbina.bottom left
corner) |- node[above=1mm,pos=0.71]{3} (condensatore); \draw
[deco=0.4] (condensatore) -|
node[above=1mm,pos=0.31]{4} (pompa); \draw [deco=0.6] (pompa)
|- node[below=1mm,pos=0.63]{1} (evaporatore); \end{scope}
%drawing the arrows
\begin{scope}[>=stealth', shorten >=-0.0cm,shorten <=-0.0cm,->]
\path[thick] (setA) edge node[] {$\bm{q_A}$} (evaporatore)
(turbina) edge node[] {$\bm{l}$} (sem)
(condensatore) edge node[] {$\bm{q_B}$} (setB); \end{scope}
% drawing the shaded axis between "pompa" and "turbina"
\begin{scope}[on background layer] \draw[shading=axis]
($(pompa.center)+(0,-3pt)$) rectangle ($(turbina.center)+(0,3pt)$);
\end{scope}
\end{tikzpicture}
\end{document}

{}key (or indenting each line by four spaces), not using the"key -- that's for quotes. Also, examples should be minimal: Don't just dump your whole code in the question, but remove all the bits that aren't directly related to the problem. In this case, you should make up a small example that demonstrates the problem. – Jake May 02 '12 at 12:28\scalebox{<factor>}{<content>}or\resizebox{<width>}{<height>}{<content>}from thegraphicxpackage (already loaded bytikz). Try\resizebox{<your width>}{!}{<your tikz picture>}. Having thetikzpicturein an extra file would be better IMHO. Have a look atstandalonewhich also gives you\includestandalone[width=<width>]{<source file>}(alsoheightandscaleetc.) – Martin Scharrer May 02 '12 at 12:42