Clean up Text During Compile

New project.

Documents pulled from various places. Text in Scrivener is all over the place, so that:

You might
have a sentence like this which doesn’t reach
the end of the line and instead displays breaks, both in Scrivener and upon compiling to pdf.

Is there a way to make sure that this text is cleaned-up when compiling? Here’s an example:

A program like Text Soap ( works on text. One solution might be to export the Scrivener file to plain text, apply textsoap, then import back into Scrivener. I don’t want to do this because I have to have separate chapters which is complicated (for me) in a non-Markdown plain text file. I could fix this is LaTeX but I’d like to keep LaTeX out of it this time.

The first thing to do is to turn on the View → Text Editing → Show Invisibles option, which will let you see exactly what is causing the anomalous formatting.

What to do next depends on what the issue is. The “automatic” options that Scrivener offers are the commands on the Edit → Text Tidying menu, and the Documents → Convert → Text to Default Formatting option. But paragraph breaks at inappropriate locations are hard to fix automatically because it’s hard for Scrivener to decide what your actual intent is.

If you own Keyboard Maestro my free Text Toolbox I can form paragraphs and clean text on a selection within Scrivener. It can also handle quotes and other things I’ve needed over the years. And with v10 of Keyboard Maestro, you can access it from the menu bar.

This looks quite interesting. Which version works with Big Sur? Mojave?

Both. If you have v10 of Keyboard Maestro, you can use the menu bar version. Older versions of Keyboard Maestro use the palette instead.

How would I use the menu bar version? I hadn’t heard of it before.

Keyboard Maestro is a macOS utility that lets you create macros that may be triggered by various means and also displayed on a palette. With v10 of the utility, you can make that palette accessible via an icon on the menu bar. In the case of Text Toolbox, it’s a pencil (of course).

Many of the text routines in Text Toolbox were inspired by Evan Goss’s Spell Catcher utility, which as a 32-bit app, is no longer supported on macOS. So I recreated and expanded it using Keyboard Maestro.

There is a companion palette on the same page (Literary Toolbox) that has a few more tricks (text analysis tools) that Text Toolbox links to, as well.

I’m using TextSoap for cleaning texts which works fine unless there are footnotes in the Scrivener document which get flattened in the process. This has most certainly to do with Apple’s non-implementation of footnotes in RTF (not RTFD) and Scrivener’s own solution to work around this omission.

Does Keyboard Maestro handle Scrivener footnotes well?

You mean, post-Compile? Textsoap can’t read .scriv files.

No, pre-compile in the Editor. It‘s all manual work.

Post-compile would be possible too of course if the compiled format allows editing.

All compile formats can be edited - after duplicating, if it’s a built-in.

I didn’t make myself clear, I didn’t mean Scrivener’s Compile settings but the compiled results. Like PDF for example which is not (at least not that easily) edible, unlike, say, RTF.

For this kind of error, you’ll be much happier if you fix it pre-Compile, in the Scrivener Editor. Even if doing so requires a fair amount of pain and suffering.

Why? Because then it will stay fixed. If you fix the output document, the problem will come back every time you Compile.

So, apart from the suggested “Literary Toolbox,” (and Scrivener’s internal Text Tidying, how can this be accomplished within Scrivener?

If the options available within Scrivener aren’t sufficient – which in this case they may not be – one alternative would be to use the Sync with External Folder option and use the tool of your choice on the External files.