Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following MWE in PSTricks, showing a rectangle:

\documentclass[pstricks, border=12pt]{standalone}
\usepackage{pst-node}

\usepackage{siunitx}
\begin{document}
\begin{pspicture}[showgrid=true](5,5)
    \psframe(4,4)
\end{pspicture}
\end{document}

What I would like to is to remove the part of the right side spanned by the coordinates (4,1) and (4,3). What is the easiest way to achieve this? I could of course just superimpose a white line, but that seems like a wrong way to do it.

share|improve this question
    
@PGFTricks: You are wrong! pst-node has nothing to do with coordinate types, except nodes! –  Herbert Oct 7 '13 at 8:50

2 Answers 2

up vote 3 down vote accepted

a "correct" way is to draw a polyline:

\psline(4,1)(4,0)(0,0)(0,4)(4,4)(4,3)

and if you want to fill the area use:

\psframe*[linecolor=cyan!40](4,4)
\psline(4,1)(4,0)(0,0)(0,4)(4,4)(4,3)
share|improve this answer
    
is there a way to remove the horizontal lines at points (4, 1) and (4,3)? –  BillyJean Oct 7 '13 at 8:45
    
sorry, I do not understand what lines do you mean. At (4, 1) and (4,3) are no horizontal lines –  Herbert Oct 7 '13 at 8:48

Just another answer with PSTricks. But the boundary of the filled region passes the middle of the line, you can see it easily by changing linewidth=5\pslinewidth, for example.

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(4,4)
    \pscustom[fillstyle=solid,fillcolor=gray]
    {
        \psline(4,3)(4,4)(0,4)(0,0)(4,0)(4,1)
    }
\end{pspicture}
\end{document}

Apparently the code above is equivalent to the following (based on Herbert's surprising comment below).

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(4,4)
    \psline[fillstyle=solid,fillcolor=gray](4,3)(4,4)(0,4)(0,0)(4,0)(4,1)
\end{pspicture}
\end{document}

Or with an overkill solution below.

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(4,4)
\pscustom
{
    \psline(4,3)(4,4)(0,4)(0,0)(4,0)(4,1)
    \gsave
        \closepath
        \fill[fillstyle=solid,fillcolor=gray]
    \grestore
}
\end{pspicture}
\end{document}

enter image description here

share|improve this answer
    
\psline[fillstyle=solid,fillcolor=gray](4,3)... does the same without \pscustom. –  Herbert Oct 7 '13 at 13:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.