答案1
\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}
答案2
解决方案:
\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}
答案3
简短的代码如下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}
答案4
\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}