角落处有令人不快的缝隙

角落处有令人不快的缝隙

在以下 MWE 中,有一些令人不快的间隙。我想使用 pswedge 绘制一条“平滑”的线(但对下图不起作用)。我该怎么做?


在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{amssymb,amsmath}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage{pstricks,pst-node}
\begin{document}
\begin{pspicture}[showgrid=true](1,-2.5)(6,1.5)
\psset{algebraic=true}
\pswedge[linewidth=1.5pt](3.5,0.25){2cm}{0}{180}
\psline[linewidth=1.5pt](1.5,-0.25)(5.5,-0.25)
\psarc[linewidth=1.5pt](3.2,-0.25){1.7cm}{180}{330}
\psarc[linewidth=1.5pt](3.5,-0.25){2cm}{-30}{0}
\SpecialCoor
\rput(3.5,-0.25){\pnode(2cm;-30){A}}
\rput(3.2,-0.25){\pnode(1.7cm;-30){B}}
\psline[linewidth=1.5pt](A)(B)
\end{pspicture}
\end{document} 

答案1

将最后的命令分组到 中\pscustom,并设置linejoin=1。我借此机会简化了您的序言:pstricks如果您加载 ,则无需加载pst-nodeSpecialCoor不再需要,因为现在默认设置了。还要注意pstricks加载xcolor。我添加了,如果您在编译器启动命令中添加TeX Live 和 MacTeX 下的开关,则auto-pst-pdf可以使用 进行编译 , 在 MiKTeX 下。pdflatex-shell-escape--enable-write18

\documentclass[12pt, border=3pt]{standalone}
\usepackage{amssymb,amsmath}
\usepackage[T1]{fontenc}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\begin{pspicture}[showgrid=true](1,-2.5)(6,1.5)
    \psset{algebraic=true, linejoin=1}
    \pswedge[linewidth=1.5pt](3.5,0.25){2cm}{0}{180}
    \psset{linecolor = red}
    \pscustom[linewidth=1.5pt]{
        \psline(1.5,-0.25)(5.5,-0.25)
        \psarc(3.2,-0.25){1.7cm}{180}{330}
        \psarc[](3.5,-0.25){2cm}{-30}{0}}
    \rput(3.5,-0.25){\pnode(2cm;-30){A}}
    \rput(3.2,-0.25){\pnode(1.7cm;-30){B}}
    \psline[linewidth=1.5pt](A)(B)
\end{pspicture}

\end{document}

在此处输入图片描述

答案2

没有\pscustom

\documentclass[12pt]{article}
\usepackage{pstricks,pst-node}
\begin{document}
    \begin{pspicture}[showgrid](1,-2.5)(6,1.5)
    \pswedge[linewidth=1.5pt](3.5,0.25){2cm}{0}{180}
    \psline[linewidth=1.5pt](1.5,-0.25)(5.5,-0.25)
    \psset{linecap=1}%%%%%%   !!!!  %%%%%%
    \psarc[linewidth=1.5pt](3.2,-0.25){1.7cm}{180}{330}
    \psarc[linewidth=1.5pt](3.5,-0.25){2cm}{-30}{0}
    \pnode[3.5,-0.25](2cm;-30){A}
    \pnode[3.2,-0.25](1.7cm;-30){B}
    \psline[linewidth=1.5pt](A)(B)
    \end{pspicture}
\end{document} 

或者 \pscustom

\begin{pspicture}[showgrid](1,-2.5)(6,1.5)
\pswedge[linewidth=1.5pt](3.5,0.25){2cm}{0}{180}
\pscustom[linewidth=1.5pt,linejoin=1]{%
    \psarc(3.2,-0.25){1.7cm}{180}{330}
    \psarc[](3.5,-0.25){2cm}{-30}{0}
    \closepath%  to get the horizontal line
}
\end{pspicture}

在此处输入图片描述

相关内容