0

I am new to TikZ in LateX. I want to produce the figyre below. This is what I have tried:

\documentclass[]{article}

\usepackage{tikz}

\usetikzlibrary{3d}

\begin{document}

\begin{tikzpicture}

  \pgfmathsetmacro{\cubex}{2}

  \pgfmathsetmacro{\cubey}{2.5}

  \pgfmathsetmacro{\cubez}{2}

  \draw [every edge/.append style={densely dashed, opacity=1.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;
  \end{tikzpicture}
\end{document}

I dont know whre to put the \node commands for the labels. Can someone help me?

enter image description here

1

You can just add labels to the existing paths by putting nodes at the corresponding stretches.

\documentclass[]{article}
\usepackage{tikz}
% \usetikzlibrary{3d} %<- not used here
\begin{document}
\begin{tikzpicture}[nodes={text=blue,circle}]
\pgfmathsetmacro{\cubex}{2}
\pgfmathsetmacro{\cubey}{2.5}
\pgfmathsetmacro{\cubez}{2}
\draw [every edge/.append style={densely dashed, opacity=1}]
  (0,0,0) coordinate (o) -- ++(-\cubex,0,0) coordinate (a) -- node[left]{$h$}
  ++(0,-\cubey,0) coordinate (b) edge coordinate [pos=1] (g) 
  ++(0,0,-\cubez)  -- node[below]{$L$} ++(\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
  (c) -- node[below right]{$W$}   ++(0,0,-\cubez);
\end{tikzpicture}
\end{document}

enter image description here

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.