2

I would like to fold 12 cubes to one. Please help me with this.

\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 Answer 1

9

There are several syntax problems:

  • \tikz inside environment tikzpicture. This probably causes the messed up bounding box.
  • The pic is finished after {cube folding}, but options follow as ordinary text (invisible because of \nullfont) with \node commands over printing, because they are all called at the same position (outside the folding pic).
  • numbered faces or manual faces? The former is used in the simplified example at the end, the latter is used in the following example, it allows further modification of single faces.
  • cube (6 faces) or dodecahedron (12 faces)?

Example:

\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}

Result

The example can be simplified to

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .