I am currently trying out Scrivener and I really enjoy using it. However, most of my writing is done in LaTeX, in collaboration with co-authors, and often reusing text from previous LaTeX files. As a consequence, I am reluctant to turn to MMD.
Is there a way to
- import/open LaTeX source documents in Scrivener such that they get sliced up in sections and subsections the Scrivener way.
- edit pure LaTeX inside Scrivener (I don’t want to learn the MMD syntax when I already know LaTeX) / also using bibtex.
- export again to a LaTeX source file for distribution
- do all of this in such a way that the exported LaTeX source file gets only the modifications that I made, such that the subversion or git version control will still work for us ?
I am sorry to ask this question here, but I could not find this exact answer. I only found links to write in MMD and export to LaTeX …
In the absence of any expert replies, I’m going to offer a tentative ‘yes’ on the first three (your 1, 2, and 2). For 3, frankly I have no idea (and here in England a git is still primarily an unpleasant person rather than anything software related - there’s a joke about a cyclops, but that’s for another time).
For importing, the standard command K will split the document up into pieces, so you can then tweak and re-arrange as you like.
You can then use Scrivener as a plain text editor, adding all the standard Latex codes, then compile the text to a tex file. I think the key here is specifying the right XSLT in the metadata: there’s a clean-latex.XSLT (or thereabouts). That lets me stick all manner of raw Latex in the text, and it all comes through fine.
Actually if you intend to work in LaTeX, I would recommend steering clear of MMD altogether and just using the Plain Text compile format. You might wish to check in the MultiMarkdown section of the forum, as there have been a few posts providing helpful tips and tricks for using some of 2.0’s new features to generate nice LaTeX structure without any extra work from you, such as chapter names and simple code expansions using replacements. All of that is optional, of course. At its most basic, Scrivener will just assemble a text file based on the contents of the Draft. That could be anything from a LaTeX document to a C++ header file.
One thing you might find a little tedious is constantly importing, splitting, compile, and uploading. Scrivener is really designed with the idea of it being the central repository from which a single person works on a thing, and they work on that thing in Scrivener until it is ready to graduate to final aesthetics or back-and-forth with editors. Any other use of it is very likely going to be a compromise. That’s not necessarily always true—there are many fringe uses of it that are quite efficient, clever, and useful—but this type of in-and-out workflow will basically negate much of what makes the program so powerful: a persistent, heavily annotated master outline that is all at once that and your actual material. Or in other words, it would take so much work to re-split the document every time you bring it in, and for so little gain: you won’t be able to “keep” the fruits of this labour once you compile.
That’s the only negative I can see with external versioning of a draft compile. Most people just dump the whole Scrivener project on Git or what have you.
Dear AmberV and MrGruff,
thank you for your encouraging replies. Based on AmberV’s comments, my conclusion is that the process of repeatedly getting things in and out of Scrivener, to share with non-users, only makes sense if I want to seriously restructure an article in a latex file that is handed over to me by someone else.
Concerning the editing in LaTeX, I have tried a number of things, which I thought I might share, that do not work as I had anticipated.
Importing an existing latex file. Importing and splitting appears to be a Scrivener command. I have set the “split at” to \section and it nicely splits my document into sections. I would, however, like to keep the word “\section” instead of seeing it disappear during import. Can this be automated ?
When using MMD-> LaTeX, I have found that I need to add a meta-data field “LaTeX XSLT”, otherwise it will default to “memoir”. The location has changed wrt pre-2.0 forum discussions. It is now in the Meta-Data panel of the compile window.
I have tried a number of options for this LaTeX XSLT file :
a) “clean-text-allow-latex.xslt”, as indicated approximately by MrGruff. This does not do any mark-up; it simply keeps my text. It, however, adds a few lines at the top of the file that I need to take care of, and it does not automatically add the .tex extension. What is the advantage over exporting to txt and not using MMD at all in this case ? This is what AmberV probably pointed out as well. I am, however, puzzled at why this option exists ? Does it have an advantage ?
b) “article.xslt” : this would probably work nicely if I use MMD->LaTeX the intended way, and just copy-paste snippets of LaTeX code into a new file. What I tried now is simply commenting out all text in all sections with the html comment tags . This makes Scrivener hang during compilation.
Concerning syntax highlighting, I have tried adding the “Edit with TextMate” button, and this works nicely. However, it kind of kills the idea of having everything together in one application instead of one thing on top of the other.
When using the clean-text options, svn treats the file as expected : no problems with detecting the right changes and leaving the rest unaltered.
Thanks again for the nice replies.
Indeed, the hang when going through MMD compiling is probably in the Perl script.
I have no technical questions left at this point; now it comes down to finding an ideal workflow to make use of Scrivener’s features while making extensive use of pasted-in LaTeX text from older files.