1<?xml version="1.0" encoding="UTF-8"?> 2 3<!--*********************************************************** 4 * 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * 22 ***********************************************************--> 23 24<helpdocument version="1.0"> 25<meta> 26<topic id="textsmath0103091100xml" indexer="include" status="PUBLISH"> 27<title id="tit" xml-lang="en-US">Brackets and Grouping</title> 28<filename>/text/smath/01/03091100.xhp</filename> 29</topic> 30</meta> 31<body> 32<bookmark xml-lang="en-US" branch="index" id="bm_id3147341"><bookmark_value>brackets and grouping in $[officename] Math</bookmark_value> 33<bookmark_value>grouping and brackets in $[officename] Math</bookmark_value> 34</bookmark> 35<paragraph role="heading" id="hd_id3147341" xml-lang="en-US" level="1" l10n="U" oldref="1"><link href="text/smath/01/03091100.xhp" name="Brackets and Grouping">Brackets and Grouping</link></paragraph> 36<paragraph role="paragraph" id="par_id3150342" xml-lang="en-US" l10n="U" oldref="2">Note: the quotation marks in the examples are used to emphasize text and do not belong to the content of the formulas and commands.</paragraph> 37<paragraph role="warning" id="par_id3146962" xml-lang="en-US" l10n="U" oldref="3">When typing example formulas into the <emph>Commands</emph> window, note that spaces are often required for correct structure.</paragraph> 38<paragraph role="paragraph" id="par_id3149054" xml-lang="en-US" l10n="U" oldref="4">Braces "{}" are used to group expressions together to form one new expression. For example, "sqrt {x * y}" is the square root of the entire product x*y, while "sqrt x * y" is the square root of x multiplied by y. Braces do not require an extra space.</paragraph> 39<paragraph role="paragraph" id="par_id3151392" xml-lang="en-US" l10n="CHG" oldref="5">Set brackets were previously inserted in the Elements window or directly in the Commands window as "left lbrace <?> right rbrace". Now, a left and a right set bracket can also be inserted using "lbrace" and "rbrace", with or without wildcards.</paragraph> 40<paragraph role="paragraph" id="par_id3147403" xml-lang="en-US" l10n="U" oldref="6">There are a total of eight (8) different types of brackets available. The "ceil" and "floor" brackets are often used for rounding up or down the argument to the next integer: "lceil -3.7 rceil = -3" or "lfloor -3.7 rfloor = -4".</paragraph> 41<paragraph role="paragraph" id="par_id3146320" xml-lang="en-US" l10n="U" oldref="63">Operator brackets, also known as Bra-kets (angle brackets with a vertical line in between), are common in Physics notation: "langle a mline b rangle" or "langle a mline b mline c over d mline e rangle." The height and positioning of the vertical lines always corresponds exactly to the enclosing brackets.</paragraph> 42<paragraph role="paragraph" id="par_id3157870" xml-lang="en-US" l10n="U" oldref="7">All brackets may only be used in pairs. The brackets have some common characteristics:</paragraph> 43<paragraph role="paragraph" id="par_id3155761" xml-lang="en-US" l10n="CHG" oldref="8">All types of brackets have the same grouping function as described for "{}" brackets.</paragraph> 44<paragraph role="paragraph" id="par_id3145590" xml-lang="en-US" l10n="U" oldref="9">All types of brackets, including those that are visible, permit empty group definition. The enclosed expression may therefore be empty.</paragraph> 45<paragraph role="paragraph" id="par_id3154562" xml-lang="en-US" l10n="U" oldref="10">Brackets do not adjust their size to the enclosed expression. For example, if you want "( a over b )" with a bracket size adjusted to a and b you must insert "left" and "right". Entering "left(a over b right)" produces appropriate sizing. If, however, the brackets themselves are part of the expression whose size is changed, they are included the size change: "size 3(a over b)" and "size 12(a over b)". The sizing of the bracket-to-expression ratio does not change in any way.</paragraph> 46<paragraph role="paragraph" id="par_id3153002" xml-lang="en-US" l10n="U" oldref="11">Since "left" and "right" ensure unique assignment of the brackets, every single bracket can be used as an argument for these two commands, even placing right brackets on the left side, or left brackets on the right. Instead of a bracket you can use the "none" qualifier, which means that there is no bracket shown and that there is no space reserved for a bracket. Using this, you can create the following expressions:</paragraph> 47<list type="unordered"> 48<listitem> 49<paragraph role="code" id="par_id3150014" xml-lang="en-US" l10n="U" oldref="12">left lbrace x right none</paragraph> 50</listitem> 51<listitem> 52<paragraph role="code" id="par_id3149877" xml-lang="en-US" l10n="U" oldref="13">left [ x right )</paragraph> 53</listitem> 54<listitem> 55<paragraph role="code" id="par_id3145241" xml-lang="en-US" l10n="U" oldref="14">left ] x right [</paragraph> 56</listitem> 57<listitem> 58<paragraph role="code" id="par_id3156060" xml-lang="en-US" l10n="U" oldref="15">left rangle x right lfloor</paragraph> 59</listitem> 60</list> 61<paragraph role="paragraph" id="par_id3150935" xml-lang="en-US" l10n="U" oldref="16">The same rules apply to "left" and "right" as to the other brackets: they also work as group builders and may enclose empty expressions.</paragraph> 62<paragraph role="paragraph" id="par_id3149030" xml-lang="en-US" l10n="U" oldref="17">The combination of mismatched brackets, single brackets and repositioned left and right brackets occurs often in mathematical formulas. The following is a formula that will create an error when typed:</paragraph> 63<list type="unordered"> 64<listitem> 65<paragraph role="code" id="par_id3155989" xml-lang="en-US" l10n="U" oldref="19">[2, 3) - right open interval</paragraph> 66</listitem> 67</list> 68<paragraph role="paragraph" id="par_id3147169" xml-lang="en-US" l10n="U" oldref="23">Using "left" and "right" makes the above expression valid in $[officename] Math: "left [2, 3 right )". However, the brackets do not have any fixed size because they adjust to the argument. Setting a single bracket is a bit cumbersome. Therefore, there you can display single brackets with a fixed size by placing a "\" (backslash) in front of normal brackets. These brackets then act like any other symbol and no longer have the special functionality of brackets; that is they do not work as group builders and their orientation corresponds to that of other symbols. See "size *2 \langle x \rangle" and "size *2 langle x rangle".</paragraph> 69<paragraph role="paragraph" id="par_id3153720" xml-lang="en-US" l10n="U" oldref="24">The complete overview is as follows</paragraph> 70<list type="unordered"> 71<listitem> 72<paragraph role="code" id="par_id3149715" xml-lang="en-US" l10n="U" oldref="25">\{ or \lbrace, \} or \rbrace</paragraph> 73</listitem> 74</list> 75<list type="unordered"> 76<listitem> 77<paragraph role="code" id="par_id3150756" xml-lang="en-US" l10n="U" oldref="26">\(, \)</paragraph> 78</listitem> 79</list> 80<list type="unordered"> 81<listitem> 82<paragraph role="code" id="par_id3145207" xml-lang="en-US" l10n="U" oldref="27">\[, \]</paragraph> 83</listitem> 84</list> 85<list type="unordered"> 86<listitem> 87<paragraph role="code" id="par_id3153153" xml-lang="en-US" l10n="U" oldref="28">\langle, \rangle</paragraph> 88</listitem> 89</list> 90<list type="unordered"> 91<listitem> 92<paragraph role="code" id="par_id3150263" xml-lang="en-US" l10n="U" oldref="29">\lceil, \rceil</paragraph> 93</listitem> 94</list> 95<list type="unordered"> 96<listitem> 97<paragraph role="code" id="par_id3147252" xml-lang="en-US" l10n="U" oldref="30">\lfloor, \rfloor</paragraph> 98</listitem> 99</list> 100<list type="unordered"> 101<listitem> 102<paragraph role="code" id="par_id3154690" xml-lang="en-US" l10n="U" oldref="31">\lline, \rline</paragraph> 103</listitem> 104</list> 105<list type="unordered"> 106<listitem> 107<paragraph role="code" id="par_id3145414" xml-lang="en-US" l10n="U" oldref="32">\ldline, \rdline</paragraph> 108</listitem> 109</list> 110<paragraph role="paragraph" id="par_id3147514" xml-lang="en-US" l10n="U" oldref="33">In this way, intervals like the one above can be built in <emph>$[officename] Math</emph> without any problems: \[2", "3\) or "\]2", "3\[ (Attention: These quotation marks are part of the entry.)</paragraph> 111<paragraph role="note" id="par_id3153532" xml-lang="en-US" l10n="U" oldref="34">Please note that the quotation marks must be entered and can be obtained with <emph>Shift+2</emph> and not with typographical quotation marks. Generally, punctuation marks (like the comma in this case) are set as text. Although it is also possible to type "\[2,~3\)" the above option is preferable. In the previous example, "fixed size" always describes a bracket size dependent on the font size used.</paragraph> 112<paragraph role="paragraph" id="par_id3153674" xml-lang="en-US" l10n="U" oldref="35">Nesting groups within each other is relatively problem-free. In the formula hat "{a + b}" the "hat" is displayed simply over the center of "{a + b}". Also, "color red lceil a rceil" and "grave hat langle x * y rangle" work as expected. The result of the latter can be compared to "grave {hat langle x * y rangle}." These attributes do not compete, but rather can be combined.</paragraph> 113<paragraph role="paragraph" id="par_id3147526" xml-lang="en-US" l10n="U" oldref="36">This differs slightly for competing or mutually influencing attributes. This is often the case with font attributes. For example, which color does the b have in "color yellow color red (a + color green b)", or which size does it have in "size *4 (a + size /2 b)"? Given a base size of 12, does it have the size 48, 6 or even 24 (which could be seen as a combination)? The following are basic resolution rules, which will be followed consistently in the future. In general, the rules apply to all group operations. This only has a visible effect on the font attributes, like "bold", "ital", "phantom", "size", "color" and "font":</paragraph> 114<list type="unordered"> 115<listitem> 116<paragraph role="listitem" id="par_id3152952" xml-lang="en-US" l10n="U" oldref="37">Group operations in sequence are treated as if every single operation is enclosed by braces. They are nested, and in every level there can be no more than one operation. Here is an example of a formula with many group operations: "size 12 color red font sans size -5 (a + size 8 b)" like "{size 12{color red{font sans{size -5 (a + {size 8 b})}}}}".</paragraph> 117</listitem> 118</list> 119<list type="unordered"> 120<listitem> 121<paragraph role="listitem" id="par_id3158441" xml-lang="en-US" l10n="U" oldref="38">This example formula is then interpreted from left to right. The operations only affect its corresponding group (or expression). Operations further to the right "replace" or "combine themselves with" their predecessors.</paragraph> 122</listitem> 123</list> 124<list type="unordered"> 125<listitem> 126<paragraph role="listitem" id="par_id3150994" xml-lang="en-US" l10n="U" oldref="39">A group operation does not have any effect on higher-level operations but rather affects only lower-level groups and expressions, including their brackets and super-/subscripts. For example, "a + size *2 (b * size -8 c_1)^2"</paragraph> 127</listitem> 128</list> 129<paragraph role="note" id="par_id3154196" xml-lang="en-US" l10n="U" oldref="40">"color ..." and "font ..." as well as "size n" (n is a decimal) replace any preceding operations of the same type</paragraph> 130<paragraph role="note" id="par_id3154136" xml-lang="en-US" l10n="U" oldref="41">for "size +n", "size -n", "size *n", and "size /n" the effects of the operations are combined,</paragraph> 131<paragraph role="note" id="par_id3146934" xml-lang="en-US" l10n="U" oldref="42">"size *2 size -5 a" would be double the starting size minus 5</paragraph> 132<paragraph role="note" id="par_id3149297" xml-lang="en-US" l10n="U" oldref="43">"font sans ( a + font serif b)"</paragraph> 133<paragraph role="note" id="par_id3155174" xml-lang="en-US" l10n="U" oldref="44">"size *2 ( a + size /2 b )"</paragraph><comment>UFI: no more StarSymbol font. Removed the following paras</comment><comment>id="par_id3151327" l10n="U" oldref="45"For the StarSymbol Unicode font there are 2 exceptions to these rules: 134id="par_id3148998" l10n="U" oldref="46"It ignores "font" commands. Otherwise, there would often be different characters from the ones desired, for example, "font sans (a oplus b)" would then neither have brackets nor an "oplus". 135id="par_id3143281" l10n="U" oldref="47"The "ital" command is ignored, for example, "ital (a + b)". This happens because italicized mathematical symbols are uncommon, even in combination with text in italics.</comment><paragraph role="tip" id="par_id3154906" xml-lang="en-US" l10n="U" oldref="50">To change the size of a formula, use "size +" or -,*,/. Do not use "size n". These can easily be used in any context. This enables you to copy to other areas by using Copy and Paste, and the result remains the same. Furthermore, such expressions survive a change of base size in the menu better than when using "size n". If you use only "size *" and "size /" (for example, "size *1.24 a or size /0.86 a") the proportions remain intact.</paragraph> 136<paragraph role="tip" id="par_id3147587" xml-lang="en-US" l10n="U" oldref="51">Examples (with a base size of 12 and 50% for indexes):</paragraph> 137<paragraph role="tip" id="par_id3148734" xml-lang="en-US" l10n="U" oldref="52">Exactly identical proportions with "size 18 a_n" and "size *1.5 a_n".</paragraph> 138<paragraph role="tip" id="par_id3152766" xml-lang="en-US" l10n="U" oldref="53">This differs in different contexts: "x^{size 18 a_n}" and "x^{size *1.5 a_n}"</paragraph> 139<paragraph role="tip" id="par_id3157986" xml-lang="en-US" l10n="U" oldref="54">Examples with size +n for a comparison. They look identical:</paragraph> 140<paragraph role="codeintip" id="par_id3158001" xml-lang="en-US" l10n="U" oldref="55">a_{size 8 n}</paragraph> 141<paragraph role="codeintip" id="par_id3147332" xml-lang="en-US" l10n="U" oldref="56">a_{size +2 n}</paragraph> 142<paragraph role="codeintip" id="par_id3155143" xml-lang="en-US" l10n="U" oldref="57">a_{size *1.333 n}</paragraph> 143<paragraph role="tip" id="par_id3147129" xml-lang="en-US" l10n="U" oldref="58">The following examples, however, do not look identical:</paragraph> 144<paragraph role="codeintip" id="par_id3147073" xml-lang="en-US" l10n="U" oldref="59">x^{a_{size 8 n}}</paragraph> 145<paragraph role="codeintip" id="par_id3147086" xml-lang="en-US" l10n="U" oldref="60">x^{a_{size +2 n}}</paragraph> 146<paragraph role="codeintip" id="par_id3154386" xml-lang="en-US" l10n="U" oldref="61">x^{a_{size *1.333 n}}</paragraph> 147<paragraph role="tip" id="par_id3153354" xml-lang="en-US" l10n="U" oldref="62">Note that all n here have different sizes. The size 1.333 results from 8/6, the desired size divided by the default index size 6. (Index size 50% with a base size of 12)</paragraph> 148</body> 149</helpdocument> 150