我的文档中枚举列表中有两个 Tikz 块代码,一个接一个,为什么以下代码对两个 Tikz 图形的缩放比例不同?我正在使用 tkz-euclide 包。
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes.geometric}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
Find the area of the triangle:
\vspace{-1em}
\begin{center}
\resizebox{2.5in}{!}{
\begin{tikzpicture}
\coordinate (Q) at (0,0);
\coordinate (A) at ($(Q)+(40:5)$);
\coordinate (P) at ($(Q)+(150:4)$);
\draw (A) -- (Q) -- (P) -- cycle;
\tkzLabelPoint[below](Q){$Q$};
\tkzLabelPoint[right](A){$A$};
\tkzLabelPoint[left](P){$P$};
\path (A) -- node [midway,above] {$11$} (P);
\path (A) -- node [midway,below right] {$9$} (Q);
\path (P) -- node [midway,below left] {6} (Q);
\end{tikzpicture}}
\end{center}
The diagram below is the plan of a field. Find the area of the field.
\vspace{-1em}
\begin{center}
\resizebox{2.5in}{!}{
\begin{tikzpicture}
\coordinate (P) at (0,0);
\coordinate (S) at ($(P)+(-20:2)$);
\coordinate (Q) at ($(P)+(110:2)$);
\coordinate (R) at ($(P)+(45:2.5)$);
\draw (P) -- (Q) -- (R) -- (S) -- cycle;
\draw[dashed] (P) -- (R);
\tkzLabelPoint[left](Q){$Q$};
\tkzLabelPoint[left](P){$P$};
\tkzLabelPoint[right](S){$S$};
\tkzLabelPoint[right](R){$R$};
\path (P) -- node [midway,sloped,above] {$650$} (R);
\tkzLabelAngle[pos = 0.35](P,Q,R){$56^\circ$};
\tkzMarkAngle[size=0.65cm,](P,Q,R);
\tkzLabelAngle[pos = 0.35](S,P,R){$44^\circ$};
\tkzMarkAngle[size=0.65cm,](S,P,R);
\tkzLabelAngle[pos = 0.35](R,P,Q){$83^\circ$};
\tkzMarkAngle[size=0.65cm,](R,P,Q);
\tkzLabelAngle[pos = 0.35](P,R,S){$65^\circ$};
\tkzMarkAngle[size=0.65cm,](P,R,S);
\end{tikzpicture}}
\end{center}
\end{document}
答案1
这是因为您的原始绘图(缩放前)比您想要的尺寸大很多,而小很多。您应该尝试使用 或 之类的选项scale
,x=legth,y=length
这样不会弄乱文本。
(ps:我不熟悉 tkzMarkAngle,但用厘米而不是图形单位来指定尺寸听起来有点不对)
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes.geometric}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
Find the area of the triangle:
\vspace{-1em}
\begin{center}
%\resizebox{2.5in}{!}{
\begin{tikzpicture}[scale=0.8]
\coordinate (Q) at (0,0);
\coordinate (A) at ($(Q)+(40:5)$);
\coordinate (P) at ($(Q)+(150:4)$);
\draw (A) -- (Q) -- (P) -- cycle;
\tkzLabelPoint[below](Q){$Q$};
\tkzLabelPoint[right](A){$A$};
\tkzLabelPoint[left](P){$P$};
\path (A) -- node [midway,above] {$11$} (P);
\path (A) -- node [midway,below right] {$9$} (Q);
\path (P) -- node [midway,below left] {6} (Q);
\end{tikzpicture}%}
\end{center}
The diagram below is the plan of a field. Find the area of the field.
\vspace{-1em}
\begin{center}
%\resizebox{2.5in}{!}{
\begin{tikzpicture}[scale=1.8]
\coordinate (P) at (0,0);
\coordinate (S) at ($(P)+(-20:2)$);
\coordinate (Q) at ($(P)+(110:2)$);
\coordinate (R) at ($(P)+(45:2.5)$);
\draw (P) -- (Q) -- (R) -- (S) -- cycle;
\draw[dashed] (P) -- (R);
\tkzLabelPoint[left](Q){$Q$};
\tkzLabelPoint[left](P){$P$};
\tkzLabelPoint[right](S){$S$};
\tkzLabelPoint[right](R){$R$};
\path (P) -- node [midway,sloped,above] {$650$} (R);
\tkzLabelAngle[pos = 0.35](P,Q,R){$56^\circ$};
%\tkzMarkAngle[size=0.65cm,](P,Q,R);
\tkzMarkAngle[size=0.65](P,Q,R);
\tkzLabelAngle[pos = 0.35](S,P,R){$44^\circ$};
%\tkzMarkAngle[size=0.65cm,](S,P,R);
\tkzMarkAngle[size=0.65](S,P,R);
\tkzLabelAngle[pos = 0.35](R,P,Q){$83^\circ$};
%\tkzMarkAngle[size=0.65cm,](R,P,Q);
\tkzMarkAngle[size=0.65](R,P,Q);
\tkzLabelAngle[pos = 0.35](P,R,S){$65^\circ$};
%\tkzMarkAngle[size=0.65cm,](P,R,S);
\tkzMarkAngle[size=0.65](P,R,S);
\end{tikzpicture}%}
\end{center}
\end{document}
答案2
首先, \resizebox
这是一个坏主意,因为您会缩放所有对象(点、线和字体)。Davide 的回答是正确的,您需要scale option
从 tikZ 使用。
我把我的代码放在因为tkz-euclide
有一个特殊的语法没有;
和一些命令可以简化。你不需要加载Tikz
因为pgfplots and Tkz-Euclide
使用TikZ
如果你的代码的很大一部分使用TikZ
为什么使用tkz-euclide
。这是很多代码没用。然后当你使用时tkz-euclide
,TikZ
总是落后所以当你不知道如何做某事时你可以使用Tikz
但最好避免混合。我使用mark=none
因为角度不相等。
我使用新版本的tkz-euclide 已上线
\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
Find the area of the triangle:
\begin{tikzpicture}[x=.8cm,y=.8cm]
\tkzDefPoint(0,0){Q}
\tkzDefShiftPoint[Q](40:5){A}
\tkzDefShiftPoint[Q](150:4){P}
\tkzDrawPolygon(A,P,Q)
\tkzLabelPoint[below](Q){$Q$}
\tkzLabelPoint[right](A){$A$}
\tkzLabelPoint[left](P){$P$}
\tkzLabelSegment[swap](A,P){$11$}
\tkzLabelSegment[](A,Q){$9$}
\tkzLabelSegment[](Q,P){$6$}
\end{tikzpicture}
The diagram below is the plan of a field. Find the area of the field.
\begin{tikzpicture}[scale=1.8]
\tkzDefPoint(0,0){P}
\tkzDefShiftPoint[P](-20:2){S}
\tkzDefShiftPoint[P](110:2){Q}
\tkzDefShiftPoint[P](45:2.5){R}
\tkzDrawPolygon(P,...,S)
\tkzDrawSegment[dashed](P,R)
\tkzLabelPoint[left](Q){$Q$}
\tkzLabelPoint[left](P){$P$}
\tkzLabelPoint[right](S){$S$}
\tkzLabelPoint[right](R){$R$}
\tkzLabelSegment[sloped](P,R){$650$}
\tkzLabelAngle[pos = 0.35](P,Q,R){$56^\circ$}
\tkzLabelAngle[pos = 0.35](S,P,R){$44^\circ$}
\tkzLabelAngle[pos = 0.35](R,P,Q){$83^\circ$}
\tkzLabelAngle[pos = 0.35](P,R,S){$65^\circ$}
\tkzMarkAngles[mark=none,size=0.65](P,R,S R,P,Q S,P,R P,Q,R)
\end{tikzpicture}
\end{document}