{"route":"/en-US-v0.14.1/reference/math/lr/","title":"Left/Right","description":"Documentation for the lr functions.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"functions","name":"Functions","children":[{"id":"functions-lr","name":"Left/Right","children":[{"id":"functions-lr-size","name":"size","children":[]},{"id":"functions-lr-body","name":"body","children":[]}]},{"id":"functions-mid","name":"Mid","children":[{"id":"functions-mid-body","name":"body","children":[]}]},{"id":"functions-abs","name":"Abs","children":[{"id":"functions-abs-size","name":"size","children":[]},{"id":"functions-abs-body","name":"body","children":[]}]},{"id":"functions-norm","name":"Norm","children":[{"id":"functions-norm-size","name":"size","children":[]},{"id":"functions-norm-body","name":"body","children":[]}]},{"id":"functions-floor","name":"Floor","children":[{"id":"functions-floor-size","name":"size","children":[]},{"id":"functions-floor-body","name":"body","children":[]}]},{"id":"functions-ceil","name":"Ceil","children":[{"id":"functions-ceil-size","name":"size","children":[]},{"id":"functions-ceil-body","name":"body","children":[]}]},{"id":"functions-round","name":"Round","children":[{"id":"functions-round-size","name":"size","children":[]},{"id":"functions-round-body","name":"body","children":[]}]}]}],"body":{"kind":"group","content":{"name":"lr","title":"Left/Right","details":"<p>Delimiter matching.</p>\n<p>The <code>lr</code> function allows you to match two delimiters and scale them with the\ncontent they contain. While this also happens automatically for delimiters\nthat match syntactically, <code>lr</code> allows you to match two arbitrary delimiters\nand control their size exactly. Apart from the <code>lr</code> function, Typst provides\na few more functions that create delimiter pairings for absolute, ceiled,\nand floored values as well as norms.</p>\n<p>To prevent a delimiter from being matched by Typst, and thus auto-scaled,\nescape it with a backslash. To instead disable auto-scaling completely, use\n<code><span class=\"typ-key\">set</span> math<span class=\"typ-punct\">.</span><span class=\"typ-func\">lr</span><span class=\"typ-punct\">(</span>size<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1em</span><span class=\"typ-punct\">)</span></code>.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> [a, b<span class=\"typ-math-op\">/</span>2] <span class=\"typ-math-delim\">$</span>\n<span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">lr</span><span class=\"typ-punct\">(</span>]<span class=\"typ-pol\">sum</span><span class=\"typ-math-op\">_</span><span class=\"typ-punct\">(</span>x=1<span class=\"typ-punct\">)</span><span class=\"typ-math-op\">^</span>n]<span class=\"typ-punct\">,</span> size<span class=\"typ-punct\">:</span> <span class=\"typ-num\">#</span><span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span> x <span class=\"typ-math-delim\">$</span>\n<span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">abs</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">(</span>x + y<span class=\"typ-punct\">)</span> <span class=\"typ-math-op\">/</span> 2<span class=\"typ-punct\">)</span> <span class=\"typ-math-delim\">$</span>\n<span class=\"typ-math-delim\">$</span> <span class=\"typ-escape\">\\{</span> (x <span class=\"typ-math-op\">/</span> y) <span class=\"typ-escape\">\\}</span> <span class=\"typ-math-delim\">$</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> math<span class=\"typ-punct\">.</span><span class=\"typ-func\">lr</span><span class=\"typ-punct\">(</span>size<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1em</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-math-delim\">$</span> { (a <span class=\"typ-math-op\">/</span> b), a, b <span class=\"typ-pol\">in</span> (0; 1<span class=\"typ-math-op\">/</span>2] } <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/63330327318f138d9440594430988bbb.png\" alt=\"Preview\"></div></div>","functions":[{"path":["math"],"name":"lr","title":"Left/Right","keywords":[],"oneliner":"Scales delimiters.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Scales delimiters.</p>\n<p>While matched delimiters scale by default, this can be used to scale\nunmatched delimiters and to control the delimiter scaling more precisely.</p>"}],"self":false,"params":[{"name":"size","details":[{"kind":"html","content":"<p>The size of the brackets, relative to the height of the wrapped content.</p>"}],"types":["relative"],"strings":[],"default":"<code><span class=\"typ-num\">100%</span> <span class=\"typ-op\">+</span> <span class=\"typ-num\">0pt</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"body","details":[{"kind":"html","content":"<p>The delimited content, including the delimiters.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"mid","title":"Mid","keywords":[],"oneliner":"Scales delimiters vertically to the nearest surrounding `{lr()}` group.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Scales delimiters vertically to the nearest surrounding <code><span class=\"typ-func\">lr</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> group.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> { x <span class=\"typ-func\">mid</span><span class=\"typ-punct\">(</span>|<span class=\"typ-punct\">)</span> <span class=\"typ-pol\">sum</span><span class=\"typ-math-op\">_</span><span class=\"typ-punct\">(</span>i=1<span class=\"typ-punct\">)</span><span class=\"typ-math-op\">^</span>n w<span class=\"typ-math-op\">_</span>i|f<span class=\"typ-math-op\">_</span>i (x)| &lt; 1 } <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/a29f9290887cdd1f41b9003f982e3560.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"body","details":[{"kind":"html","content":"<p>The content to be scaled.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"abs","title":"Abs","keywords":[],"oneliner":"Takes the absolute value of an expression.","element":false,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Takes the absolute value of an expression.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">abs</span><span class=\"typ-punct\">(</span>x<span class=\"typ-math-op\">/</span>2<span class=\"typ-punct\">)</span> <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/5892ee44ad18813000297eeafd1b6e78.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"size","details":[{"kind":"html","content":"<p>The size of the brackets, relative to the height of the wrapped content.</p>"}],"types":["relative"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"body","details":[{"kind":"html","content":"<p>The expression to take the absolute value of.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"norm","title":"Norm","keywords":[],"oneliner":"Takes the norm of an expression.","element":false,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Takes the norm of an expression.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">norm</span><span class=\"typ-punct\">(</span>x<span class=\"typ-math-op\">/</span>2<span class=\"typ-punct\">)</span> <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/602e918d9e4207139477dfb451df53cd.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"size","details":[{"kind":"html","content":"<p>The size of the brackets, relative to the height of the wrapped content.</p>"}],"types":["relative"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"body","details":[{"kind":"html","content":"<p>The expression to take the norm of.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"floor","title":"Floor","keywords":[],"oneliner":"Floors an expression.","element":false,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Floors an expression.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">floor</span><span class=\"typ-punct\">(</span>x<span class=\"typ-math-op\">/</span>2<span class=\"typ-punct\">)</span> <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/3c3107954755188561218b3da59b9b88.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"size","details":[{"kind":"html","content":"<p>The size of the brackets, relative to the height of the wrapped content.</p>"}],"types":["relative"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"body","details":[{"kind":"html","content":"<p>The expression to floor.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"ceil","title":"Ceil","keywords":[],"oneliner":"Ceils an expression.","element":false,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Ceils an expression.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">ceil</span><span class=\"typ-punct\">(</span>x<span class=\"typ-math-op\">/</span>2<span class=\"typ-punct\">)</span> <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/f0cd1c0e8d2655688398c799bc806a38.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"size","details":[{"kind":"html","content":"<p>The size of the brackets, relative to the height of the wrapped content.</p>"}],"types":["relative"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"body","details":[{"kind":"html","content":"<p>The expression to ceil.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"round","title":"Round","keywords":[],"oneliner":"Rounds an expression.","element":false,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Rounds an expression.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">round</span><span class=\"typ-punct\">(</span>x<span class=\"typ-math-op\">/</span>2<span class=\"typ-punct\">)</span> <span class=\"typ-math-delim\">$</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/b45f33012980296a7361d593384f333c.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"size","details":[{"kind":"html","content":"<p>The size of the brackets, relative to the height of the wrapped content.</p>"}],"types":["relative"],"strings":[],"default":null,"positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"body","details":[{"kind":"html","content":"<p>The expression to round.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]}],"global_attributes":[]}}}