underline to italic?

Everything related to our flagship word processor.
Post Reply
soliphint
Posts: 58
Joined: 2006-08-01 06:52:10

underline to italic?

Post by soliphint »

I have tried to Find/Replace all underlined words with italic, but cannot seem to make it happen. Is there an obvious way to do this that I'm missing?
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: underline to italic?

Post by Þorvarður »

soliphint wrote:I have tried to Find/Replace all underlined words with italic, but cannot seem to make it happen. Is there an obvious way to do this that I'm missing?
Did you enable “Attribute Sensitive” and “Replace Attributes” in the Find/Replace box?
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: underline to italic?

Post by adryan »

G’day, soliphint et al

Yes, it is a bit tricky.

Using PowerFind Pro, the Find expression is “.+” (without the quotes). Here I have typed in “.+”, selected it and underlined it (Cmd-U). Tick the Ignore Case and Attribute Sensitive checkboxes and untick the Whole Word checkbox. You’ve probably done all this already.

For the Replace expression, type “\0” (without the quotes). But this found text incorporates an underline, although it’s not obvious in the expression. The trick to removing it is to select the “\0”, then Format > Underline > None. Now italicize it (Cmd-I), tick the Replace Attributes checkbox, untick the Match Case checkbox and then Replace All.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
soliphint
Posts: 58
Joined: 2006-08-01 06:52:10

Re: underline to italic?

Post by soliphint »

Thank you very much. I don't understand it, but I'm going to give it a try. Thanks again!
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: underline to italic?

Post by Þorvarður »

soliphint wrote:Thank you very much. I don't understand it
No problem. We are here to help. :D

Tell us what font and size you are using, and what you have been doing so far, step by step, — like this:

1. First I did this…
2. Then I did this …
3 … and then I did this

This is actually a very simple operation. You don’t need any PowerFind Pro.
sh.png
sh.png (62.75 KiB) Viewed 12853 times
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: underline to italic?

Post by phspaelti »

The main reason that attribute sensitive searches fail is usually that the find expression contains some unwanted formatting. This typically can happen if you copy something into the find box, or if you type into a find box that was not empty. Check the "Format" menu to see if any unwanted attributes or styles are applied. If necessary choose "Any Attributes" to remove all attributes, and then reapply only the desired ones.

If it still doesn't work, *un*check the "Attribute Sensitive" box and make sure the Find finds something. Then re-check the "Attribute Sensitive" box. If the first works and the second doesn't, the problem is probably an unwanted formatting attribute.
philip
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: underline to italic?

Post by adryan »

G’day, Þorvarður et al

I assumed that soliphint wanted to remove the underline attribute from the newly italicized text. My suggested approach does this, whereas Þorvarður’s approach will leave the text both italicized and underlined. It’s really a question of what the desired result is. This has nothing to do with the choice of PowerFind versus PowerFind Pro.

Just to elucidate my previous posting….

In a PowerFind Pro Find expression, “.” means “any character (except a paragraph return and such-like)” and “+” means “one or more of the preceding”.

So “.+” means “the largest sequence of contiguous characters (subject to some condition)”. This would generally find everything between the cursor and the next paragraph return. But underlining the expression and ticking the Attribute Sensitive checkbox sets the condition to “the largest sequence of contiguous underlined characters”.

In the Replace expression, “\0” represents everything found by the Find operation. (That’s a zero, by the way.)

Format > Underline > None

This is what I hoped would readily be understood as referring to a command in Nisus Writer Pro’s hierarchical menu system.

I hope this helps.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
credneb
Posts: 187
Joined: 2007-03-28 07:30:34

Re: underline to italic?

Post by credneb »

You can also use the find expressions already described and just Find All.

Then dismiss the F/R dialog, and manually apply the changes you want while all of the found selections are still selected (highlighted).

So if you want to remove the underline and apply italic, simply cmd-U and then cmd-I -- or select them from the formatting menu or panel.
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: underline to italic?

Post by Þorvarður »

adryan wrote:Þorvarður’s approach will leave the text both italicized and underlined
Here is what I do:

1. Underline some text
2. Open up the Find/Replace box using PowerFind
3. Enter “Any Text” bubble in the Find field
4. Select the bubble and assign it the attribute Underline Single
5. Enter “Found” bubble in the Replace field
6. Select “Found” bubble and assign it the attribute Italic
7. While still selected, assign it the attribute Underline Single
8. Repeat step 7

This works perfectly. The text is now in italic, but not underlined. No PowerFind Pro needed. :-)
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: underline to italic?

Post by adryan »

G’day, Þorvarður et al

Ah, now the truth comes out! You have applied the Underline Single attribute twice, which was not evident in your previous posting. So yes, that works.

Others should be aware that it is immaterial whether one uses PowerFind or PowerFind Pro in this situation. The main point is that the Found or \0 expression in the Replace field incorporates a hidden Underline attribute that must be dealt with somehow.

Of course, credneb’s method works also, but I took it that soliphint was having difficulty getting it all to work in a single step using Find/Replace.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
adryan
Posts: 561
Joined: 2014-02-08 12:57:03
Location: Australia

Re: underline to italic?

Post by adryan »

G’day, jameswrecky et al

Nisus Writer offers 3 different ways of performing Find/Replace operations. You have probably found them listed in the Using drop-down menu in the Find/Replace dialog box.

Normal Find is good if you know exactly what you wish to find or replace. It’s pretty straightforward.

PowerFind and PowerFind Pro allow you to find things which are somewhat indefinite. For example, you could find every word ending in “ing” without knowing in advance what those words were. As another example, you could convert dates in “DD.MM.YYYY” format to “YYYY-MM-DD” format.

PowerFind Pro uses regular expressions (“regex”) or generalized regular expression parsing (“grep”). It’s a sort of symbolic language. For example, “\n” means “paragraph return”. “b+?” means “the shortest sequence of consecutive b’s”. Experienced users can develop very complicated expressions for surgically precise manipulations of text. All of this is explained in the Nisus Writer Pro Help and in the Macro Language Reference. A word processor without grep is a toy.

The complexity of regular expressions can be a bit daunting for beginners. (It helps if you have a background in Mathematics, Symbolic Logic or Forth programming!) So Nisus provides PowerFind as a more user-friendly medium where most of the symbols are replaced by easily recognized words. Play around with choosing items from the cogwheel drop-down menu to the left of the Find field in the dialog box.

Be aware that tailoring your Find and Replace expressions (especially with grep) can be tricky, even for experienced users. The computer will do what you tell it to do, which may not always be what you actually want it to do. So be prepared to use the Undo command if necessary. If you really want to play it safe with mission-critical documents, operate on a duplicate until you are sure all is well.

I hope this helps.

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
Post Reply