我在 Tikz 中有一个长方体。我想标记长方体的角,但我遇到了麻烦。以下是生成长方体的代码:
\begin{tikzpicture}
\pgfmathsetmacro{\cubex}{4}
\pgfmathsetmacro{\cubey}{5}
\pgfmathsetmacro{\cubez}{3}
\draw (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
\draw (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
\draw (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
\draw[dashed] (-\cubex,0,-\cubez) -- ++(0,-\cubey,0);
\draw[dashed] (-\cubex,-\cubey,-\cubez) -- node[below]{A} (-\cubex,-\cubey,0);
\draw[dashed] (-\cubex,-\cubey,-\cubez) -- (0,-\cubey,-\cubez);
\end{tikzpicture}
我想用字母 A 到 H 标记每个角。我该怎么做?另外,我想让 A 位于底部、前部、左角下方。
答案1
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\cubex}{4}
\pgfmathsetmacro{\cubey}{5}
\pgfmathsetmacro{\cubez}{3}
\draw (0,0,0) node[right] {C}
-- ++(-\cubex,0,0) node[left] {B}
-- ++(0,-\cubey,0) node[left] {A}
-- ++(\cubex,0,0) node[right] {D} -- cycle;
\draw (0,0,0) -- ++(0,0,-\cubez) node[right] {G}
-- ++(0,-\cubey,0) node[right] {H} -- ++(0,0,\cubez);
\draw (0,0,0) -- ++(-\cubex,0,0)
-- ++(0,0,-\cubez) node[left] {F} -- ++( \cubex,0,0);
\draw[dashed] (-\cubex,0,-\cubez) -- ++(0,-\cubey,0);
\draw[dashed] (-\cubex,-\cubey,-\cubez) node[left]{E} -- (-\cubex,-\cubey,0);
\draw[dashed] (-\cubex,-\cubey,-\cubez) -- (0,-\cubey,-\cubez);
\end{tikzpicture}
\end{document}