在 tex 图像中书写

在 tex 图像中书写

我有以下立方体(取自那里):

\documentclass[border=5pt, multi, tikz]{standalone}
\usetikzlibrary{quotes,arrows.meta}
\begin{document}
\begin{tikzpicture}[every edge quotes/.append style={auto, text=blue}]
      \pgfmathsetmacro{\cubex}{6}
      \pgfmathsetmacro{\cubey}{6}
      \pgfmathsetmacro{\cubez}{6}
      \draw [draw=black, every edge/.append style={draw=black, densely dashed, opacity=.5}, fill=white]
        (0,0,0) coordinate (o) -- ++(-\cubex,0,0) coordinate (a) -- ++(0,-\cubey,0) coordinate (b) edge coordinate [pos=1] (g) ++(0,0,-\cubez)  -- ++(\cubex,0,0) coordinate (c) -- cycle
        (o) -- ++(0,0,-\cubez) coordinate (d) -- ++(0,-\cubey,0) coordinate (e) edge (g) -- (c) -- cycle
        (o) -- (a) -- ++(0,0,-\cubez) coordinate (f) edge (g) -- (d) -- cycle;
      \path [every edge/.append style={draw=black, |-|}]
        (b) +(0,-5pt) coordinate (b1) edge ["6"'] (b1 -| c)
        (b) +(-5pt,0) coordinate (b2) edge ["6"] (b2 |- a)
        (c) +(3.5pt,-3.5pt) coordinate (c2) edge ["6"'] ([xshift=3.5pt,yshift=-3.5pt]e);
\end{tikzpicture}
\end{document}

在此处输入图片描述

我想在那个立方体中写和画一些东西,就像这样: 在此处输入图片描述

我怎样才能做到这一点?

答案1

有些注释很难阅读。

\documentclass[border=5pt, multi, tikz]{standalone}
\usetikzlibrary{quotes,arrows.meta,calc}
\begin{document}
\begin{tikzpicture}[every edge quotes/.append style={auto, text=blue}]
 \pgfmathsetmacro{\cubex}{6}
 \pgfmathsetmacro{\cubey}{6}
 \pgfmathsetmacro{\cubez}{6}
 \draw [draw=black, every edge/.append style={draw=black, densely dashed,
   opacity=.5}] (0,0,0) coordinate (o) -- ++(-\cubex,0,0) coordinate
   (a) -- ++(0,-\cubey,0) coordinate (b) edge coordinate [pos=1] (g)
   ++(0,0,-\cubez)  -- ++(\cubex,0,0) coordinate (c) -- cycle (o) --
   ++(0,0,-\cubez) coordinate (d) -- ++(0,-\cubey,0) coordinate (e) edge (g) --
   (c) -- cycle (o) -- (a) -- ++(0,0,-\cubez) coordinate (f) edge (g) -- (d) --
   cycle;
 \path [every edge/.append style={draw=black, |-|}]
   (b) +(0,-5pt) coordinate (b1) edge ["6"'] (b1 -| c)
   (b) +(-5pt,0) coordinate (b2) edge ["6"] (b2 |- a)
   (c) +(3.5pt,-3.5pt) coordinate (c2) edge ["6"'] ([xshift=3.5pt,yshift=-3.5pt]e);
 \path[every edge/.append style={draw=blue, densely dashed},
    nodes={minimum width=2em,circle}] 
 (o) node[below left=1em] (ox){$x_m$}
 (a) node[below right=1em] (ax) {$x_1$}  edge (ox)
 (b) node[above right=1em] (bx) {$x_{33}$} edge (ax)
 (c) node[above left=1em] (cx) {$x_{m}$} edge (bx)
 (f) node[below right=1em] (fx) {$x_{20}$} edge (ax)
 (g) node[above right=1em] (gx) {$x_{120}$} edge (bx) edge (fx)
 (e) node[above left=1em] (ex) {$x_{20}$} edge (gx);
 \begin{scope}[enclose/.style 2 args={insert path={
    let \p1=(#1),\p2=(#2),\n1={atan2(\y2-\y1,\x2-\x1)}
    in (#1.\n1+90) arc[start angle=\n1+90,end angle=\n1+270,radius=1em] 
    -- (#2.\n1-90) arc[start angle=\n1-90,end angle=\n1+90,radius=1em]
    -- cycle }}]
  \draw[red,enclose={ax}{ox}];
  \draw[purple,enclose={ax}{fx}];
  \draw[green!60!black,enclose={ax}{ex}];
  \draw[cyan,enclose={ax}{bx}];
 \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容