0

I am struggling to compile a file locally either in TexMaker or Atom that nevertheless compiles fine on ShareLatex.com (where I originally made it).

My file is of the form...

\documentclass{article}
%\documentclass[draft]{article}

\usepackage[utf8]{inputenc}
\usepackage[style=authoryear, uniquename=false, sorting=nyvt, backend=biber, doi=false, isbn=false, maxcitenames=2]{biblatex}
\usepackage{graphicx}
\usepackage{rotating}
\newcommand*{\bibtitle}{References}
\renewcommand*{\bibfont}{\raggedright\small}
\usepackage[english]{babel}
\usepackage[autostyle, english = american]{csquotes}

\MakeOuterQuote{"}
\addbibresource{references.bib}

\usepackage[singlelinecheck=false]{caption}
\usepackage{glossaries}
\makeglossaries

\input{glossary}

\title{TITLE OF DOC}}
\author{MY NAME}
\date{DATE RIGHT NOW}

\begin{document}

\maketitle

\textbf{Abstract:} Some stuff about the doc.

\clearpage

\tableofcontents

\clearpage
\include{sections/outline}
\include{sections/introduction}
\include{sections/extended_info}
\include{sections/first_bits}

\input{sections/not_done_yet}
\input{sections/also_not_done_yet}
\input{sections/this_will_be_the_conclusion}
\clearpage

\printglossary[style=long]
\clearpage

\setlength{\baselineskip}{0pt} % JEM: Single-space References

{\renewcommand*\MakeUppercase[1]{#1}%
\printbibliography[heading=bibintoc,title={\bibtitle}]}

\end{document}

So, basically, it all compiles beautifully on SharLatex.com, but on my local machine (with both TexMaker and Atom plugin) it fails because:

I can't write on file 'sections/outline.aux'

That gives a fatal error.

Now, I know that maybe I should be using \input instead of \include (although I don't know why!), and you're probably wondering why some document sections use one and not the other... but that's because of how it results in \clearpages after \include but not \input (I wanted those last input sections all on one page, because they are currently just empty titles).

Now, I would change it all to \input (and indeed the document then compiles), but that results in my images all going to the end of the document after all sections, and having no clear pages, and that's all a mess I don't want!

So is there any way I can keep my \include and \input commands exactly as they are currently (indeed, keep it all as it is) but add something to make it compile properly? Or am I doing something terribly terribly wrong that I don't understand?

Any help appreciated (relatively new to LaTeX)...

EDIT

Tried chmodding the directory and contents both to 666 and 777 and neither works, same error occurs:

Screenshot of error output from Atom LaTex compiler... error is the same with TexMaker

This is the error in the log:

./main.tex:61: I can't write on file `sections/outline.aux'.
\@include ...\immediate \openout \@partaux #1.aux 
                                                  \immediate \write \@partau...
l.61 \include{sections/outline}

(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name
./main.tex:61: Emergency stop.
\@include ...\immediate \openout \@partaux #1.aux 
                                                  \immediate \write \@partau...
l.61 \include{sections/outline}

*** (job aborted, file error in nonstop mode)

EDIT 2

I realise this is a bit of a dead end, but even if I chmod -R 777 the entire project folder it won't play ball... but if I put the files in the main directory (and change the code path) it's fine and compiles, so definitely permissions... am going crazy trying to understand what the problem is. Using Linux Mint.

EDIT 3

If I switch to using the Javascript DiCy builder in Atom's latex package then it compiles fine (as opposed to using latexmk)... therefore, I think this could be something to do with latexmk's config... is it possible there is an issue similar to MiKTeX has with openout_any=a ? If so, is there a setting that can be changed in latexmk to stop this from happening and allow everything to compile fine?

  • If maindir is the directory where your main .tex file is, do you have the included files in maindir/sections, and is that directory writeable by TeX? – Paul Stanley Apr 7 '18 at 15:44
  • 2
    this is a file permissions error I can't write on file 'sections/outline.aux' does that directory and file exist, and what file permissions do they have? – David Carlisle Apr 7 '18 at 16:45
4

There is nothing wrong with using \include rather than \input: it's perfectly good practice (note, though, that an \include will always start a new page, so you don't need the \clearpage before the \include).

The whole point of \include however is that it involves a mechanism that writes separate .aux files for each included file. That is done so that if you decide to typeset only part of the document (using \includeonly{}, LaTeX can still make use of the .aux files from sections you are not typesetting. That means that LaTeX needs to be able to write an .aux file into the directory of each included file.

Your error message suggests this is proving impossible, probably because the directory in which the included files reside is not writable by LaTex. Make sure the included .tex files are in that directory and that the directory permissions are set to enable the compiler to write to them.

  • OK, this is great info thanks! I am using Linux -- what should I do to make the 'sections' directory writeable by LaTeX? This definitely sounds like the problem and would make sense why everything is fine on sharelatex.com (they likely make it writeable by default). – ratuk_ Apr 8 '18 at 13:34
  • chmod -R 666 /path/to/directory should do it, I think. – Paul Stanley Apr 8 '18 at 16:55
  • Sadly doesn't change the problem -- I've edited my question to reflect this with a screenshot (tried both 666 and 777)... – ratuk_ Apr 8 '18 at 18:23
  • Peculiar. Have you checked the .log file. It certainly looks like a file permissions problem, doesn't it. – Paul Stanley Apr 8 '18 at 20:13
  • So - if I take all the sections out of the sections folder and have them in the main directory it's totally fine. So it's definitely a permissions thing relating to having them in a directory. – ratuk_ Apr 8 '18 at 21:14
1

After a serious amount of soul-searching and double checking and trying different things, it seems that the problem is not just (as Paul Stanley rightly suggested) "that LaTeX needs to be able to write an .aux file into the directory of each included file", but also that it needs to be able to find and write to any build directory (if you are using one). So, you don't just need permissions for subdirectories of included content, but also a mirrored structure and permissions for build files (e.g. .aux files).

Therefore, if you are building into a separate directory (e.g. to keep build files separate) you also need to have the same .tex file subdirectories there.

i.e. Where I had my subsections in a 'sections' folder (e.g. outline.aux), I also need to make sure there is an empty directory created in the build folder (e.g. build/sections). Otherwise it cannot place the .aux file in the directory.

In other words, at least for those using Atom and latexmk or TexMaker and latexmk (it seems to be latexmk that is the problem here, sincy DiCy works fine with build directories, and does not need these creating), you need to make sure directories are mirrored/created in any build subdirectory.

Painful process to find that out, but there it is. I wonder if latexmk experts can comment further but for now I have got it working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.