Graphics, Figures & Tables'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by achim »

Hi

I've written a document containing some pstricks figures and other figure like files like psmatrix. Now, my supervisor wants to reuse these figures for other publications but is not keen on installing and using pstricks.

Hence, I'm wondering if there is an easy way to extract all figures form my document separately as *.png or *.eps files. Of course I could use the selection tool from my pdf viewer and save every figure separately. But bounding boxes would not be consistent for similar figures and the resolution is dependent on the current zoom.

Is there a way to automate this?

Cheers
Achim
Last edited by achim on Wed Sep 01, 2010 12:41 am, edited 1 time in total.
OS: Kubuntu
Distribution: TexLive
Editor: Kile

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

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by localghost »

The easiest was that occurs to me is to use the (auto-)pst-pdf package and compile your document directly with pdflatex (yes, you have read right). Pay special attention to the notes about shell escape in the manual.

This way you will get an additional auxiliary file that contains all pstricks pictures on separate pages in one PDF file. Assumed that your source file is called »jobname.tex«, the file with the pictures in it will get the name »jobname-pics.pdf«. You can extract the pictures to single pages (e. g. with GSview/Ghostscript) and if necessary convert them to EPS later. It should also work with the psmatrix environment. The pstricks manual also describes how you can externalize according stuff directly.


Thorsten
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by achim »

Hi Localghost

First of all thanks for the reply and sorry that I couldn't get back to you any sooner.

I have now tried your suggestion. However, I seem to do something wrong.

Here's a minimal example:

Code: Select all

\documentclass[12pt]{article}

\usepackage{pst-pdf}
\usepackage{auto-pst-pdf}

\usepackage{graphicx}
\usepackage{pstricks}
\usepackage{pst-all}
\usepackage{pstricks-add}


\usepackage{fancybox}
\usepackage{color}
\usepackage{colortbl}
\usepackage[]{xcolor}

\begin{document}

\psset{unit=1cm, arrowsize=6pt}
\newcommand{\To}[1]{\TR{\ovalbox{\shortstack{\textbf{#1}}}}}

\begin{figure}[ht]
\centering
	\begin{psmatrix}[colsep=0.5cm, rowsep=0.5cm, nodealign=true]%
	\To{$|\red|$ } & [mnode=dot]	&	\To{$(\red)$ }	&	&	\\%
					&	\To{$)\red($ }	&	[mnode=dot]	&	[mnode=dot]	&	~$\cdots$ no p.i.%
	\end{psmatrix}%
	%
	\ncline{1,1}{1,2}%
	\ncline{1,2}{1,3}%
	\ncline[linestyle=dashed]{->}{1,3}{2,4}%
	\ncline[linestyle=dashed]{<-}{1,1}{2,2}%
	\ncline{2,2}{2,5}%
\caption{Branching of the stable equilibria for the two beam array with increasing DC from left to right.}
\end{figure}

\end{document}
When I compile via dvi-ps with \usepackage{pst-pdf} and \usepackage{auto-pst-pdf} commented out, it works fine.
With the two packages uncommented and compiling again dvi-ps I get an error; ! Incomplete \iffalse; all text was ignored after line 31.
This may(?) be all right since I didn't compile via pdflatex as you suggested.
So, compiling pdflatex I get an ! Missing } inserted error which I can absolutely make no sense of...

Can anybody recreate this error and confirm that it's not a problem with my system?
Or even better; point out what I'm doing wrong here?

Cheers
Achim

ps: In my original document I have all the pstricks figures and graphs in a separate file wrapped in a \newcommand. This file is then included with \input directly after the begin document. The error messages are the same as described above so I don't think this is the problem.
OS: Kubuntu
Distribution: TexLive
Editor: Kile
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by localghost »

Use only the auto-pst-pdf package, not both. And pay special attention to the notes in the manual regarding shell escape.

But your code contains an undefined control sequence (\TR) which makes it not compilable. See the critical line below.

Code: Select all

\newcommand{\To}[1]{\TR{\ovalbox{\shortstack{\textbf{#1}}}}}
So, please fix this first. Otherwise this comes to nothing.
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by achim »

This is puzzling me, I can't get it working...

Code: Select all

\documentclass[12pt]{article}

\usepackage{auto-pst-pdf}

\usepackage{graphicx}
\usepackage{pstricks}
\usepackage{pst-all}
\usepackage{pstricks-add}


\usepackage{fancybox}
\usepackage{color}
\usepackage{colortbl}
\usepackage[]{xcolor}

\begin{document}

\psset{unit=1cm, arrowsize=6pt}
% \newcommand{\To}[1]{\TR{\ovalbox{\shortstack{\textbf{#1}}}}}

\begin{figure}[ht]
\centering
	\begin{psmatrix}[colsep=0.5cm, rowsep=0.5cm, nodealign=true]%
	\Toval{$|\red|$ } & [mnode=dot]   &   \Toval{$(\red)$ }   &   &   \\%
				&   \Toval{$)\red($ }   &   [mnode=dot]   &   [mnode=dot]   &   ~$\cdots$ no p.i.%
	\end{psmatrix}%
	%
	\ncline{1,1}{1,2}%
	\ncline{1,2}{1,3}%
	\ncline[linestyle=dashed]{->}{1,3}{2,4}%
	\ncline[linestyle=dashed]{<-}{1,1}{2,2}%
	\ncline{2,2}{2,5}%
\caption{Branching of the stable equilibria for the two beam array with increasing DC from left to right.}
\end{figure}

\end{document}
1) \TR is a wrapper for the Rnode in psmatrix (also this is a valid command when compiling dvi-ps-pdf), leaving that aside and using \Toval still does not quite work:
2) Taking the above code and compiling as below does not do the job either.

Code: Select all

pdflatex -shell-escape test.tex
Output:

Code: Select all

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2010.8.27)  31 AUG 2010 18:30
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size12.clo
File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texmf-texlive/tex/latex/auto-pst-pdf/auto-pst-pdf.sty
Package: auto-pst-pdf 2009/04/26 v0.6 Wrapper for pst-pdf

(/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2009/04/10 v2.0 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in pdf mode detected.
)
(/usr/share/texmf-texlive/tex/latex/xkeyval/xkeyval.sty
Package: xkeyval 2008/08/13 v2.6a package option processing (HA)

(/usr/share/texmf-texlive/tex/generic/xkeyval/xkeyval.tex
\XKV@toks=\toks14
\XKV@tempa@toks=\toks15
\XKV@depth=\count87
File: xkeyval.tex 2008/08/13 v2.6a key=value parser (HA)

(/usr/share/texmf-texlive/tex/generic/xkeyval/keyval.tex)))
(/usr/share/texmf-texlive/tex/latex/ifplatform/ifplatform.sty
Package: ifplatform 2009/09/10 v0.3a Testing for the operating system

(/usr/share/texmf-texlive/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2009/09/23 v0.6 LuaTeX support for pdfTeX utility functions
 (HO)

(/usr/share/texmf-texlive/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2007/09/09 v1.2 Providing info/warning/message (HO)
)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2009/04/17 v1.2 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
(/usr/share/texmf-texlive/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2009/08/05 v1.0 Some LaTeX kernel commands for general use (HO
)
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
)
(/usr/share/texmf-texlive/tex/generic/oberdiek/catchfile.sty
Package: catchfile 2007/11/11 v1.2 Catches the contents of a file (HO)
)
runsystem(uname -s > "test.w18")...executed.

 (./test.w18)
runsystem(rm -- "test.w18")...executed.

)
\c@app@runs=\count88
runsystem(echo " ")...executed.

runsystem(echo "-------------------------------------------------")...executed.

runsystem(echo "auto-pst-pdf: Auxiliary LaTeX compilation")...executed.

runsystem(echo "-------------------------------------------------")...executed.

runsystem(latex -no-shell-escape -jobname="test-autopp" -interaction=batchmode 
 "\let \APPmakepictures \empty \input  test.tex")...executed.

runsystem(dvips -Ppdf -o "test-autopp.ps" "test-autopp.dvi")...executed.

runsystem(ps2pdf -dAutoRotatePages=/None "test-autopp.ps" "test-autopp.pdf")...
executed.

runsystem(pdfcrop  "test-autopp.pdf" "test-pics.pdf")...executed.

runsystem(rm -- "test-autopp.log")...executed.

runsystem(rm -- "test-autopp.dvi")...executed.

runsystem(rm -- "test-autopp.ps")...executed.

runsystem(rm -- "test-autopp.pdf")...executed.

runsystem(echo "-------------------------------------------------")...executed.

runsystem(echo "auto-pst-pdf: End auxiliary LaTeX compilation")...executed.

runsystem(echo "-------------------------------------------------")...executed.


(/usr/share/texmf-texlive/tex/latex/pst-pdf/pst-pdf.sty
Package: pst-pdf 2008/10/09 v1.1v PS graphics for pdfLaTeX (RN,HjG)
\c@pspicture=\count89

(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/etc/texmf/tex/latex/config/graphics.cfg
File: graphics.cfg 2009/08/28 v1.8 graphics configuration of TeX Live
)
Package graphics Info: Driver file: pdftex.def on input line 91.

(/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def
File: pdftex.def 2009/08/25 v0.04m Graphics/color for pdfTeX
\Gread@gobject=\count90
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
Package pst-pdf Info: MODE: 1 (pdfTeX mode) on input line 214.

(/usr/share/texmf-texlive/tex/latex/pstricks/pstricks.sty
Package: pstricks 2008/11/26 v0.40 LaTeX wrapper for `PSTricks' (RN,HV)

(/usr/share/texmf-texlive/tex/generic/pstricks/pstricks.tex
`PSTricks' v1.29  <2009/05/19> (tvz)
\pst@dima=\dimen105
\pst@dimb=\dimen106
\pst@dimc=\dimen107
\pst@dimd=\dimen108
\pst@dimg=\dimen109
\pst@dimh=\dimen110
\pst@hbox=\box26
\pst@boxg=\box27
\pst@cnta=\count91
\pst@cntb=\count92
\pst@cntc=\count93
\pst@cntd=\count94
\pst@cntg=\count95
\pst@cnth=\count96
\pst@toks=\toks16
(/usr/share/texmf-texlive/tex/generic/pstricks/pstricks.con)
\psunit=\dimen111
\psxunit=\dimen112
\psyunit=\dimen113
\pslinewidth=\dimen114
\pst@customdefs=\toks17
\pslinearc=\dimen115
\everypsbox=\toks18
\psframesep=\dimen116
\pslabelsep=\dimen117
\pst@shift=\dimen118
\theoverlaybox=\box28
)
File: pstricks.tex 2009/05/19 v1.29 `PSTricks' (tvz,hv)

(/usr/share/texmf/tex/latex/xcolor/xcolor.sty
Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK)

(/etc/texmf/tex/latex/config/color.cfg
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341.
Package xcolor Info: Model `RGB' extended on input line 1353.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360.
))
\ppf@output=\toks19

(/usr/share/texmf/tex/latex/preview/preview.sty
Package: preview 2008/02/03 11.85 (AUCTeX/preview-latex)
\pr@snippet=\count97
\pr@box=\box29
\pr@output=\toks20
)
(/usr/share/texmf-texlive/tex/latex/graphics/dvips.def
File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
)
(/usr/share/texmf-texlive/tex/latex/environ/environ.sty
Package: environ 2008/06/18 v0.2 A new way to define environments
\@emptytoks=\toks21
\@envbody=\toks22
)))
(/usr/share/texmf-texlive/tex/latex/pstricks/pst-all.sty
Package: pst-all 2008/01/01 the main pstricks tools

(/usr/share/texmf-texlive/tex/latex/pstricks/pst-node.sty
Package: pst-node 2006/01/01 package wrapper for pst-node.tex

(/usr/share/texmf-texlive/tex/generic/pstricks/pst-node.tex  v1.01, 2008/11/26
\psrow=\count98
\pscol=\count99
\psmatrixcnt=\count100
\psrowsep=\skip43
\pscolsep=\skip44
)
File: pst-node.tex 2008/11/26 1.01 `pst-node' (tvz)
) (/usr/share/texmf-texlive/tex/latex/pst-tree/pst-tree.sty
Package: pst-tree 2009/01/25 package wrapper for pst-tree.tex

(/usr/share/texmf-texlive/tex/generic/pst-tree/pst-tree.tex
(/usr/share/texmf-texlive/tex/generic/xkeyval/pst-xkey.tex
File: pst-xkey.tex 2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
)
 v1.11, 2009/09/17(tvz,dg,hv)
\pstree@rootbox=\box30
\pstree@box=\box31
\psnodecnt=\count101
\pstreelevel=\count102
\pstreecnt=\count103
\pstree@cnt=\count104
\pstree@stop=\count105
)
File: pst-tree.tex 2009/09/17 1.11 `pst-tree' (tvz,hv)
)
(/usr/share/texmf-texlive/tex/latex/pstricks/pst-plot.sty
Package: pst-plot 2004/07/15 package wrapper for pst-plot.tex

(/usr/share/texmf-texlive/tex/generic/pstricks/pst-plot.tex
(/usr/share/texmf-texlive/tex/generic/multido/multido.tex
 v1.41, 2004/05/18 <tvz>
\multido@count=\count106
\multidocount=\count107
\multido@stuff=\toks23
)  v1.04, 2009/06/08)
File: pst-plot.tex 2009/06/08 1.04 `pst-plot' (tvz)
)
(/usr/share/texmf-texlive/tex/latex/pst-grad/pst-grad.sty
Package: pst-grad 2004/07/15 package wrapper for pst-grad.tex (hv)

(/usr/share/texmf-texlive/tex/generic/pst-grad/pst-grad.tex
`pst-grad' v1.06, 2006/11/27 (tvz,dg,hv))
File: pst-grad.tex 2006/11/27 1.06 `pst-grad' (tvz)
)
(/usr/share/texmf-texlive/tex/latex/pst-coil/pst-coil.sty
Package: pst-coil 2006/08/11 package wrapper for pst-coil.tex (hv)

(/usr/share/texmf-texlive/tex/generic/pst-coil/pst-coil.tex  v1.06, 2006/11/27)
File: pst-coil.tex 2006/11/05 v1.00 `pst-coil' (tvz)
) (/usr/share/texmf-texlive/tex/latex/pst-text/pst-text.sty
Package: pst-text 2006/01/01 package wrapper for pst-text.tex (hv)

(/usr/share/texmf-texlive/tex/generic/pst-text/pst-text.tex
 v1.00, 2006/11/05(tvz,hv))
File: pst-text.tex 2006/11/05 1.00 `pst-text' (tvz)
)
(/usr/share/texmf-texlive/tex/latex/pst-3d/pst-3d.sty
Package: pst-3d 2005/09/02 package wrapper for pst-3d.tex (hv)

(/usr/share/texmf-texlive/tex/generic/pst-3d/pst-3d.tex
`PST-3d' v1.00, 2005/09/03 (tvz))
File: pst-3d.tex 2005/09/03 v1.00 `PST-3d' (tvz)
)
(/usr/share/texmf-texlive/tex/latex/pst-eps/pst-eps.sty
Package: pst-eps 2005/05/20 package wrapper for pst-eps.tex (hv)

(/usr/share/texmf-texlive/tex/generic/pst-eps/pst-eps.tex  v1.00, 2006/11/04
\pst@epsout=\write3
\pst@tempout=\write4
)
File: pst-eps.tex 2006/11/04 1.00 `pst-eps' (tvz)
)
(/usr/share/texmf-texlive/tex/latex/pst-fill/pst-fill.sty
Package: pst-fill 2005/09/13 package wrapper for pst-fill.tex (hv)

(/usr/share/texmf-texlive/tex/generic/pst-fill/pst-fill.tex
`PST-Fill' v1.01, 2007/03/10 (tvz,dg,hv)
\pst@fillbox=\box32
)
File: pst-fill.tex 2007/03/10 v1.01 `PST-fill' (tvz,dg)
)
(/usr/share/texmf-texlive/tex/latex/pstricks-add/pstricks-add.sty
Package: pstricks-add 2009/03/17 v. 0.13 package wrapper for pstricks-add.tex (
hv)

(/usr/share/texmf-texlive/tex/generic/pstricks-add/pstricks-add.tex
(/usr/share/texmf-texlive/tex/generic/pstricks-add/pst-fp.tex
`pst-fp' v0.02, 2009/04/02 (hv)
\pstFP@xs=\count108
\pstFP@xia=\count109
\pstFP@xib=\count110
\pstFP@xfa=\count111
\pstFP@xfb=\count112
\pstFP@rega=\count113
\pstFP@regb=\count114
\pstFP@regs=\count115
\pstFP@times=\count116
)
(/usr/share/texmf-texlive/tex/generic/pst-math/pst-math.tex
`pst-math' v0.23 , (CJ,hv)) `pstricks-add' v3.35, 2009/10/12 (dr,hv)
\pst@dimm=\dimen119
\pst@dimn=\dimen120
\pst@dimo=\dimen121
\pst@dimp=\dimen122
\pst@cntm=\count117
\pst@cntn=\count118
\pst@cnto=\count119
\pst@cntp=\count120
\@zero=\count121
\pstRadUnit=\dimen123
\pstRadUnitInv=\dimen124
\pshooklength=\dimen125
\pshookwidth=\dimen126
\@digitcounter=\count122
\psk@subticksize=\dimen127
\pst@xticksizeA=\dimen128
\pst@xticksizeB=\dimen129
\pst@xticksizeC=\dimen130
\pst@yticksizeA=\dimen131
\pst@yticksizeB=\dimen132
\pst@yticksizeC=\dimen133
\psk@llx=\dimen134
\psk@lly=\dimen135
\psk@urx=\dimen136
\psk@ury=\dimen137
\pst@xunit=\dimen138
\pst@yunit=\dimen139
\linecnt=\count123
\chart@ColorIndex=\dimen140
\chart@ColorStep=\dimen141
\pst@chartHeight=\dimen142
\pst@chartStackDepth=\dimen143
\pst@chartStackWidth=\dimen144
\chart@Toggle=\count124
)
File: pstricks-add.tex 2009/10/12 v3.35 `PSTricks-add' (hv)
)
(/usr/share/texmf-texlive/tex/latex/multido/multido.sty
Package: multido 2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)

))
(/usr/share/texmf-texlive/tex/latex/fancybox/fancybox.sty
Package: fancybox 2000/09/19 1.3

Style option: `fancybox' v1.3 <2000/09/19> (tvz)
\@fancybox=\box33
\shadowsize=\dimen145
\@Sbox=\box34
\do@VerbBox=\toks24
\the@fancyput=\toks25
\this@fancyput=\toks26
\EndVerbatimTokens=\toks27
\Verbatim@Outfile=\write5
\Verbatim@Infile=\read1
) (/usr/share/texmf-texlive/tex/latex/colortbl/colortbl.sty
Package: colortbl 2001/02/13 v0.1j Color table columns (DPC)

(/usr/share/texmf-texlive/tex/latex/tools/array.sty
Package: array 2008/09/09 v2.4c Tabular extension package (FMi)
\col@sep=\dimen146
\extrarowheight=\dimen147
\NC@list=\toks28
\extratabsurround=\skip45
\backup@length=\skip46
)
\everycr=\toks29
\minrowclearance=\skip47
) (./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.

(/usr/share/texmf/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count125
\scratchdimen=\dimen148
\scratchbox=\box35
\nofMPsegments=\count126
\nofMParguments=\count127
\everyMPshowfont=\toks30
\MPscratchCnt=\count128
\MPscratchDim=\dimen149
\MPnumerator=\count129
\everyMPtoPDFconversion=\toks31
)
Preview: Fontsize 12pt
Preview: PDFoutput 1
<test-pics.pdf, id=2, page=1, 189.70876pt x 65.24374pt>
File: test-pics.pdf Graphic file (type pdf)

<use test-pics.pdf, page 1>
<test-pics.pdf, id=3, page=2, 1200.00322pt x 1200.00322pt>
File: test-pics.pdf Graphic file (type pdf)

<use test-pics.pdf, page 2>
<test-pics.pdf, id=4, page=3, 1200.00322pt x 1200.00322pt>
File: test-pics.pdf Graphic file (type pdf)

<use test-pics.pdf, page 3>
Overfull \hbox (2199.7089pt too wide) in paragraph at lines 23--34
 [][][][] 
 []

! Missing } inserted.
<inserted text> 
                }
l.34 \end{figure}
                 
? 

LaTeX Warning: Float too large for page by 651.5003pt on input line 34.

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} <./test-pics.pdf> <./test
-pics.pdf> <./test-pics.pdf>] (./test.aux) ) 
Here is how much of TeX's memory you used:
 5191 strings out of 495061
 73071 string characters out of 1182621
 198465 words of memory out of 3000000
 8252 multiletter control sequences out of 15000+50000
 3938 words of font info for 15 fonts, out of 3000000 for 9000
 28 hyphenation exceptions out of 8191
 44i,6n,54p,287b,332s stack positions out of 5000i,500n,10000p,200000b,50000s
</usr/share/texmf-texlive/fonts/typ
e1/public/amsfonts/cm/cmr12.pfb>
Output written on test.pdf (1 page, 15635 bytes).
PDF statistics:
 34 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 21 words of extra memory for PDF output out of 10000 (max. 10000000)
! Missing } inserted.
<inserted text>
}
l.34 \end{figure}


But I've checked parentheses a thousand times now, can't spot an error.

I'm sincerely sorry for wasting your time here...
OS: Kubuntu
Distribution: TexLive
Editor: Kile
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by localghost »

achim wrote:[…] \TR is a wrapper for the Rnode in psmatrix (also this is a valid command when compiling dvi-ps-pdf), leaving that aside and using \Toval still does not quite work […]
Doesn't work for me neither. Since your sample code remains uncompilable for me, I took an example from the pstricks manual that certainly works for both of us.

Code: Select all

\listfiles
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}

\begin{document}
  \begin{figure}[!ht]
    \centering
    $
    \begin{psmatrix}
      U \\
      & X\times_Z Y & X \\
      & Y & Z
      \psset{arrows=->,nodesep=3pt}
      \everypsbox{\scriptstyle}
      \ncline{1,1}{2,2}_{y}
      \ncline[doubleline=true,linestyle=dashed]{-}{1,1}{2,3}^{x}
      \ncline{2,2}{3,2}<{q}
      \ncline{2,2}{2,3}_{p}
      \ncline{2,3}{3,3}>{f}
      \ncline{3,2}{3,3}_{g}
    \end{psmatrix}
    $
    \caption{\texttt{psmatrix} example from the \textsf{PSTricks} manual}\label{fig:psmatrix}
  \end{figure}
\end{document}
The \listfiles command in the very first line list all used files in the log. Here's my list.

Code: Select all

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size12.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
inputenc.sty    2008/03/30 v1.1d Input encoding file
    utf8.def    2008/04/05 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
pstricks-add.sty    2009/03/17 v. 0.13 package wrapper for pstricks-add.tex (hv
)
pstricks.sty    2008/11/26 v0.40 LaTeX wrapper for `PSTricks' (RN,HV)
pstricks.tex    2009/05/19 v1.29 `PSTricks' (tvz,hv)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2009/08/25 v0.04m Graphics/color for pdfTeX
pstricks-add.tex    2009/10/12 v3.35 `PSTricks-add' (hv)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
 xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
 xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
auto-pst-pdf.sty    2009/04/26 v0.6 Wrapper for pst-pdf
   ifpdf.sty    2009/04/10 v2.0 Provides the ifpdf switch (HO)
ifplatform.sty    2009/09/10 v0.3a Testing for the operating system
pdftexcmds.sty    2009/09/23 v0.6 LuaTeX support for pdfTeX utility functions (
HO)
infwarerr.sty    2007/09/09 v1.2 Providing info/warning/message (HO)
ifluatex.sty    2009/04/17 v1.2 Provides the ifluatex switch (HO)
 ltxcmds.sty    2009/08/05 v1.0 Some LaTeX kernel commands for general use (HO)

catchfile.sty    2007/11/11 v1.2 Catches the contents of a file (HO)
     tmp.w18
 pst-pdf.sty    2008/10/09 v1.1v PS graphics for pdfLaTeX (RN,HjG)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2009/08/28 v1.8 graphics configuration of TeX Live
 preview.sty    2006/08/25 11.84 (AUCTeX/preview-latex)
   dvips.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
 environ.sty    2008/06/18 v0.2 A new way to define environments
supp-pdf.mkii
tmp-pics.pdf    Graphic file (type pdf)
  t1cmtt.fd    1999/05/25 v2.5h Standard LaTeX font definitions
  t1cmss.fd    1999/05/25 v2.5h Standard LaTeX font definitions
 ***********
Packages are not up to date on my TeX Live 2009 system².
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

Re: 'Extract' figures from *.tex, *.ps, *.dvi or whatever wo

Post by achim »

Very interesting, your example works great.
I guess there is a problem with the nodes I'm using.

I'll try to figure out what exactly was the problem and let you know.

You've been a great deal of help to me, thank you so much!
OS: Kubuntu
Distribution: TexLive
Editor: Kile
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

'Extract' figures from *.tex, *.ps, *.dvi or whatever works

Post by achim »

Thank you so much Thorsten!

Here's the working script

Code: Select all

\documentclass[12pt]{article}

\usepackage{auto-pst-pdf}

\usepackage{graphicx}
\usepackage{pstricks}
\usepackage{pst-all}
\usepackage{pstricks-add}


\usepackage{fancybox}
\usepackage{color}
\usepackage{colortbl}
\usepackage[]{xcolor}


\usepackage[sumlimits, intlimits]{amsmath}      %Math Type setting
\usepackage{amsfonts}                           %Math Fonts


\begin{document}

\psset{unit=1cm, arrowsize=6pt}
\newcommand{\To}[1]{\TR{\ovalbox{\shortstack{\textbf{#1}}}}}

\begin{figure}[ht]
\centering
	$
	\begin{psmatrix}[colsep=0.5cm, rowsep=0.5cm, nodealign=true]
	\To{\mbox{\textbar \red \textbar}} & [mnode=dot]   &  \To{(\red)}   &   &   \\
			&   \To{)\red(}   &   [mnode=dot]   &   [mnode=dot]   &   ~\cdots \mbox{no p.i.}
	\ncline{1,1}{1,2}
	\ncline{1,2}{1,3}
	\ncline[linestyle=dashed]{->}{1,3}{2,4}
	\ncline[linestyle=dashed]{<-}{1,1}{2,2}
	\ncline{2,2}{2,5}
	\end{psmatrix}
	$
\caption{Branching of the stable equilibria for the two beam array with increasing DC from left to right.}
\end{figure}

\end{document}
Note the difference of the math environment. I was an idiot not enclosing the entire psmatrix in a math environment, but every node instead. (The reason why \TR was not recognised)

Compiling with pdflatex -shell-escape test.tex works brilliantly and I get the figures with the correct bounding box as a 'texfilename-pics.pdf' file (one figure a page).

Opening the *.pdf with GIMP and saving each figure as a *.eps is straight forward from here.

I hope this is of help as a reference in the future.

Again,
Thanks Thorsten!
OS: Kubuntu
Distribution: TexLive
Editor: Kile
Post Reply