Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PSTricks, Tkiz/pgf, and 'psmatrix'

269 views
Skip to first unread message

coo...@nospamverizon.net

unread,
May 3, 2012, 10:50:50 AM5/3/12
to
Compendium of a couple of things I've asked about before, with varying
degrees of success. Hoping putting everything in one place will help
resolve some issues.

I have a book (long, ponderous tome) with a fair number (100+) figures
currently rendered using PSTricks (via usual LaTeX compilation sequence:
.tex -> .dvi -> .ps -> .pdf). Most of these figures make use of the very
convenient psmatrix environment. Here is a minimal example of one such
figure,

\documentclass{article}
\usepackage{pst-node,pstricks}
\pagestyle{empty}

\begin{document}


\begin{figure}[h]
\centering
\rule[-1.5cm]{0pt}{4.5cm}
$
\psmatrix[mnode=Circle,radius=5mm,colsep=2.0cm,rowsep=1.5cm,
arrowscale=1.5] % tell PSTricks you want 5mm circles for nodes
[name=1] 1 & [name=2] 2 & [name=3] 3
\ncline[nodesep=1pt]{->}{1}{2}_{S_o\lambda^{-1}} % ncline creates
forward transitions
\ncline[nodesep=1pt]{->}{2}{3}_{S_a\lambda^{-1}}
\ncarc[nodesep=1pt,arcangle=60]{<-}{1}{3}^{F_a\lambda^{-1}} % ncarc
draws fertility arc
\nccurve[angleA=-125,angleB=-55,ncurv=3,nodesep=1pt]{->}{3}{3}_{S_a\lambda^{-1}}
% self-loop on terminal node
\endpsmatrix
$
\caption{\emph{This is an example of a life-cycle diagram drawn using
PStricks}}
\end{figure}

\end{document}


Now, for a whole slew of reasons (main one being access to OTF fonts
without the hassles of installing said fonts into LaTeX), I'd like to
try compiling the book using luaLaTeX. Easy enough, except that the
preceding minimal example doesn't compile. When I posted about this
before, there were two proposed solutions:


1\ use auto-pst-pdf, and either use the pspicture-environment or
surround the pstricks-code with the postscript-environment

2\ use Tkiz/pgf instead.


Because I have a heavy investment in pstricks, tried the former first.
Modified the example as follows:

\documentclass{article}

\usepackage{auto-pst-pdf}
\usepackage{pst-node,pstricks}
\begin{document}

\begin{figure}[h]
\centering
\rule[-1.5cm]{0pt}{4.85cm}
\begin{postscript}
$\psscalebox{0.945}{%
\psmatrix[mnode=Circle,radius=5mm,colsep=2.0cm,rowsep=1.5cm,
arrowscale=1.5]
[name=1] 1 & [name=2] 2 & [name=3] 3 & [name=4] 4
\ncline[nodesep=1pt]{->}{1}{2}_{S_0}
\ncline[nodesep=1pt]{->}{2}{3}_{S_1}
\ncline[nodesep=1pt]{->}{3}{4}_{S_2}
\nccurve[angleA=-125,angleB=-55,ncurv=3.5,nodesep=1pt]{->}{4}{4}
\nbput[nrot=0]{S_{3+}}
\ncarc[nodesep=1pt,arcangle=40]{<-}{1}{3}^{S_2m_a}
\ncarc[nodesep=1pt,arcangle=60]{<-}{1}{4}^{S_{3+}m_a}
\endpsmatrix
}$
\end{postscript}

\end{figure}

\end{document}



Alas, this doesn't compile (and yes, I've allowed -escapes, and \write18
and all the other tricks). The log reports the the postscript
environment is 'undefined'.

OK, so that didn't work. Moving on to plan (b) -- try Tkiz/pgf. Seems
reasonable, but despite a couple of hours of trial and error (and
searching for example code online), can't manage to get anything
remotely close.

So, I'd consider trying Tkiz/pgf, provided I can get a working minimal
example 9say, something that renders the figure, above). Or, I could
'stick with what I know' (psmatrix), if someone can help me figure out
how to get it to compile under luaLateX.

I suppose the third alternative would be to drink a few, then trying
installing various OTF fonts under LaTeX, but I'm leaving that as a last
resort.


Thanks much in advance for help, suggestions.

Herbert Voss

unread,
May 3, 2012, 11:20:14 AM5/3/12
to
Am 03.05.2012 16:50, schrieb coo...@NOSPAMverizon.net:
> Now, for a whole slew of reasons (main one being access to OTF fonts
> without the hassles of installing said fonts into LaTeX), I'd like to
> try compiling the book using luaLaTeX. Easy enough, except that the

Use xelatex instead and everything will be fine.

Herbert

coo...@nospamverizon.net

unread,
May 4, 2012, 2:34:48 PM5/4/12
to
I wish it were that simple. When I run xelatex against the following,
pdf gets generated (good!), which contains the labels on the arcs
(great!), but not the nodes, or the arcs themselves (not great...). The
log is filled with errors like:

** WARNING ** Image format conversion for PSTricks Failed.
** WARNING ** Interpreting special command pst: (ps:) failed.

So, something else is needed. Suggestions? I'm starting to understand
why 'font management' is a chronic issue with LaTeX (based on the number
of posts on this newsgroup about said issue). I've been generally
satisfied with cm and Palatino, but after 15+ years, thought I'd try
something slightly more modern (like OTF Minion Pro, for example). But,
if I can't get PSTricks-generated images to compile (or figure out the
Tkiz/pgf equivalent), looks like I'll be stuck with 'old school' fonts.

\documentclass[11pt]{article}
\usepackage{xltxtra,pst-node,pstricks}
\pagestyle{empty}

Herbert Voss

unread,
May 4, 2012, 3:29:53 PM5/4/12
to
Am 04.05.2012 20:34, schrieb coo...@NOSPAMverizon.net:

>> Use xelatex instead and everything will be fine.
>
> I wish it were that simple. When I run xelatex against the following,
> pdf gets generated (good!), which contains the labels on the arcs
> (great!), but not the nodes, or the arcs themselves (not great...). The
> log is filled with errors like:
>
> ** WARNING ** Image format conversion for PSTricks Failed.
> ** WARNING ** Interpreting special command pst: (ps:) failed.
>
> So, something else is needed. Suggestions? I'm starting to understand
> why 'font management' is a chronic issue with LaTeX (based on the number
> of posts on this newsgroup about said issue). I've been generally
> satisfied with cm and Palatino, but after 15+ years, thought I'd try
> something slightly more modern (like OTF Minion Pro, for example). But,
> if I can't get PSTricks-generated images to compile (or figure out the
> Tkiz/pgf equivalent), looks like I'll be stuck with 'old school' fonts.
>
> \documentclass[11pt]{article}
> \usepackage{xltxtra,pst-node,pstricks}
> \pagestyle{empty}
>
> \begin{figure}[h]
> \centering
> \rule[-1.5cm]{0pt}{4.85cm}
> \begin{postscript}

please privide examples which you already tried yourself.
the environment isn't needed and not known by xelatex and
\begin{document} is missing.
This works for me with current TeXLive and xelatex:

\documentclass[11pt]{article}
\usepackage{fontspec,pst-node}
\setmainfont{Linux Libertine O}
\pagestyle{empty}

\begin{document}
\begin{figure}[h]
\centering
\rule[-1.5cm]{0pt}{4.85cm}
$\psscalebox{0.945}{%
\psmatrix[mnode=Circle,radius=5mm,colsep=2.0cm,rowsep=1.5cm,
arrowscale=1.5]
[name=1] 1 & [name=2] 2 & [name=3] 3 & [name=4] 4
\ncline[nodesep=1pt]{->}{1}{2}_{S_0}
\ncline[nodesep=1pt]{->}{2}{3}_{S_1}
\ncline[nodesep=1pt]{->}{3}{4}_{S_2}
\nccurve[angleA=-125,angleB=-55,ncurv=3.5,nodesep=1pt]{->}{4}{4}
\nbput[nrot=0]{S_{3+}}
\ncarc[nodesep=1pt,arcangle=40]{<-}{1}{3}^{S_2m_a}
\ncarc[nodesep=1pt,arcangle=60]{<-}{1}{4}^{S_{3+}m_a}
\endpsmatrix
}$
\end{figure}

\end{document}

Herbert

coo...@nospamverizon.net

unread,
May 11, 2012, 8:31:06 PM5/11/12
to Herbert Voss
I had posted a minimal example earlier in the thread, but did forget to
copy over \begin{document}. No matter. Tried LuaLatex on your code
(substituting Times New Roman):

\documentclass[11pt]{article}
\usepackage{fontspec,pst-node}
\setmainfont{Times New Roman}
\pagestyle{empty}

\begin{document}
\begin{figure}[h]
\centering
\rule[-1.5cm]{0pt}{4.85cm}
$\psscalebox{0.945}{%
\psmatrix[mnode=Circle,radius=5mm,colsep=2.0cm,rowsep=1.5cm,
arrowscale=1.5]
[name=1] 1 & [name=2] 2 & [name=3] 3 & [name=4] 4
\ncline[nodesep=1pt]{->}{1}{2}_{S_0}
\ncline[nodesep=1pt]{->}{2}{3}_{S_1}
\ncline[nodesep=1pt]{->}{3}{4}_{S_2}
\nccurve[angleA=-125,angleB=-55,ncurv=3.5,nodesep=1pt]{->}{4}{4}
\nbput[nrot=0]{S_{3+}}
\ncarc[nodesep=1pt,arcangle=40]{<-}{1}{3}^{S_2m_a}
\ncarc[nodesep=1pt,arcangle=60]{<-}{1}{4}^{S_{3+}m_a}
\endpsmatrix
}$
\end{figure}

\end{document}


Didn't work. Get the following error:

("Loading MPS to PDF converter (version 2006.09.02).]
)
!undefined control sequence
<recently read \c@lor@to@ps

l.22 }
$


Tried same file using XeLaTex - still no luck. Different error message
(xelatex.exe: GUI framework cannot be initialized), but same result.



Herbert Voss

unread,
May 18, 2012, 2:11:51 AM5/18/12
to
Am 12.05.2012 02:31, schrieb coo...@NOSPAMverizon.net:

> Didn't work. Get the following error:
>
> ("Loading MPS to PDF converter (version 2006.09.02).]
> )
> !undefined control sequence
> <recently read \c@lor@to@ps
>
> l.22 }
> $
>
>
> Tried same file using XeLaTex - still no luck. Different error message
> (xelatex.exe: GUI framework cannot be initialized), but same result.


has nothing to with TeX, see http://www.miktex.org/2.8/issues

Herbert
0 new messages