LateX error : I can't write on file 'Rapport.pdf'

In summary, LateX error "I can't write on file 'Rapport.pdf'" occurs when the LateX compiler is unable to write or save changes to the specified file. This can happen due to various reasons, such as incorrect file permissions, a corrupted file, or a full storage disk. To fix this error, you can check file permissions, ensure the file is not open in any other program, and try saving or renaming the file. To prevent this error, make sure file permissions are set correctly and regularly back up files. If the file is corrupted, it may not be possible to recover the data, but you can try using a different program or file recovery software. If the error is due to other reasons, the data
  • #1
DePaco
14
2
Hello,
I am trying to compile my lateX document but errors appear:

! I can't write on file 'Rapport.pdf'.
Please type another file name for output
! Emergency stop
l.55 ... obj {<< /pgfprgb (/Pattern /DeviceRGB] >>
! Fatal error occurred, no output pdf file produced!
Transcript written on Rapport.log

One of the solution is to close pdf file before compilation. I have already tried it and I have the same errors.

My script is:

\documentclass[12pt,twoside]{report}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{float}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[french]{minitoc}
\usepackage{array}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage {hyperref}
\usepackage{geometry}
\usepackage{subfigure}
\usepackage{amssymb}
\usepackage[square]{natbib}
%\usepackage{bibtopic}
\usepackage{pifont}
\usepackage{soul}
\usepackage{chemist}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage{fancybox}
\usepackage{nsheader}
\usepackage{setspace}
\hypersetup{%
colorlinks= true,
linkcolor = black,
anchorcolor = black,
citecolor = black,
filecolor = black,
urlcolor = black,
breaklinks=false,
pdfpagemode= UseOutlines,
pdfstartview={XYZ 0 1000 1.0}
}
\makeatletter
\newif\if@openbib
\makeatother

\geometry{hscale=0.78,vscale=0.8,centering}
\pagestyle{fancy}
%\pagestyle{myheadings}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
\setcounter{minitocdepth}{5}
\setcounter{secnumdepth}{5}
%DEFINITION DES VARIABLES
\def\bel{\textit{Bel}}
\def\pl{\textit{Pl}}\def\fdg{\text{$^{\text{18}}\text{F-FDG}$}}
\def\flu{\(^{\text{18}}\)F}
\def\flt{\(^{18}FLT\)}
\def\fmiso{\(^{18}FMISO\)}
\def\iod{\(^{131}I\)}
\def\tec{\(^{99m}Tc\)}


\begin{document}

\dominitoc

\makeatletter

\setlength{\parskip}{2pt}

\renewcommand{\tablename}{Tableau}
\renewcommand{\figurename}{Figure}
\newcommand{\tab}{\ \ \ \ }
\renewcommand{\baselinestretch}{1.2}
\newcommand{\etal}{\textsl{et al.} }

\renewcommand{\listfigurename}{Liste des Figures}
\renewcommand{\listtablename}{Liste des Tableaux}

\widowpenalty=10000 % empeche au maximum la coupure avant la derniere ligne
\clubpenalty=10000 % empeche au maximum la coupure apres la premiere ligne
\raggedbottom % empeche l'etirement des ressorts verticaux

\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%
{0.2cm \@plus 0ex \@minus .0ex}%
{0.0ex \@plus .0ex}
{\reset@font\texorpdfstring\normalsize\textbf\bfseries}}

\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{0.2cm \@plus 0.ex \@minus .0ex}%
{0.0ex \@plus .0ex}
{\reset@font\texorpdfstring\normalsize\textbf\bfseries}}
\makeatother
\pagestyle{fancy}
\fancyhf{}

\renewcommand{\chaptermark}[1]{\markboth{{\chaptername~\thechapter{}.\quad #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection{}.\quad #1}}
\lhead[\thepage]{\rightmark}
\rhead[\leftmark]{\thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\headsep}{20pt}
\renewcommand{\chaptermark}[1]{\markboth{{#1}}{}}
\addtocontents{toc}{\protect\chaptermark{Table des matières}}
\renewcommand{\sectionmark}[1]{\markright{{#1}}{}}
\addtocontents{toc}{\protect\sectionmark{Table des matières}}

\begin{spacing}{1.5}
%\pagestyle{plain}

% \input{chapitres/pgde.tex}
\input{chapitres/Pgarde.tex}
% \date\today
%\maketitle
% \input{chapitres/Thankly.tex}
\end{spacing}

\input{chapitres/Nodule.tex}



%BIBLIOGRAPHIE..
\newpage
~\newpage
\bibliographystyle{abbrvnat-fr}
\markboth{Bibliographie}{Bibliographie}\addcontentsline{toc}{part}{Bibliographie}
\bibliography{bibliographie}



\end{document}



Thank you for your help.
 
Physics news on Phys.org
  • #2
What happens if you move the file away before you compile the code?
 
  • #3
There may be another process holding the file open like a pdf viewer maybe on a secondary desktop (if you're using multiple desktops).

Sometimes when I've run into this kind of problem, I will terminate the pdf viewer via the kill command (linux, MacOSX) or via the Windows Task Manager and if that doesn't work, I will open a completely unrelated pdf file to clear the old one from the pdf viewer's list.

Other possibilities are the file rapport.pdf is read protected or in a read protected directory or in a directory not owned by you...
 
  • #4
Hello,
I solve my problem. It is because of anti-virus. If I compile the project during anti-virus starting, I obtain this error. To solve it, I am oblige to deactivate it.
Think you for your answer.
 
  • #5
That sounds real bad. I wouldn't deactivate antivirus to compile anything.
 
  • Like
Likes FactChecker
  • #6
I use only one computer. Exactly file rapport.pdf is in a read protected directory. I have deactive this option so it ok.
Thank you for your contribution.
 
  • #7
But still you open yourself up to a whole slew of attacks by doing that. Why not build it in another directory or even on a USB stick to avoid turning off the anti-virus.

Also you could consider getting another anti-virus program if you think that's the real issue.
 
  • #8
Anti-virus is active but I would like to deactive directory protected. I am agree It's not a good solution. Now I use USB stick and it's ok.
Thank you.
 
  • Like
Likes stoomart and jedishrfu
  • #9
DePaco said:
Anti-virus is active but I would like to deactive directory protected. I am agree It's not a good solution. Now I use USB stick and it's ok.
Thank you.
Excluding folders from realtime antivirus scanning is common for heavy I/O files like those for databases and VMs. It sounds like the AV was locking the file for inspection while still being written, causing an access violation. The important thing is to never exclude temp or user home directories.
 

FAQ: LateX error : I can't write on file 'Rapport.pdf'

What is LateX error "I can't write on file 'Rapport.pdf'"?

LateX error "I can't write on file 'Rapport.pdf'" is an error that occurs when the LateX compiler is unable to write or save changes to the specified file. This can happen due to various reasons, such as incorrect file permissions, a corrupted file, or a full storage disk.

Why am I getting this error in LateX?

This error can occur due to several reasons, including incorrect file permissions, a corrupted file, or a full storage disk. It can also happen if the file is open in another program or if there is a conflict with another process trying to access the file at the same time.

How can I fix this LateX error?

The first step to fixing this error is to check the file permissions and ensure that the file is not open in any other program. If that does not solve the issue, try saving the file to a different location or renaming the file. If the error persists, try restarting your computer or freeing up space on your storage disk.

Can I prevent this LateX error from happening?

You can prevent this error by ensuring that your file permissions are set correctly, and the file is not open in any other program. It is also essential to regularly back up your files and keep your storage disk from getting full.

Is there any way to recover the data from the file with this LateX error?

If the file is corrupted, it may not be possible to recover the data. However, you can try to open the file with a different program or use a file recovery software to retrieve the data. If the file is not corrupted and the error is due to other reasons, such as file permissions, you can recover the data by fixing the error and saving the file again.

Similar threads

Replies
4
Views
2K
Back
Top