![如何将这个 tikz 图形定位在 A4 纸的中心?](https://linux22.com/image/334341/%E5%A6%82%E4%BD%95%E5%B0%86%E8%BF%99%E4%B8%AA%20tikz%20%E5%9B%BE%E5%BD%A2%E5%AE%9A%E4%BD%8D%E5%9C%A8%20A4%20%E7%BA%B8%E7%9A%84%E4%B8%AD%E5%BF%83%EF%BC%9F.png)
% Mindmap
% Author: Stefan Kottwitz
% https://www.packtpub.com/hardware-and-creative/latex-cookbook
\documentclass[border = 100pt]{standalone}
\usepackage[landscape]{geometry}
%\usepackage[margin=9cm,showframe]{geometry}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\usepackage{metalogo}
\usepackage{dtklogos}
\begin{document}
\begin{tikzpicture}
\path [
mindmap,
text = white, align=flush center,
level 1 concept/.append style =
{font=\large\bfseries, sibling angle=90},
level 2 concept/.append style =
{font=\normalsize\bfseries, level distance = 3.5cm, sibling angle=55},
level 3 concept/.append style =
{font=\small\bfseries, level distance = 3.5cm, sibling angle=60},
tex/.style = {concept, ball color=black,
font=\huge\bfseries},
engines/.style = {concept, ball color=green!50!black},
formats/.style = {concept, ball color=blue!50!black},
systems/.style = {concept, ball color=red!80!black},
editors/.style = {concept, ball color=orange!90!black}
]
node [tex] {Samples} [clockwise from=0]
child[concept color=green!50!black, nodes={engines}] {
node {Mixtures} [clockwise from=750]
child { node {Series 1}}
child { node {Series 2} }
% child { node {\XeTeX} }
%child { node {Lua\TeX} }
}
child [concept color=blue, nodes={formats}] {
node {Case Types} [clockwise from=300]
child { node {\LaTeX} }
child { node {Con\TeX t} }}
child [concept color=red, nodes={systems}] {
node [circle,draw,minimum size=6em,text width=6em]{\Large\bfseries{Single source}} [clockwise from=240]
child { node [circle,draw,minimum size=6em,text width=5em]{\large\bfseries{5 Samples}}[clockwise from=180]
child { node[circle,draw,minimum size=7em,text width=7em] {\large\bfseries{LR Check}} }}
child { node [circle,draw,minimum size=6em,text width=5em]{\large\bfseries{7 Samples}}[clockwise from=180]
child { node[circle,draw,minimum size=7em,text width=7em] {\large\bfseries{DNA Conc.}} }}
child { node [circle,draw,minimum size=6em,text width=5em] {\large\bfseries{7 Samples}} [clockwise from=180]
child { node[circle,draw,minimum size=7em,text width=7em] {\large\bfseries{Saturation}} }}
child { node[circle,draw,minimum size=6em,text width=6em]{\Large\bfseries{94 Samples}} [clockwise from=135]
child { node[circle,draw,minimum size=6em,text width=5em] {\large\bfseries{Stutter Ratio}} }
child { node[circle,draw,minimum size=6em,text width=6em] {\large\bfseries{Variances}} }}}
child [concept color=orange, nodes={editors}] {
node {STRmix} };
\end{tikzpicture}
\end{document}
答案1
部分问题在于图片太大,无法放入文本区域,部分问题在于起始节点不在图像的中心。(独立和几何不兼容,但由于您希望在 A4 纸上显示,所以这无关紧要。)
我的解决方案是将思维导图放入保存框,然后再次运行 tikz 以使该框位于页面的中心。(注意:您需要运行两次。)
% Mindmap
% Author: Stefan Kottwitz
% https://www.packtpub.com/hardware-and-creative/latex-cookbook
\documentclass[a4paper,landscape]{article}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\usepackage{metalogo}
%\usepackage{dtklogos}
\newsavebox{\tempbox}
\begin{document}
\thispagestyle{empty}% no room for page number
\savebox{\tempbox}{\begin{tikzpicture}
\path [
mindmap,
text = white, align=flush center,
level 1 concept/.append style =
{font=\large\bfseries, sibling angle=90},
level 2 concept/.append style =
{font=\normalsize\bfseries, level distance = 3.5cm, sibling angle=55},
level 3 concept/.append style =
{font=\small\bfseries, level distance = 3.5cm, sibling angle=60},
tex/.style = {concept, ball color=black,
font=\huge\bfseries},
engines/.style = {concept, ball color=green!50!black},
formats/.style = {concept, ball color=blue!50!black},
systems/.style = {concept, ball color=red!80!black},
editors/.style = {concept, ball color=orange!90!black}
]
node [tex] {Samples} [clockwise from=0]
child[concept color=green!50!black, nodes={engines}] {
node {Mixtures} [clockwise from=750]
child { node {Series 1}}
child { node {Series 2} }
% child { node {\XeTeX} }
%child { node {Lua\TeX} }
}
child [concept color=blue, nodes={formats}] {
node {Case Types} [clockwise from=300]
child { node {\LaTeX} }
child { node {Con\TeX t} }}
child [concept color=red, nodes={systems}] {
node [circle,draw,minimum size=6em,text width=6em]{\Large\bfseries{Single source}} [clockwise from=240]
child { node [circle,draw,minimum size=6em,text width=5em]{\large\bfseries{5 Samples}}[clockwise from=180]
child { node[circle,draw,minimum size=7em,text width=7em] {\large\bfseries{LR Check}} }}
child { node [circle,draw,minimum size=6em,text width=5em]{\large\bfseries{7 Samples}}[clockwise from=180]
child { node[circle,draw,minimum size=7em,text width=7em] {\large\bfseries{DNA Conc.}} }}
child { node [circle,draw,minimum size=6em,text width=5em] {\large\bfseries{7 Samples}} [clockwise from=180]
child { node[circle,draw,minimum size=7em,text width=7em] {\large\bfseries{Saturation}} }}
child { node[circle,draw,minimum size=6em,text width=6em]{\Large\bfseries{94 Samples}} [clockwise from=135]
child { node[circle,draw,minimum size=6em,text width=5em] {\large\bfseries{Stutter Ratio}} }
child { node[circle,draw,minimum size=6em,text width=6em] {\large\bfseries{Variances}} }}}
child [concept color=orange, nodes={editors}] {
node {STRmix} };
\end{tikzpicture}}% create box
\begin{tikzpicture}[remember picture,overlay]
\node[inner sep=0pt] at (current page.center) {\usebox{\tempbox}};
\end{tikzpicture}
\newpage
\end{document}