1 #LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
10 \font_typewriter default
11 \font_default_family default
17 \paperfontsize default
24 \paperorientation portrait
27 \paragraph_separation indent
29 \quotes_language english
32 \paperpagestyle default
33 \tracking_changes false
42 Introduction to the find advanced feature
45 \begin_layout Standard
46 This is an introduction to the find advanced feature of LyX, that is activated
47 through the [C-S-f] sequence (Ctrl+Shift+f).
50 \begin_layout Standard
51 First, leave the ignore format option
58 \begin_layout Enumerate
63 and see how it is found both in text mode and in math mode, and both in
64 emphasized, bold or normal face, and both in section titles and in standard
66 When finished typing the text to find in the
71 box, pressing repeatidly
75 will search for it forward, while pressing
79 will search backwards.
82 \begin_layout Enumerate
83 Search for some math by typing in the
89 \begin_inset Formula $x^{2}$
92 in simple math (C-m) mode (you can directly copy it from this text and
98 box), or also something more elaborate like
99 \begin_inset Formula $\frac{gh}{ij}$
103 See how it is found both when alone and when in subformulas and nested
104 parts of subformulas.
107 \begin_layout Standard
108 Now, uncheck the ignore format option.
111 \begin_layout Enumerate
112 Search for a plain 'about' word and see how emphasized and boldface instances,
113 as well as the ones in non-standard style, are not found anymore.
116 \begin_layout Enumerate
125 and see how you can find the respective instances with same face only,
126 and within same text style only (e.g.
127 in order to find the words in this paragraph, you need to also add an enumerate
130 emphasized text is found not only when alone, but also when it is in a
131 longer emphasized sentence.
134 \begin_layout Enumerate
135 Search for the word 'about' (again plain face) giving it a Section style
136 from the style selection dropdown menu, and see how it is found only within
138 Repeat with the word '
142 ' in emphasized face, with
146 style, and see how its corresponding instance is found.
149 \begin_layout Enumerate
150 Search for some math in centered line math (C-S-m) mode, like this
151 \begin_inset Formula \[
156 and see how only instances of the text within the same kind of environment
160 \begin_layout Subsection
161 About using regular expressions in the Find...
165 \begin_layout Standard
166 Now you can try the regular expression based searching facility.
167 Users may arbitrarily insert, within text or math material, regexp-mode
168 insets that allow to enter regular subexpressions.
169 This is done either through
173 or by typing [C-S-r].
174 Characters entered in the
178 box within regexp insets are matched according to the regular expression
183 \begin_layout Standard
184 but under the constraint that any subexpression must match a well-formed
185 LyX text segment, i.e.
186 when matching LaTeX code, no segments with unbalanced {} braces are allowed
187 to match subexpressions entered by the user.
192 , while text entered outside regexp insets is matched exactly against the
193 same text in the document.
194 Note that it is allowed to cut and paste regexp-mode insets as usual.
195 In order to try the feature, first leave the ignore format option checked.
198 \begin_layout Enumerate
199 Search for the fraction
200 \begin_inset Formula $\frac{\regexp{.*}}{mn}$
203 , where the '.*' on the numerator is the match-everything regular expression
204 that may be added by pressing the
206 [Match...]->[Anything]
208 button, or entering the regexp-mode through C-S-r and by typing '.*'.
209 See how all fractions with the specified denominator are found.
212 \begin_layout Enumerate
213 Now uncheck the Ignore Format option and search for '
221 ' in emphasized face.
222 See how, respectively, all boldface and all emphasized text is found.
225 \begin_layout Enumerate
226 Search for a plain '.*' giving it a Section style, and navigate across section
227 titles (similarly, navigate across enumerated or bulletted lists).
230 \begin_layout Enumerate
231 You can use references to subexpressions as usual, enclosing parts of the
232 regex expression within round braces '()', and referring back to them through
238 (within either the same or another regexp-mode inset, where a '
240 ' symbol is entered by pressing twice the '
243 For example, try searching for '
244 \begin_inset Formula \regexp{[\^a-z]([a-z]+)}
248 \begin_inset Formula \regexp{\backslash1}
251 ' in order to find word repetitions, if any.
254 \begin_layout Standard
255 What follows is just a set of meaningless formulas and sentences useful
256 for for testing purposes.
259 \begin_layout Standard
260 \begin_inset Formula $y+x+X^{2}+\frac{gh}{ij}-1+x_{j}^{i}+y_{jk}^{ip}+i$
264 \begin_inset Formula $z+x_{j}^{i}.$
270 \begin_layout Standard
276 \begin_inset Formula $X+y^{2}+\frac{x+x^{2}+\frac{gh}{ij}}{y^{x+x^{2}}+\frac{kl}{mn}}-about$
282 \begin_layout Standard
283 \begin_inset Formula \[
284 X+y^{2}+\frac{x+x^{2}+\frac{gh}{ij}}{y^{x+x^{2}}+\frac{kl}{mn}}-about\]
293 \begin_inset Formula $c+\frac{kl}{mn}+\frac{\sqrt{\frac{gh}{ij}}}{mn}-\frac{1+\sqrt{\frac{about}{mn}}}{mn}+\textrm{about}$
299 \begin_layout Section
300 Conclusion and future work about the find
307 \begin_layout Standard
308 This feature seems very useful to me.
309 Hope others will find it useful as well.
310 Currently, I'm not really happy with the implementation, because it has
311 at least quadratic complexity (document size multiplied by maximum paragraph
312 size, plus regexp matching complexity, if enabled, and infact it is quite
313 slow), but hopefully that will be fixable by changing the TeXOnePar() function
314 and simpleTeXOnePar() method, and possibly other TeX related methods.
317 \begin_layout Standard
318 Infact, a DocIterator could be used to keep track of the current position,
319 and an externally supplied functor could be called at each position providing
320 the DocIterator and LaTeX string translated so far to the external code.
321 This would allow to couple each DocIterator state with the position in
322 the output LaTeX string, allowing to recover the DocIterator positions
323 after a regexp-based find operation made (only once this time) on translated
327 \begin_layout Standard
328 Again, a few meaningless sentences useful for testing purposes on about.
331 \begin_layout Standard
339 \begin_layout Standard
342 what about your health
347 \begin_layout Itemize
348 search for plain 'about'
351 \begin_layout Itemize
361 \begin_layout Standard
362 \begin_inset Formula $y+x-x^{2}\cdot2$