MiKTeX, LaTeX: Error with \newwrite output file and writing with \write -- Windows API 错误2:系统找不到指定的文件
MiKTeX, LaTeX: Error with \newwrite output file and writing with \write -- Windows API error 2: The system cannot find the file specified
在 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.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
下面是 link TeXworks 控制台的屏幕截图,代码为:
TeXworks console with the problematic code
我使用 MiKTeX 控制台安装了所有最新更新,但这并没有解决问题。
错误的来源是什么,我应该如何解决?
尽可能远离 texify
。
你永远不知道 texify 到底在做什么
texify 因丢弃所有允许用户实际调试问题的有用输出而臭名昭著
相反,我建议
如果你有一个没有参考书目等额外内容的简单文档,直接用pdflatex
编译
对于更复杂的文档,使用 latexmk
等自动化工具进行编译。这将自动确定所需的 tex 运行次数,将调用 bibtex/biber 或您的文档可能需要的任何其他工具
在 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.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
下面是 link TeXworks 控制台的屏幕截图,代码为:
TeXworks console with the problematic code
我使用 MiKTeX 控制台安装了所有最新更新,但这并没有解决问题。
错误的来源是什么,我应该如何解决?
尽可能远离 texify
。
你永远不知道 texify 到底在做什么
texify 因丢弃所有允许用户实际调试问题的有用输出而臭名昭著
相反,我建议
如果你有一个没有参考书目等额外内容的简单文档,直接用
pdflatex
编译对于更复杂的文档,使用
latexmk
等自动化工具进行编译。这将自动确定所需的 tex 运行次数,将调用 bibtex/biber 或您的文档可能需要的任何其他工具