auto-pst-pdf 不再编译(大约一年后)

auto-pst-pdf 不再编译(大约一年后)

背景信息:

在 2020 年 5 月(甚至更早)之前,代码运行正常,没有任何问题。然后我今天挖出了这个项目并更新了一些内容,它不再编译了。

这里有一个平均能量损失

\documentclass[12pt,a4paper,UTF8,twoside]{ctexart}
\ctexset{today=old}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{standalone}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{color}
\usepackage[flushleft]{paralist}[2013/06/09] % VERY IMPORTANT
\usepackage{asymptote}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{multicol}
\setlength{\columnsep}{3cm}
\setlength{\columnseprule}{1pt}
\def\columnseprulecolor{\color{blue}}

\usepackage{geometry}
\geometry{%
    lmargin=1.5cm,
    rmargin=1.5cm,
    tmargin=1.8cm,
    bmargin=1.5cm,
    headheight=24pt
}

\usepackage{hyperref}
\pdfsuppressptexinfo=-1

\usepackage{fontawesome5}

\usepackage[
    type={CC},
    modifier={by-nc-nd},
    version={4.0}
]{doclicense}


\usepackage{fancyhdr}
% \usepackage{lastpage}
% \usepackage{atenddvi}   %multiple last page
\usepackage[user]{zref} %multiple last page

%%%%%%%%%%%%%%%%%%%%%
%% -- compile
%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdf]{pstricks}            %% added for pdflatex, use pdflatex -shell-escape $(NAME_PART).tex
\usepackage[crop=off]{auto-pst-pdf}   %% added for pdflatex, use pdflatex -shell-escape $(NAME_PART).tex
\usepackage{pst-coil}
\usepackage{pstricks-add}
%% \renewcommand{\familydefault}{\sfdefault} %% changes font to sans-serif

\newlength{\qspace}
\setlength{\qspace}{20pt}
\newcounter{qnumber}
\setcounter{qnumber}{0}
%%
%%
\newenvironment{question}%
{\vspace{\qspace}
    \begin{enumerate}[\bfseries 1\quad][10]%
    \setcounter{enumi}{\value{qnumber}}%
    \item
}{
    \end{enumerate}
    \filbreak % cool to know
    \stepcounter{qnumber}
}
%%
\newenvironment{questionparts}[1][1]%
{
    \begin{enumerate}[\bfseries (i)]%
    \setcounter{enumii}{#1}
    \addtocounter{enumii}{-1}
    \setlength{\itemsep}{5mm}
    \setlength{\parskip}{8pt}
}{
    \end{enumerate}
}
%%
\begin{asydef}
    import markers;
    import geometry;
    import graph;
    usepackage("amsmath");
\end{asydef}

%%% Document begins %%%

\begin{document}

\begin{question}

A plane makes an acute angle $\alpha$ with the horizontal. A box in the shape of a cube is fixed  onto  the plane  in such a way that four of its edges are horizontal and two of its sides are vertical.


A uniform rod of length $2L$ and weight $W$ rests  with its lower end at $A$ on the bottom of the box and its upper end at $B$ on a side of the box, as shown in the diagram below.  The vertical plane containing the rod  is parallel to the vertical sides of the box and cuts the lowest edge of the box at $O$. The rod makes an acute angle~$\beta$ with the side of the box at $B$.

The coefficients of friction between the rod and the box at the two points of contact are both $\tan \gamma$, where $0<   \gamma<\frac12\pi$.
%The  frictional force on the rod at $A$ acts toward $O$, 
%and the frictional force on the rod at~$B$
%acts away from $O$.

The rod is in limiting equilibrium, with the end at $A$  on the point of slipping in the direction away from $O$ and the end at $B$ on the point of slipping towards $O$. Given that $\alpha < \beta$, show that $\beta = \alpha + 2\gamma$. 

[{\bf Hint}: You may find it helpful to take moments about the midpoint of 
the rod.]
\vspace{-1.5cm}
\begin{center}
\newrgbcolor{zzttqq}{0.6 0.2 0}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{xunit=6mm  ,yunit=6mm  }
\begin{pspicture*}(-8.3,-6.72)(15.56,8.3)
\psset{xunit=0.8cm,yunit=0.8cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\pspolygon[linewidth=1.2pt,
%linecolor=zzttqq,
](0,-3)(-1.55,2.8)(4.24,4.35)(5.87,-1.41)
\psline(-2.54,-3   )(12,-3)
\psline(-2.46,-3.62)(11.59,0.11)
%\psline[linewidth=1.2pt,linecolor=zzttqq](0,-3)(-1.55,2.8)
%\psline[linewidth=1.2pt,linecolor=zzttqq](-1.55,2.8)(4.24,4.35)
%\psline[linewidth=1.2pt,linecolor=zzttqq](4.24,4.35)(5.87,-1.41)
%\psline[linewidth=1.2pt,linecolor=zzttqq](5.87,-1.41)(0,-3)
\rput[tl](2.6 ,-2.4 ){$ A $}
\rput[tl](-1.8 ,1.6){$ B $}
\rput[tl](-0.2,-3.15 ){$ O $}
\rput[tl](1.4 ,-2.7){$ \alpha $}
\rput[tl](-0.8,0.8){$ \beta $}
\psline[linewidth=2.3pt](-1.20,1.52)(2.8,-2.22)
\pscustom[linecolor=black,fillcolor=zzttqq,fillstyle=none,opacity=0.0]{\parametricplot{-0.0127510246967992202}{0.2471697861109875}{1*1.84*cos(t)+0*1.84*sin(t)+-0.0|0*1.84*cos(t)+1*1.84*sin(t)+-2.98}\lineto(0,-2.99)\closepath}
\pscustom[linecolor=black,fillcolor=zzttqq,fillstyle=none,opacity=0.0]{\parametricplot{4.974188368183839}{5.533030852440859}{1*1.45*cos(t)+0*1.45*sin(t)+-1.21|0*1.45*cos(t)+1*1.45*sin(t)+1.52}\lineto(-1.21,1.52)\closepath}
\end{pspicture*}
\end{center}

\end{question}

\end{document}

\documentclass[12pt,a4paper,UTF8,twoside]{ctexart}
\ctexset{today=old}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{standalone}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{color}
\usepackage[flushleft]{paralist}[2013/06/09] % VERY IMPORTANT
\usepackage{asymptote}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{multicol}
\setlength{\columnsep}{3cm}
\setlength{\columnseprule}{1pt}
\def\columnseprulecolor{\color{blue}}

\usepackage{geometry}
\geometry{%
    lmargin=1.5cm,
    rmargin=1.5cm,
    tmargin=1.8cm,
    bmargin=1.5cm,
    headheight=24pt
}

\usepackage{hyperref}
\pdfsuppressptexinfo=-1

\usepackage{fontawesome5}

\usepackage[
    type={CC},
    modifier={by-nc-nd},
    version={4.0}
]{doclicense}


\usepackage{fancyhdr}
% \usepackage{lastpage}
% \usepackage{atenddvi}   %multiple last page
\usepackage[user]{zref} %multiple last page

%%%%%%%%%%%%%%%%%%%%%
%% -- compile
%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdf]{pstricks}            %% added for pdflatex, use pdflatex -shell-escape $(NAME_PART).tex
\usepackage[crop=off]{auto-pst-pdf}   %% added for pdflatex, use pdflatex -shell-escape $(NAME_PART).tex
\usepackage{pst-coil}
\usepackage{pstricks-add}
%% \renewcommand{\familydefault}{\sfdefault} %% changes font to sans-serif

\newlength{\qspace}
\setlength{\qspace}{20pt}
\newcounter{qnumber}
\setcounter{qnumber}{0}
%%
%%
\newenvironment{question}%
{\vspace{\qspace}
    \begin{enumerate}[\bfseries 1\quad][10]%
    \setcounter{enumi}{\value{qnumber}}%
    \item
}{
    \end{enumerate}
    \filbreak % cool to know
    \stepcounter{qnumber}
}
%%
\newenvironment{questionparts}[1][1]%
{
    \begin{enumerate}[\bfseries (i)]%
    \setcounter{enumii}{#1}
    \addtocounter{enumii}{-1}
    \setlength{\itemsep}{5mm}
    \setlength{\parskip}{8pt}
}{
    \end{enumerate}
}
%%
\begin{asydef}
    import markers;
    import geometry;
    import graph;
    usepackage("amsmath");
\end{asydef}

%%% Document begins %%%

\begin{document}

\begin{question}

A plane makes an acute angle $\alpha$ with the horizontal. A box in the shape of a cube is fixed  onto  the plane  in such a way that four of its edges are horizontal and two of its sides are vertical.


A uniform rod of length $2L$ and weight $W$ rests  with its lower end at $A$ on the bottom of the box and its upper end at $B$ on a side of the box, as shown in the diagram below.  The vertical plane containing the rod  is parallel to the vertical sides of the box and cuts the lowest edge of the box at $O$. The rod makes an acute angle~$\beta$ with the side of the box at $B$.

The coefficients of friction between the rod and the box at the two points of contact are both $\tan \gamma$, where $0<   \gamma<\frac12\pi$.
%The  frictional force on the rod at $A$ acts toward $O$, 
%and the frictional force on the rod at~$B$
%acts away from $O$.

The rod is in limiting equilibrium, with the end at $A$  on the point of slipping in the direction away from $O$ and the end at $B$ on the point of slipping towards $O$. Given that $\alpha < \beta$, show that $\beta = \alpha + 2\gamma$. 

[{\bf Hint}: You may find it helpful to take moments about the midpoint of 
the rod.]
\vspace{-1.5cm}
\begin{center}
\newrgbcolor{zzttqq}{0.6 0.2 0}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{xunit=6mm  ,yunit=6mm  }
\begin{pspicture*}(-8.3,-6.72)(15.56,8.3)
\psset{xunit=0.8cm,yunit=0.8cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\pspolygon[linewidth=1.2pt,
%linecolor=zzttqq,
](0,-3)(-1.55,2.8)(4.24,4.35)(5.87,-1.41)
\psline(-2.54,-3   )(12,-3)
\psline(-2.46,-3.62)(11.59,0.11)
%\psline[linewidth=1.2pt,linecolor=zzttqq](0,-3)(-1.55,2.8)
%\psline[linewidth=1.2pt,linecolor=zzttqq](-1.55,2.8)(4.24,4.35)
%\psline[linewidth=1.2pt,linecolor=zzttqq](4.24,4.35)(5.87,-1.41)
%\psline[linewidth=1.2pt,linecolor=zzttqq](5.87,-1.41)(0,-3)
\rput[tl](2.6 ,-2.4 ){$ A $}
\rput[tl](-1.8 ,1.6){$ B $}
\rput[tl](-0.2,-3.15 ){$ O $}
\rput[tl](1.4 ,-2.7){$ \alpha $}
\rput[tl](-0.8,0.8){$ \beta $}
\psline[linewidth=2.3pt](-1.20,1.52)(2.8,-2.22)
\pscustom[linecolor=black,fillcolor=zzttqq,fillstyle=none,opacity=0.0]{\parametricplot{-0.0127510246967992202}{0.2471697861109875}{1*1.84*cos(t)+0*1.84*sin(t)+-0.0|0*1.84*cos(t)+1*1.84*sin(t)+-2.98}\lineto(0,-2.99)\closepath}
\pscustom[linecolor=black,fillcolor=zzttqq,fillstyle=none,opacity=0.0]{\parametricplot{4.974188368183839}{5.533030852440859}{1*1.45*cos(t)+0*1.45*sin(t)+-1.21|0*1.45*cos(t)+1*1.45*sin(t)+1.52}\lineto(-1.21,1.52)\closepath}
\end{pspicture*}
\end{center}

\end{question}

\end{document}

我认为主要问题在于\usepackage[pdf]{pstricks}\usepackage[crop=off]{auto-pst-pdf}。我记得上次也进行了一些测试和调整,但我特别做了一些注释,所以我记得如何编译它。但它仍然失败了。

我在 win10 X64 上使用 MiKTeX。我的编辑器是 Notepad++,带有插件 NppExec 来运行编译。我还单独安装了 Ghostscript。

目前,最好的结果是有 PDF 输出,但没有任何图片...那么我该如何解决这个问题呢?

一些尝试编译

pdflatex -shell-escape $(NAME_PART).tex
pdflatex -shell-escape $(NAME_PART).tex

pdflatex -synctex=1 --enable-write18 $(NAME_PART)
pdflatex -synctex=1 --enable-write18 $(NAME_PART)

答案1

对于需要 dvips 的工作流,使用这样的类有点大胆ctexart。该类在任何地方都加载 dvi 模式dvipdfmx驱动程序。

除此之外:preview所使用的包auto-pst-pdf尚未适应 LaTeX 的新 shipout 代码,如果其中一个 shipout 钩子包含它不期望的代码,则很容易失败。

下面添加了一些代码\documentclass并禁用了具体文档中不喜欢的发货代码预览。

但我建议避免auto-pst-pdf使用复杂的文档。每个附加包都会增加新的不兼容性。最好在外部小文档中创建图形并包含它们。您从自动即时运行中获得的时间显然超过了调试此系统问题所浪费的时间。

%NEW use dvips driver in dvi mode
\ifnum\pdfoutput=0\relax
\documentclass[12pt,a4paper,UTF8,twoside,dvips]{ctexart}
\else
\documentclass[12pt,a4paper,UTF8,twoside]{ctexart}
\fi

\ctexset{today=old}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{standalone}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{color}
\usepackage[flushleft]{paralist}[2013/06/09] % VERY IMPORTANT
\usepackage{asymptote}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{multicol}
\setlength{\columnsep}{3cm}
\setlength{\columnseprule}{1pt}
\def\columnseprulecolor{\color{blue}}

\usepackage{geometry}
\geometry{%
    lmargin=1.5cm,
    rmargin=1.5cm,
    tmargin=1.8cm,
    bmargin=1.5cm,
    headheight=24pt
}

\usepackage{hyperref}
\pdfsuppressptexinfo=-1

\usepackage{fontawesome5}

\usepackage[
    type={CC},
    modifier={by-nc-nd},
    version={4.0}
]{doclicense}


\usepackage{fancyhdr}
% \usepackage{lastpage}
% \usepackage{atenddvi}   %multiple last page
\usepackage[user]{zref} %multiple last page

%%%%%%%%%%%%%%%%%%%%%
%% -- compile
%%%%%%%%%%%%%%%%%%%%%
%NEW: pdf option not needed.
\usepackage{pstricks}            %% added for pdflatex, use pdflatex -shell-escape $(NAME_PART).tex
\usepackage[crop=off,cleanup=false]{auto-pst-pdf}   %% added for pdflatex, use pdflatex -shell-escape $(NAME_PART).tex
\usepackage{pst-coil}
\usepackage{pstricks-add}
%% \renewcommand{\familydefault}{\sfdefault} %% changes font to sans-serif

\newlength{\qspace}
\setlength{\qspace}{20pt}
\newcounter{qnumber}
\setcounter{qnumber}{0}
%%
%%
\newenvironment{question}%
{\vspace{\qspace}
    \begin{enumerate}[\bfseries 1\quad][10]%
    \setcounter{enumi}{\value{qnumber}}%
    \item
}{
    \end{enumerate}
    \filbreak % cool to know
    \stepcounter{qnumber}
}
%%
\newenvironment{questionparts}[1][1]%
{
    \begin{enumerate}[\bfseries (i)]%
    \setcounter{enumii}{#1}
    \addtocounter{enumii}{-1}
    \setlength{\itemsep}{5mm}
    \setlength{\parskip}{8pt}
}{
    \end{enumerate}
}
%%
\begin{asydef}
    import markers;
    import geometry;
    import graph;
    usepackage("amsmath");
\end{asydef}

%NEW avoid clash with hyperref and shipouthook
\makeatletter
\ifPreview
 \let\Hy@FirstPageHook\relax
 \let\Hy@EveryPageAnchor\relax
 \RemoveFromHook{shipout/firstpage}[ctexart]
\fi
\makeatother
%%% Document begins %%%

\begin{document}

\begin{question}

A plane makes an acute angle $\alpha$ with the horizontal. A box in the shape of a cube is fixed  onto  the plane  in such a way that four of its edges are horizontal and two of its sides are vertical.


A uniform rod of length $2L$ and weight $W$ rests  with its lower end at $A$ on the bottom of the box and its upper end at $B$ on a side of the box, as shown in the diagram below.  The vertical plane containing the rod  is parallel to the vertical sides of the box and cuts the lowest edge of the box at $O$. The rod makes an acute angle~$\beta$ with the side of the box at $B$.

The coefficients of friction between the rod and the box at the two points of contact are both $\tan \gamma$, where $0<   \gamma<\frac12\pi$.
%The  frictional force on the rod at $A$ acts toward $O$,
%and the frictional force on the rod at~$B$
%acts away from $O$.

The rod is in limiting equilibrium, with the end at $A$  on the point of slipping in the direction away from $O$ and the end at $B$ on the point of slipping towards $O$. Given that $\alpha < \beta$, show that $\beta = \alpha + 2\gamma$.

[{\bf Hint}: You may find it helpful to take moments about the midpoint of
the rod.]
\vspace{-1.5cm}
\begin{center}
\newrgbcolor{zzttqq}{0.6 0.2 0}
\newrgbcolor{xdxdff}{0.49 0.49 1}
\psset{xunit=6mm  ,yunit=6mm  }
\begin{pspicture*}(-8.3,-6.72)(15.56,8.3)
\psset{xunit=0.8cm,yunit=0.8cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\pspolygon[linewidth=1.2pt,
%linecolor=zzttqq,
](0,-3)(-1.55,2.8)(4.24,4.35)(5.87,-1.41)
\psline(-2.54,-3   )(12,-3)
\psline(-2.46,-3.62)(11.59,0.11)
%\psline[linewidth=1.2pt,linecolor=zzttqq](0,-3)(-1.55,2.8)
%\psline[linewidth=1.2pt,linecolor=zzttqq](-1.55,2.8)(4.24,4.35)
%\psline[linewidth=1.2pt,linecolor=zzttqq](4.24,4.35)(5.87,-1.41)
%\psline[linewidth=1.2pt,linecolor=zzttqq](5.87,-1.41)(0,-3)
\rput[tl](2.6 ,-2.4 ){$ A $}
\rput[tl](-1.8 ,1.6){$ B $}
\rput[tl](-0.2,-3.15 ){$ O $}
\rput[tl](1.4 ,-2.7){$ \alpha $}
\rput[tl](-0.8,0.8){$ \beta $}
\psline[linewidth=2.3pt](-1.20,1.52)(2.8,-2.22)
\pscustom[linecolor=black,fillcolor=zzttqq,fillstyle=none,opacity=0.0]{\parametricplot{-0.0127510246967992202}{0.2471697861109875}{1*1.84*cos(t)+0*1.84*sin(t)+-0.0|0*1.84*cos(t)+1*1.84*sin(t)+-2.98}\lineto(0,-2.99)\closepath}
\pscustom[linecolor=black,fillcolor=zzttqq,fillstyle=none,opacity=0.0]{\parametricplot{4.974188368183839}{5.533030852440859}{1*1.45*cos(t)+0*1.45*sin(t)+-1.21|0*1.45*cos(t)+1*1.45*sin(t)+1.52}\lineto(-1.21,1.52)\closepath}
\end{pspicture*}
\end{center}

\end{question}

\end{document}

相关内容