# Triangular Prism in LaTex [duplicate]

How do you draw a triangular prism like this in LaTex? Thank you

I also please need help in labeling all the vertices, thank you

## marked as duplicate by AboAmmar, Stefan Pinnow, Bobyandbob, Artificial Stupidity, WernerNov 23 '18 at 19:47

• Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Stefan Pinnow Nov 23 '18 at 18:16

Welcome to TeX.SE!

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[dashed,thick] (-1,0) -- (0,0.5) edge (0,2.5) -- (1,0);
\draw[thick] (-1,0) rectangle (1,2) -- (0,2.5) -- (-1,2);
\end{tikzpicture}
\end{document}


For more advanced applications I'd recommend tikz-3dplot or asymptote.

Some labels, as requested. Just to make sure: this is not a typesetting service. So please try doing something on your own!

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[dashed,thick] (-1,0) -- (0,0.5) edge (0,2.5) -- (1,0) coordinate(BR);
\draw[thick] (-1,0) coordinate(BL)  rectangle (1,2) coordinate(TR)
-- (0,2.5) coordinate(T) -- (-1,2) coordinate(TL);
\foreach \X [remember=\X as \Y (initially TL),count=\Z] in {BL,BR,TR,T,TL}
{\path (\Y) -- (\X) node[midway,anchor={90*\Z-90-ifthenelse(\Z==4,45,0)-ifthenelse(\Z==5,45,0)}]{label \Z}; }
\end{tikzpicture}
\end{document}


• @PinkT Well, this code can serve as a starting point for your attempt of adding labels. My crystal ball got stolen, so I have no clue which labels you want to put on what edge. If you add \path (-1,0) -- (1,0) node[midway,below] {$L$};, you will put a label L below the lower edge and so on. Just try out if you can arrange for the labels this way, if not, you have at least a code that shows others what you've tried, and you will receive more enthusiastic feedback. – user121799 Nov 23 '18 at 18:47
• Thank you. I cant seem to figure it out. If you could label all the vertices (doesnt matter which letter goes where) I would really appreciate that, thank you – PinkT Nov 23 '18 at 19:06
• @sztruks Yes, I did. ;-) (More seriously, to address a comment to a user who is not the owner of the post, you have to address her or him like I address you with @sztruks.) – user121799 Nov 23 '18 at 19:50

A nice solution with PSTricks.

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(8,10)
\pstGeonode[PosAngle={180,0,45}](1,1){A}(7,1){B}(4,4){C}(4,9){F}
\pstTranslation[PosAngle={180,0}]{C}{F}{A,B}[D,E]
\psline(E)(F)(D)(A)(B)(E)(D)
\psset{linestyle=dashed}
\psline(A)(C)(B)
\psline(C)(F)
\end{pspicture}
\end{document}


• Hi this doesnt work on my LaTex, could you please modify to Tikz package, thank you – PinkT Nov 23 '18 at 19:20
• @PinkT This is one of the reasons why I switched to TikZ even though I was using pstricks for more than a decade and was (then) very happy with it. – user121799 Nov 23 '18 at 19:27
• @PinkT: After compiling with xeletax you will get a pdf output. So what is the problem? The pdf output can be imported from your document using \includegraphics. – Artificial Stupidity Nov 23 '18 at 19:27
• Since all my other work is on LaTex, it has to all be together – PinkT Nov 23 '18 at 19:28
• @ArtificialStupidity Sorry to interfere, but this is definitely not best practice. What if the OP includes the drawing in, say, a beamer presentation, in which different fonts are used. See e.g. here for an extended discussion. – user121799 Nov 23 '18 at 19:55