]> git.lyx.org Git - lyx.git/blob - lib/doc/AdvancedSearch.lyx
A little more XHTML documentation. This is on generated CSS.
[lyx.git] / lib / doc / AdvancedSearch.lyx
1 #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
2 \lyxformat 374
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 \begin_inset Foot
65 status collapsed
66
67 \begin_layout Plain Layout
68 This document is currently maintained by Tommaso Cucinotta, the main developer
69  of this feature at the moment.
70  For suggestions, comments or clarification requests regarding this document,
71  as well as for notifying possible issues or bugs arising from the use of
72  this feature, please use the standard support channels of LyX (i.e., bug
73  tracking and mailing lists).
74 \end_layout
75
76 \end_inset
77
78
79 \end_layout
80
81 \begin_layout Author
82 by the LyX Team
83 \end_layout
84
85 \begin_layout Section
86 Introduction
87 \end_layout
88
89 \begin_layout Standard
90 The Advanced Find&Replace feature of LyX allows for searching of complex,
91  format-sensitive text segments and mathematics contents within LyX documents.
92  This constitutes an enhancement of the standard (quick) Find&Replace feature.
93 \end_layout
94
95 \begin_layout Standard
96 The set of capabilities of the 
97 \begin_inset Quotes eld
98 \end_inset
99
100 Find
101 \begin_inset Quotes erd
102 \end_inset
103
104  part of the enhanced Find&Replace feature may be summarised as follows:
105 \end_layout
106
107 \begin_layout Itemize
108 the text to search for is entered by means of a full-featured LyX mini-editor;
109 \end_layout
110
111 \begin_layout Itemize
112 searching of the entered text occurs both within text and within mathematical
113  formulas possibly present in the document;
114 \end_layout
115
116 \begin_layout Itemize
117 both searching of text and of mathematical formulas is allowed, where the
118  latter is done by entering mathematics in the usual way the LyX user is
119  accustomed to do; not only entire mathematical formulas are found, but
120  also parts occurring within more complex formulas;
121 \end_layout
122
123 \begin_layout Itemize
124 both case-sensitive and case-insensitive search is possible;
125 \end_layout
126
127 \begin_layout Itemize
128 search may be restricted so as to match only at word-boundaries;
129 \end_layout
130
131 \begin_layout Itemize
132 search may be format-insensitive, so that the searched text is found in
133  any context/style (standard text, section headings, notes, and even mathematics
134 ), or it may be format-sensitive, so that, for example, a word entered with
135  a section heading will only be found within section headings.
136 \end_layout
137
138 \begin_layout Standard
139 The set of capabilities related to the 
140 \begin_inset Quotes eld
141 \end_inset
142
143 Replace
144 \begin_inset Quotes erd
145 \end_inset
146
147  part of the Find&Replace feature may be summarised as follows:
148 \end_layout
149
150 \begin_layout Itemize
151 the replaced text may be entered by means of a full-featured LyX mini-editor;
152 \end_layout
153
154 \begin_layout Itemize
155 replace may optionally preserve capitalisation, so that the replaced text
156  capitalisation is adapted so as to mimic the one of the matching text (i.e.,
157  all lowercase, all uppercase, first uppercase followed by lowercase).
158 \end_layout
159
160 \begin_layout Standard
161 The Advanced Find&Replace feature is activated with a set of default options
162  which is suitable for the most common needs.
163  A detailed discussion of the available options follows in Sections
164 \begin_inset space ~
165 \end_inset
166
167
168 \begin_inset CommandInset ref
169 LatexCommand ref
170 reference "sec:Basic-usage"
171
172 \end_inset
173
174  and
175 \begin_inset space ~
176 \end_inset
177
178
179 \begin_inset CommandInset ref
180 LatexCommand ref
181 reference "sec:Advanced-usage"
182
183 \end_inset
184
185 .
186 \end_layout
187
188 \begin_layout Section
189 \begin_inset CommandInset label
190 LatexCommand label
191 name "sec:Basic-usage"
192
193 \end_inset
194
195 Basic usage
196 \end_layout
197
198 \begin_layout Standard
199 The advanced Find&Replace feature of LyX is activated through the [C-S-f]
200  sequence (Ctrl+Shift+f), or through the 
201 \noun on
202 Edit->Find&Replace (Advanced)
203 \noun default
204  menĂ¹ item.
205 \end_layout
206
207 \begin_layout Subsection
208 Searching for text
209 \end_layout
210
211 \begin_layout Standard
212 Enter into the 
213 \noun on
214 Find...
215
216 \noun default
217  LyX mini-editor a simple word, and search for occurrences of it by pushing
218  the 
219 \noun on
220 Next
221 \noun default
222  button below it (or just pressing 
223 \noun on
224 [Return]
225 \noun default
226  or 
227 \noun on
228 [Enter
229 \noun default
230 ]).
231  The entered word is found both in text mode and in math mode, and both
232  in emphasized, bold or normal face, and both in section titles and in standard
233  text.
234  Pressing repeatedly 
235 \noun on
236 [Enter]
237 \noun default
238  keeps searching forward.
239  Similarly, pressing 
240 \noun on
241 [Shift+Enter]
242 \noun default
243  searches for the entered text backwards.
244 \end_layout
245
246 \begin_layout Subsection
247 Searching for mathematics
248 \end_layout
249
250 \begin_layout Standard
251 Mathematical formulas may be searched for by typing in the 
252 \noun on
253 Find...
254
255 \noun default
256  mini-editor a mathematical formula, such as 
257 \begin_inset Formula $x^{2}$
258 \end_inset
259
260  or also something more complex like 
261 \begin_inset Formula $\frac{x^{2}}{1+x^{2}}$
262 \end_inset
263
264 .
265  When searching for such formula, it is found both when it is alone and
266  when it occurs in subformulas and nested parts of subformulas, for example
267  the mentioned segments would be found in something like 
268 \begin_inset Formula $\frac{x^{2}}{\sqrt{\frac{x^{2}}{1+x^{2}}}}.$
269 \end_inset
270
271
272 \end_layout
273
274 \begin_layout Subsection
275 Style-aware search
276 \end_layout
277
278 \begin_layout Standard
279 It is also possible to search for text with specific styles.
280  This is done by switching to the 
281 \noun on
282 Advanced
283 \noun default
284  pane and unchecking the 
285 \noun on
286 ignore format
287 \noun default
288  option.
289  This way:
290 \end_layout
291
292 \begin_layout Enumerate
293 Entering in the 
294 \noun on
295 Find...
296
297 \noun default
298  LyX mini-editor a plain word and searching for it would not find instances
299  of the word occurring in emphasized or boldface.
300 \end_layout
301
302 \begin_layout Enumerate
303 Entering in the 
304 \noun on
305 Find...
306
307 \noun default
308  LyX mini-editor an emphasized or boldface word and searching for it would
309  find the respective instances with same face only, and within the same
310  text style only.
311  Note that, for example, an emphasized text is found not only when occurring
312  alone, but also when it is contained in a longer emphasized sentence.
313 \end_layout
314
315 \begin_layout Enumerate
316 Entering in the 
317 \noun on
318 Find...
319
320 \noun default
321  LyX mini-editor a plain word and giving it a Section style from the style
322  selection dropdown menu, and searching for it, finds occurrences of if
323  only within Section titles.
324  Also, if the text to search is given an emphasized or bold face, in addition
325  to a 
326 \noun on
327 Section
328 \noun default
329  style, then it is found only when occurring with the same style.
330 \end_layout
331
332 \begin_layout Enumerate
333 Entering in the 
334 \noun on
335 Find...
336
337 \noun default
338  LyX mini-editor some mathematics in centered line math (C-S-m) mode, like
339  this 
340 \begin_inset Formula \[
341 x^{2}\]
342
343 \end_inset
344
345 finds only instances of the text within the same kind of mathematical environmen
346 t.
347 \end_layout
348
349 \begin_layout Section
350 \begin_inset CommandInset label
351 LatexCommand label
352 name "sec:Advanced-usage"
353
354 \end_inset
355
356 Advanced usage
357 \end_layout
358
359 \begin_layout Subsection
360 About using regular expressions in the Find...
361  box
362 \end_layout
363
364 \begin_layout Standard
365 There is a regular expression based searching facility.
366  Users may arbitrarily insert, within text or math material to search for,
367  regexp-mode insets that allow to enter regular subexpressions.
368  This is done either through the 
369 \noun on
370 [Match...]
371 \noun default
372  dropdown button or by typing [C-S-r].
373  Characters entered in the 
374 \noun on
375 Find...
376
377 \noun default
378  LyX mini-editor within regexp insets are matched according to the regular
379  expression matching rules
380 \begin_inset Foot
381 status collapsed
382
383 \begin_layout Plain Layout
384 but under the constraint that any subexpression must match a well-formed
385  LyX text segment, i.e., when matching LaTeX code, no segments with unbalanced
386  {} braces are allowed to match subexpressions entered by the user.
387 \end_layout
388
389 \end_inset
390
391 , while text entered outside regexp insets is matched exactly against the
392  same text in the document.
393  Note that it is allowed to cut and paste regexp-mode insets as usual.
394  Examples of using such a feature may be:
395 \end_layout
396
397 \begin_layout Enumerate
398 Searching for all fractions with a given denominator: for example, entering
399  in the 
400 \noun on
401 Find...
402
403 \noun default
404  LyX mini-editor the fraction 
405 \begin_inset Formula $\frac{.*}{1+x^{2}}$
406 \end_inset
407
408 , where the 
409 \begin_inset Formula $.*$
410 \end_inset
411
412  on the numerator is the match-everything regular expression that may be
413  added by pressing the 
414 \noun on
415 [Match...]->[Anything]
416 \noun default
417  button, or entering the regexp-mode through C-S-r and by typing 
418 \begin_inset Formula $.*$
419 \end_inset
420
421 , finds all fractions with the given denominator.
422 \end_layout
423
424 \begin_layout Enumerate
425 Searching for all text with a given style: for example, after unchecking
426  the 
427 \noun on
428 Ignore Format
429 \noun default
430  option from the 
431 \noun on
432 Advanced
433 \noun default
434  pane, entering a 
435 \series bold
436
437 \begin_inset Formula $.*$
438 \end_inset
439
440
441 \series default
442  regular expression and adding it an emphasized or bold face, finds all
443  emphasized and bold face text, respectively.
444  Also, giving to the 
445 \begin_inset Formula $.*$
446 \end_inset
447
448  regular expression a bullet-list, enumerated or Section style, you can
449  find all bullet or enumerated lists, or section titles.
450 \end_layout
451
452 \begin_layout Standard
453 Finally, references to subexpressions in regular expressions may be used
454  as usual, enclosing parts of the expression within round braces 
455 \begin_inset Formula $()$
456 \end_inset
457
458 , and referring back to them through 
459 \begin_inset Formula $\backslash1$
460 \end_inset
461
462
463 \begin_inset Formula $\backslash2$
464 \end_inset
465
466 , etc..., where a 
467 \begin_inset Formula $\backslash$
468 \end_inset
469
470  symbol is entered in regular-expression mode by pressing twice the backslash
471  key.
472  For example, try searching for the 
473 \begin_inset Formula $([a-z]+)[[:blank:]]\backslash1$
474 \end_inset
475
476  regular expression in order to find word repetitions, if any.
477 \end_layout
478
479 \begin_layout Standard
480 Note that back references work both when occurring within the same regular
481  expression, and when occurring in multiple different regular expressions,
482  where numbering of back-referenced sub-expressions is absolute, i.e., 
483 \begin_inset Formula $\backslash1$
484 \end_inset
485
486  always refers to the first occurrence of 
487 \begin_inset Formula $()$
488 \end_inset
489
490  in all entered regular expressions.
491 \end_layout
492
493 \end_body
494 \end_document