scrivener export to latex

Is it necessary for scrivener to make a directory for latex-exported files? If my latex file is to be blah.tex. Scrivener/mmd makes a directory called blah.tex which contains a file called blah.tex and any graphics in the file. That’s not good practice (a directory and file inside of the same name), but it’s worse for my purposes.

I’m using a package (tufte latex) that reads a local file from within the bowels of the package…that local file contains any last-minute formatting. So I end up with a directory structure like:

…blah.tex (a directory):
…blah.tex (the actual latex file)

By being inside of directory blah.tex, the actual blah.tex latex file cannot then see the localformatfile.tex. To change that, I’d need to make a special version of the whole tufte package in order to look a directory up, which I’d rather not do.

The bottom line: I DON’T want scrivener to make a special directory for my .tex file and figures. I’ll do that, thanks. Then I can control the ancillary file calls.

Is there a way to defeat this directory-construction?


Yes, this is absolutely necessary - see my reply to your earlier post here:

If it didn’t create a directory, Scrivener wouldn’t be able to save anything other than the .tex file itself.

There is one exception: if the directory you are saving into already has the “.tex” extension, then Scrivener won’t try to create another directory inside that. (Although this behaviour will be prohibited by sandboxing, which is being enforced by Apple in the Mac App Store from next month and so will affect that version, meaning that the Mac App Store version may have no choice but to make a new directory each time.

So, to sum up:

Add the “.tex” extension to your main directory. (You can also just add “_tex” or “-tex” if I recall correctly, e.g. “mainDirectory-tex”.) Or:

After exporting the first time, the next time choose to overwrite the .tex file inside the .tex directory rather than overwrite the .tex directory itself. This way, any other files you have placed inside the .tex directory will not be deleted.

This is the only sensible way for it to work given file system constraints and rules, and it is unlike to change, I’m afraid.

All the best,

Thanks, Keith. If I understand what you’re suggesting, I don’t think it works. Scrivener insists on always making a new blah.tex folder inside the existing blah.tex folder. That is, when I export, if I choose to go into the existing blah.tex folder to save out…I get a new one. I could create a whole nest of identically named folders (I’ve got 2 now). It doesn’t matter whether I do .tex, -tex, or _tex as the name of the folder, if I go inside, it still makes a new folder, with the actual blah.tex file inside.

But what I guess does work, and I wasn’t sure given the innards of the package, is I added to the Meta-Data file in Scrivener:

latex input: …/localformatfile

and it indeed followed the path up to the local file in the higher directory (where localformatfile really should be) that I need.

While I understand the need that you say Scrivener has, I think that my use case is not crazy and that something like what you suggest should be doable.


Wait, are you using the latest beta from the Beta Testing forum that I suggested in the other thread? I thought you said you’d downloaded it. Earlier versions don’t support the -tex/.tex/_tex trick of not creating a new folder each time (they only supported it for -mmd, _mmd and .mmd for MMD plain text files). The new beta should work in this way, though. Can you please confirm that you have tried this on the latest beta?

And I should have suggested using meta-data for this before, sorry about that!

All the best,