【问题标题】:MiKTeX, LaTeX: Error with \newwrite output file and writing with \write -- Windows API error 2: The system cannot find the file specifiedMiKTeX、LaTeX:使用 \newwrite 输出文件和使用 \write 写入时出错——Windows API 错误 2:系统找不到指定的文件
【发布时间】:2020-12-25 10:16:12
【问题描述】:

在 Windows 10 Home 上使用 TeXworks v0.6.5 (MiKTeX 20.7),我正在尝试将一行写入文本文件。

在排版这段代码时

\documentclass{article}

\newwrite\justafile

\begin{document}

% Write to text file:

\immediate\openout\justafile=exam.txt

\immediate\write\justafile{Chosen questions: bla, bla and bla.}

\immediate\closeout\justafile

\end{document}

控制台输出以下消息(编译日志的最后 5 行):

No pages of output.
Transcript written on example.log.

Sorry, but "MiKTeX Compiler Driver" did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:\Users\Miriam Briskman\AppData\Local\MiKTeX\2.9\miktex\log\texify.log

日志文件包含以下错误信息:

2020-09-06 19:47:38,817-0400 INFO  texify - this process (4764) started by 'miktex-texworks' with   command line: "C:\Users\Miriam Briskman\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\texify.exe" --pdf --synctex=1 --clean example.tex
2020-09-06 19:47:38,880-0400 INFO  texify.core - start process: pdflatex --synctex=1 "C:/Users/Miriam Briskman/OneDrive/Desktop/Brooklyn College/Fall 2020/CISC 1050/Tests/Test Pool/New folder\example.tex"
2020-09-06 19:47:39,249-0400 INFO  texify.core - start process: pdflatex --synctex=1 "C:/Users/Miriam Briskman/OneDrive/Desktop/Brooklyn College/Fall 2020/CISC 1050/Tests/Test Pool/New folder\example.tex"
2020-09-06 19:47:39,587-0400 ERROR texify.core - The system cannot find the file specified.

2020-09-06 19:47:39,587-0400 ERROR texify.core - Function: CopyFileW
2020-09-06 19:47:39,587-0400 ERROR texify.core - Result: 2
2020-09-06 19:47:39,587-0400 ERROR texify.core - Data: existing="C:/Users/MIRIAM~1/AppData/Local/Temp/mik68959/_src\example.pdf", path="C:/Users/Miriam Briskman/OneDrive/Desktop/Brooklyn College/Fall 2020/CISC 1050/Tests/Test Pool/New folder\example.pdf"
2020-09-06 19:47:39,587-0400 ERROR texify.core - Source: Libraries\MiKTeX\Core\File\win\winFile.cpp:383
2020-09-06 19:47:39,592-0400 FATAL texify - Windows API error 2: The system cannot find the file specified.

2020-09-06 19:47:39,592-0400 FATAL texify - Info: existing="C:/Users/MIRIAM~1/AppData/Local/Temp/mik68959/_src\example.pdf", path="C:/Users/Miriam Briskman/OneDrive/Desktop/Brooklyn College/Fall 2020/CISC 1050/Tests/Test Pool/New folder\example.pdf"
2020-09-06 19:47:39,592-0400 FATAL texify - Source: Libraries\MiKTeX\Core\File\win\winFile.cpp
2020-09-06 19:47:39,592-0400 FATAL texify - Line: 383

下面是 TeXworks 控制台屏幕截图的链接,其中包含代码:

TeXworks console with the problematic code

我使用 MiKTeX 控制台安装了所有最近的更新,但这并没有解决问题。

错误的根源是什么,我应该如何解决?

【问题讨论】:

  • 可以直接用pdflatex而不是texify编译吗? Texify 因丢弃所有有用的错误消息而臭名昭著....
  • @samcarter_is_at_topanswers.xyz,非常感谢!当我将处理工具从pdfLaTeX+MakeIndex+BibTeX更改为仅pdfLaTeX时,代码编译正常,输出文件创建修改成功。如果您特别怀疑 texify 出了什么问题,您想添加这个建议作为问题的答案吗?再次,非常感谢!
  • 我不知道 texify 出了什么问题,这正是我建议远离它的问题所在。直接使用latex时,总会说出问题所在。这可能不是每个用户都能理解的,但至少有一个用户可以获取这些信息以获取在线帮助。
  • 我明白了。非常感谢您的解决方案和建议,@samcarter_is_at_topanswers.xyz!

标签: windows io latex pdflatex miktex


【解决方案1】:

尽可能远离texify。

  • 你永远不知道 texify 到底在做什么

  • texify 因丢弃所有有用的输出而臭名昭著,这些输出可以让用户实际调试他们的问题

我建议要么

  • 如果您有一个没有参考书目等额外内容的简单文档,请直接使用 pdflatex 编译。

  • 对于更复杂的文档,请使用latexmk 等自动化工具进行编译。这将自动确定所需的 tex 运行次数,将调用 bibtex/biber 或您的文档可能需要的任何其他工具

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-01
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 2010-10-18
    • 2023-03-13
    • 2017-04-29
    相关资源
    最近更新 更多