使用 tikz 折叠立方体

使用 tikz 折叠立方体

我想将 12 个立方体折叠成一个。请帮我。

\documentclass[11pt]{article}
\usepackage{tikz}
%optional libraries
\usetikzlibrary{decorations,arrows,automata,positioning}
\usetikzlibrary{mindmap}
\usetikzlibrary{calc}
\usetikzlibrary{folding}
\usepackage[grapics,tightpage,active]{preview}
\setlength{\PreviewBorder}{2pt}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{tikzpicture}[]
\tikz \pic [folding line length=10mm, numbered faces, transform shape]
  {cube folding};
face 1 = {\node {1};},
face 2 = {\node {2};},
face 3 = {\node {3};},
face 4 = {\node {4};},
face 5 = {\node {5};},
face 6 = {\node {6};},
face 7 = {\node {7};},
face 8 = {\node {8};},
face 9 = {\node {9};},
face 10 = {\node {10};},
face 11 = {\node {11};},
face 12 = {\node {12};}
];
\end{tikzpicture}
\end{document} 

答案1

有几个语法问题:

  • \tikz内部环境tikzpicture。这可能会导致边界框混乱。
  • pic在之后完成,{cube folding}但选项以普通文本的形式(由于而不可见\nullfont)跟随,并且\node命令优先于打印,因为它们都在相同位置(折叠图片之外)调用。
  • numbered faces还是手动修改面?前者用于最后的简化示例,后者用于下面的示例,它允许对单个面进行进一步的修改。
  • cube(6 个面)还是dodecahedron(12 个面)?

例子:

\documentclass[11pt]{article}
\usepackage{tikz}
%optional libraries
\usetikzlibrary{decorations,arrows,automata,positioning}
\usetikzlibrary{mindmap}
\usetikzlibrary{calc}
\usetikzlibrary{folding}
\usepackage[grapics,tightpage,active]{preview}
\setlength{\PreviewBorder}{2pt}
\PreviewEnvironment{tikzpicture}
\begin{document}
  \begin{tikzpicture}
  \path pic [
    folding line length=10mm,
    transform shape,
    % numbered faces,
    face 1 = {\node {1};},
    face 2 = {\node {2};},
    face 3 = {\node {3};},
    face 4 = {\node {4};},
    face 5 = {\node {5};},
    face 6 = {\node {6};},
    face 7 = {\node {7};},
    face 8 = {\node {8};},
    face 9 = {\node {9};},
    face 10 = {\node {10};},
    face 11 = {\node {11};},
    face 12 = {\node {12};}
  ]
    {dodecahedron folding};
  \end{tikzpicture}
\end{document}

结果

该示例可以简化为

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{folding}
\usepackage[tightpage,active]{preview}
\setlength{\PreviewBorder}{2pt}
\PreviewEnvironment{tikzpicture}
\begin{document}
  \begin{tikzpicture}
    \pic [
      folding line length=10mm,
      transform shape,
      numbered faces,
    ]
    {dodecahedron folding};
  \end{tikzpicture}
\end{document}

相关内容