# Draw a rectangle with naming all vertices and labeling all sides

How can I draw a rectangle with name of all four vertices and label on all four sides ?

• Why should you just provide a picture? Why not show what you have tried? Jun 23 at 2:54

\documentclass[a4paper]{article}

\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[scale=2]
\hspace{-2cm}
\draw
(0,0)node[left]{P}  to node[left]{1cm}      ++(0,1)node[left]{Q}
to node[above]{7cm}     ++(7,0)node[right]{R}
to node[right]{1cm}     ++(0,-1)node[right]{S}
to node[below]{7cm}     (0,0)
;

\end{circuitikz}
\end{document}


Solution:

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -| node[pos=0,left]{P} node[pos=.25,above]{7\,cm}
node[pos=.5,right]{Q} node[pos=.75,right]{1\,cm}
++(7,-1) -|  node[pos=0,right]{R} node[pos=.25,below]{7\,cm}
node[pos=.5,left]{S} node[pos=.75,left]{1\,cm} cycle;
\end{tikzpicture}
\end{document}


A short code with pstricks:

\documentclass[border=6pt]{standalone}
\usepackage{pst-eucl}

\begin{document}

\psset{yunit=2cm, linejoin=1}
\begin{pspicture}(-0.5,-0.25)(7.5,1.25)
\pstGeonode[PointSymbol=none, PosAngle={180,0,0,180}](0,1){P}(7,1){Q}(7,0){R}(0,0){S}
\psframe(P)(R)
\pcline(P)(Q)\naput{7\,cm}
\pcline(Q)(R)\naput[nrot=:U]{1\,cm}
\pcline(R)(S)\naput{7\,cm}
\pcline(S)(P)\naput[nrot=:U]{1\,cm}
\end{pspicture}

\end{document}


\documentclass{standalone}
\usepackage{tikz}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}
\node[draw, minimum width=5cm, minimum height=1cm,
label=\si{7}{cm},
label=below:\si{7}{cm},
label=right:\si{1}{cm},
label=left:\si{1}{cm},
label={[inner sep=1pt]north east:Q},
label={[inner sep=1pt]north west:P},
label={[inner sep=1pt]south east:R},
label={[inner sep=1pt]south west:S}] {};
\end{tikzpicture}
\end{document}