1 #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
6 \use_default_options false
17 \font_typewriter default
18 \font_default_family default
26 \default_output_format default
27 \bibtex_command default
28 \index_command default
29 \paperfontsize default
40 \paperorientation portrait
48 \paragraph_separation indent
49 \paragraph_indentation default
50 \quotes_language english
53 \paperpagestyle default
54 \tracking_changes false
74 \begin_layout Standard
75 The Advanced Find&Replace feature
79 \begin_layout Plain Layout
80 For suggestions, comments or clarification requests regarding this document,
81 as well as for notifying possible issues or bugs arising from the use of
82 this feature, please use the standard support channels of LyX (i.e., bug
83 tracking and mailing lists).
88 of LyX allows for searching of complex, format-sensitive text segments
89 and mathematics contents within LyX documents.
90 This constitutes an enhancement of the standard (quick) Find&Replace feature.
93 \begin_layout Standard
94 The set of capabilities of the
95 \begin_inset Quotes eld
99 \begin_inset Quotes erd
102 part of the enhanced Find&Replace feature may be summarised as follows:
105 \begin_layout Itemize
106 the text to search for is entered by means of a full-featured LyX mini-editor;
109 \begin_layout Itemize
110 searching of the entered text occurs both within text and within mathematical
111 formulas possibly present in the document;
114 \begin_layout Itemize
115 both searching of text and of mathematical formulas is allowed, where the
116 latter is done by entering mathematics in the usual way the LyX user is
117 accustomed to do; not only entire mathematical formulas are found, but
118 also parts occurring within more complex formulas;
121 \begin_layout Itemize
122 both case-sensitive and case-insensitive search is possible;
125 \begin_layout Itemize
126 search may be restricted so as to match only at word-boundaries;
129 \begin_layout Itemize
130 search may be format-insensitive, so that the searched text is found in
131 any context/style (standard text, section headings, notes, and even mathematics
132 ), or it may be format-sensitive, so that, for example, a word entered with
133 a section heading will only be found within section headings;
136 \begin_layout Itemize
137 search may be widened to a specific
141 , i.e., a set of files which may be all the children of the document being
142 edited, all the open files, or all the manuals available from the
149 \begin_layout Standard
150 The set of capabilities related to the
151 \begin_inset Quotes eld
155 \begin_inset Quotes erd
158 part of the Find&Replace feature may be summarised as follows:
161 \begin_layout Itemize
162 the replaced text may be entered by means of a full-featured LyX mini-editor;
165 \begin_layout Itemize
166 replace may optionally preserve capitalisation, so that the replaced text
167 capitalisation is adapted so as to mimic the one of the matching text (i.e.,
168 all lowercase, all uppercase, first uppercase followed by lowercase).
171 \begin_layout Standard
172 The Advanced Find&Replace feature is activated with a set of default options
173 which is suitable for the most common needs.
174 A detailed discussion of the available options follows in Sections
179 \begin_inset CommandInset ref
181 reference "sec:Basic-usage"
190 \begin_inset CommandInset ref
192 reference "sec:Advanced-usage"
199 \begin_layout Section
200 \begin_inset CommandInset label
202 name "sec:Basic-usage"
209 \begin_layout Standard
210 The advanced Find&Replace feature of LyX is activated through the [C-S-f]
211 sequence (Ctrl+Shift+f), or through the
213 Edit->Find&Replace (Advanced)
216 This causes the Advanced Find&Replace dialog to show up, as shown in Figure
221 \begin_inset CommandInset ref
223 reference "fig:AdvancedFindReplaceDialog"
228 \begin_inset Wrap figure
235 \begin_layout Plain Layout
236 \begin_inset Graphics
237 filename clipart/AdvancedFindAndReplace.png
245 \begin_layout Plain Layout
248 \begin_layout Plain Layout
249 \begin_inset CommandInset label
251 name "fig:AdvancedFindReplaceDialog"
255 The Advanced Find&Replace Dialog.
263 \begin_layout Plain Layout
272 \begin_layout Subsection
276 \begin_layout Standard
282 LyX mini-editor a simple word, and search for occurrences of it by clicking
287 button below it (or just pressing the
296 The entered word is found both in text mode and in math mode, and both
297 in emphasized, bold or normal face, and both in section titles and in standard
303 keeps searching forward.
308 searches for the entered text backwards.
311 \begin_layout Standard
316 option allows matches to occur only with the same case as entered in the
327 option allows matches to occur only at word boundaries.
330 \begin_layout Subsection
331 Searching for mathematics
334 \begin_layout Standard
335 Mathematical formulas may be searched for by typing in the
340 mini-editor a mathematical formula, such as
341 \begin_inset Formula $x^{2}$
344 or also something more complex like
345 \begin_inset Formula $\frac{x^{2}}{1+x^{2}}$
349 When searching for such formula, it is found both when it is alone and
350 when it occurs in subformulas and nested parts of subformulas, for example
351 the mentioned segments would be found in something like
352 \begin_inset Formula $\frac{x^{2}}{\sqrt{\frac{x^{2}}{1+x^{2}}}}.$
358 \begin_layout Subsection
362 \begin_layout Standard
363 It is also possible to search for text with specific styles.
364 This is done by switching to the
368 pane and unchecking the
376 \begin_layout Enumerate
382 LyX mini-editor a plain word and searching for it would not find instances
383 of the word occurring in emphasized or boldface.
386 \begin_layout Enumerate
392 LyX mini-editor an emphasized or boldface word and searching for it would
393 find the respective instances with same face only, and within the same
395 Note that, for example, an emphasized text is found not only when occurring
396 alone, but also when it is contained in a longer emphasized sentence.
399 \begin_layout Enumerate
405 LyX mini-editor a plain word and giving it a Section style from the style
406 selection dropdown menu, and searching for it, finds occurrences of if
407 only within Section titles.
408 Also, if the text to search is given an emphasized or bold face, in addition
413 style, then it is found only when occurring with the same style.
416 \begin_layout Enumerate
422 LyX mini-editor some mathematics in centered line math (C-S-m) mode, like
424 \begin_inset Formula \[
429 finds only instances of the text within the same kind of mathematical environmen
433 \begin_layout Subsection
437 \begin_layout Standard
438 The text segments matching the text entered in the
443 LyX mini-editor may be replaced with the text segments entered in the
449 In order to find the next occurrence and replace it, click on the
463 Alternatively, you can use the [
479 \begin_layout Standard
480 You can replace full-featured formatted LyX segments in place of the matching
481 text segments in your document.
482 Typical scenarios in which to use this capability may be (just to mention
486 \begin_layout Itemize
487 replacing occurrences of a word with a customized formatted version of the
488 same word, for example replacing occurrences of a name like
489 \begin_inset Quotes eld
493 \begin_inset Quotes erd
496 with its monospace version
499 \begin_inset Quotes eld
503 \begin_inset Quotes erd
509 \begin_layout Itemize
510 performing a notation rework of mathematical symbols, for example replacing
512 \begin_inset Quotes eld
516 \begin_inset Formula $R$
520 \begin_inset Quotes erd
524 \begin_inset Quotes eld
528 \begin_inset Formula $\mathbb{R}$
532 \begin_inset Quotes erd
535 (you may want to disable the
543 pane, in order to avoid replacing all
544 \begin_inset Quotes eld
548 \begin_inset Quotes erd
551 letters occurring in normal text), or occurrences of
552 \begin_inset Formula $x_{j}^{i}$
556 \begin_inset Formula $x_{i,\, j}$
560 \begin_inset Formula $x[k]$
564 \begin_inset Formula $x_{k}$
570 \begin_layout Section
571 \begin_inset CommandInset label
573 name "sec:Advanced-usage"
580 \begin_layout Subsection
581 About using regular expressions in the Find...
585 \begin_layout Standard
586 There is a regular expression based searching facility.
587 Users may arbitrarily insert, within text or math material to search for,
588 regexp-mode insets that allow to enter regular subexpressions.
589 This is done either through the
593 dropdown button or by the [C-S-r] key sequence.
594 Characters entered in the
599 LyX mini-editor within regexp insets are matched according to the regular
600 expression matching rules
604 \begin_layout Plain Layout
605 but under the constraint that any subexpression must match a well-formed
606 LyX text segment, i.e., when matching LaTeX code, no segments with unbalanced
607 {} braces are allowed to match subexpressions entered by the user.
612 , while text entered outside regexp insets is matched exactly against the
613 same text in the document.
614 Note that it is allowed to cut and paste regexp-mode insets as usual.
615 Examples of using such a feature may be:
618 \begin_layout Enumerate
619 Searching for all fractions with a given denominator: for example, entering
625 LyX mini-editor the fraction
626 \begin_inset Formula $\frac{.*}{1+x^{2}}$
630 \begin_inset Formula $.*$
633 on the numerator is the match-everything regular expression that may be
634 added by clicking on the
636 [Match...]->[Anything]
638 button, or entering the regexp-mode through the [C-S-r] key sequence and
640 \begin_inset Formula $.*$
643 ) finds all fractions with the given denominator.
646 \begin_layout Enumerate
647 Searching for all text with a given style: for example, after unchecking
659 \begin_inset Formula $.*$
664 regular expression and adding it an emphasized or bold face, finds all
665 emphasized and bold face text, respectively.
667 \begin_inset Formula $.*$
670 regular expression a bullet-list, enumerated or Section style, you can
671 find all bullet or enumerated lists, or section titles.
674 \begin_layout Standard
675 Finally, references to subexpressions in regular expressions may be used
676 as usual, enclosing parts of the expression within round braces
677 \begin_inset Formula $()$
680 , and referring back to them through
681 \begin_inset Formula $\backslash1$
685 \begin_inset Formula $\backslash2$
689 \begin_inset Formula $\backslash$
692 symbol is entered in regular-expression mode by pressing twice the backslash
694 For example, try searching for the
695 \begin_inset Formula $([a-z]+)[[:blank:]]\backslash1$
698 regular expression in order to find word repetitions, if any.
701 \begin_layout Standard
702 Note that back references work both when occurring within the same regular
703 expression, and when occurring in multiple different regular expressions,
704 where numbering of back-referenced sub-expressions is absolute, i.e.,
705 \begin_inset Formula $\backslash1$
708 always refers to the first occurrence of
709 \begin_inset Formula $()$
712 in all entered regular expressions.
715 \begin_layout Standard
716 Note that the use of back references in the replaced text is not (yet) implement