3

I have an elusive problem with the interaction of pstricks and tufte-book style.

I find that trying to include pstricks code is unreliable. Sometimes the figure appears, sometimes it does not.

I have pared back my MWE to the following

\documentclass[a4paper]{tufte-book}

\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\usepackage{xcolor}

\usepackage{lipsum}

\title{A long title with a need\\\noindent to break the line} % Title of the book
%----------------------------------------------------------------------------------------
\begin{document}

\mainmatter
\cleardoublepage

\chapter{Introduction}
\lipsum[1-4]

\chapter{Next}
\lipsum[1-7]
%----------------------------------------------------------------------------------------
\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
  \pscircle*[linecolor=cyan]{5}
  \psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
  \Huge\sffamily\bfseries
  \rput(-4.5,4.5){A} \rput(4.5,4.5){B}
  \rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
  \rput(0,0){pst-pdf}
  \rmfamily
  \rput(0,-3.8){PSTricks}
  \rput(0,3.8){\LaTeX}
\end{pspicture}

\end{document}

As it stands, that will not produce a figure. However, various tweaks allow the figure to appear. For example, simply change the title to (taking the break out)

\title{A long title with a need to break the line}

and I get the figure. Also, reducing \lipsum[1-3] in the Introduction allows the figure to be rendered. There have been other things too that made me think that I had located the problem, but I cannot find a good reason.

There is some error reporting in the autopp.log file. Here is the tail end, which I don't understand.

! Use of \SOUL@n doesn't match its definition.
\\... {\string \MakeTextLowercase }\edef \SOUL@n {
                                                  \string #2}\ifx \SOUL@x \S...
l.25 \chapter
             {Next}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

! Use of \SOUL@n doesn't match its definition.
\\...1}{\MakeTextLowercase }}\else \edef \SOUL@n {
                                                  \string #2\space }\ifx \SO...
l.25 \chapter
             {Next}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

! Extra }, or forgotten \endgroup.
<argument> ... need\\\noindent to break the line}}

l.25 \chapter
             {Next}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

LaTeX Font Info:    Try loading font information for OT1+pplx on input line 25.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\ot1pplx.fd"
File: ot1pplx.fd 2004/09/06 font definitions for OT1/pplx.
)
LaTeX Font Info:    Try loading font information for OML+zplm on input line 25.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\omlzplm.fd"
File: omlzplm.fd 2002/09/08 Fontinst v1.914 font definitions for OML/zplm.
)
LaTeX Font Info:    Try loading font information for OMS+zplm on input line 25.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\omszplm.fd"
File: omszplm.fd 2002/09/08 Fontinst v1.914 font definitions for OMS/zplm.
)
LaTeX Font Info:    Try loading font information for OMX+zplm on input line 25.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\omxzplm.fd"
File: omxzplm.fd 2002/09/08 Fontinst v1.914 font definitions for OMX/zplm.
)
LaTeX Font Info:    Try loading font information for OT1+zplm on input line 25.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\ot1zplm.fd"
File: ot1zplm.fd 2002/09/08 Fontinst v1.914 font definitions for OT1/zplm.
)
! Missing $ inserted.
<inserted text> 
                $
l.25 \chapter
             {Next}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing { inserted.
<to be read again> 
                   $
l.25 \chapter
             {Next}
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)

)
Runaway preamble?
$}\reserved@a }\let \SOUL@errmsg \SOUL@error \let \-\relax \count@ \m@ne \ETC.
! File ended while scanning preamble of \valign.
<inserted text> 
                \cr }
<*> ... \APPmakepictures \empty \input  tester.tex

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Missing # inserted in alignment preamble.
<to be read again> 
                   \cr 
<*> ... \APPmakepictures \empty \input  tester.tex

There should be exactly one # between &'s, when an
\halign or \valign is being set up. In this case you had
none, so I've put one in; maybe that will work.

! Emergency stop.
<*> ... \APPmakepictures \empty \input  tester.tex

*** (job aborted, no legal \end found)

Can anyone see what is going on and offer some advice?

Thanks

Oh, I should explain that I am using an up-to-date version of MikTex 2.9 and I'm running pdflatex

1

Use

\RequirePackage{ifpdf}
\ifpdf
  \documentclass[a4paper]{tufte-book}% default run
\else
  \documentclass[a4paper,nols]{tufte-book}% PSTricks run
  \usepackage{pstricks}
  \usepackage{pstricks-add}
\fi
\usepackage{auto-pst-pdf}

\usepackage{lipsum}    
\title{A long title with a need\\\noindent to break the line} % Title of the book
%----------------------------------------------------------------------------------------
\begin{document}
[...]

Withou the optional argument nols (no letterspacing) the internal latex run isn't successfull for the PSTricks image.

enter image description here

  • Thanks, but when I add the nols option there are side effects. In my MWE, the running header is displayed in all lowercase. If my example had included the title page, it would have looked different using the nols option. What can I do to fix the running header at least? – Blair Oct 6 '15 at 19:46
  • In my example the option nols is only used for creating the PSTricks figures, but not for the regular document. Do you have the \ifpdf part in your document?? – user2478 Oct 7 '15 at 7:01
  • No, I tried to copy your code above, but it didn't work so, thinking that the else option is what I needed I just used that. I don't understand how you intend to use the code above. Are you suggesting that it be complied once with latex then again with pdflatex? Please spell out the use case (for dummies like me). – Blair Oct 7 '15 at 20:13
  • you need both options, not only one of them. The if is for the pdflatex run and the else for the internal latex' run of auto-pst-pdf` – user2478 Oct 7 '15 at 20:59
  • OK, you are correct. Thank you :-). I must have done something wrong the first time I tried your code. It works now. However, I don't understand what is happening. I just run pdflatex and it seems to produce the PSTricks figure. How is that possible (the if-else structure suggests that the file must be processed at least twice)? – Blair Oct 8 '15 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.