嗨!我想了解如何在 tkzpicture 图形上应用 Latex 页面坐标系。我想正确定位三角形的中心点相对于圆的 x 轴。另外,我想将三角形锚定在页面的西边,将圆锚定在页面的东边。
这是我的代码:
\begin{center}
\begin{tikzpicture}
\draw[very thin] (0,0)--(3,0)--(3,2)--cycle;
\coordinate[label=left:$P$](P) at (0,0);
\coordinate[label=right:$Q$](Q) at (3,0);
\coordinate[label=above:$R$](R) at (3,2);
\tkzLabelSegment[below=2pt](P,Q){$x$}
\tkzLabelSegment[right=2pt](Q,R){$y$}
\tkzLabelSegment[above left=-6pt](P,R){$\sqrt{x^2+y^2}$}
\tkzMarkAngle[size=0.7](P,R,Q)
\tkzLabelAngle[pos=1](Q,P,R){$\varphi$}
\tkzMarkAngle[size=0.8](Q,P,R)
\tkzLabelAngle[pos=1](P,R,Q){$\psi$}
\tkzMarkRightAngle(P,Q,R)
\end{tikzpicture}
\qquad
\begin{tikzpicture}[r]
\draw [thin, gray, ->] (0,-3) -- (0,3) % draw y-axis line
node [above, black] {$y$}; % add label for y-axis
\draw [thin, gray, ->] (-3,0) -- (3,0) % draw x-axis line
node [right, black] {$x$}; % add label for x-axis
%circle
\draw[fill=none, very thin](0,0) circle (2.5);
\draw[fill=black](0,0) node [below left] {$O$};
%dots % their lines
\draw [dashed] (1.76,0) -- (1.76,1.76) -- (-1.76,1.76);
\draw [very thin] (0,0) -- (1.76,1.76) node[circle,black,fill,inner sep=1pt]{} node[above right]{$P_{\varphi}$};
\draw [dashed] (-1.76,0) -- (-1.76,1.76);
\draw[very thin] (0,0) -- (-1.76,1.76) node[circle,black,fill,inner sep=1pt]{} node[above left]{$P_{\frac{\pi}{2}-\varphi}$};
%angles
\draw (1.1,0) arc (0:135:1.1)node[above left,pos=0.65]{$\frac{\pi}{2}-\varphi$};
\draw (0.5,0) arc (0:45:0.5)node[above right,pos=0.1]{$\varphi$};
\end{tikzpicture}
\end{center}
请将您的修改应用于样本论文中提供的代码。
谢谢
答案1
我不完全明白你到底想要什么,但我认为你想将左图与正文的左边距对齐,将右图与正文的右边距对齐。因此,也许你想要的是这样的,它会另外对齐两张图片的 x 轴(\lipsum
添加文本以说明与正文边距的对齐):
\documentclass[a4paper,12pt]{article}
\usepackage{tkz-euclide}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{center}
\begin{tikzpicture}[baseline=0pt]
\draw[very thin] (0,0)--(3,0)--(3,2)--cycle;
\coordinate[label=left:$P$](P) at (0,0);
\coordinate[label=right:$Q$](Q) at (3,0);
\coordinate[label=above:$R$](R) at (3,2);
\tkzLabelSegment[below=2pt](P,Q){$x$}
\tkzLabelSegment[right=2pt](Q,R){$y$}
\tkzLabelSegment[above left=-6pt](P,R){$\sqrt{x^2+y^2}$}
\tkzMarkAngle[size=0.7](P,R,Q)
\tkzLabelAngle[pos=1](Q,P,R){$\varphi$}
\tkzMarkAngle[size=0.8](Q,P,R)
\tkzLabelAngle[pos=1](P,R,Q){$\psi$}
\tkzMarkRightAngle(P,Q,R)
\end{tikzpicture}
\hfill
\begin{tikzpicture}[baseline=0pt]
\draw [thin, gray, ->] (0,-3) -- (0,3) % draw y-axis line
node [above, black] {$y$}; % add label for y-axis
\draw [thin, gray, ->] (-3,0) -- (3,0) % draw x-axis line
node [right, black] {$x$}; % add label for x-axis
%circle
\draw[fill=none, very thin](0,0) circle (2.5);
\draw[fill=black](0,0) node [below left] {$O$};
%dots % their lines
\draw [dashed] (1.76,0) -- (1.76,1.76) -- (-1.76,1.76);
\draw [very thin] (0,0) -- (1.76,1.76) node[circle,black,fill,inner sep=1pt]{} node[above right]{$P_{\varphi}$};
\draw [dashed] (-1.76,0) -- (-1.76,1.76);
\draw[very thin] (0,0) -- (-1.76,1.76) node[circle,black,fill,inner sep=1pt]{} node[above left]{$P_{\frac{\pi}{2}-\varphi}$};
%angles
\draw (1.1,0) arc (0:135:1.1)node[above left,pos=0.65]{$\frac{\pi}{2}-\varphi$};
\draw (0.5,0) arc (0:45:0.5)node[above right,pos=0.1]{$\varphi$};
\end{tikzpicture}
\end{center}
\lipsum[1]
\end{document}
或者也许你想让两张图片垂直居中对齐:
\documentclass[a4paper,12pt]{article}
\usepackage{tkz-euclide}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{center}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\draw[very thin] (0,0)--(3,0)--(3,2)--cycle;
\coordinate[label=left:$P$](P) at (0,0);
\coordinate[label=right:$Q$](Q) at (3,0);
\coordinate[label=above:$R$](R) at (3,2);
\tkzLabelSegment[below=2pt](P,Q){$x$}
\tkzLabelSegment[right=2pt](Q,R){$y$}
\tkzLabelSegment[above left=-6pt](P,R){$\sqrt{x^2+y^2}$}
\tkzMarkAngle[size=0.7](P,R,Q)
\tkzLabelAngle[pos=1](Q,P,R){$\varphi$}
\tkzMarkAngle[size=0.8](Q,P,R)
\tkzLabelAngle[pos=1](P,R,Q){$\psi$}
\tkzMarkRightAngle(P,Q,R)
\end{tikzpicture}
\hfill
\begin{tikzpicture}[baseline=(current bounding box.center)]
\draw [thin, gray, ->] (0,-3) -- (0,3) % draw y-axis line
node [above, black] {$y$}; % add label for y-axis
\draw [thin, gray, ->] (-3,0) -- (3,0) % draw x-axis line
node [right, black] {$x$}; % add label for x-axis
%circle
\draw[fill=none, very thin](0,0) circle (2.5);
\draw[fill=black](0,0) node [below left] {$O$};
%dots % their lines
\draw [dashed] (1.76,0) -- (1.76,1.76) -- (-1.76,1.76);
\draw [very thin] (0,0) -- (1.76,1.76) node[circle,black,fill,inner sep=1pt]{} node[above right]{$P_{\varphi}$};
\draw [dashed] (-1.76,0) -- (-1.76,1.76);
\draw[very thin] (0,0) -- (-1.76,1.76) node[circle,black,fill,inner sep=1pt]{} node[above left]{$P_{\frac{\pi}{2}-\varphi}$};
%angles
\draw (1.1,0) arc (0:135:1.1)node[above left,pos=0.65]{$\frac{\pi}{2}-\varphi$};
\draw (0.5,0) arc (0:45:0.5)node[above right,pos=0.1]{$\varphi$};
\end{tikzpicture}
\end{center}
\lipsum[1]
\end{document}