5

In the following MWE, there are some unpleasant gaps. I would like to produce a "smooth" line as drawn with the use of pswedge (which isn't working for the lower chart). How can I do that?


enter image description here

\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} 
Gotti91
  • 509
  • In tikz there is the option line joint -- maybe there is something similar in ´pstricks´ or you switch to ´tikz´ (see http://tex.stackexchange.com/questions/21063 for example). – Dr. Manuel Kuehner Feb 21 '17 at 00:11

2 Answers2

4

Group the last commands in a \pscustom, and set linejoin=1. I took the opportunity to simplify your preamble: needless to load pstricks if you load pst-node. SpecialCoor is no more necessary, as it is set by default nowadays. Note also that pstricks loads xcolor. I added auto-pst-pdf, which enables to compile with pdflatex if you add to the compiler launching command the -shell-escape switch under TeX Live and MacTeX, --enable-write18 under MiKTeX.

\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}

enter image description here

Bernard
  • 271,350
  • Thank you very much. Somewhere I read about the \closepath command ... Is it necessary to use it (here)? – Gotti91 Feb 21 '17 at 00:40
  • It does not seem to change whatever. Oh, by the way: \SpecialCoord is no more necessary nowadays: it is the default. – Bernard Feb 21 '17 at 00:50
1

Without \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} 

or with \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}

enter image description here