我正在学习 Tikz。我画了一张带有一些标签的图片,我想把它插入到我的论文中。但如果图片很大,我想缩放它。缩放图片不是缩放标签。我可以对标签应用缩放因子,但我更喜欢一次性缩放所有内容,就像我们在图形环境中所做的那样。
在输出中,您看到S/R1
缩放后保持不变
\documentclass{standalone}
\usepackage{tkz-euclide,tikzscale}
\usetikzlibrary{calc,shapes,decorations,decorations.text, mindmap,shadings,patterns,matrix,arrows.meta,intersections,automata,backgrounds}
\begin{document}
\begin{tikzpicture}[%
coord/.style = {help lines, color=gray!40, dashed,xstep=0.5cm,ystep=0.5cm},%
2ndRect/.style = {magenta, pattern=north west lines, pattern color=magenta},%
3rdRect/.style = {magenta, pattern=crosshatch dots, pattern color=gray},%
insideArrow/.style = {black,{stealth[scale=2]}-{stealth[scale=2]}},%
smallRect/.style = {fill=white},%
every node/.append style = {font =\bfseries},%
scale=.5
]
%
% Draw HelpLines just to work faster
%
\tkzInit[xmax=20,ymax=10,xmin=0,ymin=0]
\tkzAxeXY
\draw[coord] (0,0) grid (20,10);
%
% Draw Rectangles
%
\draw (1,1) rectangle (18,5); % 1st rectangle
\draw[2ndRect] (4,1.5) rectangle (15,4.5); % 2nd rectangle
\path[fill=white](6,2) rectangle (13,4); % workaround 4 clipping background
\draw[3rdRect] (6,2) rectangle (13,4); % 3rd rectangle
\draw[smallRect] (6.5,2.5) rectangle (8.5,3.5); % small %rectangle
\node at (7.5,3) {S/R1}; % label
\draw[smallRect] (10.5,2.5) rectangle (12.5,3.5); % small rectangle
\node at (11.5,3) {S/R1}; % label
\draw[insideArrow] (8.8,3) -- (10.2,3); % arrow btwen small rectangles
\end{tikzpicture}
\end{document}