Debian Codegraph @

docs/manual/ManPages.html

raw symbols SCIP
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>ManPages</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b>
12 ManPages
13 </b></font></table></table>
14 <p>You can create a documentation or education system with files that you and others can read into Praat (with the <a href="Read_from_file___.html">Read from file...</a> command). Your files will become a hypertext system very similar to the usual <a href="Manual.html">Manual</a>.</p>
15 <h2>Example 1: a single document</h2>
16 <p>If you create a single ManPages text file, it will look like a manual with a single page. Here is an example:</p>
17 <code> ManPagesTextFile<br></code>
18 <code> "Welkom" "miep" 19970820 0<br></code>
19 <code> &lt;intro&gt; "Hallo allemaal!"<br></code>
20 <code> &lt;entry&gt; "Belangrijk..."<br></code>
21 <code> &lt;normal&gt; "Hoogge\e""erd publiek!"<br></code>
22 <code> &lt;normal&gt; "Einde."<br></code>
23 <p>A ManPages text file should start with the following information:</p>
24 <dl>
25 <dd style="position:relative;padding-left:1em;text-indent:-2em">1. The word &#8220;ManPagesTextFile&#8221; on the first line.</dd>
26 <dd style="position:relative;padding-left:1em;text-indent:-2em">2. The title of the manual page, between double quotes. This will be drawn at the top of the page. The name of the ManPages text file should be derived from this title (see below).</dd>
27 <dd style="position:relative;padding-left:1em;text-indent:-2em">3. The author of the manual page, between double quotes. This will be drawn at the bottom of the page.</dd>
28 <dd style="position:relative;padding-left:1em;text-indent:-2em">4. The date you created or modified the page, in the format year &#8211; month (two digits) &#8211; day (two digits), without spaces.</dd>
29 <dd style="position:relative;padding-left:1em;text-indent:-2em">5. The recording time. If this is not zero, three sound buttons (see below) will appear at the top of the page.</dd>
30 <dd style="position:relative;padding-left:1em;text-indent:-2em">6. A sequence of paragraph types and texts. You put the types between &lt; and &gt;, and the texts between double quotes (if your text contains a double quote, you should write two double quotes).</dd>
31 </dl>
32 <p>The format of a ManPages text file is rather free, as long as the first line is correct, the four required pieces of information are there in the correct order, and there is a correct alternation between paragraph texts and types. If you put multiple elements on a line, there should be at least one space between them. You may distribute texts across multiple lines, as long as you do not add any spaces:</p>
33 <code> &lt;normal&gt; "Hoogge\e""erd<br></code>
34 <code> publiek!"<br></code>
35 <p>This will have exactly the same effect as above.</p>
36 <h2>Example 2: multiple documents</h2>
37 <p>The above example with a single document is not very useful. You will usually want to refer to other documents:</p>
38 <code> ManPagesTextFile<br></code>
39 <code> "Welcome" "Paul Boersma" 19970820 1.0<br></code>
40 <code> &lt;intro&gt; "Welcome to Paul's transcription course."<br></code>
41 <code> &lt;entry&gt; "Groups of speech sounds"<br></code>
42 <code> &lt;normal&gt; "You can listen to the following sounds<br></code>
43 <code> from the languages of the world,<br></code>
44 <code> pronounced by a %single speaker (#me):"<br></code>
45 <code> &lt;list_item&gt; "@Vowels, quite problematic for Dutch students!"<br></code>
46 <code> &lt;list_item&gt; "@@Dorsal fricatives@, equally problematic!"<br></code>
47 <p>With the symbol &#8220;<code><font size=+1>@</font></code>&#8221;, you create a <i>link</i> to another ManPages text file. A link will be drawn in blue on your screen. In this example, you have created links to the files <code><font size=+1>Vowels.man</font></code> and <code><font size=+1>Dorsal_fricatives.man</font></code> in the same folder as the current file (all <code><font size=+1>.man</font></code> files have to be in the same folder; this makes it likely that their names are unique). If the link contains spaces or other non-alphanumeric symbols, you have to use three &#8220;<code><font size=+1>@</font></code>&#8221; symbols, as shown; with a single word, you may use a single &#8220;<code><font size=+1>@</font></code>&#8221;.</p>
48 <p>In resolving the file name, the ManPages system replaces spaces and other special symbols with underscores, and converts any initial lower-case character by its upper-case variant. For instance, if your link is &#8220;<code><font size=+1>@@back vowels@</font></code>&#8221;, the file name will be <code><font size=+1>Back_vowels.man</font></code>.</p>
49 <p>The title in the second line of <code><font size=+1>Back_vowels.man</font></code> must be equal to the link name, though capitalization of the first letter is allowed. Thus, the title of <code><font size=+1>Back_vowels.man</font></code> will probably be &#8220;Back vowels&#8221;. Likewise, the starting file with the title &#8220;Welcome&#8221; should have the name <code><font size=+1>Welcome.man</font></code> if any other files refer to it.</p>
50 <h2>Paragraph types</h2>
51 <p>A normal paragraph will have type <code><font size=+1><normal></font></code>. The hypertext system will leave a blank space between paragraphs with this type. The first paragraph of a manual page will normally have the type <code><font size=+1><intro></font></code>. Though this may look the same as <code><font size=+1><normal></font></code>, the search system of the <a href="Manual.html">Manual</a> may take account of the distinction.</p>
52 <p>Headings (like the title &#8220;Paragraph types&#8221; of this subsection) have type <code><font size=+1><entry></font></code>. This will be drawn in a larger character size.</p>
53 <p>For lists, you use the type <code><font size=+1><list_item></font></code>. You will often combine this with <i>button</i> symbols, like in the following:</p>
54 <code> &lt;normal&gt; "Choose a colour:"<br></code>
55 <code> &lt;list_item&gt; "\bu @Red."<br></code>
56 <code> &lt;list_item&gt; "\bu @Green."<br></code>
57 <code> &lt;list_item&gt; "\bu @Blue."<br></code>
58 <p>For text that should appear with a fixed character width, you use the type <code><font size=+1><code></font></code>.</p>
59 <p>For a paragraph that should be connected with the following paragraph without leaving a blank space (probably a definition), you use the type <code><font size=+1><term></font></code>.</p>
60 <p>For a paragraph with a blank left margin, you use the type <code><font size=+1><definition></font></code>.</p>
61 <p>For a paragraph with an embedded script (a picture), you use the type <code><font size=+1><script></font></code> (see below).</p>
62 <h2>Special symbols and styles</h2>
63 <p>You can use all of Praat&#8217;s <a href="Special_symbols.html">special symbols</a> and <a href="Text_styles.html">text styles</a>, except that some <i>single</i> text-style symbols have different meanings:</p>
64 <dl>
65 <dd style="position:relative;padding-left:1em;text-indent:-2em">&#8226; A single percent sign introduces a word in italic: <code><font size=+1>%pot</font></code> gives <i>pot</i>.</dd>
66 <dd style="position:relative;padding-left:1em;text-indent:-2em">&#8226; A single number sign introduces a word in bold: <code><font size=+1>#pot</font></code> gives <b>pot</b>.</dd>
67 <dd style="position:relative;padding-left:1em;text-indent:-2em">&#8226; A single dollar sign introduces a word in monospace: <code><font size=+1>$pot</font></code> gives <code><font size=+1>pot</font></code>.</dd>
68 <dd style="position:relative;padding-left:1em;text-indent:-2em">&#8226; A single underscore is rendered as an underscore: <code><font size=+1>a_b</font></code> gives a_b.</dd>
69 </dl>
70 <p>To create a single italic, bold, or subscripted letter, you revert to the usual technique for stretches of italic, bold, or subscripted text. So, to get <i>F</i><sub>1</sub>, you type <code><font size=+1>%F__1_</font></code>.</p>
71 <h2>Sound links</h2>
72 <p>Your text may contain links to sound files. They are drawn in blue. The format is:</p>
73 <code> &lt;normal&gt; "You should know that @@\FIct.aifc|\ct@ is more open than<br></code>
74 <code> @@\FIo.aifc|o@."<br></code>
75 <p>On your screen, you will see an <b>&#596;</b> and an <b>o</b> symbol, both drawn in blue. If you click on one of these sound links, one of the sound files <code><font size=+1>ct.aifc</font></code> or <code><font size=+1>o.aifc</font></code> will be played.</p>
76 <p>The format of the sound link &#8220;<code><font size=+1>@@\FIo.aifc|o@</font></code>&#8221; is to be understood as follows. The pipe symbol separates the link information (<code><font size=+1>\FIo.aifc</font></code>) from the viewable link text (<code><font size=+1>o</font></code>). The link information is introduced with a symbol (<code><font size=+1>\FI</font></code>) that tells the manual system that a sound file name follows. The manual system reads this file, sees that it contains a sound, and plays that sound.</p>
77 <p>You can use relative path names, e.g., <code><font size=+1>\FIsounds/o.aifc</font></code> refers to the file <code><font size=+1>o.aifc</font></code> in the subfolder <code><font size=+1>sounds</font></code>, which must be contained in the same folder as the <code><font size=+1>.man</font></code> files. To make sure that your manual pages run on all platforms (Windows, Macintosh, Unix), you will want to use the forward slash (/) to separate the folder name(s) from the file name, as in this example (i.e. you avoid the backslash (\) that is usual on Windows computers).</p>
78 <h2>Pictures as embedded scripts</h2>
79 <p>Your text may contain Praat scripts. They typically draw a picture in your manual page, with the font and font size of the manual until you specify otherwise in the script. The format is:</p>
80 <code> &lt;script&gt; 4.5 4 "<br></code>
81 <code> Draw inner box<br></code>
82 <code> Axes: 0, 100, 0, 100<br></code>
83 <code> Text: 50, "Centre", 50, "Half", "Hello!!"<br></code>
84 <code> "<br></code>
85 <p>The two numbers after <code><font size=+1><script></font></code> are the width and the height of the picture (the &#8220;outer viewport&#8221;) in inches, if the font size of the manual is 12. If the font size is larger, the viewport will be scaled up accordingly.</p>
86 <p>Please note that the script is enclosed within double quotes. Therefore, you will have to double any double quotes that occur in the script.</p>
87 <p>If needed, a script like this can create objects in the object list of the manual. However, you have to make sure that you remove them after use:</p>
88 <code> &lt;script&gt; 6 3 "<br></code>
89 <code> Create Sound from formula: "sineWithNoise", 1, 0.0, 1.0, 44100,<br></code>
90 <code> ... ~1/2 * sin (2 * pi * 377 * x) + randomGauss (0, 0.1)<br></code>
91 <code> To Spectrogram: 0.005, 5000, 0.002, 20, "Gaussian"<br></code>
92 <code> Paint: 0, 0, 0, 0, 100.0, "yes", 50.0, 6.0, 0.0, "yes"<br></code>
93 <code> plusObject: "Sound sineWithNoise"<br></code>
94 <code> Remove<br></code>
95 <code> "<br></code>
96 <p>Note that this script does not set the font and font size. This means that the drawing will use the font and font size of the manual page, which is usually what you want.</p>
97 <p>For obvious safety reasons, embedded scripts cannot contain commands that change the contents of any disk or send messages. Thus, commands like <b>Save as WAV file...</b>, <b><code><font size=+1>deleteFile: "out.txt"</font></code></b>, <code><font size=+1>writeFile: "out.txt", string$</font></code>, or <b><code><font size=+1>runSystem</font></code></b> are forbidden. Several other commands, such as <b><code><font size=+1>pauseScript</font></code></b> and <b><code><font size=+1>editor</font></code></b>, are irrelevant inside pictures and are therefore forbidden as well. Note that commands like <b><code><font size=+1>writeInfoLine</font></code></b>, <b>Read from file...</b>, and <b><code><font size=+1>runScript</font></code></b> are still available (with the last two, you can use relative paths; with <code><font size=+1>runScript</font></code>, you can only run scripts that do not call any of the forbidden commands directly or indirectly).</p>
98 <p>The commands <b>Set outer viewport...</b> and <b>Set inner viewport...</b> are available; they count in inches (if the font size of the manual is 12). The (0, 0) point is in the upper left corner, as in the Picture window, so that you can test your picture with a normal Praat script; for instance, the following script draws a cross in the upper half of the picture and a rectangle in the lower half:</p>
99 <code> &lt;script&gt; 4.5 4 "<br></code>
100 <code> Axes: 0, 100, 0, 100<br></code>
101 <code> Select inner viewport: 0, 4.5, 0, 2<br></code>
102 <code> Draw line: 0, 0, 100, 100<br></code>
103 <code> Draw line: 0, 100, 100, 0<br></code>
104 <code> Select inner viewport: 0, 4.5, 2, 4<br></code>
105 <code> Draw rectangle: 0, 100, 0, 100<br></code>
106 <code> "<br></code>
107 <p align=middle><img height=400 width=450 src=ManPages_1.png></p><h2>Script links</h2>
108 <p>Your text may contain links to Praat scripts. They are drawn in blue. The format is:</p>
109 <code> &lt;normal&gt; "Here is a script that @@\SCdraw.praat|draws@ what you have selected."<br></code>
110 <p>On your screen, you will see the word <b>draws</b>, drawn in blue. If you click on it, the script <code><font size=+1>draw.praat</font></code> will be executed. The string &#8220;<code><font size=+1>\SC</font></code>&#8221; indicates that a script file name follows. As with sounds, you can use relative file paths. The script can take arguments:</p>
111 <code> &lt;normal&gt; "This script @@\SCload2files.praat hello.wav hello.TextGrid|loads@ some files."<br></code>
112 <p>If the script file name or any arguments except the last contain spaces, they have to be enclosed within double quotes, which have to be doubled again in the ManPage code:</p>
113 <code> &lt;normal&gt; "Here is a script that @@\SC""my scripts/draw.praat""|draws@ what you have selected."<br></code>
114 <code> &lt;normal&gt; "This script @@\SC""my scripts/load2files.praat"" ""my sounds/hello.wav"" my textgrids/hello.TextGrid|loads@ some files."<br></code>
115 <p>For safety reasons, the user will see a warning about "trusting the author of the manual pages" if you include script links in your manual.</p>
116 <h2>How to separate link information and link text</h2>
117 <p>The separation between link information and viewable link text, as seen in the above description of sound and script links, is actually a general mechanism in the hypertext system. For instance, if you want to see the text "x" in blue on your screen, and create a link from it to the page "Dorsal fricatives", you specify the link as <code><font size=+1>@@Dorsal fricatives|x@</font></code>.</p>
118 <h2>Sound buttons</h2>
119 <p>If the <i>recording time</i> in the second line is not 0, three buttons will appear near the top of the page:</p>
120 <dl>
121 <dd style="position:relative;padding-left:1em;text-indent:-2em">1. The <b>Record</b> button allows you to record a sound from the microphone.</dd>
122 <dd style="position:relative;padding-left:1em;text-indent:-2em">2. The <b>Play</b> button allows you to play this recorded sound. In this way, you can compare your own utterances with the sounds behind the sound links, for example.</dd>
123 <dd style="position:relative;padding-left:1em;text-indent:-2em">3. The <b>Copy last played to list</b> button copies the latest sound to the list of objects, allowing you to perform analyses on it, save it to disk, et cetera. The latest sound may be a sound that you recorded with the <b>Record</b> button, a sound that you played with the <b>Play</b> button, or a sound that you played by clicking on a sound link, whichever occurred most recently.</dd>
124 </dl>
125 <h2>And beyond</h2>
126 <p>If you need even more flexibility than ManPages offer you, consider using the <a href="Demo_window.html">Demo window</a> instead.</p>
127 <h3>Links to this page</h3>
128 <ul>
129 <li><a href="What_was_new_in_3_6_.html">What was new in 3.6?</a>
130 <li><a href="What_was_new_in_3_9_.html">What was new in 3.9?</a>
131 <li><a href="What_was_new_in_4_5_.html">What was new in 4.5?</a>
132 <li><a href="What_was_new_in_4_6_.html">What was new in 4.6?</a>
133 </ul>
134 <hr>
135 <address>
136 <p>© Paul Boersma 2023-04-20</p>
137 </address>
138 </body>
139 </html>