1
0
Fork 0
doc/main/editing/man-search-and-replace.en.tm

96 lines
5.5 KiB
Plaintext
Raw Normal View History

2017-07-06 21:53:54 +08:00
<TeXmacs|1.99.5>
2011-08-28 15:59:50 +08:00
<style|<tuple|tmdoc|english>>
2011-08-28 15:59:50 +08:00
<\body>
<tmdoc-title|Search and replace>
You can start searching text by pressing <key|C-s> or <menu|Edit|Search>.
2017-07-06 21:53:54 +08:00
Doing this, a new special \Psearch toolbar\Q will appear below the main
text, just above the footer. When typing text in the search field of the
toolbar, all occurrences of this text will be highlighted in the main
2017-07-06 21:53:54 +08:00
document. Moreover, one \Pprincipal\Q occurrence will be highlighted in red
and you may navigate through all occurrences using <key|pageup> and
<key|pagedown> (or <key|up> and <key|down>, or <key|return>). Using
<key|home> and <key|end>, you may jump to the first and last occurrences
respectively. As soon as you press the escape key <key|escape>, the search
toolbar will be closed, searching stops and focus returns to the main
document.
2011-08-28 15:59:50 +08:00
2017-07-06 21:53:54 +08:00
During a search, <TeXmacs> only looks for text in the same mode and
language as at the position where you started your search. In other words,
when searching an <math|x> in math-mode, you will not find any x's in the
ordinary text. As a current limitation, the search string on the search
toolbar can only contain ordinary text and no math-symbols or more
complicated structured text. More complex searches will be discussed below.
2011-08-28 15:59:50 +08:00
In order to replace text, you should use <menu|Edit|Replace> or press
2017-07-06 21:53:54 +08:00
<key|C-=>. This will cause a special \Preplace toolbar\Q to appear below
the main text, just above the footer. You are prompted for the string that
is to be replaced and the string by which to replace. Again, you may use
the <key|pageup> and <key|pagedown> keys in order to navigate through the
occurrences of the search string. When pressing <key|tab> or <key|return>
in the search field, focus will be moved to the replace field. You may
still use the <key|pageup> and <key|pagedown> keys in order to navigate
through the occurrences of the search string. In addition, pressing
<key|return> will replace the principal occurrence of the search string by
the replace string. Using <key|S-return>, you may undo the last
replacement. You may replace all remaining occurrences by pressing
<key|C-return>. Like in the case of searching, the query-replace command is
mode and language sensitive.
2011-08-28 15:59:50 +08:00
The search and replace toolbars are quite rudimentary in the sense that
they only allow for searching and replacing plain text. By pressing the
<icon|tm_expand_tool.xpm> icon on either of these toolbars, you may expand
the toolbar into a full blown widget with larger search and replace fields
2017-07-06 21:53:54 +08:00
that may contain arbitrary markup. Searching and replacing can be done
using more or less the same keyboard shortcuts as in the case of the
toolbars, but you may now search and replace arbitrary content.
2011-08-28 15:59:50 +08:00
When searching non textual content, the conditions for having a hit are
somewhat released. For instance, assume that you are just starting a new
search with an empty search field. Then typing<nbsp><key|F6> inserts the
<markup|strong> tag with no text inside yet. Instead of looking only for
2017-07-06 21:53:54 +08:00
\Pstrong empty strings\Q, <TeXmacs> will rather look for all strong markup
in your document. If you next enter the letter \Pa\Q, then <TeXmacs> will
look for all strong text that contains the letter \Pa\Q. In a<nbsp>similar
way, when searching for the formula <math|<frac|x|>>, <TeXmacs> will
highlight all fractions in which the numerator contains the variable
<math|x>. Yet another example: a search for <math|<frac||<sqrt|x>>> will
2017-07-06 21:53:54 +08:00
highlight all formulas in which the denominator contains a square root that
contains the variable <math|x>. For instance, the fraction
<math|<frac|a+b|c+<sqrt|x+y>>> will be highlighted, but not
<math|<frac|<sqrt|x+y>|a+<sqrt|y>>>.
When using the structured text and replace widgets, <TeXmacs> also
implements a few additional special tags for enhancing structured
searching. First of all, it can happen that you would like to search for
certain content <em|inside> a special context. For instance, you might want
2017-07-06 21:53:54 +08:00
to search for all occurrences of the letter \Pa\Q inside a <markup|strong>
tag. When searching for <strong|a>, as above, <TeXmacs> will highlight all
2017-07-06 21:53:54 +08:00
<markup|strong> tags that contain the letter \Pa\Q. In order to highlight
the letters \Pa\Q themselves, you should first enter the <markup|strong>
tag inside an empty search field using <key|F6>. You next enter a special
<markup|select-region> tag using <key|std ?>, and finally insert the letter
2017-07-06 21:53:54 +08:00
\Pa\Q inside this tag. Other special markup that can be used inside search
fields are the \Pwildcards\Q <math|x>, <math|y> and <math|z>, which are
entered using <key|std 1>,<nbsp><key|std 2> and<nbsp><key|std 3>.
As soon as you start using the structured text and replace widgets instead
of the toolbars, this will be remembered as a user preference: any
subsequent searches or replacements will again use the widgets. In order to
switch back to the less intrusive toolbar methods for searching and
replacing, you should press the <icon|tm_compress_tool.xpm> icon.
2011-08-28 15:59:50 +08:00
<tmdoc-copyright|1998--2002|Joris van der Hoeven>
<tmdoc-license|Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled "GNU Free
Documentation License".>
2017-07-06 21:53:54 +08:00
</body>
<initial|<\collection>
</collection>>