我有下图的代码
\begin{tikzpicture}[scale=1,font=\footnotesize]
\coordinate (A) at (0,0);
\coordinate (B) at (0:1.5);
\coordinate (C) at ([shift={(B)}]-50:1);
\coordinate (D) at ([shift={(C)}]-160:1.5);
\coordinate (E) at (240:1);
\path ($(A)+(0.5,2)$) coordinate (A')
($(B)+(0.5,2)$) coordinate (B')
($(C)+(0.5,2)$) coordinate (C')
($(D)+(0.5,2)$) coordinate (D')
($(E)+(0.5,2)$) coordinate (E');
\fill[left color=gray!70,right color=gray!70, middle color=gray!40, opacity=1.2] (A')--(B')--(C')--(D')--(E')--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (E)--(E')--(D')--(D)--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (C)--(D)--(D')--(C')--cycle;
\draw[line width=0.2pt] (E)--(E')--(A')--(B')--(C')--(C)--(D)--cycle
(C')--(D')--(E') (D)--(D');
\draw (D)node[below]{Khối lăng trụ};
\end{tikzpicture}
这是图片
当我使用选项 scale=0.7 时,图片如下图所示
该案例到底出现了什么问题?
答案1
事实上,符号坐标并没有发生变换。然而,在
\coordinate (C) at ([shift={(B)}]-50:1);
\coordinate (D) at ([shift={(C)}]-160:1.5);
由于 Ti 的方式,转变得到了有效的转变钾Z 解析这些。因此,您需要将这些表达式替换为
\coordinate (C) at ($(-50:1)+(B)$);
\coordinate (D) at ($(-160:1.5)+(C)$);
获得
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1,font=\footnotesize]
\coordinate (A) at (0,0);
\coordinate (B) at (0:1.5);
\coordinate (C) at ($(-50:1)+(B)$);
\coordinate (D) at ($(-160:1.5)+(C)$);
\coordinate (E) at (240:1);
\path ($(A)+(0.5,2)$) coordinate (A')
($(B)+(0.5,2)$) coordinate (B')
($(C)+(0.5,2)$) coordinate (C')
($(D)+(0.5,2)$) coordinate (D')
($(E)+(0.5,2)$) coordinate (E');
\fill[left color=gray!70,right color=gray!70, middle color=gray!40, opacity=1.2] (A')--(B')--(C')--(D')--(E')--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (E)--(E')--(D')--(D)--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (C)--(D)--(D')--(C')--cycle;
\draw[line width=0.2pt] (E)--(E')--(A')--(B')--(C')--(C)--(D)--cycle
(C')--(D')--(E') (D)--(D');
\draw (D)node[below]{Khoi lang tru};
\end{tikzpicture}
\begin{tikzpicture}[scale=0.7,font=\footnotesize]
\coordinate (A) at (0,0);
\coordinate (B) at (0:1.5);
\coordinate (C) at ($(-50:1)+(B)$);
\coordinate (D) at ($(-160:1.5)+(C)$);
\coordinate (E) at (240:1);
\path ($(A)+(0.5,2)$) coordinate (A')
($(B)+(0.5,2)$) coordinate (B')
($(C)+(0.5,2)$) coordinate (C')
($(D)+(0.5,2)$) coordinate (D')
($(E)+(0.5,2)$) coordinate (E');
\fill[left color=gray!70,right color=gray!70, middle color=gray!40, opacity=1.2] (A')--(B')--(C')--(D')--(E')--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (E)--(E')--(D')--(D)--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (C)--(D)--(D')--(C')--cycle;
\draw[line width=0.2pt] (E)--(E')--(A')--(B')--(C')--(C)--(D)--cycle
(C')--(D')--(E') (D)--(D');
\draw (D)node[below]{Khoi lang tru};
\end{tikzpicture}
\end{document}
顺便说一句,你可以稍微简化一下你的图片,
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1,font=\footnotesize]
\path (0,0) coordinate (A) (0:1.5) coordinate (B)
++ (-50:1) coordinate (C) ++ (-160:1.5) coordinate (D)
(240:1) coordinate (E);
\path ($(A)+(0.5,2)$) coordinate (A')
($(B)+(0.5,2)$) coordinate (B')
($(C)+(0.5,2)$) coordinate (C')
($(D)+(0.5,2)$) coordinate (D')
($(E)+(0.5,2)$) coordinate (E');
\fill[left color=gray!70,right color=gray!70, middle color=gray!40, opacity=1.2] (A')--(B')--(C')--(D')--(E')--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (E)--(E')--(D')--(D)--cycle;
\fill[left color=gray!90,right color=gray!40, middle color=gray!60, opacity=1.2] (C)--(D)--(D')--(C')--cycle;
\draw[line width=0.2pt] (E)--(E')--(A')--(B')--(C')--(C)--(D)--cycle
(C')--(D')--(E') (D)--(D');
\draw (D)node[below]{Khoi lang tru};
\end{tikzpicture}
\end{document}
还请注意,我的编辑器不处理中的特殊字符Khối lăng trụ
,所以我不得不删除它们,很抱歉。