Ask Your Question
0

how to use search & replace to make superscripts?

asked 2017-10-07 04:32:52 +0100

catbill gravatar image

I am editing a document and want to change numbers used in scientific notation to superscript. For example, I would like to make all occurences of -5 appear as superscripts. There must be a way to use search and replace to change all -5s, then all -6s, etc. I just don't want to make each change individually.

In the search and replace window, there is a superscript option. However, it searches for superscripts. I don't want it to do that but rather to change normal numbers to superscripts. What am I missing?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2017-10-07 06:03:43 +0100

robleyd gravatar image

Search for the value you want to change using Find all - once found the values will be selected and you can apply a pre-existing style, or use Format | Character to change the selections to superscript.

If this answer helped you, please accept it by clicking the check mark ✔ to the left and, karma permitting, upvote it. If this resolves your problem, close the question, that will help other people with the same question.

edit flag offensive delete link more

Comments

Thank you, robleyd. I should have thought about that. It would often work just fine but sometimes I may want to make changes on a case-by-case basis. Any way to do that?

catbill gravatar imagecatbill ( 2017-10-07 06:20:28 +0100 )edit

If by case-by-case you mean some but not all of the e.g. -5 then unless there is an additional search parameter that will identify the cases - for example followed by a full stop - then you'll need to do them individually.

And remember you can use regular expressions to find.

robleyd gravatar imagerobleyd ( 2017-10-07 07:18:09 +0100 )edit
1

answered 2017-10-07 08:56:53 +0100

You can use some RegExp magic.

Let's assume you are searching for something like 10-5 or 10-77 but not 11-2 or 10 - 7 (notice the space), and you want to select the negative exponents only to raise them. Open the full search-replace tool with Ctrl H → More options → check Regular expressions. On the Search box type something like

(?<=0)-[:digit:]+

This is a "look-behind expression" that search for a "minus" (here a dash, if your text have real "minus signs" --U+2212-- you'll need to change the expression accordingly) and one or more digits that follows a zero, but without selecting the zero. Of course it will be quite difficult to find positive exponents without messing up proper numbers, but at least you have something :)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-10-07 04:32:52 +0100

Seen: 22 times

Last updated: Oct 07