如何解决TeXStudio中Beamer文档的紧急停止编译错误?
问题
将一份在Overleaf可正常编译的Beamer文档导入TeXStudio后,出现紧急停止错误:
! Emergency stop. \pgfsys@defineimage ...astform }\else {\pdfximage \pgf@imageheight \pgf@imag... l.16 ...ight=12pt]{beamericonbook}{beamericonbook}
日志核心报错信息:
! I can't write on file `1.pdf'. (Press Enter to retry, or Control-C to exit; default file extension is `.pdf') Please type another file name for output ! Emergency stop. \pgfsys@defineimage ...astform }\else {\pdfximage \pgf@imageheight \pgf@imag... l.16 ...ight=12pt]{beamericonbook}{beamericonbook} *** (job aborted, file error in nonstop mode)
文档代码如下:
% Inbuilt themes in beamer \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{mathabx} \usepackage{mathpazo} \usepackage{eulervm} \usepackage{natbib} % Theme choice: \usetheme{Darmstadt} \usefonttheme{serif} \usecolortheme{rose} \makeatletter \newenvironment{withoutheadline}{ \setbeamertemplate{headline}[default] \def\beamer@entrycode{\vspace*{\-headheight}} }{} \makeatother \definecolor{macouleur}{RGB}{0,150,200} \setbeamercolor{structure}{fg=macouleur} \setbeamercolor{section in toc}{fg=black} % Title page details: \beamertemplatenavigationsymbolsempty \title{Génie Logiciel \\newline ------ \\newline Introductions} \author{2022/2023} \institute{Yo} \date{} \begin{document} \begin{withoutheadline} \begin{frame} \titlepage \centering \includegraphics[scale=0.30]{Polytech.jpg} \end{frame} \end{withoutheadline} \begin{withoutheadline} \begin{frame}{Organisation du module} \begin{itemize} \item 22h de CM/TD/TP \\newline \item Programmation orientée Objet et UML \item Versionning et GIT \item Testing et Junit \item Design patterns et Java \\newline \item Examen final sur table \end{itemize} \end{frame} \end{withoutheadline} \begin{withoutheadline} \begin{frame}{Sommaire} \tableofcontents \end{frame} \end{withoutheadline} \section{Logiciel, crise et génie logiciels} \begin{frame}{Slide 1.1} This is an unordered list: \begin{itemize} \item Item 1 \item Item 2 \item Item 3 \end{itemize} and this is an ordered list: \begin{enumerate} \item Item 1 \item Item 2 \item Item 3 \end{enumerate} \end{frame} % Blocks frame \section{Partie 2} \begin{frame}{Slide 2.1} \begin{block}{Standard Block} This is a standard block. \end{block} \begin{alertblock}{Alert Message} This block presents alert message. \end{alertblock} \begin{exampleblock}{An example of typesetting tool} Example: MS Word, \\LaTeX{} \end{exampleblock} \end{frame} \end{document}
解决方法
- 检查文件权限与占用:报错核心是无法写入
1.pdf,先确认该文件是否被PDF阅读器等程序占用,关闭所有相关程序;再检查文档所在文件夹的读写权限,右键文件夹→属性→安全,确保当前用户拥有写入权限。 - 修改TeXStudio输出设置:打开TeXStudio的「选项→配置TeXStudio→构建」,查看默认输出文件名是否被设为
1.pdf,改成与文档同名的文件名(比如文档名为genie-logiciel.tex,输出设为genie-logiciel.pdf),避免文件名冲突。 - 清理编译临时文件:手动删除文档文件夹下的
.aux、.log、.nav等临时文件,或使用TeXStudio工具栏的「清理」按钮,之后重新编译。 - 更新MiKTeX包:打开MiKTeX控制台,执行更新操作,安装所有可用包更新,避免因包版本不兼容引发的异常。
- 修正代码小问题:代码中
\vspace*{\-headheight}的负号位置错误,改为\vspace*{-\headheight},虽然这不是直接导致写入错误的原因,但可避免潜在排版问题。
内容的提问来源于stack exchange,提问作者boubou
相关产品推荐
相关产品推荐

