TikZ做思维导图并插入幻灯片
先给出幻灯片中的效果:
mind maps 制作
前序准备
首先加载必要的包和库
\documentclass[tikz]{standalone}
\usepackage{ctex}
\usepackage{xcolor}
\usetikzlibrary{mindmap}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\end{tikzpicture}
\end{document}
注意:tikz绘图使用standalone类
绘制父节点(node)以及子节点(child node)
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue!50!black, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{Title}
child { node {Chapter1}}
child { node {Chapter2}};
\end{tikzpicture}
grow cyclic
使得旋转添加子节点every node/.style=concept
定义每个节点的默认样式,例如后面的concept color
定义默认颜色,text=white
定义文字颜色白色level 1/.append style
后定义了第一级子节点与父节点间距(level distance
),旋转添加子节点之间的角度(sibling angle
)
同样,可以单独定义第一级子节点样式
\tikzstyle{level 1 concept}+=[concept color=purple!40, level distance=5cm, sibling angle=72]
\node{Title}
child { node {Chapter1}}
child { node {Chapter2}};
颜色的设置
- 首先需要宏包:
\usepackage{xcolor}
- 可以通过RGB三原色定义,例如
\definecolor{blue0}{RGB}{18, 76, 158} %RGB
或者通过green!50!blue
定义颜色
- 可对所有nodes定义默认颜色blue0,通过
every node/.style=concept, concept color=blue0
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
- 在child后面添加方括号改变node颜色,例如这里变为
green!50!blue
\node{\Title}[clockwise from=180]
child [concept color=green!50!blue]{ node {\ChapterI} [clockwise from=-90]}
完整的mind map
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue!50!black, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{Title}[clockwise from=180] % clockwise from定义子节点产生位置
child [concept color=green!50!blue]{ node {Chapter1} [clockwise from=-90]
child [concept color=red!50!blue] { node {S1}}
child [concept color=red!50!blue] { node {S2}}
child [concept color=red!50!blue] { node {S3}}
child [concept color=red!50!blue] { node {S4}}
}
child [concept color=green!50!blue] { node {Chapter2}[clockwise from=160]
child [concept color=red!50!blue] { node {S1}}
child [concept color=red!50!blue] { node {S2}}
child [concept color=red!50!blue] { node {S3}}
}
child [concept color=green!50!blue] { node {Chapter3}[clockwise from=66]
child [concept color=red!50!blue] { node {S1}}
child [concept color=red!50!blue] { node {S2}}
}
child [concept color=green!50!blue] { node {S1}[clockwise from=-3]
child [concept color=red!50!blue] { node {S2}}
child [concept color=red!50!blue] { node {S3}}
}
child [concept color=green!50!blue]{ node {Chapter5}}
;
\end{tikzpicture}
将mind maps插入幻灯片
\section{结构}
\begin{frame}[t]{结构}
\begin{figure}
\centering
\only<1>{\includegraphics[page=1, width=0.7\linewidth]{pic/mindmap}}
\only<2>{\includegraphics[page=2, width=0.7\linewidth]{pic/mindmap}}
\only<3>{\includegraphics[page=3, width=0.7\linewidth]{pic/mindmap}}
\only<4>{\includegraphics[page=4, width=0.7\linewidth]{pic/mindmap}}
\only<5>{\includegraphics[page=5, width=0.7\linewidth]{pic/mindmap}}
\only<6>{\includegraphics[page=6, width=0.7\linewidth]{pic/mindmap}}
\end{figure}
\end{frame}
源码及效果
\documentclass[tikz]{standalone}
\usepackage{ctex}
\usepackage{xcolor}
\usetikzlibrary{mindmap}
\pagestyle{empty}
\begin{document}
%\tikzstyle{every text node part} = [font=\bferize]
%-----------------------------定义颜色---------------------------------------
\definecolor{blue0}{RGB}{18, 76, 158} %RGB
%-----------------------------定义节点---------------------------------------
\def\Title{TITLE}
\def\ChapterI{Chapter1}
\def\CISI{Section1}
\def\CISII{Section2}
\def\CISIII{Section3}
\def\CISIV{Section4}
\def\ChapterII{Chapter2}
\def\CIISI{Section1}
\def\CIISII{Section2}
\def\CIISIII{Section3}
\def\ChapterIII{Chapter3}
\def\CIIISI{Section1}
\def\CIIISII{Section2}
\def\ChapterIV{Section3}
\def\CIVSI{Section1}
\def\CIVSII{Section2}
\def\ChapterV{Conclusion}
%----------------------------------------------------------------------------
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{\Title}[clockwise from=180]
child [concept color=black!20]{ node {\ChapterI} [clockwise from=-90]
child [concept color=black!20] { node {\CISI}}
child [concept color=black!20] { node {\CISII}}
child [concept color=black!20] { node {\CISIII}}
child [concept color=black!20] { node {\CISIV}}
}
child [concept color=black!20] { node {\ChapterII}[clockwise from=160]
child [concept color=black!20] { node {\CIISI}}
child [concept color=black!20] { node {\CIISII}}
child [concept color=black!20] { node {\CIISIII}}
}
child [concept color=black!20] { node {\ChapterIII}[clockwise from=66]
child [concept color=black!20] { node {\CIIISI}}
child [concept color=black!20] { node {\CIIISII}}
}
child [concept color=black!20] { node {\ChapterIV}[clockwise from=-3]
child [concept color=black!20] { node {\CIVSI}}
child [concept color=black!20] { node {\CIVSII}}
}
child [concept color=black!20]{ node {\ChapterV}}
;
\end{tikzpicture}
\newpage
%----------------------------------------------------------------------------
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{\Title}[clockwise from=180]
child [concept color=green!50!blue]{ node {\ChapterI} [clockwise from=-90]
child [concept color=red!50!blue] { node {\CISI}}
child [concept color=red!50!blue] { node {\CISII}}
child [concept color=red!50!blue] { node {\CISIII}}
child [concept color=red!50!blue] { node {\CISIV}}
}
child [concept color=black!20] { node {\ChapterII}[clockwise from=160]
child [concept color=black!20] { node {\CIISI}}
child [concept color=black!20] { node {\CIISII}}
child [concept color=black!20] { node {\CIISIII}}
}
child [concept color=black!20] { node {\ChapterIII}[clockwise from=66]
child [concept color=black!20] { node {\CIIISI}}
child [concept color=black!20] { node {\CIIISII}}
}
child [concept color=black!20] { node {\ChapterIV}[clockwise from=-3]
child [concept color=black!20] { node {\CIVSI}}
child [concept color=black!20] { node {\CIVSII}}
}
child [concept color=black!20]{ node {\ChapterV}}
;
\end{tikzpicture}
\newpage
%----------------------------------------------------------------------------
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{\Title}[clockwise from=180]
child [concept color=green!50!blue]{ node {\ChapterI} [clockwise from=-90]
child [concept color=red!50!blue] { node {\CISI}}
child [concept color=red!50!blue] { node {\CISII}}
child [concept color=red!50!blue] { node {\CISIII}}
child [concept color=red!50!blue] { node {\CISIV}}
}
child [concept color=green!50!blue] { node {\ChapterII}[clockwise from=160]
child [concept color=red!50!blue] { node {\CIISI}}
child [concept color=red!50!blue] { node {\CIISII}}
child [concept color=red!50!blue] { node {\CIISIII}}
}
child [concept color=black!20] { node {\ChapterIII}[clockwise from=66]
child [concept color=black!20] { node {\CIIISI}}
child [concept color=black!20] { node {\CIIISII}}
}
child [concept color=black!20] { node {\ChapterIV}[clockwise from=-3]
child [concept color=black!20] { node {\CIVSI}}
child [concept color=black!20] { node {\CIVSII}}
}
child [concept color=black!20]{ node {\ChapterV}}
;
\end{tikzpicture}
\newpage
%----------------------------------------------------------------------------
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{\Title}[clockwise from=180]
child [concept color=green!50!blue]{ node {\ChapterI} [clockwise from=-90]
child [concept color=red!50!blue] { node {\CISI}}
child [concept color=red!50!blue] { node {\CISII}}
child [concept color=red!50!blue] { node {\CISIII}}
child [concept color=red!50!blue] { node {\CISIV}}
}
child [concept color=green!50!blue] { node {\ChapterII}[clockwise from=160]
child [concept color=red!50!blue] { node {\CIISI}}
child [concept color=red!50!blue] { node {\CIISII}}
child [concept color=red!50!blue] { node {\CIISIII}}
}
child [concept color=green!50!blue] { node {\ChapterIII}[clockwise from=66]
child [concept color=red!50!blue] { node {\CIIISI}}
child [concept color=red!50!blue] { node {\CIIISII}}
}
child [concept color=black!20] { node {\ChapterIV}[clockwise from=-3]
child [concept color=black!20] { node {\CIVSI}}
child [concept color=black!20] { node {\CIVSII}}
}
child [concept color=black!20]{ node {\ChapterV}}
;
\end{tikzpicture}
\newpage
%----------------------------------------------------------------------------
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{\Title}[clockwise from=180]
child [concept color=green!50!blue]{ node {\ChapterI} [clockwise from=-90]
child [concept color=red!50!blue] { node {\CISI}}
child [concept color=red!50!blue] { node {\CISII}}
child [concept color=red!50!blue] { node {\CISIII}}
child [concept color=red!50!blue] { node {\CISIV}}
}
child [concept color=green!50!blue] { node {\ChapterII}[clockwise from=160]
child [concept color=red!50!blue] { node {\CIISI}}
child [concept color=red!50!blue] { node {\CIISII}}
child [concept color=red!50!blue] { node {\CIISIII}}
}
child [concept color=green!50!blue] { node {\ChapterIII}[clockwise from=66]
child [concept color=red!50!blue] { node {\CIIISI}}
child [concept color=red!50!blue] { node {\CIIISII}}
}
child [concept color=green!50!blue] { node {\ChapterIV}[clockwise from=-3]
child [concept color=red!50!blue] { node {\CIVSI}}
child [concept color=red!50!blue] { node {\CIVSII}}
}
child [concept color=black!20]{ node {\ChapterV}}
;
\end{tikzpicture}
\newpage
%----------------------------------------------------------------------------
\begin{tikzpicture}[mindmap, grow cyclic, every node/.style=concept, concept color=blue0, text=white,
level 1/.append style={level distance=5cm, sibling angle=72},
level 2/.append style={level distance=3cm,sibling angle=60},]
\node{\Title}[clockwise from=180]
child [concept color=green!50!blue]{ node {\ChapterI} [clockwise from=-90]
child [concept color=red!50!blue] { node {\CISI}}
child [concept color=red!50!blue] { node {\CISII}}
child [concept color=red!50!blue] { node {\CISIII}}
child [concept color=red!50!blue] { node {\CISIV}}
}
child [concept color=green!50!blue] { node {\ChapterII}[clockwise from=160]
child [concept color=red!50!blue] { node {\CIISI}}
child [concept color=red!50!blue] { node {\CIISII}}
child [concept color=red!50!blue] { node {\CIISIII}}
}
child [concept color=green!50!blue] { node {\ChapterIII}[clockwise from=66]
child [concept color=red!50!blue] { node {\CIIISI}}
child [concept color=red!50!blue] { node {\CIIISII}}
}
child [concept color=green!50!blue] { node {\ChapterIV}[clockwise from=-3]
child [concept color=red!50!blue] { node {\CIVSI}}
child [concept color=red!50!blue] { node {\CIVSII}}
}
child [concept color=green!50!blue]{ node {\ChapterV}}
;
\end{tikzpicture}
\end{document}