我对 pstricks 和 tufte-book 风格的交互存在一个难以捉摸的问题。
我发现尝试包含 pstricks 代码并不可靠。有时图像会出现,有时则不会。
我已将 MWE 缩减为以下内容
\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}
目前,这不会产生图形。但是,各种调整可以让图形出现。例如,只需将标题更改为(去掉分隔符)
\title{A long title with a need to break the line}
然后我就得到了这个图。此外,在简介中减少\lipsum[1-3]
允许渲染这个图。还有其他事情也让我认为我已经找到了问题所在,但我找不到一个好的理由。
autopp.log 文件中有一些错误报告。这是结尾,我不明白。
! 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)
有人能看到发生了什么并提供一些建议吗?
谢谢
哦,我应该解释一下,我正在使用最新版本的 MikTex 2.9,并且正在运行 pdflatex
答案1
使用
\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}
[...]
如果没有可选参数(无字母间距), PSTricks 图像的nols
内部运行将无法成功。latex