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 want to get the nodes on which the \*cline intersects the hypothetical edge of \ncput. The following animation shows my attempt to find the nodes by a trial & error approach.

I need the nodes because I want to have a transparent background in PNG format in which \ncput* fails to do so.

enter image description here

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

\begin{document}
\multido{\n=0.1+0.1}{10}{%
\begin{pspicture}[showgrid=false](2,2)
    \pstGeonode
        [
            PosAngle={135,-45},
            PointName={default,default,none},
            PointSymbol={none}
        ]
        (0,1){A}
        (2,0){B}
        ([offset=15pt]{B}A){A'}
        ([offset=-15pt]{A}B){B'}
        ([nodesep=\n]{B'}A'){A''}
        ([nodesep=\n]{A'}B'){B''}
    %
    \psline(A)(B)
    %
    \bgroup
        \psset{linestyle=dashed,dash=1pt 1pt,linecolor=red,linewidth=0.5\pslinewidth}
        \psline(A)(A')
        \psline(B)(B')
    \egroup
    %
    \pcline{|<*-}(A')(A'')
    \pcline{->|*}(B'')(B')
    \ncline[linestyle=none]{A''}{B''}
    \ncput[nrot=:0]{$\sqrt{5}$}
\end{pspicture}}
\end{document}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

Problem solved!

Now, I can get a transparent label in PNG as follows.

enter image description here

\documentclass[pstricks,border=12pt,multi]{standalone}
\usepackage{pst-eucl}
\newcommand\ncputtransparent[4][1pt]{%
    \ncline[linestyle=none]{#2}{#3}
    \ncput[nrot=:0]{\psDefBoxNodes{obj}{#4}}
    \pcline{|<*-}(#2)([nodesep=#1]{#2}obj:Cl)
    \pcline{->|*}([nodesep=#1]{#3}obj:Cr)(#3)
}

\begin{document}
\begin{pspicture}[showgrid=false](2,2)
    \pstGeonode
        [
            PosAngle={135,-45},
            PointName={default,default,none},
            PointSymbol={none}
        ]
        (0,1){A}
        (2,0){B}
        ([offset=15pt]{B}A){A'}
        ([offset=-15pt]{A}B){B'}
    %
    \psline(A)(B)
    %
    \bgroup
        \psset{linestyle=dashed,dash=1pt 1pt,linecolor=red,linewidth=0.5\pslinewidth}
        \psline(A)(A')
        \psline(B)(B')
    \egroup
    \ncputtransparent[3pt]{A'}{B'}{$\sqrt5$}
\end{pspicture}
\end{document}

Just for a comparison purpose, the following code uses the opaque \ncput*. Can you see the difference? Note: I deliberately enclose the image in a quote tag to emphasize the opaque label.

enter image description here

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

\begin{document}
\begin{pspicture}[showgrid=false](2,2)
    \pstGeonode
        [
            PosAngle={135,-45},
            PointName={default,default,none},
            PointSymbol={none}
        ]
        (0,1){A}
        (2,0){B}
        ([offset=15pt]{B}A){A'}
        ([offset=-15pt]{A}B){B'}
    %
    \psline(A)(B)
    %
    \bgroup
        \psset{linestyle=dashed,dash=1pt 1pt,linecolor=red,linewidth=0.5\pslinewidth}
        \psline(A)(A')
        \psline(B)(B')
    \egroup
    \pcline{|<*->|*}(A')(B')
    \ncput*[nrot=:0]{$\sqrt5$}
\end{pspicture}
\end{document}
share|improve this answer

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.