Simple Scrivener -> Latex text substitution

I’m having difficulty getting “alpha” to ultimately compile to $\alpha$ in a Scrivener-MMD-Latex workflow?

(Recursive pattern matching in Scrivener’s replacements seems over-exercised)

Yeah, Replacements can get a little wonky when the replacement string contains matching components from the original string. It’s a bit tricky to solve since fixing it would mean removing the ability to make compound replacements. An overall solution is on the list of things to address though, if possible.

The best workaround is to make it so that condition doesn’t actually occur. Case-sensitivity would be a good way to approach this one. Write with “ALPHA” and have it converted to $\alpha$. Now the resulting string no longer matches the original search pattern.

Ok, thanks. As it turns out I did a similar thing using alph as my sufficiently different replacement.


FWIW actually it would probably be better if these replacements could be handled in a latex compile (which oddly seems just as difficult) for compatibility with a new workflow I’ve adopted using writelatex. I used to do a Scrivener->MMD->Latex (with KeyboardMaestro for extra automation) for the first 95% with a final 5% polishing and editing. Now it is more like 60% for the first part until the overall structure is fixed before moving into the cloud and editing using writeleaf which has been a bit of a revelation with recent improvements. Now, if only Scrivener could talk to writeleaf with bi-directional imports/exports (folders<->inputfiles<->(replacements)<->mmd etc) … please place on to do list :confused:

Could you expand a bit on what you mean by that? I don’t understand what a “latex compile” is, if you aren’t using the MultiMarkdown engine to generate a LaTeX. Do you mean using plain-text and composing the document as LaTeX (or shorthand LaTeX as the case may be) to start with? Replacements should be working fine for that as well.

I wasn’t referring to anything Scrivener does but LaTeX’s own compile. On a broader level, I was kind of hoping that once I decide to move from Scrivener to Overleaf in my workflow this decision could be reversible (in case I really wanted to change the basic structure again back in Scrivener). Having latex do the auto-replacement (simply - I think it can be done messily) facilitates some sort of manual attempt at this two-way flow but a bigger two-way integration seems unlikely anytime soon so I’m not going to worry too much about it (and accept the rubicon when Overleafing).


Okay, I’ve never messed with anything like “Replacements” in LaTeX itself. It could be there is something like that, but I’ve usually just created commands to compact complicated sequences down to something easier to type and read.

Ah, okay. I guess that explains what I just ran into.

Each of my paragraphs start with an attribution for who said it, either I: or R: (or some predictable pattern based off those).

When I compile I need those autonumbered, so I was using replacements to change “I:” to “<$n>. I:”

This has been working flawlessly on WinScriv. But on MacScriv, the replacements are apparently being recursive - instead of the expected output of “1. I:” I’m getting. “1. 2. <$N>. <$n>. I:”

But case-sensitivity is an easy enough workaround I guess.