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.

Is there a simpler way to obtain the reference nodes shown as dots below?

enter image description here

\documentclass[dvips,dvipsnames,rgb]{article}

\usepackage{pstricks,pst-node,graphicx}

\psset{framesep=0pt,linewidth=0.1pt}

\SpecialCoor

\newsavebox\mybox

\newenvironment{MyFrameBox}[4][8]{%BEGIN
    \def\labeling##1##2{\qdisk(##1){0.2pt}\uput{#3}[##2](##1){\scalebox{#4}{##1}}}%
    \def\scaling{%
        \scalebox{#1}{%
            \rnode[B]{B}{\rnode[c]{c}{\rnode[t]{t}{%
            \rnode[tl]{tl}{\rnode[l]{l}{\rnode[Bl]{Bl}{%
            \rnode[bl]{bl}{\rnode[b]{b}{\rnode[br]{br}{%
            \rnode[Br]{Br}{\rnode[r]{r}{\rnode[tr]{tr}{%
            \psframebox[linecolor=lightgray]{#2}}}}}}}}}}}}}%       
            \labeling{B}{135}\labeling{c}{45}%
            \labeling{t}{90}\labeling{tl}{180}%
            \labeling{l}{135}\labeling{Bl}{180}%
            \labeling{bl}{-90}\labeling{b}{-90}%
            \labeling{br}{-90}\labeling{Br}{0}%
            \labeling{r}{0}\labeling{tr}{0}%
            \psline[linecolor=lightgray](Bl)(Br)%
            \usebox{\mybox}}}
    \begin{lrbox}{\mybox}\ignorespaces}{%END
    \end{lrbox}\scaling\ignorespacesafterend}

\begin{document}
\begin{MyFrameBox}[10]{\color{red}\rm\"Age}{0.5pt}{0.1}
\psset{arrowscale=0.25,arrows=<->}
\ncline[linecolor=blue]{t}{r}
\end{MyFrameBox}
\end{document}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted
\documentclass{article}

\usepackage{pst-node}

\def\DefNodes#1#2{\rnode[tl]{#1-tl}{\rnode[tr]{#1-tr}{%
  \rnode[bl]{#1-bl}{\rnode[br]{#1-br}{#2}}}}}

\begin{document}

\psscalebox{10}{\DefNodes{Age}{\cyan Age}}%
\pspolygon[linecolor=red](Age-tl)(Age-tr)(Age-br)(Age-bl)%
\psline[linestyle=dashed,linecolor=red](Age-bl|0,0)(Age-br|0,0)%
\pcline[linestyle=none](Age-tl)(Age-tr)\ncput{\rnode{Age-tc}{\psdot}}%
\pcline[linestyle=none](Age-bl)(Age-br)\ncput{\rnode{Age-bc}{\psdot}}%
\pcline[linestyle=none](Age-bl)(Age-tl)\ncput{\rnode{Age-lc}{\psdot}}%
\pcline[linestyle=none](Age-br)(Age-tr)\ncput{\rnode{Age-rc}{\psdot}}%
\pcline[linestyle=none](Age-lc)(Age-rc)\ncput{\rnode{Age-C}{\psdot}}%
\psdots(Age-bl)(Abe-bl|0,0)(Age-tl)(Age-tr)(Agr-br|0,0)(Age-br)
\pcline[arrows=<->,linecolor=blue,arrowscale=1.25](Age-rb|0,0)(Age-tc)

\end{document}
share|improve this answer
    
the box dimension of a character is used for typesetting but it is not the real bounding box of the character. Compare the boxes for italics, where nearly all characters have parts outside of the box. Characters which touches only the baseline like o e are set a bit deeper (outside the bb) to get a better optic view of the printed line –  Herbert Dec 28 '10 at 17:43
    
the pst-node version from http://texnik.dante.de/tex/generic/pst-node/ knows the macro \psDefBoxNodes{..} and defines 12 nodes. See documentation for the names. It Will be available from CTAN this year :-) –  Herbert Dec 28 '10 at 21:20
    
I have read it. But you changed - to :. Anyway, why do you always enable line numbers of LTXexample? For me (hopely others too), these line numbers have no purpose because you never say something referring to a certain line. In addition, these line numbers make us difficult to copy/paste---line numbers get copied as well and we are forced to do an extra job, removing the line numbers after pasting. –  xport Dec 29 '10 at 4:26
    
- causes a problem with \nclines, the reason why I changed it to :. The sources are already available with every TeX distribution –  Herbert Dec 29 '10 at 7:01
    
You have renamed t to tC, l to Cl, r to Cr, B to BC, b to bC, etc. All have 2 characters. Did you forget to rename C to CC? –  xport Aug 13 '11 at 3:32
show 1 more comment

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.