需要 Latex 代码在 Latex 中创建下图

需要 Latex 代码在 Latex 中创建下图

在此处输入图片描述

\documentclass[a4paper]{article}

\title{Using PSTricks with pdflatex on overleaf}
\author {Overleaf}

\usepackage{pst-node}
\usepackage{pst-coil}
\usepackage{auto-pst-pdf}

\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{empty}

\begin{document}
\maketitle
This is a PSTricks drawing:

\psset{subgriddiv=0}
\SpecialCoor
\psset{griddots=5, subgriddiv=0,gridlabels=5pt}


\begin{pspicture}(14,14)\psgrid
\rput(3.2,7.2) {$A$}
\rput(10.8,6.8) ($B$}
\rput(6.8, 10.8){$C$}
\rput(7.2,3.2) ($D$}
\rput(6.8,7.2){$0$}
\pscircle(7,7){4}
\psline[linecolor=red, linewidth=1.5pt](7,3) (3,7) (11,7) (7,11) (7,3) (7,11)
\rput(1,2.2) {$r$}
\end{pspicture}

\end{document)

答案1

使用以下方法简化代码pst-eucl

\documentclass[a4paper]{article}

\title{Using PSTricks with pdflatex on overleaf}
\author {Overleaf}

\usepackage{pst-node, pst-eucl}
\usepackage{pst-coil}
\usepackage{auto-pst-pdf}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{empty}

\begin{document}
\maketitle
%This is a PSTricks drawing:

\psset{subgriddiv=0}
\SpecialCoor
\psset{griddots=1, subgriddiv=0, gridlabels=5pt, gridwidth=1.5pt, linejoin=1}

\begin{pspicture}(14,14)
\pstGeonode[PosAngle={60,-150,-120,60,130}, PointSymbol=none, PointNameSep=1.5em](3,7){A}(11,7){B}(7,11){C}(7,3){D}(7,7){O}
\pscircle(7,7){4}
\pstRightAngle{A}{O}{D}
\pstMarkAngle[MarkAngleRadius=0.7]{D}{A}{B}{\SI{45}{\degree}}
\pstRightAngle{B}{O}{C}
\psline[linecolor=red, linewidth=1.5pt](A)(B)(C)(D)(A)
\psgrid
\rput(1,2.2) {$r$}
\end{pspicture}

\end{document} 

在此处输入图片描述

答案2

如果你想使用 tikz,这是另一种可能性:

\documentclass[border=2mm]{standalone}
\usepackage{siunitx} % for display angles (\ang command)
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
\draw[thick]     (0,0) circle (4);
\draw[thick,red] (4,0) -- (-4,0) -- (0,-4) -- (0,4) -- cycle;
\draw (0, 0.5) -| ( 0.5,0);
\draw (0,-0.5) -| (-0.5,0);
\draw (-3.5,0) arc (0:-45:0.5) node [midway,right] {\ang{45}};
\foreach\x in {-5,...,5} \foreach\y in {-4,...,4}
{% the little dots
  \fill (\x,\y) circle (0.5pt);
}
\node at ( 0, 0) [above left]  {$O$};
\node at (-4, 0) [above right] {$A$};
\node at ( 4, 0) [below left]  {$B$};
\node at ( 0, 4) [below left]  {$C$};
\node at ( 0,-4) [above right] {$D$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容