Graphics, Figures & TablesPSTricks | Draw a Theatre Hall

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Draw a Theatre Hall

Post by svend_tveskaeg »

@Clemens:
Interesting. (I have never used TikZ. ;) )

@Thorsten:
The code in the test file test.tex is

Code: Select all

\documentclass{article}
\usepackage{auto-pst-pdf,pstricks-add}

\begin{document}

\psscalebox{0.6}{%
 \begin{pspicture}(-0.5,-0.75)(11,11)
  \psaxes[ticksize=-5pt 0]{->}(11,11)
  \psMatrixPlot[dotsize=1.1cm,dotstyle=square*,linecolor=red]{10}{10}{matrix.data}
  \psMatrixPlot[dotsize=0.5cm,dotstyle=o,ChangeOrder]{10}{10}{matrix.data}
 \end{pspicture}
}

\end{document}
with the following content of the file matrix.data:

Code: Select all

/dotmatrix [ % <------------ important line
0 1 1 0 0 0 0 1 1 1
0 1 1 0 1 1 1 0 1 0
1 0 1 1 0 0 0 1 1 0
0 0 1 0 0 0 0 0 1 1
1 1 1 1 1 0 1 0 0 1
0 0 1 1 0 1 0 1 1 1
1 0 0 0 1 1 0 0 0 1
0 0 0 1 1 1 0 1 1 0
1 1 0 0 0 0 1 0 0 1
1 0 1 0 0 1 1 1 0 0
] def % <------------ important line
I compiled using

Code: Select all

pdflatex -shell-escape test.tex
Only the axes get printed; no dots nor squares are created. (I have attached the log file.)

P.S. Thank you for helping me.
Attachments
test.log
Log file.
(14.39 KiB) Downloaded 324 times
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

Re: PSTricks | Draw a Theatre Hall

Post by localghost »

Bad news. I was able to reproduce the problem, but not yet able to track it. But further investigations will have to wait until I've got a little more time.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Draw a Theatre Hall

Post by svend_tveskaeg »

localghost wrote:... further investigations will have to wait until I've got a little more time.
No problem at all. I am just glad to get help.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PSTricks | Draw a Theatre Hall

Post by localghost »

In the meantime I had the opportunity to test an example. The error seems to be caused somewhere between the DVI and the PS format. But let us proceed one by one.


The testing environments:
  • Windows XP SP3, MiKTeX 2.9, Ghostscript 9.06
  • openSUSE 12.2, TeX Live 2012, Ghostscript 9.05

The tested code example:

Code: Select all

\documentclass[landscape]{article}
\usepackage{geometry}
\usepackage{pstricks-add}
%\usepackage{auto-pst-pdf}
\usepackage{filecontents}

\begin{filecontents*}{hall.dat}
/dotmatrix [
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0
0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0
0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0
0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0
] def
\end{filecontents*}

\pagestyle{empty}

\begin{document}
  \noindent
  \psscalebox{0.6}{
    \begin{pspicture}(12,12)
      \psMatrixPlot[dotsize=1cm,dotstyle=square,fillcolor=magenta,ChangeOrder]{8}{32}{hall.dat}
    \end{pspicture}
  }
\end{document}
The (commented) auto-pst-pdf package is only used when compiling directly with PDFLaTeX.


The testing methods and the results:
Different typesetting engines have been tested to find out where the problem might be. Since the planned output format is PDF, different compiling and conversion routes have been tried. A short overview.

The typesetting engines:
  • LaTeX → DVI: works
  • LaTeX → PDF: fails (by auto-pst-pdf)
  • XeLaTeX → PDF: works
The conversion routes:
  • DVI → PS: fails (hence PS → PDF fails also)
  • DVI → PDF: fails
The only working method to get a proper output is to use the XeLaTeX typesetting engine. But this might not be satisfactory since the document is probably set up for another engine. The fail of PDFLaTeX is due to the fact that auto-pst-pdf uses Ghostscript as back-end for conversions.

So the focus is on the step between DVI and PS. Since the conversion is done by DVIPS, it's worth to take a look at what this tools prints on the command line. It didn't print anything. But the conversion fails with the result that the output is empty (see above). So the next step, the conversion from PS to PDF, has to be examined. And Ghostscript complains with this output.

Code: Select all

Error: /invalidfileaccess in --run--
Operand stack:
   (hall.dat)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1894   1   6   %oparray_pop   --nostringval--
Dictionary stack:
   --dict:1158/1684(ro)(G)--   --dict:0/20(G)--   --dict:153/200(L)--   --dict:174/300(L)--   --dict:38/200(L)--   --dict:110/200(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 118641
GPL Ghostscript 9.05: Unrecoverable error, exit code 1
I took the output from my Linux system. But the output on Windows is identical.


Summary
Something in the generated DVI output by the \psMatrixPlot command seems flawed. It can be viewed but not converted. Only XeLaTeX manages to compile the code. As far as I know it produces XDVI output and uses the xdvipdfmx tool to convert this to PDF. The obtained output from XeLaTeX is attached. The failure is for sure not by Ghostscript because it manages to convert other stuff flawlessly

I suggest to contact the maintainer of pstricks-add. He is a board member. If he doesn't react in the next few days, we will contact him by PM.
Attachments
The output of the provided example produced by XeLaTeX.
The output of the provided example produced by XeLaTeX.
XeLaTeX-pstricks-add-Theatre-Hall.png (2.09 KiB) Viewed 5587 times
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Draw a Theatre Hall

Post by CrazyHorse »

svend_tveskaeg wrote:Thank you. I have already looked at page 82, though, without understanding it.

Just a small example to get me going would be much appreciated.
you can use a simple psmatrix:

Code: Select all

\documentclass{article}
\usepackage{pst-node}
\colorlet{seat}{red!50!black!50}
\colorlet{mixer}{black}
\colorlet{stage}{brown}
\psset{framesep=0pt,linewidth=0.5pt,dimen=inner}
\begin{document}

\begin{center}
\begingroup
\catcode`\X=13
\catcode`\_=13
\catcode`\M=13
\catcode`\,=13
\def X{\psframebox[linecolor=seat]{\color{seat!75}\rule{5pt}{5pt}}}
\def M{\psframebox{\color{black!75}\rule{5pt}{5pt}}}
\def_{\psframebox[linestyle=none]{\color{white}\rule{5pt}{5pt}}}
\def,{\kern1pt}
\begin{psmatrix}[rowsep=-5pt,colsep=1pt]
X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X\\
~\\
X,X,_,_,X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,X,X\\
X,X,_,_,X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,X,X\\
~\\
_,X,X,_,_,X,X,X,X,X,X,X,X,X,X,X,_,_,X,X,_\\
_,X,X,_,_,X,X,X,X,X,X,X,X,X,X,X,_,_,X,X,_\\
_,X,X,_,_,X,X,X,X,X,M,X,X,X,X,X,_,_,X,X,_\\
~\\
_,_,X,X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,X,_,_\\
_,_,X,X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,X,_,_\\
_,_,X,X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,X,_,_\\
~\\
_,_,_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,_\\
\end{psmatrix}
\endgroup

\bigskip
\psframebox[linecolor=stage,framesep=0pt]{\color{stage!70}\rule{5cm}{13pt}}
\end{center}

\end{document}
Attachments
psmatrix-Theatre-Hall.png
psmatrix-Theatre-Hall.png (2.14 KiB) Viewed 5578 times
Last edited by localghost on Wed Sep 26, 2012 9:21 pm, edited 1 time in total.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Draw a Theatre Hall

Post by svend_tveskaeg »

@CrazyHorse:
Thank you. Nice idea!

@Thorsten:
I would still like to see an example with \psMatrixPlot.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PSTricks | Draw a Theatre Hall

Post by localghost »

svend_tveskaeg wrote:[…] I would still like to see an example with \psMatrixPlot.
You did read my last reply?
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Draw a Theatre Hall

Post by CrazyHorse »

localghost wrote:
  • DVI → PS: fails (hence PS → PDF fails also)
  • DVI → PDF: fails
The only working method to get a proper output is to use the XeLaTeX typesetting engine. But this might not be satisfactory since the document is probably set up for another engine. The fail of PDFLaTeX is due to the fact that auto-pst-pdf uses Ghostscript as back-end for conversions.
that is a problem with the security setting of GhostScript. When invoking from an external GUI it often denies opening and running external files. Run it from the terminal "pdflatex -shell-escape file" and should work.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PSTricks | Draw a Theatre Hall

Post by localghost »

CrazyHorse wrote:that is a problem with the security setting of GhostScript. When invoking from an external GUI it often denies opening and running external files. Run it from the terminal "pdflatex -shell-escape file" and should work.
Unfortunately is doesn't either work from the terminal. There is something that Ghostscript rejects. Is there any method to evade the security switch?
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Draw a Theatre Hall

Post by CrazyHorse »

localghost wrote:
CrazyHorse wrote:that is a problem with the security setting of GhostScript. When invoking from an external GUI it often denies opening and running external files. Run it from the terminal "pdflatex -shell-escape file" and should work.
Unfortunately is doesn't either work from the terminal. There is something that Ghostscript rejects. Is there any method to evade the security switch?
at least "ps2pdf -dNOSAFER ..." is important. However I had no problem here with your example.
Post Reply