我有一个文档中的流程图article
。
\documentclass{article}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{matrix,shapes,arrows,positioning,chains}
\begin{document}
\tikzstyle{block} = [draw, rectangle, text centered,text width=7.5cm, minimum height=8mm,node distance=10em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle(cloud)=[ellipse,draw, text centered,node distance=10em,minimum height=2em,minimum size=0cm]
\tikzstyle{decision}=[draw,diamond,text centered, node distance=10em,inner sep=2pt,minimum size=0cm]
\tikzstyle{io}=[trapezium,minimum size=0cm,trapezium left angle=70,trapezium right angle=-70,minimum height=4em, draw, text width=4.5em, text centered, node distance=10em, inner sep=2pt]
\begin{figure}[H]
\centering
\begin{tikzpicture}
\node[draw,ellipse](Mulai){Mulai};
\node[block,below of=Mulai,node distance=1.5cm](step1){Studi literatur};
\node[block,below of=step1,node distance=2cm](step2){Formulasi model matematika};
\node[block,below of=step2,node distance=2cm](step3){Analisis kestabilan titik ekulibrium};
\node[block,below of=step3,node distance=2cm](step4){Penyelesaian kontrol optimal menggunakan \textit{Pontryagin Maximum Principle}};
\node[block,below of=step4,node distance=2.5cm](step5){Simulasi numerik dengan program \textit{MATLAB}};
\node[io,below of=step5,node distance=2.5cm](Penutup){Kesimpulan dan Saran};
\node[draw,ellipse,below of=Penutup,node distance=2cm](End){Selesai};
\path[line](Mulai)--(step1);
\path[line](step1)--(step2);
\path[line](step2)--(step3);
\path[line](step3)--(step4);
\path[line](step4)--(step5);
\path[line](step5)--(Penutup);
\path[line](Penutup)--(End);
\end{tikzpicture}
\caption{\textit{Flowchart} Alur Penelitian}
\end{figure}
\end{document}
如何将其放入beamer
文档中?
答案1
也许matrix of nodes
作为替代方案?
在矩阵样式的定义中,可以轻松微调垂直空间和应用于节点的样式。
\documentclass[9pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,arrows,positioning,chains}
\begin{document}
\begin{frame}
\begin{figure}
\begin{tikzpicture}
\tikzset{
block/.style={
draw,
rectangle,
align=flush center,
text width=7.5cm,
minimum height=1.2em,
},
line/.style={
draw,
-latex',
},
io/.style={
trapezium,
minimum size=0cm,
trapezium left angle=70,
trapezium right angle=-70,
minimum height=3em,
draw,
text width=4.5em,
text centered,
inner sep=2pt,
},
}
\matrix (m) [
matrix of nodes,
row sep = 3mm,
row 1/.style={nodes={draw,ellipse}},
row 2/.style={nodes={block}},
row 3/.style={nodes={block}},
row 4/.style={nodes={block}},
row 5/.style={nodes={block}},
row 6/.style={nodes={block}},
row 7/.style={nodes={io}},
row 8/.style={nodes={draw,ellipse}},
]{
Mulai \\
Studi literatur \\
Formulasi model matematika \\
Analisis kestabilan titik ekulibrium \\
Penyelesaian kontrol optimal menggunakan \emph{Pontryagin Maximum Principle} \\
Simulasi numerik dengan program \emph{MATLAB} \\
Kesimpulan dan Saran \\
Selesai \\
};
\draw[line] (m-1-1) -- (m-2-1);
\draw[line] (m-2-1) -- (m-3-1);
\draw[line] (m-3-1) -- (m-4-1);
\draw[line] (m-4-1) -- (m-5-1);
\draw[line] (m-5-1) -- (m-6-1);
\draw[line] (m-6-1) -- (m-7-1);
\draw[line] (m-7-1) -- (m-8-1);
\end{tikzpicture}
\caption{\textit{Flowchart} Alur Penelitian}
\end{figure}
\end{frame}
\end{document}
答案2
利用chains
库代码变得简单而且很短:
\documentclass{beamer}
%\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption}{size=\footnotesize}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning,
shapes}
\tikzset{FlowChart/.style = {% can be used in any flowchart
arr/.style = {semithick, -{Stealth[scale=0.8]}},
base/.style = {draw, text width=62mm, minimum height=6mm, align=flush center},
startstop/.style = {ellipse, draw, inner xsep = 0pt},
process/.style = {base},
io/.style = {base, trapezium, trapezium stretches body,
trapezium left angle=70, trapezium right angle=110,
text width=31mm},
decision/.style = {base, diamond, aspect=1.5, inner sep=0pt},
every edge quotes/.style = {auto=right}
}
}
\begin{document}
\begin{frame}
\frametitle{Frame title}
\begin{figure}
\footnotesize
\begin{tikzpicture}[FlowChart,
node distance = 3mm,
start chain = going below
]
\begin{scope}[nodes={on chain, join=by arr}]
\node [startstop] {Mulai};
\node [process] {Studi literatur};
\node [process] {Formulasi model matematika};
\node [process] {Analisis kestabilan titik ekulibrium};
\node [process] {Penyelesaian kontrol optimal menggunakan
\emph{Pontryagin Maximum Principle}};
\node [process] {Simulasi numerik dengan program \emph{MATLAB}};
\node [io] {Kesimpulan dan Saran};
\node [startstop] {Selesai};
\end{scope}
\end{tikzpicture}
\caption{\textit{Flowchart} Alur Penelitian}
\end{figure}
\end{frame}
\end{document}
答案3
我假设你问的是怎样做这两件事:
- 如何创建水平流程图
- 如何将其安装到投影仪幻灯片上
对于第一点,你可以用 替换below of
。right of
对于第二点,你可以手动摆弄尺寸,或者简单地使用 缩放整个 tikzpicture \begin{tikzpicture}[scale=0.65,...]
。
这是对您的示例的快速尝试:
\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{matrix,shapes,arrows,positioning,chains}
\begin{document}
\tikzstyle{block} = [draw, rectangle, text centered,text width=1.7cm, minimum height=0.6\textheight,node distance=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle(cloud)=[ellipse,draw, text centered,node distance=10em,minimum height=2em,minimum size=0cm]
\tikzstyle{decision}=[draw,diamond,text centered, node distance=10em,inner sep=2pt,minimum size=0cm]
\tikzstyle{io}=[trapezium,minimum size=0cm,trapezium left angle=70,trapezium right angle=-70,minimum height=5em, draw, text width=3.5em, text centered, node distance=5em, inner sep=2pt]
\begin{frame}[t, fragile]
\begin{figure}[H]
\centering % horizontal centering
\vfill % vertical centering
\begin{tikzpicture}[scale=0.65, every node/.style={scale=0.65}]
\node[draw,ellipse, minimum width=7em, minimum height=4em](Mulai){Mulai};
\node[block,right of=Mulai, anchor=west, node distance=5em](step1){Studi literatur};
\node[block,right of=step1, anchor=west](step2){Formulasi model matematika};
\node[block,right of=step2, anchor=west](step3){Analisis kestabilan titik ekulibrium};
\node[block,right of=step3, anchor=west](step4){Penyelesaian kontrol optimal menggunakan \textit{Pontryagin Maximum Principle}};
\node[block,right of=step4, anchor=west](step5){Simulasi numerik dengan program \textit{MATLAB}};
\node[io,right of=step5, anchor=west](Penutup){Kesimpulan dan Saran};
\node[draw,ellipse,right of=Penutup,anchor=west, node distance=5em, minimum width=7em, minimum height=4em](End){Selesai};
\path[line](Mulai)--(step1);
\path[line](step1)--(step2);
\path[line](step2)--(step3);
\path[line](step3)--(step4);
\path[line](step4)--(step5);
\path[line](step5)--(Penutup);
\path[line](Penutup)--(End);
\end{tikzpicture}
\caption{\textit{Flowchart} Alur Penelitian}
\end{figure}
\vfill
\end{frame}
\end{document}
答案4
这是一个解决方案:
\documentclass[9pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,arrows,positioning,chains}
\begin{document}
\begin{frame}
\begin{figure}
\begin{tikzpicture}
\tikzset{
block/.style={draw, rectangle,align=flush center,text width=7.5cm, minimum height=1.2em},
line/.style={draw, -latex'},
io/.style={
trapezium,minimum size=0cm,trapezium left angle=70,trapezium right angle=-70,minimum height=3em, draw, text width=4.5em, text centered,inner sep=2pt},
}
\node[draw,ellipse](Mulai){Mulai};
\node[block,below=2mm of Mulai](step1){Studi literatur};
\node[block,below=3mm of step1](step2){Formulasi model matematika};
\node[block,below=3mm of step2](step3){Analisis kestabilan titik ekulibrium};
\node[block,below=3mm of step3](step4){Penyelesaian kontrol optimal menggunakan \emph{Pontryagin Maximum Principle}};
\node[block,below=3mm of step4](step5){Simulasi numerik dengan program \emph{MATLAB}};
\node[io,below=4mm of step5](Penutup){Kesimpulan dan Saran};
\node[draw,ellipse,below=4mm of Penutup](End){Selesai};
\path[line](Mulai)--(step1);
\path[line](step1)--(step2);
\path[line](step2)--(step3);
\path[line](step3)--(step4);
\path[line](step4)--(step5);
\path[line](step5)--(Penutup);
\path[line](Penutup)--(End);
\end{tikzpicture}
\caption{\textit{Flowchart} Alur Penelitian}
\end{figure}
\end{frame}
\end{document}