{"route":"/en-US-v0.14.1/reference/math/attach/","title":"Attach","description":"Documentation for the attach functions.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"syntax","name":"Syntax","children":[]},{"id":"functions","name":"Functions","children":[{"id":"functions-attach","name":"Attach","children":[{"id":"functions-attach-base","name":"base","children":[]},{"id":"functions-attach-t","name":"t","children":[]},{"id":"functions-attach-b","name":"b","children":[]},{"id":"functions-attach-tl","name":"tl","children":[]},{"id":"functions-attach-bl","name":"bl","children":[]},{"id":"functions-attach-tr","name":"tr","children":[]},{"id":"functions-attach-br","name":"br","children":[]}]},{"id":"functions-scripts","name":"Scripts","children":[{"id":"functions-scripts-body","name":"body","children":[]}]},{"id":"functions-limits","name":"Limits","children":[{"id":"functions-limits-body","name":"body","children":[]},{"id":"functions-limits-inline","name":"inline","children":[]}]}]}],"body":{"kind":"group","content":{"name":"attach","title":"Attach","details":"<p>Subscript, superscripts, and limits.</p>\n<p>Attachments can be displayed either as sub/superscripts, or limits. Typst\nautomatically decides which is more suitable depending on the base, but you\ncan also control this manually with the <code>scripts</code> and <code>limits</code> functions.</p>\n<p>If you want the base to stretch to fit long top and bottom attachments (for\nexample, an arrow with text above it), use the <a href=\"/en-US-v0.14.1/reference/math/stretch/\"><code>stretch</code></a>\nfunction.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-pol\">sum</span><span class=\"typ-math-op\">_</span><span class=\"typ-punct\">(</span>i=0<span class=\"typ-punct\">)</span><span class=\"typ-math-op\">^</span>n a<span class=\"typ-math-op\">_</span>i = 2<span class=\"typ-math-op\">^</span><span class=\"typ-punct\">(</span>1+i<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/411437d70da7deb746bc3f0a67ecac51.png\" alt=\"Preview\"></div></div>\n<h2 id=\"syntax\">Syntax</h2>\n<p>This function also has dedicated syntax for attachments after the base: Use\nthe underscore (<code>_</code>) to indicate a subscript i.e. bottom attachment and the\nhat (<code>^</code>) to indicate a superscript i.e. top attachment.</p>","functions":[{"path":["math"],"name":"attach","title":"Attach","keywords":[],"oneliner":"A base with optional attachments.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>A base with optional attachments.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">attach</span><span class=\"typ-punct\">(</span>\n  <span class=\"typ-pol\">Pi</span><span class=\"typ-punct\">,</span> t<span class=\"typ-punct\">:</span> <span class=\"typ-pol\">alpha</span><span class=\"typ-punct\">,</span> b<span class=\"typ-punct\">:</span> <span class=\"typ-pol\">beta</span><span class=\"typ-punct\">,</span>\n  tl<span class=\"typ-punct\">:</span> 1<span class=\"typ-punct\">,</span> tr<span class=\"typ-punct\">:</span> 2+3<span class=\"typ-punct\">,</span> bl<span class=\"typ-punct\">:</span> 4+5<span class=\"typ-punct\">,</span> br<span class=\"typ-punct\">:</span> 6<span class=\"typ-punct\">,</span>\n<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/84fd52f8518c49b5d0c2154d3762e8c5.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"base","details":[{"kind":"html","content":"<p>The base to which things are attached.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"t","details":[{"kind":"html","content":"<p>The top attachment, smartly positioned at top-right or above the base.</p>\n<p>You can wrap the base in <code><span class=\"typ-func\">limits</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> or <code><span class=\"typ-func\">scripts</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> to override the\nsmart positioning.</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"b","details":[{"kind":"html","content":"<p>The bottom attachment, smartly positioned at the bottom-right or below\nthe base.</p>\n<p>You can wrap the base in <code><span class=\"typ-func\">limits</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> or <code><span class=\"typ-func\">scripts</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> to override the\nsmart positioning.</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"tl","details":[{"kind":"html","content":"<p>The top-left attachment (before the base).</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"bl","details":[{"kind":"html","content":"<p>The bottom-left attachment (before base).</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"tr","details":[{"kind":"html","content":"<p>The top-right attachment (after the base).</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"br","details":[{"kind":"html","content":"<p>The bottom-right attachment (after the base).</p>"}],"types":["none","content"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true}],"returns":["content"],"scope":[]},{"path":["math"],"name":"scripts","title":"Scripts","keywords":[],"oneliner":"Forces a base to display attachments as scripts.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Forces a base to display attachments as scripts.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">scripts</span><span class=\"typ-punct\">(</span><span class=\"typ-pol\">sum</span><span class=\"typ-punct\">)</span><span class=\"typ-math-op\">_</span>1<span class=\"typ-math-op\">^</span>2 <span class=\"typ-escape\">!=</span> <span class=\"typ-pol\">sum</span><span class=\"typ-math-op\">_</span>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/c9599c27cd86c13285b8d314e2c8528c.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"body","details":[{"kind":"html","content":"<p>The base to attach the scripts to.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]},{"path":["math"],"name":"limits","title":"Limits","keywords":[],"oneliner":"Forces a base to display attachments as limits.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Forces a base to display attachments as limits.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-math-delim\">$</span> <span class=\"typ-func\">limits</span><span class=\"typ-punct\">(</span>A<span class=\"typ-punct\">)</span><span class=\"typ-math-op\">_</span>1<span class=\"typ-math-op\">^</span>2 <span class=\"typ-escape\">!=</span> A<span class=\"typ-math-op\">_</span>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/ffb91cddf4edf78f1af94d7ff70772ce.png\" alt=\"Preview\"></div></div>","title":null}}],"self":false,"params":[{"name":"body","details":[{"kind":"html","content":"<p>The base to attach the limits to.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"inline","details":[{"kind":"html","content":"<p>Whether to also force limits in inline equations.</p>\n<p>When applying limits globally (e.g., through a show rule), it is\ntypically a good idea to disable this.</p>"}],"types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">true</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true}],"returns":["content"],"scope":[]}],"global_attributes":[]}}}