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