GeneralXeLaTeX pst-asr: slow compile

LaTeX specific issues not fitting into one of the other forums of this category.
Linguist
Posts: 43
Joined: Mon Nov 07, 2011 12:07 pm

XeLaTeX pst-asr: slow compile

Post by Linguist »

I'm using the pst-asr package to include autosegmental diagrams in my linguistics thesis. However, I also want to use XeLaTeX.

This is possible, however the compile process is very slow. (No problems if I compile LaTeX => PS => PDF)

It takes approximatelty 10 seconds (on my current computer) to process a single simple autosegmental diagram. Considering the large number of autosegmental diagrams I want to include in my thesis (at last count there are 36), this is a strong disincentive to use XeLaTeX; a single compile taking upwards of 10 minutes.

I have two questions:
  • 1) Is it possible to speed up the compile process in some way?

    2) If not, is it possible to enable some kind of draft mode for pst-asr (similar to the draft option for graphicx) such that my autosegmental diagrams are not included. That way the slow compile will only be a problem when I wish to produce a final version.
Many Thanks

Code: Select all

\documentclass[a4paper,12pt]{report}

\usepackage{pstricks,pst-xkey,pst-asr}

\begin{document}

{\asr \4ki:p\endasr}

\end{document}

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

XeLaTeX pst-asr: slow compile

Post by Stefan Kottwitz »

You could use pst2pdf for extracting the images which can be used via \includegraphics or \includepdf (pdfpages) then.

Another funny option is using the TikZ external library for it, such as with

Code: Select all

\usepackage{pstricks} 
\usepackage{tikz} 
\usetikzlibrary{external} 
\tikzset{external/system call={xelatex --jobname="\image" "\texsource"}} 
\tikzexternalize
and later in the document having TikZ pictures, each with with a single node, which contains the pspicture environment.

Stefan
LaTeX.org admin
Linguist
Posts: 43
Joined: Mon Nov 07, 2011 12:07 pm

Re: XeLaTeX pst-asr: slow compile

Post by Linguist »

Thanks for your quick reply.

I'm afraid I don't understand how I'd actually carry out either method you recommend. Could you please provide some more details?

I chased up the pgfmanual for tikz, but at 1165 pages and with only a single hit for the string "pspicture" I decided it would be more straightforward to ask.

Thanks again.
Linguist
Posts: 43
Joined: Mon Nov 07, 2011 12:07 pm

XeLaTeX pst-asr: slow compile

Post by Linguist »

After googling around a bit I figured out how to get the 2nd option to work.

1) Use the code provided by Stefan_K
2) Include the pst-asr figure in a pspicture environment (like Stefan said) as so:

Code: Select all

\begin{tikzpicture}
 \node{\begin{pspicture}
  {\asr \4ki:p\endasr}
 \end{pspicture}};
\end{tikzpicture}
3) For TeXnicCenter users Add: "--shell-escape " (without the qutations marks) to the beginning of Command line arguments to pass to the compiler: (Build define output profiles)

This works, but the images appear cropped; i.e. only the top half of the diagram appears. (Actually, the rest is there, i.e. selecteable, it's just invisible) I've attached the PDF that the externalization process produces. As you can see the diagram is located right at the bottom left for some reason.

Does anyone have a solution to this?

Also I'm still curious as to how to implement Stefan's pst2pdf solution (I'm using Windows 7, Miktex, TeXnicCenter). I couldn't figure that one out. My poor humanities trained brain was addled by talk of "perl scripts".
Attachments
filename-figure0.pdf
(4.51 KiB) Downloaded 588 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: XeLaTeX pst-asr: slow compile

Post by Stefan Kottwitz »

Perhaps post short compilable sample code with an example image, so we can test it. Otherwise it's quite theoretically, and I don't see a reason for now.

Stefan
LaTeX.org admin
Linguist
Posts: 43
Joined: Mon Nov 07, 2011 12:07 pm

XeLaTeX pst-asr: slow compile

Post by Linguist »

Here's the (minimal) code that produces the "cropped" image.

Code: Select all

\documentclass[12pt]{report}

\usepackage{pstricks}
\usepackage{pst-xkey}
\usepackage{pst-asr}

\usepackage{tikz}
	\usetikzlibrary{external}
	\tikzset{external/system call={xelatex --jobname="\image" "\texsource"}}
	\tikzexternalize

\begin{document}

%\tikzset{external/force remake} %uncomment if the images should be remade

\begin{tikzpicture}
	\node{\begin{pspicture}
		{\asr \4ki:p\endasr}
	\end{pspicture}};
\end{tikzpicture}

\end{document}
I've also attached two PDFs. test.pdf is the output this code produces (XeLaTeX => PDF) and test-figure0.pdf is the PDF that the externalization process produces.

Thanks for your help.
Attachments
test-figure0.pdf
PDF produced by externalization process
(4.48 KiB) Downloaded 576 times
test.pdf
Output of given code
(5.41 KiB) Downloaded 488 times
Linguist
Posts: 43
Joined: Mon Nov 07, 2011 12:07 pm

XeLaTeX pst-asr: slow compile

Post by Linguist »

I have this sinking feeling that this thread has ended, which is a real pain because I'm really close to a solution.

I tried the solutions to a similar problem here: http://tex.stackexchange.com/questions/ ... ts-cropped but none of them worked.

This is my desparate final plea for help. Finding a solution to this problem will make the difference for me of using XeLaTeX or plain LaTeX. XeLaTeX has lots of benefits for me.

So, help?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

XeLaTeX pst-asr: slow compile

Post by Johannes_B »

Hi,

unfortunately i am not very confident with either pstricks nor tikz.

A workaround that needs quite a bit of manual work would be to put all pspictures in single tex files using documentclass standalone

Code: Select all

\documentclass{standalone}
\usepackage{pstricks}
\usepackage{pst-xkey}
\usepackage{pst-asr}
\begin{document}
\begin{pspicture}(1,2)
	\asr \4ki:p\endasr
\end{pspicture}
\end{document}


As you can see, the result is not very satisfying.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Linguist
Posts: 43
Joined: Mon Nov 07, 2011 12:07 pm

Re: XeLaTeX pst-asr: slow compile

Post by Linguist »

Hi,

Thanks for the suggestion; anything that might provide a solution is welcome.

Unfortunately, compiling your code also produces a cropped image (attached) in this case the the k-i-p is cropped out and only the tier with x's is visible.

Is there a way to adjust the cropping options? I can only figure out how to turn them on or off (crop=true|false) turning the cropping off altogether is not an option.

Thanks,
(and Merry Christmas)
Attachments
test1.pdf
(4.22 KiB) Downloaded 500 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

XeLaTeX pst-asr: slow compile

Post by Johannes_B »

It works if i include package auto-pst-pdf as well and compile using pdflatex with the -shell-escape switched on.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply