1

I have this Tikz schem enter image description here

Code

\documentclass[border=10pt]{standalone}
%\usepackage[margin=1cm]{geometry}
\usepackage{tikz,xcolor}
\usetikzlibrary{shapes.geometric,arrows,positioning,fit,calc,}
\tikzset{
b/.style={draw, rectangle, rounded corners=2ex,minimum height=0.5in, minimum width=2in,align=center},
c/.style={draw, rectangle, rounded corners=2ex, minimum height=0.5in, minimum  width=2in,align=center, rotate=-90},
ar/.style={rounded corners=2ex,->,>=latex },  
myarrow/.style args={#1 colored by #2 and #3}{
    -stealth,line width=#1,#2,postaction={draw,-stealth,#3,line width=(#1)/3,
    shorten <=(#1)/3,shorten >=2*(#1)/3}, 
  }
}

\begin{document}
\begin{tikzpicture} 
    \node (block1) [b] {Application InOut};
    \node (block2) [b,below= 4cm of block1] {Logical de calcul \\ d'indicateurs};
    \node (block3)[c, right=2cm of block1]  {API Java \\ \color{red} (requetes, recuperation \\ \color{red}desresulats)};
% connections within block A
\draw[ar] ([xshift=-1cm]block1.south) --++ (0,-2cm) -- ++(0.5,0) -- ([xshift=-0.5cm]block2.north);
\draw[ar] ([xshift= 1cm]block1.south) |- ([yshift=1cm]block3.south);
\draw[ar] ([yshift=-1cm]block3.south) -| (block1.south);
\node (block4) [c,right=9cm of block1] {Services Web \\ \color{red} (REST)};
\node (block5) [c, right= 11cm of block1] {MicMac \\ \color{red} (simulation)};
% connections within block B
\draw[ar] ([yshift=0.5cm]block4.north)  -- ([yshift=0.5cm]block5.south);
\draw[ar] ([yshift=-0.5cm]block5.south) -- ([yshift=-0.5cm]block4.north);
% connection between blocks A and B
\draw[ar] ([yshift=0.5cm]block3.north)  -- node[above]{\parbox[t]{3cm}{- Choix du scenario\\
- Fichiers meteo}} ([yshift=0.5cm]block4.south);
\draw[ar] ([yshift=-0.5cm]block4.south) --node[below]{\parbox[t]{3cm}{- Apport d'zaote \\
- Apport de pesticide}} ([yshift=-0.5cm]block3.north);
\node(n1)[draw,fill opacity=0.2,fill=blue, fit=(block1)(block2)(block3),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:MEANS}
]{};
\node(n2)[draw,fill opacity=0.2,fill=blue, fit=(block4)(block5),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:RECORD}
]{};
\draw[myarrow=10pt colored by blue!50!white and white] (block2.south) --node[right,xshift= 0.2cm](){\color{red} (Indicateurs)} ++(0,-1.5cm);
\end{tikzpicture}
\end{document}

Now I wan't to include into a beamer frame so I do like that :

\documentclass[hyperref={pdfpagemode=FullScreen, colorlinks=true}, xcolor={dvipsnames, svgnames, table}]{beamer}

\usefonttheme{professionalfonts} % using non standard fonts for beamer
%\usefonttheme{serif} % default family is serif
%\usepackage{fontspec}
%\setmainfont{Liberation Serif}

\usepackage[utf8]{inputenc}
\usepackage{default}
%\usepackage{xcolor}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows,positioning,fit,calc,}
\tikzset{
b/.style={draw, rectangle, rounded corners=2ex,minimum height=0.5in, minimum width=2in,align=center},
c/.style={draw, rectangle, rounded corners=2ex, minimum height=0.5in, minimum  width=2in,align=center, rotate=-90},
ar/.style={rounded corners=2ex,->,>=latex },  
myarrow/.style args={#1 colored by #2 and #3}{
    -stealth,line width=#1,#2,postaction={draw,-stealth,#3,line width=(#1)/3,
    shorten <=(#1)/3,shorten >=2*(#1)/3}, 
  }
}


%\usepackage{concrete}
\usetheme{Goettingen}
%\usetheme{Hannover}
\usepackage[frenchb]{babel}
\author{Author}
\title{Project}
\date{22 avril 2014}
\institute{Institute}
\begin{document}
\begin{frame}
\frametitle{Schéma}
\resizebox{10cm}{!}{%
\begin{tikzpicture} 
    \node (block1) [b] {Application InOut};
    \node (block2) [b,below= 4cm of block1] {Logical de calcul \\ d'indicateurs};
    \node (block3)[c, right=2cm of block1]  {API Java \\ \color{red} (requêtes, récupération \\ \color{red}des résultats)};
% connections within block A
\draw[ar] ([xshift=-1cm]block1.south) --++ (0,-2cm) -- ++(0.5,0) -- ([xshift=-0.5cm]block2.north);
\draw[ar] ([xshift= 1cm]block1.south) |- ([yshift=1cm]block3.south);
\draw[ar] ([yshift=-1cm]block3.south) -| (block1.south);
\node (block4) [c,right=10cm of block1] {Services Web \\ \color{red} (REST)};
\node (block5) [c, right= 12cm of block1] {MicMac \\ \color{red} (simulation)};
% connections within block B
\draw[ar] ([yshift=0.5cm]block4.north)  -- ([yshift=0.5cm]block5.south);
\draw[ar] ([yshift=-0.5cm]block5.south) -- ([yshift=-0.5cm]block4.north);
% connection between blocks A and B
\draw[ar] ([yshift=0.5cm]block3.north)  -- node[above]{\parbox[t]{4cm}{\begin{itemize}
                                                                        \item[-] Choix du scénario
                                                                        \item[-] Fichiers météo
                                                                        \item[-] Valeurs d'autres paramètres à définir
                                                                       \end{itemize} }} ([yshift=0.5cm]block4.south);
\draw[ar] ([yshift=-0.5cm]block4.south) --node[below]{\parbox[t]{4cm}{\begin{itemize}
                                                                       \item[-] Apport d'azote
                                                                       \item[-] Apport de pesticide
                                                                       \item[-] Apport d'eau
                                                                       \item[-] Rendement
                                                                       \item[-] D'autres résultats selon les besoins de MEANS
                                                                      \end{itemize} }} ([yshift=-0.5cm]block3.north);
\node(n1)[draw,fill opacity=0.2,fill=blue, fit=(block1)(block2)(block3),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:MEANS}
]{};
\node(n2)[draw,fill opacity=0.2,fill=blue, fit=(block4)(block5),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:RECORD}
]{};

\draw[myarrow=10pt colored by blue!50!white and white] (block2.south) --node[right,xshift= 0.2cm](){\color{red} (Indicateurs)} ++(0,-1.5cm);
\end{tikzpicture}
} %
\end{frame}

\end{document} 

I get this result : enter image description here

As you can see the result is not the same. Can someone could help me to solve this?

  • I can get the output in the beamer – Jesse Apr 19 '14 at 17:15
  • The output is the second picture or you want another thing? – Hunsu Apr 19 '14 at 17:17
  • I copy and paste my file into beamer and compiles fine. Of course I use \resizebox{\textwidth}{!}{ contents} from graphicx – Jesse Apr 19 '14 at 17:22
  • Perhapse the problem is the theme I'm using. I don't know why I get 'above' printed – Hunsu Apr 19 '14 at 17:26
  • 1
    Please post complete code. What, for example, is 'the theme I'm using'?! – cfr Apr 19 '14 at 18:12
1

If fou want to have the result as the first picture in the beamer, the simplest way is to compile the Tikz picture previously then include the image in the beamer.

If you compile using PDFLaTeX you can include a pdf file like a picture, and you can obtain it by compiling :

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}

\input{Picture.tikz}

\end{document}

If you have several pictures or if you would rather use eps pictures because of a compilation in LaTeX, I can give you a script in bash to make that task faster.`

To continue after your comment :

I got a result putting this code in the tex I compile :

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\usetikzlibrary{shapes.geometric,arrows,positioning,fit,calc,}
\tikzset{
b/.style={draw, rectangle, rounded corners=2ex,minimum height=0.5in, minimum width=2in,align=center},
c/.style={draw, rectangle, rounded corners=2ex, minimum height=0.5in, minimum  width=2in,align=center, rotate=-90},
ar/.style={rounded corners=2ex,->,>=latex },  
myarrow/.style args={#1 colored by #2 and #3}{
    -stealth,line width=#1,#2,postaction={draw,-stealth,#3,line width=(#1)/3,
    shorten <=(#1)/3,shorten >=2*(#1)/3}, 
  }
}


%\usepackage{concrete}
%\usetheme{Goettingen}
%\usetheme{Hannover}
\usepackage[frenchb]{babel}
\author{Author}
\title{Project}
\date{22 avril 2014}
%\institute{Institute}

\begin{document}

\input{Picture.tikz}

\end{document}

and this code in Picture.tikz:

\begin{tikzpicture} 
    \node (block1) [b] {Application InOut};
    \node (block2) [b,below= 4cm of block1] {Logical de calcul \\ d'indicateurs};
    \node (block3)[c, right=2cm of block1]  {API Java \\ \color{red} (requêtes, récupération \\ \color{red}des résultats)};
% connections within block A
\draw[ar] ([xshift=-1cm]block1.south) --++ (0,-2cm) -- ++(0.5,0) -- ([xshift=-0.5cm]block2.north);
\draw[ar] ([xshift= 1cm]block1.south) |- ([yshift=1cm]block3.south);
\draw[ar] ([yshift=-1cm]block3.south) -| (block1.south);
\node (block4) [c,right=10cm of block1] {Services Web \\ \color{red} (REST)};
\node (block5) [c, right= 12cm of block1] {MicMac \\ \color{red} (simulation)};
% connections within block B
\draw[ar] ([yshift=0.5cm]block4.north)  -- ([yshift=0.5cm]block5.south);
\draw[ar] ([yshift=-0.5cm]block5.south) -- ([yshift=-0.5cm]block4.north);
% connection between blocks A and B
\draw[ar] ([yshift=0.5cm]block3.north)  -- node[above]{\parbox[t]{4cm}{\begin{itemize}
                                                                        \item[-] Choix du scénario
                                                                        \item[-] Fichiers météo
                                                                        \item[-] Valeurs d'autres paramètres à définir
                                                                       \end{itemize} }} ([yshift=0.5cm]block4.south);
\draw[ar] ([yshift=-0.5cm]block4.south) --node[below]{\parbox[t]{4cm}{\begin{itemize}
                                                                       \item[-] Apport d'azote
                                                                       \item[-] Apport de pesticide
                                                                       \item[-] Apport d'eau
                                                                       \item[-] Rendement
                                                                       \item[-] D'autres résultats selon les besoins de MEANS
                                                                      \end{itemize} }} ([yshift=-0.5cm]block3.north);
\node(n1)[draw,fill opacity=0.2,fill=blue, fit=(block1)(block2)(block3),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:MEANS}
]{};
\node(n2)[draw,fill opacity=0.2,fill=blue, fit=(block4)(block5),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:RECORD}
]{};

\draw[myarrow=10pt colored by blue!50!white and white] (block2.south) --node[right,xshift= 0.2cm](){\color{red} (Indicateurs)} ++(0,-1.5cm);
\end{tikzpicture}

Note : I had to comment two lines

%\usetheme{Hannover}

and

%\institute{Institute}

My compiler wouldn't recognize them I suppose they are local packages you added.

  • How to compile a tikz sheme to Picture.tikz – Hunsu Apr 19 '14 at 20:23
  • Thanks I learned something. I don't know why it doesn't work the first time (bug?). I haven't added local packages. – Hunsu Apr 20 '14 at 9:40

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.