Technical Writing

Greetings. I recently read the post about the freeze on new features, but I just started using Scrivener and wanted to offer my input anyway.

I love using Scrivener. It is the organization and writing tool I’ve been looking for. I wish I had discovered it when I was writing my Ph.D. thesis, but better late than never.

I’m a theoretical physicist, so all of my professional writing eventually ends up in LaTeX. Since a LaTeX source file is just a text file, I don’t really understand the idea behind MultiMarkDown. I have just been exporting my writing in Scrivener to a text file, then compiling it with LaTeX.

There are three features that would make this even easier than it already is:

  1. The ability to export directly to a “.tex” file
  2. Parentheses completion
  3. Color-coded text

The first seems like it would be pretty easy to implement. Right now I have to export to a “.txt” file, then rename it as a “.tex” file before I compile it with LaTeX. Basically, it would be nice to give the export file any name and extension I want.

The second point is probably of minor importance to most writers, but of great importance to programmers and people who use LaTeX for a lot of equations. An option to have the text editor highlight matching parentheses would be quite useful.

The third might not be as easy to implement, but who knows? In LaTeX and most programming languages there are keywords and special commands. Some editors offer a color scheme that will display these in different colors than the main text, which is very handy at times.

I realize that Scrivener was not designed for programmers, and most writers probably don’t use lots of equations. (I’ve heard that every equation supposedly reduces projected book sales by a million copies, so that’s probably a wise decision!) However, I think these three features would make Scrivener a very attractive option for writers in math, physics, engineering, chemistry, biology, computer science, and other technical fields.

If anyone wonders why I don’t just use TeXShop or VI, it’s because these editors are no good for organizing large amounts of text. You could use these editors to write a novel, too. The great features of Scrivener are just as appealing to technical writers as anyone else!

When you export (or compile draft) to plain text the file save dialogue has a “hide extension” checkbox in the lower left corner. If you de-select that, it will display the .txt extension and you can change that to .tex right at save time.

You can also use the “edit in an external editor” feature to work on any given scrivening in an external text editor. When you save and exit the external text editor, it is updated inside Scrivener. I’ve heard a few people talk about using TextMate which provides syntax hilighting, that may be a good match for you.

As for MMD, it’s a simple and readable way to mark up a text file so that it can be converted to any format, including LaTeX. It does have some limitations in that there isn’t a mapping between MMD and every LaTeX command; if you are doing complicated things in LaTeX then it may not be for you. But it does most common things. I recommend looking over the MMD manual to get a feel for what it can do. I believe there is a way to pass LaTeX commands through for those items that aren’t covered by MMD as well but I haven’t had need for it myself.

MMD translates the markup that it recognizes and doesn’t change anything else. So the way to pass LateX command through is to use them. MMD won’t touch them.

That won’t work. :frowning: MMD has to convert certain characters into LaTeX-friendly syntax, which does effectively break raw LaTeX commands. You can obviously use the more permissive “clean-text-allow-latex.xslt”, but even that will not work for all LaTeX constructs. There’s a special syntax to infuse raw commands directly, but IIRC this doesn’t work reliably in the current version of MMD.

My advice to those who want to use LaTeX directly with Scrivener is to compile to plain MMD and use a script or folder action to transform the output. Here’s a small Perl script (use at your own risk :stuck_out_tongue: ) that removes the metadata and transforms Markdown headings into LaTeX headings. It also takes care of the footnotes, so you can still use “Scrivener footnotes” in you document.

Maybe you have particular funky LaTeX constructs in mind, but commands work just fine. I haven’t had a problem in several hundred pages of LaTeX other than single quotes.


You’re suggestions sound very helpful, but I can’t make either of them work.

First, when I try to compile my draft to something other than a text file, I get this message:

You cannot save this document with extension “.tex” at the end of the name. The required extension is “.txt”.

As I said in my original post, it’s simple to change the extension after I compile. I just don’t see any reason you can’t name your file something like “myFile.tex” or"myFile.note".

I was very excited about using the external editor, but it only seems to work for media files, not text files. If I am working on one of the text segments the “Open in External Editor” command under the “View” menu is not available. If this option were available for text files as well as media files, that would be ideal. I can see the problem, though. If you used an external editor to do something to a text file that wasn’t compatible with Scrivener’s Rich Text format, you might run into problems when you were ready to use it in Scrivener again.

I’ve found a workaround for LaTeX equations: LaTeXiT. I have used LaTeXiT in the past to put equations into Keynote presentations, so I should have thought of it sooner. I can type my equation, make sure it compiles, then put it into Scrivener and not worry about it any more. So far, this has worked well for me.

Thanks for your comments, and let me know if I’m doing something wrong when I compile my draft or try to use an external editor.

About using TextMate as an external editor, I know some people here have said they’ve done it but I never looked into exactly how.

So, now I did a forum search and I found this forum post.

Apparently it isn’t via Scrivener’s “open in external editor” but via a textmate service that they got to edit the files in textmate.

Sorry about the misleading instructions, I hadn’t tried it myself but only heard of others using it.

I know I am perhaps a bit late on this post but…

I am at the same stage MMD seems to work for some but I can’t make it work and I don’t want to use the memoir class - as has been said just the straight .tex would be nice for me as I am blissfully happy in LaTeX.
I do my writing in Scrivener because it just so good to be able to manipulate the text. I have found that if I use compile and then save as plain text, I can just change the extension using “Get Info”. The result still needs working on because of the spurious characters it throws up but I’m happy (probably because I am a Humanities student and know no different!

BTW my workflow at the moment is Journler, for data collection with Skim for PDF’s, Scrivener for drafting and LaTeX with BibDesk for polishing. What about anyone else?

I am raising this thread from the dead because I use Scrivener for my writing. I write technical articles. The time has come where I am going to need to put up some formulas that have square roots, integrals, and all kinds of nasty things math.

Can anyone recommend something for me to use? I have zero experience with Latex or MMD or anything else but I have the following programs, NWP, Mellel, and Scrivener. If I need another program or two to get this done so be it but MS Word will not be that program. I am running a MS free atmosphere when possible.

I am also willing to learn so please recommend a good starting point. I ask again because this thread is over 18 months old and there may have been advances in this area.

While learning and converting your workflow to LaTeX just for equations would probably be overkill, its mathematics syntax is probably no more difficult to learn than any other, and there are tools for turning equations into images, such as LaTeXiT, which require you to know nothing about document formatting. You just type in the equation, click a button, and save it out as an resolution independent vector image. Once you have that, you can drop the image into Scrivener in the text where it should go.

All you would need to get that working is the BasicTeX installable package, available from the MacTeX project, which is about a 50mb download instead of the whopping 1.5gb or whatever for the full system. BasicTeX would be all you need for equations.

An example demonstrating the concise syntax:

\[ \left|\sum_{i=1}^n a_ib_i\right| \le \left(\sum_{i=1}^n a_i^2\right)^{1/2} \left(\sum_{i=1}^n b_i^2\right)^{1/2} \]

After clicking the “LaTeXiT!” button, you can drag the result straight into Scrivener, or to your disk first to rename it. You would probably want to store your plain-text equations somewhere in Scrivener, too—perhaps in an annotation around the image, so if you need you can paste it back in and fix a typo or what have you.

LaTexiT it is then. Thanks for the heads up on BasicTeX. I probably should learn to format my documents in LaTex anyway, I am not sure why but why not! :slight_smile:

Thanks so much. I think I am going to get the equations formatted and then copy that text into Scrivener. Then I guess I have to run it through a filter or something for LaTeXiT to do it’s magic. This may be fun!