Document Classesneed help with xypic and/or pstricks

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
starlite1079
Posts: 5
Joined: Tue Oct 21, 2008 8:21 pm

need help with xypic and/or pstricks

Post by starlite1079 »

Hi.

I am trying to create a drawing of four boxes with arrows to each and to a fifth box in the center. I got something almost working with xypic, but the arrows that should go only to the center box are going all the way across the diagram instead. It was suggested I use pgf/TikZ, but I was not able to run it correctly (many many errors occurred). I also attempted to use pstricks, but the labeling is not correct (I'm trying to work from an example in the User's Guide).

Here is my code (I have the working but not correct xypic code commented out):

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage[all]{xy}

\begin{document}
%\xymatrix@C=4cm@R=3cm{\ar@{<.>}[dr] |{\fbox{proper time $\tau$}}
%  \fbox{TCB}  \ar@{<->}[d]_{\text{fixed rate}}  & \ar@{<->}[l]_{\text{4-dimensional transformation}}  \fbox{TCG} \ar@{<->}[d]^{\text{fixed rate}} \\
%\fbox{TDB} \ar@{<.>}[ur]  & \fbox{TT} \ar@{<.>}[l]^{\text{4-dimensional transformation}}}
\[
   \setlength{\arraycolsep}{3cm}
   \begin{array}{cc}
      \Rnode{a}{\psframebox{TDB}} & \Rnode{b}{\psframebox{TCB}}\\[1.5cm]
      \Rnode{c}{\psframebox{TT}} & \Rnode{d}{\psframebox{TCG}}\\[1.5cm]
      \Rnode{e}{\psframebox{proper time \tau}}\\[.5cm]
   \end{array}
   \psset{nodesep=5pt,arrows=<->}
   \ncline{a}{b}\Aput{4-dimensional transformation}
   \ncline{a}{c}\Bput{fixed rate}
   \ncline[linestyle=dashed]{c}{d}\Bput{4-dimensional transformation}
   \ncline{b}{d}\Bput{fixed rate}
\]
\end{document}
I really appreciate any help anyone sends.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

need help with xypic and/or pstricks

Post by localghost »

An example for pstricks might be better than all explanations fro my side [1]. As an alternative there is pgf/TikZ. A gallery with examples is also available for this package [2]. Both packages have a very comprehensive documentation.

[1] /PSTricks/psmatrix/cd
[2] TikZ and PGF examples


Best regards and welcome to the board
Thorsten¹
starlite1079
Posts: 5
Joined: Tue Oct 21, 2008 8:21 pm

Re: need help with xypic and/or pstricks

Post by starlite1079 »

Thanks Thorsten. I am trying to work with an example from PStricks like the one you linked to. However, the labels do not show up correctly :(

As I mentioned in my post, I tried to install and run TikZ/pgf but I got a zillion errors. Apparently this package doesn't work with Redhat Enterprise Linux.
Otherwise I would probably be happy to use TikZ instead.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

need help with xypic and/or pstricks

Post by gmedina »

Hi,

I assume that you are the same person that asked this same very question in this thread fron CQF.info. An answer has been given to you there. Please inform that you are posting in more than one board to prevent duplication of efforts and waste of time.

If you are not that same person, then please excuse me and refer to the links above to find a solution.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
starlite1079
Posts: 5
Joined: Tue Oct 21, 2008 8:21 pm

Re: need help with xypic and/or pstricks

Post by starlite1079 »

Hi gmedina. Yes, it is the same person. I did the cross post since I thought I might receive other advice. I got the same advice, though. Oh well.
I'll take a look at the CQF thread. Thanks.
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

need help with xypic and/or pstricks

Post by CrazyHorse »

starlite1079 wrote:Hi gmedina. Yes, it is the same person. I did the cross post since I thought I might receive other advice. I got the same advice, though. Oh well.
I'll take a look at the CQF thread. Thanks.
what _exactly_ went wrong with your PSTricks example? I have
no problem with your code.

Herbert
starlite1079
Posts: 5
Joined: Tue Oct 21, 2008 8:21 pm

need help with xypic and/or pstricks

Post by starlite1079 »

Hi CrazyHorse,

When I ran the example for PStricks it didn't produce errors. However, when I looked at the output, all of the labels were placed one on top of the other in one arbitrary location. For whatever reason, the labeling is faulty. I have the most current version of pstricks. It came with my TeTeX distribution.

So, I went back to my original diagram trying to use XYpic. I found more examples on the Internet and was able to produce this:

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\usepackage[all]{xy}

\begin{document}
\begin{figure}[h!]
\xymatrixrowsep{3pc}\xymatrixcolsep{4pc}
\xymatrix{
\fbox{TCB}
\ar@{<->}[rr]^{\text{4-dimensional transformation: Eqs.(4)-(5)}}
\ar@{<->}[dd]_{\text{fixed rate Eq.(3)}}
\ar@{<-->}[dr] &&
\fbox{TCG} \ar@{<->}[dd]^{\text{fixed rate Eq.(1)}}\\
& \fbox{proper time $\tau$}
\ar@{<->}[ur]^{\text{Eqs. (6)-(7)}} \ar@{<->}[dr]_{\text{Eqs.(8)-(9)}}
\ar@{<-->}[dl] &&\\
\fbox{TDB}
\ar@{<-->}[rr]_{\text{4-dimensional transformation}}&&
\fbox{TT}}
\end{figure}
\end{document}
This worked properly and with the labels where they should be. It is definitely a puzzle why PStricks didn't work.
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

need help with xypic and/or pstricks

Post by CrazyHorse »

starlite1079 wrote: When I ran the example for PStricks it didn't produce errors. However, when I looked at the output, all of the labels were placed one on top of the other in one arbitrary location. For whatever reason, the labeling is faulty. I have the most current version of pstricks. It came with my TeTeX distribution.
I suppose that you viewed the dvi output. For PSTricks look always at the PostScript
output or alternative, for the pdf one, cretaed by ps2pdf

Herbert
Post Reply