I want to draw the figure above, a wooden cube with one orner cut off and shaded.

enter image description here

I can only draw the cube, I can't remove a part of the cube by a plane.






   \draw[thick,black] (4,0,0) -- (0,0,0) -- (0,4,0) -- (4,4,0);

   \draw[thick,black]  (4,0,0) -- (4,0,-4) -- (4,4,-4) -- (4,4,0) -- cycle;

   \draw[thick,black](0,4,0) -- (0,4,-4) -- (4,4,-4);

   \draw[style=dashed, color=black] (4,0,-4) -- (0,0,-4)-- (0,4,-4);

   \draw[style=dashed, color=black] (0,0,0) -- (0,0,-4); 



enter image description here

  • 2
    Please do not get me wrong, but in the future please consider asking clearer questions. If you ask for a shaded corner and end up accepting an answer that has no shaded corner, then this is your choice, but a bit odd for those who provided what you were asking for.
    – user194703
    May 15, 2020 at 22:51

3 Answers 3


A very short code with pst-solides3d:

\documentclass[12pt, border=6pt, svgnames]{standalone}


  \psset{viewpoint=50 75 30 rtp2xyz, Decran=25, lightsrc=viewpoint}
 \psSolid[action=draw*, object=cube, RotZ=40, fillcolor=ForestGreen!80, trunccoeff=.5, trunc=0]%


enter image description here


This draws such a truncated cube. It uses an orthographic view.

\begin{tikzpicture}[3d view={120}{15},line join=round,
    declare function={a=4;b=2;}]
 \draw[style=dashed, color=black] (a,0,-a) -- (0,0,-a)-- (0,a,-a);
 \draw[style=dashed, color=black] (0,0,0) -- (0,0,-a); 
 \draw[thick,black]  (a,0,0) -- (a,0,-a) -- (a,a,-a) -- (a,a,-b);
 \draw[thick,black] (a,a-b,0) -- (a,0,0) -- (0,0,0) -- (0,a,0) -- (a-b,a,0);
 \draw[thick,black](0,a,0) -- (0,a,-a) -- (a,a,-a);
 (a,a,-b) -- (a-b,a,0) -- (a,a-b,0) -- cycle;

enter image description here

You can change the view angles to some extent (if you overdo it, the dashed lines will be in the foreground) and change the cube dimension a and the dimension of the missing corner b. For instance, with 3d view={150}{15} and declare function={a=4;b=1;} you will get

enter image description here

Please note that patterns.meta requires a not too old TeX installation. If you have a rather old version, load patterns instead of patterns.meta, and use e.g. pattern=north east lines instead of pattern={Lines[angle=45,distance={4.5pt}]}.

  • Hello I don't know the prospect "perspective". Where is the doc?
    – rpapa
    May 15, 2020 at 17:06
  • 1
    @rpapa Section 64 Three Point Perspective Drawing Library of the pgfmanual v3.1.5, starts on p. 738. I am only using the 3d view. One could also use a perspective view, but judging from the screen shot the OP seems to ask for an orthographic view.
    – user194703
    May 15, 2020 at 17:08
  • 1
    @rpapa 我的榮幸 ;-)
    – user194703
    May 15, 2020 at 17:25
  • 2
    @OlegLobachev I think that the 3d library was around for a while (whether or not 10 years I do not know) but it only entered the manual perhaps 2 years back. The older version had a bug. The perspective library, which serves a somewhat different purpose, emerged from this thread, so it is much more recent. For orthonormal projections one can equally well use the tikz-3dplot package, which first appeared 2009-11-09. Since it autoloads 3d, so perhaps 3d is that old.
    – user194703
    May 15, 2020 at 18:12
  • 2
    @OlegLobachev I think it looks fine. If you used 3d coordinates, i.e. coordinates with 3 entries, you only need to change the projection to get an orthographic result.
    – user194703
    May 15, 2020 at 18:56

1- install inkscape.org app (free and open source).

2- draw your figure.

3- save it as cupe.tex.

4- include cupe.tex in your document or open it then copy the latex code from it and past it in your document.

When should I use \input vs. \include?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.