]> git.lyx.org Git - lyx.git/blob - lib/doc/AdvancedSearch.lyx
Regenerate lfuns.lyx
[lyx.git] / lib / doc / AdvancedSearch.lyx
1 #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
2 \lyxformat 408
3 \begin_document
4 \begin_header
5 \textclass amsart
6 \use_default_options false
7 \begin_modules
8 theorems-ams
9 eqs-within-sections
10 figs-within-sections
11 \end_modules
12 \maintain_unincluded_children false
13 \language english
14 \inputencoding auto
15 \fontencoding global
16 \font_roman default
17 \font_sans default
18 \font_typewriter default
19 \font_default_family default
20 \use_xetex false
21 \font_sc false
22 \font_osf false
23 \font_sf_scale 100
24 \font_tt_scale 100
25
26 \graphics default
27 \default_output_format default
28 \output_sync 0
29 \bibtex_command default
30 \index_command default
31 \paperfontsize default
32 \spacing single
33 \use_hyperref false
34 \papersize default
35 \use_geometry false
36 \use_amsmath 1
37 \use_esint 1
38 \use_mhchem 1
39 \use_mathdots 1
40 \cite_engine basic
41 \use_bibtopic false
42 \use_indices false
43 \paperorientation portrait
44 \suppress_date false
45 \use_refstyle 0
46 \index Index
47 \shortcut idx
48 \color #008000
49 \end_index
50 \secnumdepth 3
51 \tocdepth 3
52 \paragraph_separation indent
53 \paragraph_indentation default
54 \quotes_language english
55 \papercolumns 1
56 \papersides 1
57 \paperpagestyle default
58 \tracking_changes false
59 \output_changes false
60 \html_math_output 0
61 \html_be_strict true
62 \end_header
63
64 \begin_body
65
66 \begin_layout Title
67 Advanced Find&Replace
68 \end_layout
69
70 \begin_layout Author
71 by the LyX Team
72 \end_layout
73
74 \begin_layout Section
75 Introduction
76 \end_layout
77
78 \begin_layout Standard
79 The Advanced Find&Replace feature
80 \begin_inset Foot
81 status collapsed
82
83 \begin_layout Plain Layout
84 For suggestions, comments or clarification requests regarding this document,
85  as well as for notifying possible issues or bugs arising from the use of
86  this feature, please use the standard support channels of LyX (i.e., bug
87  tracking and mailing lists).
88 \end_layout
89
90 \end_inset
91
92  of LyX allows for searching of complex, format-sensitive text segments
93  and mathematics contents within LyX documents.
94  This constitutes an enhancement of the standard (quick) Find&Replace feature.
95 \end_layout
96
97 \begin_layout Standard
98 The set of capabilities of the 
99 \begin_inset Quotes eld
100 \end_inset
101
102 Find
103 \begin_inset Quotes erd
104 \end_inset
105
106  part of the enhanced Find&Replace feature may be summarised as follows:
107 \end_layout
108
109 \begin_layout Itemize
110 the text to search for is entered by means of a full-featured LyX mini-editor;
111 \end_layout
112
113 \begin_layout Itemize
114 searching of the entered text occurs both within text and within mathematical
115  formulas possibly present in the document;
116 \end_layout
117
118 \begin_layout Itemize
119 both searching of text and of mathematical formulas is allowed, where the
120  latter is done by entering mathematics in the usual way the LyX user is
121  accustomed to do; not only entire mathematical formulas are found, but
122  also parts occurring within more complex formulas;
123 \end_layout
124
125 \begin_layout Itemize
126 both case-sensitive and case-insensitive search is possible;
127 \end_layout
128
129 \begin_layout Itemize
130 search may be restricted so as to match only at word-boundaries;
131 \end_layout
132
133 \begin_layout Itemize
134 search may be format-insensitive, so that the searched text is found in
135  any context/style (standard text, section headings, notes, and even mathematics
136 ), or it may be format-sensitive, so that, for example, a word entered with
137  a section heading will only be found within section headings;
138 \end_layout
139
140 \begin_layout Itemize
141 search may be widened to a specific 
142 \emph on
143 scope
144 \emph default
145 , i.e., a set of files which may be all the children of the document being
146  edited, all the open files, or all the manuals available from the 
147 \noun on
148 Help
149 \noun default
150  menu.
151 \end_layout
152
153 \begin_layout Standard
154 The set of capabilities related to the 
155 \begin_inset Quotes eld
156 \end_inset
157
158 Replace
159 \begin_inset Quotes erd
160 \end_inset
161
162  part of the Find&Replace feature may be summarised as follows:
163 \end_layout
164
165 \begin_layout Itemize
166 the replaced text may be entered by means of a full-featured LyX mini-editor;
167 \end_layout
168
169 \begin_layout Itemize
170 replace may optionally preserve capitalisation, so that the replaced text
171  capitalisation is adapted so as to mimic the one of the matching text (i.e.,
172  all lowercase, all uppercase, first uppercase followed by lowercase).
173 \end_layout
174
175 \begin_layout Standard
176 The Advanced Find&Replace feature is activated with a set of default options
177  which is suitable for the most common needs.
178  A detailed discussion of the available options follows in Sections
179 \begin_inset space ~
180 \end_inset
181
182
183 \begin_inset CommandInset ref
184 LatexCommand ref
185 reference "sec:Basic-usage"
186
187 \end_inset
188
189  and
190 \begin_inset space ~
191 \end_inset
192
193
194 \begin_inset CommandInset ref
195 LatexCommand ref
196 reference "sec:Advanced-usage"
197
198 \end_inset
199
200 .
201 \end_layout
202
203 \begin_layout Section
204 \begin_inset CommandInset label
205 LatexCommand label
206 name "sec:Basic-usage"
207
208 \end_inset
209
210 Basic usage
211 \end_layout
212
213 \begin_layout Standard
214 The advanced Find&Replace feature of LyX is activated through the [C-S-f]
215  sequence (Ctrl+Shift+f), or through the 
216 \noun on
217 Edit->Find&Replace (Advanced)
218 \noun default
219  menĂ¹ item.
220  This causes the Advanced Find&Replace dialog to show up, as shown in Figure
221 \begin_inset space ~
222 \end_inset
223
224
225 \begin_inset CommandInset ref
226 LatexCommand ref
227 reference "fig:AdvancedFindReplaceDialog"
228
229 \end_inset
230
231 .
232 \begin_inset Wrap figure
233 lines 0
234 placement O
235 overhang 0in
236 width "40col%"
237 status open
238
239 \begin_layout Plain Layout
240 \begin_inset Graphics
241         filename clipart/AdvancedFindAndReplace.png
242         lyxscale 60
243         width 4cm
244
245 \end_inset
246
247
248 \end_layout
249
250 \begin_layout Plain Layout
251 \begin_inset Caption
252
253 \begin_layout Plain Layout
254 \begin_inset CommandInset label
255 LatexCommand label
256 name "fig:AdvancedFindReplaceDialog"
257
258 \end_inset
259
260 The Advanced Find&Replace Dialog.
261 \end_layout
262
263 \end_inset
264
265
266 \end_layout
267
268 \end_inset
269
270
271 \end_layout
272
273 \begin_layout Subsection
274 Searching for text
275 \end_layout
276
277 \begin_layout Standard
278 Enter into the 
279 \noun on
280 Find...
281
282 \noun default
283  LyX mini-editor a simple word, and search for occurrences of it by clicking
284  on the 
285 \noun on
286 Next
287 \noun default
288  button below it (or just pressing the 
289 \noun on
290 [Return]
291 \noun default
292  or 
293 \noun on
294 [Enter
295 \noun default
296 ] keys).
297  The entered word is found both in text mode and in math mode, and both
298  in emphasized, bold or normal face, and both in section titles and in standard
299  text.
300  Pressing repeatedly 
301 \noun on
302 [Enter]
303 \noun default
304  keeps searching forward.
305  Similarly, pressing 
306 \noun on
307 [Shift+Enter]
308 \noun default
309  searches for the entered text backwards.
310 \end_layout
311
312 \begin_layout Standard
313 While searching, the 
314 \noun on
315 case sensitive
316 \noun default
317  option allows matches to occur only with the same case as entered in the
318  
319 \noun on
320 Find...
321
322 \noun default
323  box.
324  The 
325 \noun on
326 whole words
327 \noun default
328  option allows matches to occur only at word boundaries.
329 \end_layout
330
331 \begin_layout Subsection
332 Searching for mathematics
333 \end_layout
334
335 \begin_layout Standard
336 Mathematical formulas may be searched for by typing in the 
337 \noun on
338 Find...
339
340 \noun default
341  mini-editor a mathematical formula, such as 
342 \begin_inset Formula $x^{2}$
343 \end_inset
344
345  or also something more complex like 
346 \begin_inset Formula $\frac{x^{2}}{1+x^{2}}$
347 \end_inset
348
349 .
350  When searching for such formula, it is found both when it is alone and
351  when it occurs in subformulas and nested parts of subformulas, for example
352  the mentioned segments would be found in something like 
353 \begin_inset Formula $\frac{x^{2}}{\sqrt{\frac{x^{2}}{1+x^{2}}}}.$
354 \end_inset
355
356
357 \end_layout
358
359 \begin_layout Subsection
360 Style-aware search
361 \end_layout
362
363 \begin_layout Standard
364 It is also possible to search for text with specific styles.
365  This is done by switching to the 
366 \noun on
367 Advanced
368 \noun default
369  pane and unchecking the 
370 \noun on
371 ignore format
372 \noun default
373  option.
374  This way:
375 \end_layout
376
377 \begin_layout Enumerate
378 Entering in the 
379 \noun on
380 Find...
381
382 \noun default
383  LyX mini-editor a plain word and searching for it would not find instances
384  of the word occurring in emphasized or boldface.
385 \end_layout
386
387 \begin_layout Enumerate
388 Entering in the 
389 \noun on
390 Find...
391
392 \noun default
393  LyX mini-editor an emphasized or boldface word and searching for it would
394  find the respective instances with same face only, and within the same
395  text style only.
396  Note that, for example, an emphasized text is found not only when occurring
397  alone, but also when it is contained in a longer emphasized sentence.
398 \end_layout
399
400 \begin_layout Enumerate
401 Entering in the 
402 \noun on
403 Find...
404
405 \noun default
406  LyX mini-editor a plain word and giving it a Section style from the style
407  selection dropdown menu, and searching for it, finds occurrences of if
408  only within Section titles.
409  Also, if the text to search is given an emphasized or bold face, in addition
410  to a 
411 \noun on
412 Section
413 \noun default
414  style, then it is found only when occurring with the same style.
415 \end_layout
416
417 \begin_layout Enumerate
418 Entering in the 
419 \noun on
420 Find...
421
422 \noun default
423  LyX mini-editor some mathematics in centered line math (C-S-m) mode, like
424  this 
425 \begin_inset Formula \[
426 x^{2}
427 \]
428
429 \end_inset
430
431 finds only instances of the text within the same kind of mathematical environmen
432 t.
433 \end_layout
434
435 \begin_layout Subsection
436 Replace
437 \end_layout
438
439 \begin_layout Standard
440 The text segments matching the text entered in the 
441 \noun on
442 Find...
443
444 \noun default
445  LyX mini-editor may be replaced with the text segments entered in the 
446 \noun on
447 Replace...
448
449 \noun default
450  LyX mini-editor.
451  In order to find the next occurrence and replace it, click on the 
452 \noun on
453 Next
454 \noun default
455  and 
456 \noun on
457 Prev
458 \noun default
459  buttons below the 
460 \noun on
461 Replace...
462
463 \noun default
464  mini-editor.
465  Alternatively, you can use the [
466 \noun on
467 Enter
468 \noun default
469 ] and [
470 \noun on
471 Shift+Enter
472 \noun default
473 ] keys while in the 
474 \noun on
475 Replace...
476
477 \noun default
478  LyX mini-editor.
479 \end_layout
480
481 \begin_layout Standard
482 You can replace full-featured formatted LyX segments in place of the matching
483  text segments in your document.
484  Typical scenarios in which to use this capability may be (just to mention
485  a few):
486 \end_layout
487
488 \begin_layout Itemize
489 replacing occurrences of a word with a customized formatted version of the
490  same word, for example replacing occurrences of a name like 
491 \begin_inset Quotes eld
492 \end_inset
493
494 func()
495 \begin_inset Quotes erd
496 \end_inset
497
498  with its monospace version 
499 \family typewriter
500
501 \begin_inset Quotes eld
502 \end_inset
503
504 func()
505 \begin_inset Quotes erd
506 \end_inset
507
508 ;
509 \end_layout
510
511 \begin_layout Standard
512 performing a notation rework of mathematical symbols, for example replacing
513  occurrences of 
514 \begin_inset Quotes eld
515 \end_inset
516
517
518 \begin_inset Formula $R$
519 \end_inset
520
521
522 \begin_inset Quotes erd
523 \end_inset
524
525  with 
526 \begin_inset Quotes eld
527 \end_inset
528
529
530 \begin_inset Formula $\mathbb{R}$
531 \end_inset
532
533
534 \begin_inset Quotes erd
535 \end_inset
536
537  (you may want to enable the 
538 \noun on
539 whole-words
540 \noun default
541  and 
542 \noun on
543 case-sensitive
544 \noun default
545  options and disable the 
546 \family typewriter
547 \noun on
548 Ignore Format
549 \family default
550 \noun default
551  option in the 
552 \family typewriter
553 \noun on
554 Advanced
555 \family default
556 \noun default
557  pane, in order to avoid replacing all 
558 \begin_inset Quotes eld
559 \end_inset
560
561 R
562 \begin_inset Quotes erd
563 \end_inset
564
565  letters occurring in normal text), or occurrences of 
566 \begin_inset Formula $x_{j}^{i}$
567 \end_inset
568
569  with 
570 \begin_inset Formula $x_{i,\, j}$
571 \end_inset
572
573 , or occurrences of 
574 \begin_inset Formula $x[k]$
575 \end_inset
576
577  with 
578 \begin_inset Formula $x_{k}$
579 \end_inset
580
581 .
582 \end_layout
583
584 \begin_layout Section
585 \begin_inset CommandInset label
586 LatexCommand label
587 name "sec:Advanced-usage"
588
589 \end_inset
590
591 Advanced usage
592 \end_layout
593
594 \begin_layout Subsection
595 About using regular expressions in the Find...
596  box
597 \end_layout
598
599 \begin_layout Standard
600 There is a regular expression based searching facility.
601  Users may arbitrarily insert, within text or math material to search for,
602  regexp-mode insets that allow to enter regular subexpressions.
603  This is done either through the 
604 \noun on
605 [Match...]
606 \noun default
607  dropdown button or by the [C-S-r] key sequence.
608  Characters entered in the 
609 \noun on
610 Find...
611
612 \noun default
613  LyX mini-editor within regexp insets are matched according to the regular
614  expression matching rules
615 \begin_inset Foot
616 status collapsed
617
618 \begin_layout Plain Layout
619 but under the constraint that any subexpression must match a well-formed
620  LyX text segment, i.e., when matching LaTeX code, no segments with unbalanced
621  {} braces are allowed to match subexpressions entered by the user.
622 \end_layout
623
624 \end_inset
625
626 , while text entered outside regexp insets is matched exactly against the
627  same text in the document.
628  Note that it is allowed to cut and paste regexp-mode insets as usual.
629  Examples of using such a feature may be:
630 \end_layout
631
632 \begin_layout Enumerate
633 Searching for all fractions with a given denominator: for example, entering
634  in the 
635 \noun on
636 Find...
637
638 \noun default
639  LyX mini-editor the fraction 
640 \begin_inset Formula $\frac{.*}{1+x^{2}}$
641 \end_inset
642
643  (where the 
644 \begin_inset Formula $.*$
645 \end_inset
646
647  on the numerator is the match-everything regular expression that may be
648  added by clicking on the 
649 \noun on
650 [Match...]->[Anything]
651 \noun default
652  button, or entering the regexp-mode through the [C-S-r] key sequence and
653  by typing 
654 \begin_inset Formula $.*$
655 \end_inset
656
657 ) finds all fractions with the given denominator.
658 \end_layout
659
660 \begin_layout Enumerate
661 Searching for all text with a given style: for example, after unchecking
662  the 
663 \noun on
664 Ignore Format
665 \noun default
666  option from the 
667 \noun on
668 Advanced
669 \noun default
670  pane, entering a 
671 \series bold
672
673 \begin_inset Formula $.*$
674 \end_inset
675
676
677 \series default
678  regular expression and adding it an emphasized or bold face, finds all
679  emphasized and bold face text, respectively.
680  Also, giving to the 
681 \begin_inset Formula $.*$
682 \end_inset
683
684  regular expression a bullet-list, enumerated or Section style, you can
685  find all bullet or enumerated lists, or section titles.
686 \end_layout
687
688 \begin_layout Standard
689 Finally, references to subexpressions in regular expressions may be used
690  as usual, enclosing parts of the expression within round braces 
691 \begin_inset Formula $()$
692 \end_inset
693
694 , and referring back to them through 
695 \begin_inset Formula $\backslash1$
696 \end_inset
697
698
699 \begin_inset Formula $\backslash2$
700 \end_inset
701
702 , etc..., where a 
703 \begin_inset Formula $\backslash$
704 \end_inset
705
706  symbol is entered in regular-expression mode by pressing twice the backslash
707  key.
708  For example, try searching for the 
709 \begin_inset Formula $([a-z]+)[[:blank:]]\backslash1$
710 \end_inset
711
712  regular expression in order to find word repetitions, if any.
713 \end_layout
714
715 \begin_layout Standard
716 Note that back references work both when occurring within the same regular
717  expression, and when occurring in multiple different regular expressions,
718  where numbering of back-referenced sub-expressions is absolute, i.e., 
719 \begin_inset Formula $\backslash1$
720 \end_inset
721
722  always refers to the first occurrence of 
723 \begin_inset Formula $()$
724 \end_inset
725
726  in all entered regular expressions.
727 \end_layout
728
729 \begin_layout Standard
730 Note that the use of back references in the replaced text is not (yet) implement
731 ed.
732 \end_layout
733
734 \end_body
735 \end_document