1

I have wrote this latex code to draw a 3D box.


\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}
\begin{figure}
\begin{center}
\begin{circuitikz}



\draw (0,0)
to[short](0,3) node[above] {D}
to[short](3,3) node[above] {C}
to[short](3,0) node[above] {G}
to[short](0,0) node[above] {H}
(1,2)
to[short](4,2) node[above] {B}
to[short](4,-1) node[above] {F}
to[short](1,-1) node[above] {E}
to[short](1,2) node[above] {A}
(0,3) to[short] (1,2)
(3,3) to[short] (4,2)
(0,0) to[short] (1,-1)
(3,0) to[short] (4,-1);



\end{circuitikz}
\end{center}
\end{figure}
\end{document}

enter image description here

Now I want to color the ABCD, ADHE, BCGH sides. How do I color these sides?

2

Like this (saving coordinates of corners for later use)

\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}
\begin{figure}
\begin{center}
\begin{circuitikz}

\draw (0,0)
to[short](0,3) coordinate[label=above:$D$] (D)
to[short](3,3) coordinate[label=above:$C$] (C)
to[short](3,0) coordinate[label=above:$G$] (G)
to[short](0,0) coordinate[label=above:$H$] (H)
(1,2)
to[short](4,2) coordinate[label=above:$B$] (B)
to[short](4,-1)coordinate[label=above:$F$] (F)
to[short](1,-1)coordinate[label=above:$E$] (E)
to[short](1,2) coordinate[label=above:$A$] (A)
(D) to[short] (A)
(C) to[short] (B)
(H) to[short] (E)
(G) to[short] (F);
\fill[orange,opacity=0.4](A)--(B)--(C)--(D)--cycle;

\end{circuitikz}
\end{center}
\end{figure}
\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.