我画了一个包。如何在调用之前将绘图缩小 30%?我试过缩放,我是新手,没用。
\documentclass[a4paper]{article}
\usepackage[margin=10mm]{geometry}
\usepackage {array, tikz, amssymb}
\centering
\tikzset{
pics/mynode/.style args={#1,#2,#3}{
code={
\draw (-1,0) arc (180:360:1);
\draw (1,0) arc (0:180:1 and 2);
\draw [rounded corners=2 ] (0,2) -- (0.5,2.5) -- (-0.5,2.5) -- cycle;
% How do I scale bag to 30%?
%\node[#3] (#1) at (1,1) {#2};
}
}
}
\begin{document}
\begin{center}
\begin{tabular}{ m{8cm} m{0.5cm} m{8cm} }
%\hline
3) & & 4) \\
\begin{tikzpicture}
\draw (3,0) pic{mynode={1,2,3}};
\draw (0,3) pic{mynode={B, Hello, red}};
\draw (2,1.5) pic{mynode={C, Bye,}};
%\draw[thick, blue] (A)--(B)--(C)--(A);
\end{tikzpicture} & & \\
\end{tabular}
\end{center}
\end{document}
答案1
例如,应用图片时:
pic[scale=0.7]{mynode={1,2,blue}}
将所有坐标缩放 0.7(但不包括字体或其他与坐标不直接相关的东西),而
pic[scale=0.7, transform shape]{mynode={B, Hello, red}}
将所有内容按 0.7 缩放。从您的示例中稍微操纵的 MWE:
\documentclass[a4paper]{article}
\usepackage[margin=10mm]{geometry}
\usepackage {array, tikz, amssymb}
\centering
\tikzset{
pics/mynode/.style args={#1,#2,#3}{
code={
\draw (-1,0) arc (180:360:1);
\draw (1,0) arc (0:180:1 and 2);
\draw [rounded corners=2 ] (0,2) -- (0.5,2.5) -- (-0.5,2.5) -- cycle;
% How do I scale bag to 30%?
\node[#3] (#1) at (1,1) {#2};
}
}
}
\begin{document}
\begin{center}
\begin{tabular}{ m{8cm} m{0.5cm} m{8cm} }
3) & & 4) \\
\begin{tikzpicture}
\draw (3,0) pic[scale=0.7]{mynode={1,2,blue}};
\draw (0,3) pic[scale=0.7, transform shape]{mynode={B, Hello, red}};
\draw (2,1.5) pic{mynode={C, Bye,}};
%\draw[thick, blue] (A)--(B)--(C)--(A);
\end{tikzpicture} & & \\
\end{tabular}
\end{center}
\end{document}