How to use a token more than once in a replacement?

I need to include figure images in my compiled manuscript. Additionally, I need to include a note to the production team below the image specifying the image file name. To do this, I include something like this in the manuscript:

PD: comp place image01.tif here

This works thanks to the wonderful $img tag, but it’s a lot of typing. And I must type in the image file name twice. Then I thought of replacements and how a project replacement could be used to replace a short form with these two lines.

So I created the project replacement:

The with for this replacement is:
PD: comp place $@.tif here

And in my manuscript I type something like:

When I compile the manuscript, the replacement only replaces the first occurrence of $@ in the with string. It does not replace the second occurrence.

Is it possible to have the project replace feature substitute each occurrence of $@ found in the with statement?


That’s a good idea, but unfortunately you can’t use the stored replacement value twice.

Can the production team be educated to search for and use the <$img tag as their cue instead of the plain-text note? If so perhaps highlight or text colour could be used to indicate whether an image has been addressed (if that is necessary; I’m assuming the removal of the note is the current indicator).

Thanks for the reply. Guess I’ll submit a feature request.

Just an FYI for my particular situation…having the images in the compiled Word document is a nice to have for the tech reviewers. It gives them a chance to see the image inline with the content instead of looking at the image separately outside of the document. Having the production team search for the <$img tag doesn’t work because it’s the compiled Word document that I submit to the publisher and that tag is not present in the compiled document.

Long story short, my publisher requires the manuscript to be in a Word document formatted using their Word template. At this point, the production note is no longer just plain text, but text formatted with a specific style. It’s a complicated mess, but it works for them.

My current work around is to use TextExpander. I setup a TextExpander shortcut that inserts the two lines while requiring me to only type the image file name once. This works fine, but I still hope that some day replacements will allow the stored value to be used twice.

Thanks again,

Okay, got it, that makes sense. I use a similar tool, Typinator, for a wide range of tasks like this. They are really indispensable tools. Just so you know I did put forward the idea of variable duplication on output in Replacements back when the feature was developed, and Keith wasn’t keen on it then, so you can give it a shot, but it’s working the way it was intended for now.