summaryrefslogtreecommitdiff
path: root/Master/tlpkg/texworks/texworks-help/TeXworks-manual/en/GoingfurtherEditingtools.html
blob: e4227617cac9866f523fc596fd35721e8cdc527a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  "http://www.w3.org/TR/html4/loose.dtd">  
<html > 
<head><title>4 Going further: Editing tools</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)"> 
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)"> 
<!-- info,2,imgdir:images/,sec-filename,next,index=2,url-enc,html --> 
<meta name="src" content="index.tex"> 
<link rel="stylesheet" type="text/css" href="index.css"> 
</head><body 
>
<!--l. 5--><p class="noindent" ><div id="container"> <!--l. 5--><div class="crosslinks"><p class="noindent">[<a 
href="GoingfurtherOthertools.html" >next</a>] [<a 
href="Firststeps.html" >prev</a>] [<a 
href="Firststeps.html#tailFirststeps.html" >prev-tail</a>] [<a 
href="#tailGoingfurtherEditingtools.html">tail</a>] [<a 
href="index.html#GoingfurtherEditingtools.html" >up</a>] </p></div>
<!--l. 5--><p class="indent" >   <div class="chapternumber">4</div><h1><a 
 id="x21-170004"></a>Going further: Editing tools</h1>
<!--l. 7--><p class="indent" >   When you have had some practise with T<sub>E</sub>Xworks, you&#8217;ll find the need for more effective
tools. Many of them are bundled with T<sub>E</sub>Xworks. We are going to see some of them
now.
   <h3 class="sectionHead"><span class="titlemark">4.1   </span> <a 
 id="x21-180004.1"></a>Creating a document from a template</h3>
<a 
 id="dx21-18001"></a>
<!--l. 11--><p class="noindent" >Most documents you will create will use the same instructions in the preamble,
the same layout settings, similar heading and so on. You can use predefined
templates to get started quickly or create your own with all of these settings
already in place.
<!--l. 13--><p class="indent" >   Use <em><b>File</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>New from template&#x2026;</b></em> or <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">N</span> (Mac OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">N</span>). A
dialogue box opens to allow you to select one of the templates. After
selecting one and pressing <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">OK</span></span></span>, a document is created and you can start to
work.
<!--l. 15--><p class="indent" >   If you want to create a personal template, you just have to create a suitable
document with everything you always want to do (and perhaps marking places to
fill in the rest) and save it as a <span class="path">.tex</span> file in the <span class="path">&#x003C;resources&#x003E;\templates</span> folder, or a
sub-folder of it, if you wish.
<!--l. 17--><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4.2   </span> <a 
 id="x21-190004.2"></a>Creating a project using several source files</h3>
<a 
 id="dx21-19001"></a>
<!--l. 19--><p class="noindent" >When the source becomes long, it is sometimes difficult to navigate
and maintain it. In that case, it is useful to split the source into
different smaller files: one file will be the main document, with the
preamble and the <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">document</span></span></span> environment, as well as calls to the
&#8220;sub-documents&#8221;<span class="footnote-mark"><a 
href="index22.html#fn1x5"><sup class="textsuperscript">1</sup></a></span><a 
 id="x21-19002f1"></a>,
which could in turn contain separate chapters, for example.
<!--l. 22--><p class="indent" >   But there might be a problem if you want to start typesetting/compilation in
a sub-document: as there is neither a preamble nor a <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">document</span></span></span> environment
                                                                          

                                                                          
there, L<sup>A</sup>T<sub>E</sub>X will stop immediately with an error.
<!--l. 24--><p class="indent" >   To tell T<sub>E</sub>Xworks that it should typeset the main document, one adds at the very
beginning of the sub-document the instruction:<a 
 id="dx21-19003"></a> 
   <div class="fancyvrb" id="fancyvrb5"><a 
 id="x21-19005r1"></a><span 
class="ec-lmtt-10x-x-109">%</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;!TeX</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;root</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;=</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;path/main_file.tex</span></div>
<!--l. 28--><p class="noindent" >for example: 
   <div class="fancyvrb" id="fancyvrb6"><a 
 id="x21-19007r1"></a><span 
class="ec-lmtt-10x-x-109">%</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;!TeX</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;root</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;=</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;manual.tex</span></div>
<!--l. 33--><p class="indent" >   If the main file is in the same folder, its name is enough, as in the above
example. Otherwise, you must also give the path to the main document
(preferably relative to the sub-document in question, e.g., <span class="path">../manual.tex</span>). Notice
that the slash <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">/</span></span></span> and not the backslash <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\</span></span></span> should be used as directory separator
even on Windows.
<!--l. 35--><p class="indent" >   Further, with MiKTeX, the call to a sub-document <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\input{name.tex}</span></span></span> should
include the extension <span class="path">.tex</span> to ensure proper SyncTeX functionality (see
section&#x00A0;<a 
href="GoingfurtherOthertools.html#x30-310005.1">5.1<!--tex4ht:ref: sec.synctex --></a>).
   <h3 class="sectionHead"><span class="titlemark">4.3   </span> <a 
 id="x21-200004.3"></a>Spell-checking</h3>
<!--l. 39--><p class="noindent" >You can turn on automatic spell-checking<a 
 id="dx21-20001"></a> of your source document from <em><b>Edit</b></em>
<span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Spelling</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>&#x003C;language&#x003E;</b></em>. It is also possible to ask T<sub>E</sub>Xworks to enable spell-checking by
default by setting a dictionary in <em><b>Edit</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Preferences&#x2026;</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Editor</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Spell-check
language</b></em>.
<!--l. 41--><p class="indent" >   During typing, every word the spell-checker considers wrong is underlined by a
red wavy line. A right-click on the word opens a contextual menu in which there
are some replacement suggestions. Click on the desired word to make the
replacement.
<!--l. 43--><p class="indent" >   Before using the spell-checker, you need to install dictionaries in the right
folder of T<sub>E</sub>Xworks: <span class="path">&#x003C;resources&#x003E;\dictionaries</span>. The <span class="path">&#x003C;resources&#x003E;</span> folder can be accessed
easily via <em><b>Help</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Settings and Resources&#x2026;</b></em>.
<!--l. 45--><p class="indent" >   <div class="OSspecific"><div class="OSspecificLogo OSLinux"></div> On Linux, the dictionaries are usually taken from the folder
<span class="path">/usr/share/myspell/dicts</span>&#8212;the default path for myspell dictionaries. Note,
though, that the maintainer of your T<sub>E</sub>Xworks package may have changed this to reflect
the file system layout of your Linux distribution. You can override this
default by setting the <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">TW_DICPATH</span></span></span> environment variable before running T<sub>E</sub>Xworks. </div>
<!--l. 49--><p class="indent" >   One can use the available dictionaries for OpenOffice.org and other free
                                                                          

                                                                          
software;<span class="footnote-mark"><a 
href="index23.html#fn2x5"><sup class="textsuperscript">2</sup></a></span><a 
 id="x21-20002f2"></a>
if you have Mozilla Thunderbird with spell-checking, you can copy its <span class="path">.aff</span> and <span class="path">.dic</span>
files<a 
 id="dx21-20003"></a><a 
 id="dx21-20004"></a> as well, for example.
   <h3 class="sectionHead"><span class="titlemark">4.4   </span> <a 
 id="x21-210004.4"></a>Search and replace</h3>
<a 
 id="dx21-21001"></a>
<a 
 id="dx21-21002"></a>
<!--l. 54--><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.4.1   </span> <a 
 id="x21-220004.4.1"></a>Standard functions</h4>
<!--l. 56--><p class="noindent" >The options of the menu <em><b>Search</b></em>&#8212;<em><b>Find&#x2026;</b></em>, <em><b>Find again</b></em>, <em><b>Replace&#x2026;</b></em>, <em><b>Replace again</b></em>,
and <em><b>Go to Line&#x2026;</b></em> (<span class="keystroke">Ctrl</span><span class="keystroke">F</span>, <span class="keystroke">Ctrl</span><span class="keystroke">G</span>, <span class="keystroke">Ctrl</span><span class="keystroke">R</span>, <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">R</span>, and <span class="keystroke">Ctrl</span><span class="keystroke">L</span>, respectively)&#8212;are
standard actions (Mac OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">F</span>, <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">G</span>, <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">R</span>, <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">R</span>, and <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">L</span>);
the first and the third open a dialogue box:
<div class="center" 
>
<!--l. 58--><p class="noindent" >
<!--l. 59--><p class="noindent" > <img 
src="images/replaceDialog.png" alt="pict"  
></div>
<!--l. 62--><p class="indent" >   Here, the usual options are available: <em>Wrap around</em>, <em>Find backwards</em>,
<em>Search/Replace within selection</em>, or <em>Find all occurrences</em>. The following options
are also usual: <em>Case sensitive</em> and <em>Whole words</em>. By default, the search is forward,
towards the end of the document.
<!--l. 64--><p class="indent" >   The option <em>Search/Replace in all open files</em> is also a frequent choice, but not as
much as the others; this allows, for example, replacement in all the files of a
project&#8212;pay attention, though, as this is very powerful.
<!--l. 66--><p class="indent" >   The last option, <em>Regular expression</em>, is detailed in the next sub-section.
<!--l. 68--><p class="indent" >   In the <em><b>Search</b></em> menu there are other options:
                                                                          

                                                                          
      <dl class="description"><dt class="description">
<span 
class="ec-lmbx-12">Copy to Find</span> </dt><dd 
class="description">copies the currently selected text into the <b><span 
class="ec-lmro-12">Find</span></b> field of the
      Find dialogue or the <b><span 
class="ec-lmro-12">Replace</span></b> field of the Replace dialogue; you still
      need to open the dialogues separately
      </dd><dt class="description">
<span 
class="ec-lmbx-12">Copy to Replace</span> </dt><dd 
class="description">copies the currently selected text into the <b><span 
class="ec-lmro-12">With</span></b> field of
      the <b><span 
class="ec-lmro-12">Replace</span></b> dialogue
      </dd><dt class="description">
<span 
class="ec-lmbx-12">Find Selection</span> </dt><dd 
class="description">uses the current selection for a search without opening the
      <b><span 
class="ec-lmro-12">Find</span></b> dialogue&#8212;very fast
      </dd><dt class="description">
<span 
class="ec-lmbx-12">Show selection</span> </dt><dd 
class="description">scrolls the view to the currently selected text&#8212;useful if
      word wrapping is turned off and you moved in the document using the
      vertical scroll bar on the right</dd></dl>
<!--l. 76--><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.4.2   </span> <a 
 id="x21-230004.4.2"></a>Advanced search and replace (regular expressions)</h4>
<a 
 id="dx21-23001"></a>
<!--l. 78--><p class="noindent" >The regular expressions provide a very powerful tool, but they require some effort
to be well understood. To understand them fully would require a manual of its
own<span class="footnote-mark"><a 
href="index24.html#fn3x5"><sup class="textsuperscript">3</sup></a></span><a 
 id="x21-23002f3"></a>,
so we&#8217;ll only give some simple ideas of use. For more advanced uses, as well as lists
of the most used codes, see section <a 
href="Regularexpressions.html#x43-51000B">B<!--tex4ht:ref: sec:regexp --></a>.
<!--l. 80--><p class="indent" >   Suppose we have the following text: 
   <div class="fancyvrb" id="fancyvrb7"><a 
 id="x21-23004r1"></a><span 
class="ec-lmtt-10x-x-109">Voici</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;du</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;texte</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;pour</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;tester</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;les</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;expressions</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;r</span><span 
class="ec-lmtt-10x-x-109">éguli</span><span 
class="ec-lmtt-10x-x-109">ères</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;dans</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;du</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;texte</span>
<br class="fancyvrb" /><a 
 id="x21-23006r2"></a><span 
class="ec-lmtt-10x-x-109">accentu</span><span 
class="ec-lmtt-10x-x-109">é.</span><br class="fancyvrb" /><a 
 id="x21-23008r3"></a><span 
class="ec-lmtt-10x-x-109">Voici</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;du</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;texte</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;pour</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;tester</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;les</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;expressions</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;r</span><span 
class="ec-lmtt-10x-x-109">éguli</span><span 
class="ec-lmtt-10x-x-109">ères</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;dans</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;du</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;texte</span>
<br class="fancyvrb" /><a 
 id="x21-23010r4"></a><span 
class="ec-lmtt-10x-x-109">accentu</span><span 
class="ec-lmtt-10x-x-109">é.</span><br class="fancyvrb" /><a 
 id="x21-23012r5"></a><span 
class="ec-lmtt-10x-x-109">Voici</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;du</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;texte</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;pour</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;tester</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;les</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;expressions</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;r</span><span 
class="ec-lmtt-10x-x-109">éguli</span><span 
class="ec-lmtt-10x-x-109">ères.</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;Voici</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;du</span>
<br class="fancyvrb" /><a 
 id="x21-23014r6"></a><span 
class="ec-lmtt-10x-x-109">texte</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;pour</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;tester</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;les</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;expressions</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;r</span><span 
class="ec-lmtt-10x-x-109">éguli</span><span 
class="ec-lmtt-10x-x-109">ères.</span><br class="fancyvrb" /><a 
 id="x21-23016r7"></a><span 
class="ec-lmtt-10x-x-109">truc</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;truc</span>
<br class="fancyvrb" /><a 
 id="x21-23018r8"></a><span 
class="ec-lmtt-10x-x-109">t</span><span 
class="ec-lmtt-10x-x-109">él.:</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;010-99-99-99</span><br class="fancyvrb" /><a 
 id="x21-23020r9"></a><span 
class="ec-lmtt-10x-x-109">t</span><span 
class="ec-lmtt-10x-x-109">él.:</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;00.32.10.99.99.99</span><br class="fancyvrb" /><a 
 id="x21-23022r10"></a><span 
class="ec-lmtt-10x-x-109">t</span><span 
class="ec-lmtt-10x-x-109">él.:</span><span 
class="ec-lmtt-10x-x-109">&#x00A0;00/32-10/99.99.99</span></div>
<!--l. 93--><p class="noindent" >We want to
                                                                          

                                                                          
      <ol  class="enumerate1" >
      <li 
  class="enumerate" id="x21-23024x1">insert an empty line after each &#8220;accentué&#8221; (to create paragraphs in L<sup>A</sup>T<sub>E</sub>X),
      but not after the three telephone numbers;
      </li>
      <li 
  class="enumerate" id="x21-23026x2">replace each <span 
class="ec-lmro-12">tab </span>character between the two words &#8220;truc&#8221; of the fourth
      paragraph by three spaces; and finally
      </li>
      <li 
  class="enumerate" id="x21-23028x3">make  the  telephone  numbers  consistent  by  replacing  the  various
      punctuation characters by spaces.</li></ol>
<!--l. 100--><p class="indent" >   For 1., in the dialogue box <b><span 
class="ec-lmro-12">Replace</span></b> (<span class="keystroke">Ctrl</span><span class="keystroke">R</span>) for <em>Replace:</em> we put
&#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n</span></span></span>&#8249;<span class="footnote-mark"><a 
href="index25.html#fn4x5"><sup class="textsuperscript">4</sup></a></span><a 
 id="x21-23029f4"></a>
and in <em>With:</em> &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n\n</span></span></span>&#8249;. &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n</span></span></span>&#8249; is the code to match or insert a line feed. You will need
to select the first four paragraphs and the beginning of the fifth (the first
telephone number) and to tick the <em>Replace within selection</em> and <em>Regular
expression</em> options; if this was not done and an empty line has been inserted after
each line, select the telephone lines and do the reverse action: replace
&#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n\n</span></span></span>&#8249; by &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n</span></span></span>&#8249;. So we replaced one line feed by two, creating an empty
line.
<!--l. 102--><p class="indent" >   For 2., use &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\t</span></span></span>&#8249; and &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">&#x2423;&#x2423;&#x2423;</span></span></span>&#8249;<span class="footnote-mark"><a 
href="index26.html#fn5x5"><sup class="textsuperscript">5</sup></a></span><a 
 id="x21-23030f5"></a>.
&#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\t</span></span></span>&#8249; is the code which represents a tab, while a space is typed in literally (here
represented as <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">&#x2423;</span></span></span>).
<!--l. 104--><p class="indent" >   For 3., find &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">-|\.|/</span></span></span>&#8249; and replace with &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">&#x2423;</span></span></span>&#8249;. Here, &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">|</span></span></span>&#8249; provides alternatives (<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">-</span></span></span>,
<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">.</span></span></span>, or <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">/</span></span></span>); for the dot we have used &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\.</span></span></span>&#8249; because the dot alone is a regular
expression code which represents any character and we would have replaced all
the characters by spaces! We therefore have to use a code&#8212;prefixing the
dot with a backslash tells specifies that the normal meaning of the dot
should be used instead of the special meaning it usually has in regular
expressions.
<!--l. 106--><p class="indent" >   If one has strings of the same character but of different lengths (for example 3,
                                                                          

                                                                          
4, or 5 times the sames character e) and one wants to truncate all these strings to
a string with less characters (for example 2), one can ask to replace the string
&#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">e{3,5}</span></span></span>&#8249; by &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">ee</span></span></span>&#8249;.
<!--l. 108--><p class="indent" >   If one wants to insert the same string at the beginning of some paragraphs
separated or not by an empty line, for example &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\noindent&#x2423;</span></span></span>&#8249; or &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\item&#x2423;</span></span></span>&#8249;, one
can replace &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n\n</span></span></span>&#8249; or &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n</span></span></span>&#8249; by &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n\n\\noindent&#x2423;</span></span></span>&#8249; or &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\n\\noindent&#x2423;</span></span></span>&#8249;. Pay
attention, we have a double <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\</span></span></span> in front of <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">noindent</span></span></span> to get one (<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\noindent</span></span></span>)
because <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\</span></span></span> is an escape character in regular expressions (we&#8217;ve met it before in the
expression <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\.</span></span></span>)!
<!--l. 110--><p class="indent" >   If it were making sense, we could replace all the letters between &#8220;a&#8221; and &#8220;m&#8221;
by &#8220;$&#8221; using &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">[a-m]</span></span></span>&#8249; and &#8250;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">$</span></span></span>&#8249;.
   <h3 class="sectionHead"><span class="titlemark">4.5   </span> <a 
 id="x21-240004.5"></a>Other tools for editing and error tracking</h3>
<!--l. 114--><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.5.1   </span> <a 
 id="x21-250004.5.1"></a>Standard tools</h4>
<!--l. 116--><p class="noindent" >It is always possible to undo<a 
 id="dx21-25001"></a> an action using <em><b>Edit</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Undo</b></em> or <span class="keystroke">Ctrl</span><span class="keystroke">Z</span> (Mac
OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Z</span>): this way you can undo stepwise! The inverse action,
redo, is available as <em><b>Edit</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Redo</b></em><a 
 id="dx21-25002"></a> or <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">Z</span> (Mac OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Shift
<span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">Z</span>).<span class="footnote-mark"><a 
href="index27.html#fn6x5"><sup class="textsuperscript">6</sup></a></span><a 
 id="x21-25003f6"></a>
<!--l. 118--><p class="indent" >   T<sub>E</sub>Xworks also provides the standard editing tools such as the clipboard; therefore one
can select, cut/copy and paste a piece of text normally.
<!--l. 120--><p class="indent" >   You can select with the mouse by dragging over the desired text, or by
double-clicking to select a word. Using the keyboard, holding down <span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span> while
moving using the arrow keys will select text. You can also move and select word
by word moving left or right holding <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span> down (<span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span> on Mac OS
X). The clipboard shortcuts are the ones you&#8217;ll find in almost every program:
<span class="keystroke">Ctrl</span><span class="keystroke">X</span> to cut, <span class="keystroke">Ctrl</span><span class="keystroke">C</span> to copy, and <span class="keystroke">Ctrl</span><span class="keystroke">V</span> to paste (<span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">X</span>, <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">C</span> and <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">V</span>,
respectively, on Mac OS X).
<!--l. 122--><p class="indent" >   You can easily change the case<a 
 id="dx21-25004"></a> of a selection&#8212;put everything upper case or
lower case&#8212;using <em><b>Edit</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Change case</b></em> and next, depending on the desired effect,
                                                                          

                                                                          
<em><b>ALL UPPERCASE</b></em>, <em><b>all lowercase</b></em>, or <em><b>Toggle Case</b></em> (which toggles the case of each
letter individually).
<!--l. 124--><p class="indent" >   It is also convenient to show the line numbers<a 
 id="dx21-25005"></a>, as all error messages refer to
these numbers; you can toggle the line numbers, on the left of the editing panel,
from <em><b>Format</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Line Numbers</b></em>.
   <h4 class="subsectionHead"><span class="titlemark">4.5.2   </span> <a 
 id="x21-260004.5.2"></a>Commenting</h4>
<!--l. 128--><p class="noindent" >When preparing a document with (L<sup>A</sup>)T<sub>E</sub>X, it is often useful to prevent compilation of a
portion of text to be able to locate an error; you can do this piece by piece until
you find the part which causes the error. For that, commenting the source block
by block is needed.
<!--l. 130--><p class="indent" >   We have seen that the symbol <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">%</span></span></span> marks the beginning of a comment. To comment<a 
 id="dx21-26001"></a>
a big piece of text, it is sufficient to select it and ask to mark it as comment <em><b>Format</b></em>
<span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Comment</b></em> or <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">]</span> (Mac OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">]</span>). To remove the comment, select
the lines and choose <em><b>Format</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Uncomment</b></em><a 
 id="dx21-26002"></a> or <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">[</span> (Mac OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">Shift
<span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke">[</span>).<span class="footnote-mark"><a 
href="index28.html#fn7x5"><sup class="textsuperscript">7</sup></a></span><a 
 id="x21-26003f7"></a>
   <h4 class="subsectionHead"><span class="titlemark">4.5.3   </span> <a 
 id="x21-270004.5.3"></a>Matching delimiters</h4>
<!--l. 135--><p class="noindent" >A frequent error is to forget a closing symbol: parenthesis, bracket, square bracket,
<em>etc</em>. T<sub>E</sub>Xworks helps with a tool to show the pairs of symbols: when the cursor moves over
one of these symbols, its partner is briefly highlighted. You can also select an
entire block<a 
 id="dx21-27001"></a> using <em><b>Edit</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Balance Delimiters</b></em> or by the shortcut <span class="keystroke">Ctrl</span><span class="keystroke">B</span>
(Mac OS X: <span class="keystroke"> <img 
src="images/MacCmdKey.png" alt="pict"  
></span><span class="keystroke">B</span>). Thus, you will immediately see the scope of the
block.
<!--l. 137--><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.5.4   </span> <a 
 id="x21-280004.5.4"></a>Smart quotes</h4>
<!--l. 139--><p class="noindent" >Another similar error, but this time semantic and not hindering typesetting, is in
the use of quotes when one wants to give focus to some text.
                                                                          

                                                                          
<!--l. 141--><p class="indent" >   There are two types of quotation marks in English: the &#8216;single&#8217; quotes
and the &#8220;double&#8221; quotes. They are formed by &#8216; and &#8217;; these are not the
quotation marks used in programming and found on the keyboard: <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">"</span></span></span> and
<span class="obeylines-h"><span class="verb"><span 
class="ts1-lmtt12-">'</span></span></span>. Using the T<sub>E</sub>Xworks smart quotes system, one can use the latter as normal to
automatically produce the typographically correct single/double opening and
close quotes.
<!--l. 143--><p class="indent" >   In a <span class="path">.tex</span> document, select one of the smart quotes system: <em><b>Format</b></em>
<span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Smart Quotes</b></em><span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>TeX Ligatures</b></em>, <span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>TeX Commands</b></em>, <span 
class="lmsy-10x-x-120">&#x2192;</span><em><b>Unicode Characters</b></em>.
Then, when you want to start a quoted section in your text, let&#8217;s say
enclosed in double quotes, type <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">"</span></span></span>, then the text to be quoted, and finish
again by <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">"</span></span></span>; T<sub>E</sub>Xworks will automatically insert the correct opening quotes <span class="obeylines-h"><span class="verb"><span 
class="ts1-lmtt12-">``</span></span></span> and
later the correct closing ones <span class="obeylines-h"><span class="verb"><span 
class="ts1-lmtt12-">''</span></span></span>. The three options give the same result
in the typeset document, but <em><b>TeX Ligatures</b></em> should work best in most
cases.
<!--l. 145--><p class="indent" >   Finally, it is possible to define personal quotation marks systems (in the
file <span class="path">smart-quotes-modes.txt</span> in the <span class="path">configuration</span> folder of the resource
folder).
<!--l. 147--><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4.6   </span> <a 
 id="x21-290004.6"></a>Auto-completion</h3>
<!--l. 149--><p class="noindent" >Another tool which rapidly becomes indispensable is auto-completion. Indeed,
when you use (L<sup>A</sup>)T<sub>E</sub>X, you have to continuously enter codes to, for example,
create environments; you also have to remember to close every group you
open.
<!--l. 151--><p class="indent" >   Auto-completion allows you to type a keyword, hit the <span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span> key, and have T<sub>E</sub>Xworks insert
the (L<sup>A</sup>)T<sub>E</sub>X command or environment code automatically.
<!--l. 153--><p class="indent" >   As an example to insert &#8220;L<sup>A</sup>T<sub>E</sub>X&#8221;, we have to type <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\LaTeX</span></span></span>. This is
not difficult, but entering &#8220;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\</span></span></span>&#8221; followed by the word &#8220;<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">LaTeX</span></span></span>&#8221; with
alternating capitals and lower case letters could become annoying after a
while.<span class="footnote-mark"><a 
href="index29.html#fn8x5"><sup class="textsuperscript">8</sup></a></span><a 
 id="x21-29001f8"></a>
With auto-completion, you just enter <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">latex</span></span></span> and hit <span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span> to get <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\LaTeX</span></span></span>. You just
have to take care that there is no <em>letter</em> directly preceding or succeeding
<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">latex</span></span></span>&#8212;e.g., <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">alatex</span></span></span>&#8212;, or else the mechanism might not pick up the correct
                                                                          

                                                                          
keyword.
<!--l. 156--><p class="indent" >   Another example is <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">bmin</span></span></span>, which gives 
   <div class="fancyvrb" id="fancyvrb8"><a 
 id="x21-29003r1"></a><span 
class="ec-lmtt-10x-x-109">\begin{minipage}{}</span><br class="fancyvrb" /><a 
 id="x21-29005r2"></a><span 
class="ts1-lmtt10-x-x-109">&#x2219;</span><br class="fancyvrb" /><a 
 id="x21-29007r3"></a><span 
class="ec-lmtt-10x-x-109">\end{minipage}</span><span 
class="ts1-lmtt10-x-x-109">&#x2219;</span></div>
<!--l. 162--><p class="noindent" >with the cursor between the empty pair of curly brackets where you need to enter the
size of the minipage. See the section <a 
href="CustomizingTw.html#x38-50000A.3">A.3<!--tex4ht:ref: sec.autocompletion --></a> for a list of the keywords for
auto-completion. Notice the &#8220;<span 
class="ts1-lmr12-">&#x2219;</span>&#8221; in the minipage environment. They are
placeholders which can be reached by <span class="keystroke">Ctrl</span><span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span> (<span class="keystroke"> <img 
src="images/MacOptKey.png" alt="pict"  
></span><span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span> on the Mac), repeating this
shortcut cycles forward through the placeholders; by <span class="keystroke">Ctrl</span><span class="keystroke">Shift <span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span> (<span class="keystroke"> <img 
src="images/MacOptKey.png" alt="pict"  
></span><span class="keystroke">Shift
<span 
class="lmsy-10x-x-120">&#x21D1;</span></span><span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span>), you can also cycle backwards.
<!--l. 164--><p class="indent" >   If a partial keyword is given, repeatedly hitting <span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span> will cycle through possible
completions. For example, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">bali</span></span></span> (the <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">b</span></span></span> commonly indicates the beginning of an
environment, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\begin{}</span></span></span>) creates the <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">align</span></span></span> environment after one <span class="keystroke"><span 
class="msam-10x-x-120">&#x21C6;</span></span>, next
<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">align*</span></span></span>, and after that, in succession, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">alignat</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">alignat*</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">aligned</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">alignedat</span></span></span>,
and <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">alignedat</span></span></span> with options; to access the last environments directly, they have
their own codes which start by <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">bali</span></span></span> (<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">balis</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">baliat</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">baliats</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">balied</span></span></span>, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">baliedat</span></span></span>
and <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">baliedato</span></span></span>).
<!--l. 166--><p class="indent" >   If you want to create your own keywords, you can add a <span class="path">.txt</span> file in the
<span class="path">completion</span> folder inside the resources folder. The entries in the file should have
the following format: 
   <div class="fancyvrb" id="fancyvrb9"><a 
 id="x21-29009r1"></a><span 
class="ec-lmtt-10x-x-109">bfigo:=\begin{figure}[#INS#]#RET##RET#\end{figure}</span><span 
class="ts1-lmtt10-x-x-109">&#x2219;</span><br class="fancyvrb" /><a 
 id="x21-29011r2"></a><span 
class="ec-lmtt-10x-x-109">\bibliography{#INS#}</span><span 
class="ts1-lmtt10-x-x-109">&#x2219;</span></div>
<!--l. 172--><p class="indent" >   In the first case, <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">bfigo</span></span></span> is the assigned keyword (with <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">:=</span></span></span>) to be converted into
a <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">figure</span></span></span> environment with an optional argument; there are two carriage returns
(<span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">#RET#</span></span></span>) after the <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">begin</span></span></span>, i.e., an empty line, and the cursor is placed between the
square brackets (at the position of <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">#INS#</span></span></span>). &#8220;<span 
class="ts1-lmr12-">&#x2219;</span>&#8221; is a place holder as introduced
before.
<!--l. 174--><p class="indent" >   In the second case, we give ourselves a shortcut, which will let us type the first
part of <span class="obeylines-h"><span class="verb"><span 
class="ec-lmtt-12">\bibliography{}</span></span></span> and have T<sub>E</sub>Xworks convert it to the full name plus braces (with
the cursor between them). In this case, the keyword is the instruction
itself.
<!--l. 176--><p class="indent" >   Note that the <span class="path">.txt</span> file containing the auto-completion information needs to be
UTF-8 encoded&#8212;this is the default encoding for all files created with
T<sub>E</sub>Xworks.
                                                                          

                                                                          
                                                                          

                                                                          
                                                                          

                                                                          
   <!--l. 5--><div class="crosslinks"><p class="noindent">[<a 
href="GoingfurtherOthertools.html" >next</a>] [<a 
href="Firststeps.html" >prev</a>] [<a 
href="Firststeps.html#tailFirststeps.html" >prev-tail</a>] [<a 
href="GoingfurtherEditingtools.html" >front</a>] [<a 
href="index.html#GoingfurtherEditingtools.html" >up</a>] </p></div>
<!--l. 5--><p class="indent" >   <a 
 id="tailGoingfurtherEditingtools.html"></a>  </div> 
</body></html>