5

I am using a Mac, OS X 10.10.1, TeXLive, all packages up-to-date. MacTeX-2014 Distribution.

The document is based on the moderncv package and uses multibib. I can run LaTeX on the file, and it generates the required three .aux files, one for each of the bibliographies.

I then attempt to run bibtex against each of these .aux files in a terminal window using

bibtex /Users/mbc/Desktop/moderncv/examples/book.aux 

bibtex returns the following error

bibtex: Not writing to /Users/mbc/Desktop/moderncv/examples/book.blg (openout_any = p).
I couldn't open file name `/Users/mbc/Desktop/moderncv/examples/book.blg'

I have tried to run the same command using sudo - same error as above. A search for a solution suggested that the file texmf.cnf be edited to change openout_any = p to openout_any = a but I can not find texmf.cnf on my machine at all.

I suspect that configuration is handled differently in the MacTeX-2014 Distribution.

Any pointers would be appreciated.

2

According to the UK TeX FAQ, referenced in the comments:

LaTeX won't include from other directories

You wanted to \include{../bar/xyz.tex}, but LaTeX says:

latex: Not writing to ../bar/xyz.aux (openout_any = p).
! I can't write on file `../bar/xyz.aux'.

The error comes from TeX’s protection against writing to directories that aren’t descendents of the one where your document resides. (The restriction protects against problems arising from LaTeXing someone else’s malicious, or merely broken, document. If such a document overwrites something you wanted kept, there is obvious potential for havoc.)

Document directory structures that can lead to this problem will look like the fictional mybook:

./base/mybook.tex
./preface/Preface.tex
./preface/***
./chapter1/Intro.tex
...

With such a structure, any document directory (other than the one where mybook.tex lives), seems "up" the tree from the base directory. (References to such files will look like \include{../preface/Preface}: the ".." is the hint.)

But why did it want to write at all? — "what's going in in my \include" explains how \include works, among other things by writing an .aux file for every \included file.

Solutions to the problem tend to be drastic:

Restructure the directories that hold your document so that the master file is at the root of the tree:

./mybook.tex
./mybook/preface/Preface.tex
./mybook/preface/***
./mybook/chapter1/Intro.tex
...

and so on.

Did you actually need \include? — if not, you can replace \include by \input throughout. (This only works if you don’t need \includeonly.) You could patch your system's texmf.cnf – if you know what you're doing, the error message should be enough of a hint; this action is definitely not recommended, and is left to those who can "help themselves" in this respect.

| improve this answer | |

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.