Generic Nonfiction (Latex) compile behaviour

Preparing a scientific document I decided to give the General nonfiction Latex a try.
But I soon stumble upon the nasty behaviour that as soon as I refer to images in the document, which leads to multiple file output, Scrivener then introduces the nasty habit to create an superfluous compile folder.

I call it nasty because in the first place I don’t want an extra subdir to be created since I have created a designated directory already for the sole purpose to bundle all files including pre-generated latex class files in it.
Furthermore, the folder being created inherits the .tex extension, under MacOs this leads to a package folder structure. From the point of view of Finder and applications the directory resembles a single file, which as soon as I want to postprocess the resulting file, it leads to error that the so-called file cannot be edited because of readonly file permissions.

Compile as .txt efficiently is simply useless for me this way. My suggestion would be that compile folder creation should be an explicit choice. MMD->Latex neighter is an option, since it interprets my latex and rendering it all with backslashes.

That is unavoidable Scrivener behaviour (the template cannot make such decisions), as in most cases that will be the desirable outcome. It would instead be “nasty” I think to spray thousands of files into the designated output folder when that may not be what you expect. :slight_smile: A subfolder keeps things tidy and easy to delete in case of mistakes. You’ll get the same exact thing for example if you compile to HTML.

Are you handy with the shell? If so, open up the compile Format by double-clicking on it in the compile overview screen, and visit the Processing pane. If you enable post-processing and click the Edit Script button, you’ll see I’ve supplied a simple latexmk command as an example—but using that you could control just about everything about the compile process, including making it so that the compile target is a specific folder on your system rather than wherever you select after pressing the Compile button.

That’s not a Mac behaviour, or at least I have no such result on my system. You must have some tool installed that is declaring “.tex” folders to be treated as packages that for some reason.

Well that’s more of a MultiMarkdown question than a Scrivener one, per se, but what you’re looking for is:

`\raw{syntax}`{=latex}

The user manual project is a demonstration of MMD → LaTeX, which makes heavy use of raw LaTeX syntax where needed. I use a combination of styles and section layouts to generate the backtick syntax shown above, but this is Markdown, you can just type it into the editor, too.

You could also just make sure your compile folder name has -mmd at the end, e.g. “compile-mmd” and then multiple images are all compiled into the same folder level without removing any existing files like latex templates etc. (§21.5.1 user manual).

That is an approach one can take with the Markdown-based formats, but plain-text, which the native LaTeX template uses, does not observe that convention.

Ah, :blush: OK! So if the OP can solve the bundle problem with foldername.tex, that would be the simplest solution?

The simplest, yes (and to the OP, check TeXStudio—I think I recall that being the culprit). The not simplest but most efficient would be to build a deployment script into the post-processing pane that merges compiled updates with an established master LaTeX folder, and then cleans up the compile folder (potentially trashing the whole thing).

I am using the iPad and the Windows versions. Where do I find the Generic Nonfiction Latex template?

On Windows, if you haven’t already, you will need to upgrade to the v3 release candidate to work with the template (you will find it in the Non-Fiction template category). There are a few finishing touches that need to be done to the template, but last I checked, it works well at this point.

Once you do have a project built, using it, you could work with it on the iPad, just for the writing part of course. The iOS version of Scrivener, with the exception of the basic capability of exporting text into a file, does not have 99% of the features necessary to make this template work!