我知道有几种方法可以缩放整个 tikz 图片(例如\resizebox
)。但是,我只想缩放单个 tikz 图片中的某些部分。
就我而言,我想为会议创建一些幻灯片,其中一张幻灯片应由已经存在的不同单个(复杂)tikz 图片组成。此外,我想让它们部分重叠。我已经找到了\begin{scope}[scale=.2] ... \end{scope}
。但是,这不起作用。
以下 MWE 应该能够直观地表达我的意思:
\documentclass[border=3mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes}
\begin{document}
\begin{tikzpicture}[auto,
node distance=.5cm,
rect/.style={rectangle, draw, thick, inner sep=5pt, minimum width=20mm, minimum height=10mm, align=center, fill=white},
ellips/.style={circle, draw, thick, inner sep=0pt, minimum size=22mm, align=center, fill=white}]
\node[rect] (A) at (-1, 0) {Stuff A};
\node[rect] (B) [right= of A] {Stuff B};
\node[rect] (C) [right= of B] {Stuff C};
\node[ellips] (D) at (0,0) {As a whole};
\node[ellips] (E) [below= of D] {we should \\ be scalable};
\draw [draw, thick] (D.270) [] to node {} (E.90);
\end{tikzpicture}
\end{document}
D
在我的真实情况下,和的组合E
是一个相当复杂的 tikz 图片,我想让它变小并打印“上方”/“之间”A
和B
。
答案1
tikzpicture
我不完全确定这是否能满足您的需求,但您可以尝试在整体和内部节点上进行嵌套缩放(参见如何缩放包含文本的 tikzpicture?):
\documentclass[border=3mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes}
\begin{document}
\begin{tikzpicture}[auto,
node distance=.5cm,
rect/.style={rectangle, draw, thick, inner sep=5pt, minimum width=20mm, minimum height=10mm, align=center, fill=white},
ellips/.style={circle, draw, thick, inner sep=0pt, minimum size=22mm, align=center, fill=white}]
\node[rect] (A) at (-1, 0) {Stuff A};
\node[rect] (B) [right= of A] {Stuff B};
\node[rect] (C) [right= of B] {Stuff C};
\node (DE) [right= -5mm of A]{
\begin{tikzpicture}[scale=0.6, every node/.style={scale=0.6}]
\node[ellips] (D) at (0,0) {As a whole};
\node[ellips] (E) [below= 2cm of D] {we should \\ be scalable};
\draw [draw, thick] (D.270) [] to node {} (E.90);
\end{tikzpicture}
};
\end{tikzpicture}
\end{document}
生产(摆弄定位后):