1 #LyX 1.6.5svn created this file. For more info see http://www.lyx.org/
6 \use_default_options false
11 \font_typewriter default
12 \font_default_family default
19 \paperfontsize default
27 \paperorientation portrait
30 \paragraph_separation indent
32 \quotes_language english
35 \paperpagestyle default
36 \tracking_changes false
45 Introduction to the find advanced feature
48 \begin_layout Standard
49 This is an introduction to the find advanced feature of LyX, that is activated
50 through the [C-S-f] sequence (Ctrl+Shift+f) and can be closed just by hitting
58 \begin_layout Standard
59 First, leave the ignore format option
66 \begin_layout Enumerate
71 and see how it is found both in text mode and in math mode, and both in
72 emphasized, bold or normal face, and both in section titles and in standard
74 When finished typing the text to find in the
79 box, pressing repeatidly
83 will search for it forward, while pressing
87 will search backwards.
90 \begin_layout Enumerate
91 Search for some math by typing in the
97 \begin_inset Formula $x^{2}$
100 in simple math (C-m) mode (you can directly copy it from this text and
106 box), or also something more elaborate like
107 \begin_inset Formula $\frac{gh}{ij}$
111 See how it is found both when alone and when in subformulas and nested
112 parts of subformulas.
115 \begin_layout Standard
116 Now, uncheck the ignore format option.
119 \begin_layout Enumerate
120 Search for a plain 'about' word and see how emphasized and boldface instances,
121 as well as the ones in non-standard style, are not found anymore.
124 \begin_layout Enumerate
133 and see how you can find the respective instances with same face only,
134 and within same text style only (e.g.
135 in order to find the words in this paragraph, you need to also add an enumerate
138 emphasized text is found not only when alone, but also when it is in a
139 longer emphasized sentence.
142 \begin_layout Enumerate
143 Search for the word 'about' (again plain face) giving it a Section style
144 from the style selection dropdown menu, and see how it is found only within
146 Repeat with the word '
150 ' in emphasized face, with
154 style, and see how its corresponding instance is found.
157 \begin_layout Enumerate
158 Search for some math in centered line math (C-S-m) mode, like this
159 \begin_inset Formula \[
164 and see how only instances of the text within the same kind of environment
168 \begin_layout Subsection
169 About using regular expressions in the Find...
173 \begin_layout Standard
174 Now you can try the regular expression based searching facility.
175 Users may arbitrarily insert, within text or math material, regexp-mode
176 insets that allow to enter regular subexpressions.
177 This is done either through
181 or by typing [C-S-r].
182 Characters entered in the
186 box within regexp insets are matched according to the regular expression
191 \begin_layout Plain Layout
192 but under the constraint that any subexpression must match a well-formed
193 LyX text segment, i.e.
194 when matching LaTeX code, no segments with unbalanced {} braces are allowed
195 to match subexpressions entered by the user.
200 , while text entered outside regexp insets is matched exactly against the
201 same text in the document.
202 Note that it is allowed to cut and paste regexp-mode insets as usual.
203 In order to try the feature, first leave the ignore format option checked.
206 \begin_layout Enumerate
207 Search for the fraction
208 \begin_inset Formula $\frac{\regexp{.*}}{mn}$
211 , where the '.*' on the numerator is the match-everything regular expression
212 that may be added by pressing the
214 [Match...]->[Anything]
216 button, or entering the regexp-mode through C-S-r and by typing '.*'.
217 See how all fractions with the specified denominator are found.
220 \begin_layout Enumerate
221 Now uncheck the Ignore Format option and search for '
229 ' in emphasized face.
230 See how, respectively, all boldface and all emphasized text is found.
233 \begin_layout Enumerate
234 Search for a plain '.*' giving it a Section style, and navigate across section
235 titles (similarly, navigate across enumerated or bulletted lists).
238 \begin_layout Enumerate
239 You can use references to subexpressions as usual, enclosing parts of the
240 regex expression within round braces '()', and referring back to them through
246 (within either the same or another regexp-mode inset, where a '
248 ' symbol is entered by pressing twice the '
251 For example, try searching for '
252 \begin_inset Formula \regexp{[\^a-z]([a-z]+)}
257 \begin_inset Formula \regexp{\backslash1}
261 ' in order to find word repetitions, if any.
264 \begin_layout Standard
265 What follows is just a set of meaningless formulas and sentences useful
266 for for testing purposes.
269 \begin_layout Standard
270 \begin_inset Formula $y+x+X^{2}+\frac{gh}{ij}-1+x_{j}^{i}+y_{jk}^{ip}+i$
274 \begin_inset Formula $z+x_{j}^{i}.$
280 \begin_layout Standard
286 \begin_inset Formula $X+y^{2}+\frac{x+x^{2}+\frac{gh}{ij}}{y^{x+x^{2}}+\frac{kl}{mn}}-about$
292 \begin_layout Standard
293 \begin_inset Formula \[
294 X+y^{2}+\frac{x+x^{2}+\frac{gh}{ij}}{y^{x+x^{2}}+\frac{kl}{mn}}-about\]
303 \begin_inset Formula $c+\frac{kl}{mn}+\frac{\sqrt{\frac{gh}{ij}}}{mn}-\frac{1+\sqrt{\frac{about}{mn}}}{mn}+\textrm{about}$
309 \begin_layout Section
310 Conclusion and future work about the find
317 \begin_layout Standard
318 This feature seems very useful to me.
319 Hope others will find it useful as well.
320 Currently, I'm not really happy with the implementation, because it has
321 at least quadratic complexity (document size multiplied by maximum paragraph
322 size, plus regexp matching complexity, if enabled, and infact it is quite
323 slow), but hopefully that will be fixable by changing the TeXOnePar() function
324 and simpleTeXOnePar() method, and possibly other TeX related methods.
327 \begin_layout Standard
328 Infact, a DocIterator could be used to keep track of the current position,
329 and an externally supplied functor could be called at each position providing
330 the DocIterator and LaTeX string translated so far to the external code.
331 This would allow to couple each DocIterator state with the position in
332 the output LaTeX string, allowing to recover the DocIterator positions
333 after a regexp-based find operation made (only once this time) on translated
337 \begin_layout Standard
338 Again, a few meaningless sentences useful for testing purposes on about.
341 \begin_layout Standard
349 \begin_layout Standard
352 what about your health
357 \begin_layout Itemize
358 search for plain 'about'
361 \begin_layout Itemize
371 \begin_layout Standard
372 \begin_inset Formula $y+x-x^{2}\cdot2$