auto-pst-pdf 无法创建 pdf 文件

auto-pst-pdf 无法创建 pdf 文件

我想在论文中加入大量图表。最近,我了解到我们可以使用以下方法格式化 LaTeX 字体中的文本和标签psfrag

我将 Texstudio 与 pdflatex 一起使用,因此我必须启用 --shell-escape。但是,使用 创建 pdf 文件时似乎出现某种错误auto-pst-pdf。我收到错误消息,提示未创建 -pics.pdf 文件,因此没有输出。

我也尝试过pstool。这里复制了图表,但我无法更改任何文本或标签。所以我认为在pdf.eps文件创建文件的过程中出现了某种错误。

以下是我的最低工作示例:

\documentclass[12pt,fleqn]{article}


\usepackage{graphicx}

\usepackage{pstool}
\usepackage{psfrag}
%\usepackage[bookmarks]{hyperref}

\begin{document}

 \begin{figure}

    \centering
    \psfrag{0}{$0$}
    \psfrag{10}{$10$}
    \includegraphics{loadings.eps}
    \label{loadings}
\end{figure}

\end{document}

我尝试更改 x 轴标签,并在几个图上尝试过,但似乎都没有用。所以我认为我在某些地方犯了错误。

我检查了log-file并发布了我认为发生错误的部分。

runsystem(echo " ")...executed.

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

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

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

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

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

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

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

runsystem(latex -disable-write18 -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  "test-autopp.ps" "test-autopp.pdf")...executed.

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



Package auto-pst-pdf Warning: 
    Creation of test-pics.pdf failed.
This warning occured on input line 124.


Package auto-pst-pdf Warning: 
    Could not create test-pics.pdf. Auxiliary files not deleted.
This warning occured on input line 124.

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

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

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

不知何故,在生成 pdf 文件的过程中出现故障。

编辑当我包含该选项时crop=off,我能够生成图表。但是,当我尝试更改轴时,什么也没有发生,与我使用该pstool包时的问题完全相同。

编辑2.0 当我按照 Raaja 的建议运行 MWE 时,我设法让它正常工作。同样,当我想将其包含在主文件中时,我得到一个空白页作为输出。相关日志输出:

    runsystem(echo " ")...executed.

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

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

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

runsystem(latex -disable-write18 -jobname=""Thesis Msc Jasper"-autopp" -interac
tion=batchmode  "\let \APPmakepictures \empty \input  "Thesis Msc Jasper".tex")
...executed.



Package auto-pst-pdf Warning: 
    Creation of "Thesis Msc Jasper"-autopp.dvi failed.
This warning occured on input line 124.


Package auto-pst-pdf Warning: 
    Could not create "Thesis Msc Jasper"-pics.pdf. Auxiliary files not deleted.

This warning occured on input line 124.

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

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

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


("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pst-pdf\pst-pdf
.sty"
Package: pst-pdf 2017/06/22 v1.2d PS graphics for pdfLaTeX (RN,HjG)

("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\generic\ifxetex\ifxet
ex.sty"
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\ifvt
ex.sty"
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
)
("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\generic\luatex85\luat
ex85.sty"
Package: luatex85 2016/06/15 v1.4 pdftex aliases for luatex
)
\c@pspicture=\count153
Package pst-pdf Info: MODE: 1 (pdfTeX mode) on input line 214.

("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pstricks\pstric
ks.sty"
Package: pstricks 2017/09/17 v0.65 LaTeX wrapper for `PSTricks' (RN,HV)

("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\latex\iftex\iftex.sty
"
Package: iftex 2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX, 
and LuaTeX
)
("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\generic\xkeyval\pst-x
key.tex"
File: pst-xkey.tex 2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
)
("C:\Users\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pstricks\pstr
icks.tex"

我认为错误再次出现在与之前相同的位置。不知何故,它无法正确生成 pdf 文件。

答案1

您可以auto-pst-pdf明确使用包,而不是\includegraphics使用它\psfragfig{}来实现您想要的效果,如下所示:

%&pdflatex
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[12pt,fleqn]{article}
\usepackage{graphicx}
\usepackage{auto-pst-pdf}
\usepackage{psfrag}
\begin{document}
\begin{figure}
    \centering
    {
        \psfrag{<org>}[<pos>][]{<replacement>}
        \psfragfig[<figure_def>]{<your_figure>.eps}
    }
    \caption{your caption}
    \label{your label}
\end{figure}
\end{document}

此外,据我所知,您不需要pstool这里。

有关psfrag包及其用法的更多信息,值得参考:http://ftp.snt.utwente.nl/pub/software/tex/macros/latex/contrib/psfrag/pfgguide.pdf

更新 1:

如果使用.pdf和的混合,那么请确保将所有内容封装在独立模块中,如下所示:.eps{...}

环境psfrag

    \begin{figure}
        \centering
        {
            \psfrag{<org>}[<pos>][]{<replacement>}
            \psfragfig[<figure_def>]{<your_figure>.eps}
        }
        \caption{your caption}
        \label{your label}
    \end{figure}

环境.pdf

    \begin{figure}
        \centering
        {
            \includegraphics[<figure_def>]{<your_figure>.pdf}
        }
        \caption{your caption}
        \label{your label}
    \end{figure}

这样做,您将不会因为dvips混合了.pdf和而无法读取图形而看到空的图形框.eps

答案2

作为 Raaja 答案的延伸。

文件名不带空格很重要。我尝试了几个test.tex示例loadings plot.tex文件,test.tex一切都很好,但loadings plot.tex图消失了。

相关内容