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