# Re: Find All and Emphasize

Hi all,


I'd like to mention that, with the patch I committed right now on the SVN, the current version of LyX from trunk implements correctly this kind of feature, i.e., you can search for a plain word and replace it with its emphasized or boldface version, or search for some text (i.e., X1) and replace it with a math symbol ($X_1$), or you can search for some maths (i.e., $X^1$) and replace it with some rework of it (i.e., $Y_1$), etc.. I know there are many use-cases, and I hope somebody helps in identifying the most important ones and/or possible issues.

Regards,

Tommaso

Tommaso Cucinotta ha scritto:

Bruce Pourciau ha scritto:

On Aug 12, 2009, at 5:38 PM, rgheck wrote:

On 08/12/2009 04:34 PM, Bruce Pourciau wrote:

Is there a simple way to go back through a document and italicize
(emphasize) all occurrences of a certain word?


Not within LyX itself. The best way to do it is to run a script of some
sort on the .lyx file. E.g.:


sed -e 's/ that / \n\n\\emph on\nthat\n\\emph default\n /g' < t.lyx >tt.lyx

is a dumb sed one-liner that almost does it.

This is acutally the usage scenario I'm trying to target with the "Find LyX..." (a.k.a., Advanced Search or Find Advanced) feature of LyX 2.0.0 from svn. There, you can enter arbitrarily complex LyX text inside the Replace... area, so that you can do (in principle) exactly what you are seeking for. It doesn't work perfectly fine, as of now, for example, in your case, after the replacement, you would get a set of "\emph{word}" instead of the word emphasized, but I think it won't be difficult to fix such issues.


Of course, for the advanced user, the text-based search/replace made directly on the .lyx file with a text editor, is the only thing you can do with the current official LyX releases, and it works (unless you make mistakes -- backup first).

Bye,

Tommaso