Latex: Preset Replacements and Autoref broken (2.4.1)?


I am experiencing a problem which seemed to be introduced with the last update (2.4.1/22817).

I am writing my PhD thesis and therefore I need to insert lots of images. The names of the images have upper- and lower case letters and are all stored as “png”.

The images are placed in the text (no MMD command is used) and the description is placed directly under it in squared brackets. Within the text, I used the link syntax [](#Name of File) - but without the “.png” extension as I find the text more readable.

As I am a clever guy, I insert the missing “.png” as a preset replacement:
Replace: With:

This worked perfectly!

However, after upgrading Scrivener this does not seem to work any longer. In the produced PDF, no link to an image is working ("?? ??" is displayed). I found out that the autoref command does not look like expected. In the latex code, each autoref ends with “.png.png”. The ending “.png” is added twice, not only once (this can be reproduced by adding more letters: they also appear twice in the latex code).

However, I do not want to “fix” all references in my thesis by adding “.png” to each occurrence and by deleting the preset replacement.

Also, I cannot fix the replacement like:
Replace: With:
If I do this, $@ is replaced by exactly what is given in the text (means that upper and lower cases are present). The corresponding “label” in the latex code is converted to lower cases. Again, the references cannot be set by latex because a mixed cases reference cannot be matched to a lower case label.

I would like to use Scrivener like I did before the upgrade. Are there any workarounds present? Is there any chance that this is fixed in the next upgrade?

Thanks in advance,

Quick question: are you using the Mac App Store version or the regular version?

I am using the regular version.

I have the same problem after a recent update. The search and replace seems to be happening twice, resulting in .png.png for the previous poster. In my case, I was automatically wrapping some elements in html comments: [code]

[/code] This escapes them through Multimarkdwon to LaTeX. After the recent update I now end up with the following in the Markdown file [code]


[/code] This, of course, produces a mess in LaTeX

It’s fine if you search for something and replace it with something else entirely, like: "A" –> "B" But if you try to include part of the search term in the replacement: "A" –> "AB" you end up actually getting: "A" –> "ABB"

So, at least I am not alone with this issue. :wink:
I do hope there is a fix soon.



as I have not received any information yet, I would like to ask if there is a solution and a fix. Thanks in advance!


I still can’t confirm this problem. I make heavy use of replacements, including the $@ token as well as regular expressions, and I have no abnormalities with the output in the latest versions. I created a test document with “” typed into it, and set up the following replacement:


And the compiled result was, “”.

(Just out of curiosity, why are you handling the conversion to LaTeX yourself, instead of letting MMD handle it? It’s got a much more flexible definition of a figure cross-reference in its processing engine than one line of replacement code. Why not just fix up the MMD syntax and let it handle the rest? I’m thinking something like, “](#$@)” to “](#$@.png)”.)

I’m not sure how to set up the second example provided by samrae, as only the result was shown. If I run the “AB” test with replacing “A” to “B”, the compiled result is “BB”, as expected.

So I need a bit more to go on, there must be some other setting common to you both that is making a mess.

Try starting from a completely blank new project and make a simple test that should replicate the problem.

Hi and thanks for your answer.

Unfortunately, it still does not work. I created a new project and inserted links to an image: , then I inserted a preset replacement: --> . In the exported latex file, this ends up as: \autoref{test.png.png}

I tried changing the flags for “Case Sensitive” and “Whole Word”, but this didn’t change anything. Also, I tried to omit the leading “[”, but the result is the same.

Regarding your question (“just out of curiosity”): this is exactly what I wrote at the beginning of my first post. I would like to (and need to) handle the autorefs by MMD.
Therefore I do not want to use the latex replacement “”. In fact, I cannot use this, because the filenames have upper and lower cases. This would be reflected in the autoref commands in latex - but the labels would have been converted to lower case. It would end up in \autoref{ThisIsAnImage} while the created label would be \label{thisisanimage}.


Oh hold up, are you creating a Scrivener Link from the image name to the graphic? When you compile to any MMD processed format, any Scrivener Link pointing to a graphic file in the Binder will have that file exported to the compile folder, and replace the hyperlinked text with the name of that file—thus tacking on the PNG for you. That’s the idea for that tool, you can just be sloppy and type out the name as it suits you, or even not the name at all, because in the end the filename will be generated precisely as it will be exported, replacing the hyperlinked text.