0

I'm trying to create a papercraft cube, and can't seem to get an image in one of the faces. I have tried this

\documentclass{article}
\usepackage[paperwidth=8cm,paperheight=8cm,margin=0.5cm]{geometry}
\usepackage{tikz}

\begin{document}

\usetikzlibrary {folding} \begin{tikzpicture}[scale=3.3] \pic [ folding line length=6mm, transform shape, rotate=40, face 1= { \node{ Pax }; }, face 2= { \node{ Tibi }; }, face 3= { \node{\tiny Marce}; }, face 4= { \node{\tiny Evangelista}; }, face 5= { \node{\tiny Meus}; } face 6= { \node[path picture={\node at (path picture bounding box.center){ \includegraphics{dogos.jpg}} }] } ] { cube folding }; \end{tikzpicture}

\end{document}

I have tried this too, with the two versions; it does not work either.

It simply creates an empty face (it also creates two pages, I don't really know why). I have also tried simply including \includegraphics into the face, but that does not work either. The only difference with the two examples seems to be that it's rotated and the scale, but I don't think that is the thing. The image is in .png and .jpg format, too.

jjmerelo
  • 210
  • Why the extra node? face 6= {\node{\includegraphics{dogos.jpg}};}? By the way, you're missing the ;, the {} from the outer nodeand a,` between face 5 and face 6. The extra page comes from the picture being to big. – Qrrbrbirlbel May 21 '23 at 12:05
  • @Qrrbrbirlbel that was suggested by the answers I've mentioned, also tried without it. Will check the comma, though. – jjmerelo May 21 '23 at 12:10
  • @Qrrbrbirlbel the comma and semicolon did it... partially. Now the whole cube has disappeared – jjmerelo May 21 '23 at 12:12
  • @Qrrbrbirlbel changing the size and your comma and semicolon managed to make it. It still deletes part of the folding lines, but that's not big deal. face 6= { \node[anchor=center] {\includegraphics[width=0.9cm]{dogos} };} Can you please turn your comment into an answer so that I can accept it? Thanks! – jjmerelo May 21 '23 at 12:14

1 Answers1

1

You were missing a , between face 5 and face 6 which is the reason why face 6 was empty.

I'd only use one node here where the image is scaled to the folding line length.

Code

\documentclass{article}
\usepackage[paperwidth=8cm,paperheight=8cm,margin=0.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary {folding}
\begin{document}
\begin{tikzpicture}[scale=3]
  \pic [
    folding line length=6mm,
    transform shape,
    rotate=40,
    face 1= { \node{ Pax }; },
    face 2= { \node{ Tibi }; },
    face 3= { \node{\tiny Marce}; },
    face 4= { \node{\tiny Evangelista}; },
    face 5= { \node{\tiny Meus}; }, % ← ,
    face 6= { \node{\includegraphics[width=6mm]{example-image} }; } % ← ;
  ]
  { cube folding };
\end{tikzpicture}
\end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821