将 Tikz 方案纳入到 Beamer 演示文稿的更好方法是什么

将 Tikz 方案纳入到 Beamer 演示文稿的更好方法是什么

我有这个 Tikz 方案 在此处输入图片描述

代码

\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}

现在我不想将其纳入投影仪框架,所以我喜欢这样做:

\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} 

我得到这个结果: 在此处输入图片描述

如您所见,结果并不相同。有人能帮我解决这个问题吗?

答案1

如果您希望将结果作为投影仪中的第一张图片,最简单的方法是事先编译 Tikz 图片,然后将图像包含在投影仪中。

如果使用PDFLaTeX进行编译则可以像图片一样包含pdf文件,可以通过编译获得它:

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

\begin{document}

\input{Picture.tikz}

\end{document}

如果您有几张图片,或者由于在 LaTeX 中进行编译而更愿意使用 eps 图片,我可以为您提供一个 bash 脚本以加快该任务的完成速度。`

评论后继续:

将此代码放入我编译的 tex 中得到了结果:

\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}

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}

注意:我必须评论两行

%\usetheme{Hannover}

%\institute{Institute}

我的编译器无法识别它们,我想它们是你添加的本地包。

相关内容