Keeping Tags from breaking


I am using tags in my dissertation and I have a number of tags that break across a line. They do not seem to work if they break. What is the best way to keep them from breaking? The word joiner function does not work, because it puts a character in the tag.


What are you referring to as “tags”? The software doesn’t have a feature referred to by that name, and the only thing somewhat close to that is “Keywords”, but they are not typically presented in the text area.

I am referring to the auto-numbering tags that might look something like this:
Figure 4.<$n#ch4_figure:chapter4>.

How do you prevent them from breaking across a line?


Ah my mistake, I get what you mean now. So you just mean visually in the editor—to keep things tidy? Because of course when you compile that whole thing will be compacted down into the number ‘21’ or whatever, and should not be subject to any unruly soft line breaks. If you are just meaning in the editor, there isn’t a way to do that without inserting control characters like the word joiner.

Unfortunately we don’t have any control over the wrapping model, that’s provided by the text engine.

One possibility, if you don’t use word joiners elsewhere, is to use compile Replacements to strip them out. Replacements are evaluated before placeholder tags are (so that you can programmatically modify them). In my testing this appears to work fine. You’ll need to insert a word joiner in a text editor, then Shift-arrow over it to select it and then you can cut and paste into the Replacements field. It’s a zero-width character so when you do this you shouldn’t see anything selected, but the footer bar will indicate that one character is selected.

I found the Replacements solution works, but I noticed changing ~ to (word joiner)~ introduced TWO word joiners. That’s probably not a problem, but I added a second Replacement that changes two word joiners to one — and that worked!

Yeah, that’s a known bug that occurs because Replacements run multiple times in the compile process. If the replacement string contains enough of the original find string then it matches again and runs the original replacement again.