{"route":"/en-US-v0.14.1/reference/model/par/","title":"Paragraph","description":"Documentation for the `par` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"boxes-and-blocks","name":"Boxes and blocks","children":[]},{"id":"what-becomes-a-paragraph","name":"What becomes a paragraph?","children":[]},{"id":"example","name":"Example","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-leading","name":"leading","children":[]},{"id":"parameters-spacing","name":"spacing","children":[]},{"id":"parameters-justify","name":"justify","children":[]},{"id":"parameters-justification-limits","name":"justification-limits","children":[]},{"id":"parameters-linebreaks","name":"linebreaks","children":[]},{"id":"parameters-first-line-indent","name":"first-line-indent","children":[]},{"id":"parameters-hanging-indent","name":"hanging-indent","children":[]},{"id":"parameters-body","name":"body","children":[]}]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-line","name":"Paragraph Line","children":[{"id":"definitions-line-numbering","name":"numbering","children":[]},{"id":"definitions-line-number-align","name":"number-align","children":[]},{"id":"definitions-line-number-margin","name":"number-margin","children":[]},{"id":"definitions-line-number-clearance","name":"number-clearance","children":[]},{"id":"definitions-line-numbering-scope","name":"numbering-scope","children":[]}]}]}],"body":{"kind":"func","content":{"path":[],"name":"par","title":"Paragraph","keywords":[],"oneliner":"A logical subdivison of textual content.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>A logical subdivison of textual content.</p>\n<p>Typst automatically collects <em>inline-level</em> elements into paragraphs.\nInline-level elements include <a href=\"/en-US-v0.14.1/reference/text/text/\" title=\"text\">text</a>, <a href=\"/en-US-v0.14.1/reference/layout/h/\">horizontal spacing</a>,\n<a href=\"/en-US-v0.14.1/reference/layout/box/\">boxes</a>, and <a href=\"/en-US-v0.14.1/reference/math/equation/\">inline equations</a>.</p>\n<p>To separate paragraphs, use a blank line (or an explicit <a href=\"/en-US-v0.14.1/reference/model/parbreak/\" title=\"`parbreak`\"><code>parbreak</code></a>).\nParagraphs are also automatically interrupted by any block-level element\n(like <a href=\"/en-US-v0.14.1/reference/layout/block/\" title=\"`block`\"><code>block</code></a>, <a href=\"/en-US-v0.14.1/reference/layout/place/\" title=\"`place`\"><code>place</code></a>, or anything that shows itself as one of these).</p>\n<p>The <code>par</code> element is primarily used in set rules to affect paragraph\nproperties, but it can also be used to explicitly display its argument as a\nparagraph of its own. Then, the paragraph's body may not contain any\nblock-level content.</p>\n<h2 id=\"boxes-and-blocks\">Boxes and blocks</h2>\n<p>As explained above, usually paragraphs only contain inline-level content.\nHowever, you can integrate any kind of block-level content into a paragraph\nby wrapping it in a <a href=\"/en-US-v0.14.1/reference/layout/box/\" title=\"`box`\"><code>box</code></a>.</p>\n<p>Conversely, you can separate inline-level content from a paragraph by\nwrapping it in a <a href=\"/en-US-v0.14.1/reference/layout/block/\" title=\"`block`\"><code>block</code></a>. In this case, it will not become part of any\nparagraph at all. Read the following section for an explanation of why that\nmatters and how it differs from just adding paragraph breaks around the\ncontent.</p>\n<h2 id=\"what-becomes-a-paragraph\">What becomes a paragraph?</h2>\n<p>When you add inline-level content to your document, Typst will automatically\nwrap it in paragraphs. However, a typical document also contains some text\nthat is not semantically part of a paragraph, for example in a heading or\ncaption.</p>\n<p>The rules for when Typst wraps inline-level content in a paragraph are as\nfollows:</p>\n<ul>\n<li>\n<p>All text at the root of a document is wrapped in paragraphs.</p>\n</li>\n<li>\n<p>Text in a container (like a <code>block</code>) is only wrapped in a paragraph if the\ncontainer holds any block-level content. If all of the contents are\ninline-level, no paragraph is created.</p>\n</li>\n</ul>\n<p>In the laid-out document, it's not immediately visible whether text became\npart of a paragraph. However, it is still important for various reasons:</p>\n<ul>\n<li>\n<p>Certain paragraph styling like <code>first-line-indent</code> will only apply to\nproper paragraphs, not any text. Similarly, <code>par</code> show rules of course\nonly trigger on paragraphs.</p>\n</li>\n<li>\n<p>A proper distinction between paragraphs and other text helps people who\nrely on Assistive Technology (AT) (such as screen readers) navigate and\nunderstand the document properly.</p>\n</li>\n<li>\n<p>PDF export will generate a <code>P</code> tag only for paragraphs.</p>\n</li>\n<li>\n<p>HTML export will generate a <code>&lt;p&gt;</code> tag only for paragraphs.</p>\n</li>\n</ul>\n<p>When creating custom reusable components, you can and should take charge\nover whether Typst creates paragraphs. By wrapping text in a <a href=\"/en-US-v0.14.1/reference/layout/block/\" title=\"`block`\"><code>block</code></a>\ninstead of just adding paragraph breaks around it, you can force the absence\nof a paragraph. Conversely, by adding a <a href=\"/en-US-v0.14.1/reference/model/parbreak/\" title=\"`parbreak`\"><code>parbreak</code></a> after some content in a\ncontainer, you can force it to become a paragraph even if it's just one\nword. This is, for example, what <a href=\"/en-US-v0.14.1/reference/model/list/#parameters-tight\">non-<code>tight</code></a> lists do to\nforce their items to become paragraphs.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>\n  first-line-indent<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1em</span><span class=\"typ-punct\">,</span>\n  spacing<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0.65em</span><span class=\"typ-punct\">,</span>\n  justify<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\nWe proceed by contradiction.\nSuppose that there exists a set\nof positive integers <span class=\"typ-math-delim\">$</span>a<span class=\"typ-math-delim\">$</span>, <span class=\"typ-math-delim\">$</span>b<span class=\"typ-math-delim\">$</span>, and\n<span class=\"typ-math-delim\">$</span>c<span class=\"typ-math-delim\">$</span> that satisfies the equation\n<span class=\"typ-math-delim\">$</span>a<span class=\"typ-math-op\">^</span>n + b<span class=\"typ-math-op\">^</span>n = c<span class=\"typ-math-op\">^</span>n<span class=\"typ-math-delim\">$</span> for some\ninteger value of <span class=\"typ-math-delim\">$</span>n &gt; 2<span class=\"typ-math-delim\">$</span>.\n\nWithout loss of generality,\nlet <span class=\"typ-math-delim\">$</span>a<span class=\"typ-math-delim\">$</span> be the smallest of the\nthree integers. Then, we <span class=\"typ-escape\">...</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/cab222a5bd10633b8312040d645e7baf.png\" alt=\"Preview\"></div></div>"}],"self":false,"params":[{"name":"leading","details":[{"kind":"html","content":"<p>The spacing between lines.</p>\n<p>Leading defines the spacing between the <a href=\"/en-US-v0.14.1/reference/text/text/#parameters-bottom-edge\">bottom edge</a>\nof one line and the <a href=\"/en-US-v0.14.1/reference/text/text/#parameters-top-edge\">top edge</a> of the following line. By\ndefault, these two properties are up to the font, but they can also be\nconfigured manually with a text set rule.</p>\n<p>By setting top edge, bottom edge, and leading, you can also configure a\nconsistent baseline-to-baseline distance. You could, for instance, set\nthe leading to <code><span class=\"typ-num\">1em</span></code>, the top-edge to <code><span class=\"typ-num\">0.8em</span></code>, and the bottom-edge\nto <code><span class=\"typ-op\">-</span><span class=\"typ-num\">0.2em</span></code> to get a baseline gap of exactly <code><span class=\"typ-num\">2em</span></code>. The exact\ndistribution of the top- and bottom-edge values affects the bounds of\nthe first and last line.</p>"},{"kind":"example","content":{"body":"<div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/9c812905bc7a3255ec39739967cf00b1.png\" alt=\"Preview\"></div>","title":null}}],"types":["length"],"strings":[],"default":"<code><span class=\"typ-num\">0.65em</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"spacing","details":[{"kind":"html","content":"<p>The spacing between paragraphs.</p>\n<p>Just like leading, this defines the spacing between the bottom edge of a\nparagraph's last line and the top edge of the next paragraph's first\nline.</p>\n<p>When a paragraph is adjacent to a <a href=\"/en-US-v0.14.1/reference/layout/block/\" title=\"`block`\"><code>block</code></a> that is not a paragraph,\nthat block's <a href=\"/en-US-v0.14.1/reference/layout/block/#parameters-above\"><code>above</code></a> or <a href=\"/en-US-v0.14.1/reference/layout/block/#parameters-below\"><code>below</code></a> property\ntakes precedence over the paragraph spacing. Headings, for instance,\nreduce the spacing below them by default for a better look.</p>"}],"types":["length"],"strings":[],"default":"<code><span class=\"typ-num\">1.2em</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"justify","details":[{"kind":"html","content":"<p>Whether to justify text in its line.</p>\n<p>Hyphenation will be enabled for justified paragraphs if the\n<a href=\"/en-US-v0.14.1/reference/text/text/#parameters-hyphenate\">text function's <code>hyphenate</code> property</a> is set to\n<code><span class=\"typ-key\">auto</span></code> and the current language is known.</p>\n<p>Note that the current <a href=\"/en-US-v0.14.1/reference/layout/align/#parameters-alignment\">alignment</a> still has an effect\non the placement of the last line except if it ends with a\n<a href=\"/en-US-v0.14.1/reference/text/linebreak/#parameters-justify\">justified line break</a>.</p>\n<p>By default, Typst only changes the spacing between words to achieve\njustification. However, you can also allow it to adjust the spacing\nbetween individual characters using the\n<a href=\"/en-US-v0.14.1/reference/model/par/#parameters-justification-limits\"><code>justification-limits</code> property</a>.</p>"}],"types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">false</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"justification-limits","details":[{"kind":"html","content":"<p>How much the spacing between words and characters may be adjusted during\njustification.</p>\n<p>When justifying text, Typst needs to stretch or shrink a line to the\nfull width of the measure. To achieve this, by default, it adjusts the\nspacing between words. Additionally, it can also adjust the spacing\nbetween individual characters. This property allows you to configure\nlower and upper bounds for these adjustments.</p>\n<p>The property accepts a dictionary with two entries, <code>spacing</code> and\n<code>tracking</code>, each containing a dictionary with the keys <code>min</code> and <code>max</code>.\nThe <code>min</code> keys define down to which lower bound gaps may be shrunk while\nthe <code>max</code> keys define up to which upper bound they may be stretched.</p>\n<ul>\n<li>\n<p>The <code>spacing</code> entry defines how much the width of spaces between words\nmay be adjusted. It is closely related to <a href=\"/en-US-v0.14.1/reference/text/text/#parameters-spacing\" title=\"`text.spacing`\"><code>text.spacing</code></a> and its\n<code>min</code> and <code>max</code> keys accept <a href=\"/en-US-v0.14.1/reference/layout/relative/\">relative lengths</a>, just like\nthe <code>spacing</code> property.</p>\n<p>A <code>min</code> value of <code><span class=\"typ-num\">100%</span></code> means that spaces should retain their normal\nsize (i.e. not be shrunk), while a value of <code><span class=\"typ-num\">90%</span> <span class=\"typ-op\">-</span> <span class=\"typ-num\">0.01em</span></code> would\nindicate that a space can be shrunk to a width of 90% of its normal\nwidth minus 0.01× the current font size. Similarly, a <code>max</code> value of\n<code><span class=\"typ-num\">100%</span> <span class=\"typ-op\">+</span> <span class=\"typ-num\">0.02em</span></code> means that a space's width can be increased by 0.02×\nthe current font size. The ratio part must always be positive. The\nlength part, meanwhile, must not be positive for <code>min</code> and not be\nnegative for <code>max</code>.</p>\n<p>Note that spaces may still be expanded beyond the <code>max</code> value if there\nis no way to justify the line otherwise. However, other means of\njustification (e.g. spacing apart characters if the <code>tracking</code> entry\nis configured accordingly) are first used to their maximum.</p>\n</li>\n<li>\n<p>The <code>tracking</code> entry defines how much the spacing between letters may\nbe adjusted. It is closely related to <a href=\"/en-US-v0.14.1/reference/text/text/#parameters-tracking\" title=\"`text.tracking`\"><code>text.tracking</code></a> and its <code>min</code>\nand <code>max</code> keys accept <a href=\"/en-US-v0.14.1/reference/layout/length/\">lengths</a>, just like the <code>tracking</code>\nproperty. Unlike <code>spacing</code>, it does not accept relative lengths\nbecause the base of the relative length would vary for each character,\nleading to an uneven visual appearance. The behavior compared to\n<code>spacing</code> is as if the base was <code><span class=\"typ-num\">100%</span></code>.</p>\n<p>Otherwise, the <code>min</code> and <code>max</code> values work just like for <code>spacing</code>. A\n<code>max</code> value of <code><span class=\"typ-num\">0.01em</span></code> means that additional spacing amounting to\n0.01× of the current font size may be inserted between every pair of\ncharacters. Note that this also includes the gaps between spaces and\ncharacters, so for spaces the values of <code>tracking</code> act in addition to\nthe values for <code>spacing</code>.</p>\n</li>\n</ul>\n<p>If you only specify one of <code>spacing</code> or <code>tracking</code>, the other retains\nits previously set value (or the default if it was not previously set).</p>\n<p>If you want to enable character-level justification, a good value for\nthe <code>min</code> and <code>max</code> keys is around <code><span class=\"typ-num\">0.01em</span></code> to <code><span class=\"typ-num\">0.02em</span></code> (negated for\n<code>min</code>). Using the same value for both gives a good baseline, but\ntweaking the two values individually may produce more balanced results,\nas demonstrated in the example below. Be careful not to set the bounds\ntoo wide, as it quickly looks unnatural.</p>\n<p>Using character-level justification is an impactful microtypographical\ntechnique that can improve the appearance of justified text, especially\nin narrow columns. Note though that character-level justification does\nnot work with every font or language. For example, cursive fonts connect\nletters. Using character-level justification would lead to jagged\nconnections.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">let</span> <span class=\"typ-func\">example</span><span class=\"typ-punct\">(</span>name<span class=\"typ-punct\">)</span> <span class=\"typ-op\">=</span> <span class=\"typ-func\">columns</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">2</span><span class=\"typ-punct\">,</span> gutter<span class=\"typ-punct\">:</span> <span class=\"typ-num\">10pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>\n  <span class=\"typ-func\">#</span><span class=\"typ-func\">place</span><span class=\"typ-punct\">(</span>top<span class=\"typ-punct\">,</span> float<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">,</span> scope<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;parent&quot;</span><span class=\"typ-punct\">,</span> <span class=\"typ-func\">strong</span><span class=\"typ-punct\">(</span>name<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n  <span class=\"typ-comment\">/* Text from https://en.wikipedia.org/wiki/Anne_Bayley */</span>\n<span class=\"typ-punct\">]</span>\n\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">page</span><span class=\"typ-punct\">(</span>width<span class=\"typ-punct\">:</span> <span class=\"typ-num\">440pt</span><span class=\"typ-punct\">,</span> height<span class=\"typ-punct\">:</span> <span class=\"typ-num\">21em</span><span class=\"typ-punct\">,</span> margin<span class=\"typ-punct\">:</span> <span class=\"typ-num\">15pt</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>justify<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">text</span><span class=\"typ-punct\">(</span>size<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0.8em</span><span class=\"typ-punct\">)</span>\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">grid</span><span class=\"typ-punct\">(</span>\n  columns<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span><span class=\"typ-num\">1fr</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">1fr</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  gutter<span class=\"typ-punct\">:</span> <span class=\"typ-num\">20pt</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">{</span>\n    <span class=\"typ-comment\">// These are Typst&#39;s default limits.</span>\n    <span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>justification-limits<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>\n      spacing<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>min<span class=\"typ-punct\">:</span> <span class=\"typ-num\">100%</span> <span class=\"typ-op\">*</span> <span class=\"typ-num\">2</span> <span class=\"typ-op\">/</span> <span class=\"typ-num\">3</span><span class=\"typ-punct\">,</span> max<span class=\"typ-punct\">:</span> <span class=\"typ-num\">150%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n      tracking<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>min<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0em</span><span class=\"typ-punct\">,</span> max<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0em</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n    <span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n    <span class=\"typ-func\">example</span><span class=\"typ-punct\">[</span>Word-level justification<span class=\"typ-punct\">]</span>\n  <span class=\"typ-punct\">}</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">{</span>\n    <span class=\"typ-comment\">// These are our custom character-level limits.</span>\n    <span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>justification-limits<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>\n      tracking<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>min<span class=\"typ-punct\">:</span> <span class=\"typ-op\">-</span><span class=\"typ-num\">0.01em</span><span class=\"typ-punct\">,</span> max<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0.02em</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n    <span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n    <span class=\"typ-func\">example</span><span class=\"typ-punct\">[</span>Character-level justification<span class=\"typ-punct\">]</span>\n  <span class=\"typ-punct\">}</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/fb060df59ab97e6e1174e0a9031d64e3.png\" alt=\"Preview\"></div></div>","title":"Character-level justification"}}],"types":["dictionary"],"strings":[],"default":"<code><span class=\"typ-punct\">(</span>\n  spacing<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>min<span class=\"typ-punct\">:</span> <span class=\"typ-num\">66.67%</span> <span class=\"typ-op\">+</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">,</span> max<span class=\"typ-punct\">:</span> <span class=\"typ-num\">150%</span> <span class=\"typ-op\">+</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  tracking<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>min<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">,</span> max<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"linebreaks","details":[{"kind":"html","content":"<p>How to determine line breaks.</p>\n<p>When this property is set to <code><span class=\"typ-key\">auto</span></code>, its default value, optimized line\nbreaks will be used for justified paragraphs. Enabling optimized line\nbreaks for ragged paragraphs may also be worthwhile to improve the\nappearance of the text.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">page</span><span class=\"typ-punct\">(</span>width<span class=\"typ-punct\">:</span> <span class=\"typ-num\">207pt</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>linebreaks<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;simple&quot;</span><span class=\"typ-punct\">)</span>\nSome texts feature many longer\nwords. Those are often exceedingly\nchallenging to break in a visually\npleasing way.\n\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>linebreaks<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;optimized&quot;</span><span class=\"typ-punct\">)</span>\nSome texts feature many longer\nwords. Those are often exceedingly\nchallenging to break in a visually\npleasing way.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/afe7dac249a627a4a78b08bcfbe89be6.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["auto","str"],"strings":[{"string":"simple","details":"<p>Determine the line breaks in a simple first-fit style.</p>"},{"string":"optimized","details":"<p>Optimize the line breaks for the whole paragraph.</p>\n<p>Typst will try to produce more evenly filled lines of text by\nconsidering the whole paragraph when calculating line breaks.</p>"}],"default":"<code><span class=\"typ-key\">auto</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"first-line-indent","details":[{"kind":"html","content":"<p>The indent the first line of a paragraph should have.</p>\n<p>By default, only the first line of a consecutive paragraph will be\nindented (not the first one in the document or container, and not\nparagraphs immediately following other block-level elements).</p>\n<p>If you want to indent all paragraphs instead, you can pass a dictionary\ncontaining the <code>amount</code> of indent as a length and the pair\n<code>all: <span class=\"typ-key\">true</span></code>. When <code>all</code> is omitted from the dictionary, it defaults to\n<code><span class=\"typ-key\">false</span></code>.</p>\n<p>By typographic convention, paragraph breaks are indicated either by some\nspace between paragraphs or by indented first lines. Consider</p>\n<ul>\n<li>reducing the <a href=\"/en-US-v0.14.1/reference/model/par/#parameters-spacing\">paragraph <code>spacing</code></a> to the\n<a href=\"/en-US-v0.14.1/reference/model/par/#parameters-leading\"><code>leading</code></a> using <code><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>spacing<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0.65em</span><span class=\"typ-punct\">)</span></code></li>\n<li>increasing the <a href=\"/en-US-v0.14.1/reference/layout/block/#parameters-spacing\">block <code>spacing</code></a> (which inherits the\nparagraph spacing by default) to the original paragraph spacing using\n<code><span class=\"typ-key\">set</span> <span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>spacing<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1.2em</span><span class=\"typ-punct\">)</span></code></li>\n</ul>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>spacing<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1.2em</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>\n  first-line-indent<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1.5em</span><span class=\"typ-punct\">,</span>\n  spacing<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0.65em</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\nThe first paragraph is not affected\nby the indent.\n\nBut the second paragraph is.\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>length<span class=\"typ-punct\">:</span> <span class=\"typ-num\">100%</span><span class=\"typ-punct\">)</span>\n\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>first-line-indent<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">(</span>\n  amount<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1.5em</span><span class=\"typ-punct\">,</span>\n  all<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n\nNow all paragraphs are affected\nby the first line indent.\n\nEven the first one.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/8d7d84d566dc85bdc1bc0863bc851879.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["length","dictionary"],"strings":[],"default":"<code><span class=\"typ-punct\">(</span>amount<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">,</span> all<span class=\"typ-punct\">:</span> <span class=\"typ-key\">false</span><span class=\"typ-punct\">)</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"hanging-indent","details":[{"kind":"html","content":"<p>The indent that all but the first line of a paragraph should have.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">par</span><span class=\"typ-punct\">(</span>hanging-indent<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1em</span><span class=\"typ-punct\">)</span>\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">lorem</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">15</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/7bde69f34692105af6720864a7d17480.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["length"],"strings":[],"default":"<code><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 contents of the paragraph.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[{"path":["par"],"name":"line","title":"Paragraph Line","keywords":["line numbering"],"oneliner":"A paragraph line.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>A paragraph line.</p>\n<p>This element is exclusively used for line number configuration through set\nrules and cannot be placed.</p>\n<p>The <a href=\"/en-US-v0.14.1/reference/model/par/#definitions-line-numbering\"><code>numbering</code></a> option is used to enable line\nnumbers by specifying a numbering format.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;1&quot;</span><span class=\"typ-punct\">)</span>\n\nRoses are red. <span class=\"typ-escape\">\\</span>\nViolets are blue. <span class=\"typ-escape\">\\</span>\nTypst is there for you.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/6f6e7b60b1d411a81b15694f783e2013.png\" alt=\"Preview\"></div></div>","title":null}},{"kind":"html","content":"<p>The <code>numbering</code> option takes either a predefined\n<a href=\"/en-US-v0.14.1/reference/model/numbering/\">numbering pattern</a> or a function returning styled content. You\ncan disable line numbers for text inside certain elements by setting the\nnumbering to <code><span class=\"typ-key\">none</span></code> using show-set rules.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-comment\">// Styled red line numbers.</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> n <span class=\"typ-op\">=&gt;</span> <span class=\"typ-func\">text</span><span class=\"typ-punct\">(</span>red<span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span><span class=\"typ-pol\">#</span><span class=\"typ-pol\">n</span><span class=\"typ-punct\">]</span>\n<span class=\"typ-punct\">)</span>\n\n<span class=\"typ-comment\">// Disable numbers inside figures.</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">show</span> <span class=\"typ-func\">figure</span><span class=\"typ-punct\">:</span> <span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> <span class=\"typ-key\">none</span>\n<span class=\"typ-punct\">)</span>\n\nRoses are red. <span class=\"typ-escape\">\\</span>\nViolets are blue.\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">figure</span><span class=\"typ-punct\">(</span>\n  caption<span class=\"typ-punct\">:</span> <span class=\"typ-punct\">[</span>Without line numbers.<span class=\"typ-punct\">]</span>\n<span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>\n  Lorem ipsum <span class=\"typ-escape\">\\</span>\n  dolor sit amet\n<span class=\"typ-punct\">]</span>\n\nThe text above is a sample <span class=\"typ-escape\">\\</span>\noriginating from distant times.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/58937016f47739bbce0d3f8c6d6a9f94.png\" alt=\"Preview\"></div></div>","title":null}},{"kind":"html","content":"<p>This element exposes further options which may be used to control other\naspects of line numbering, such as its <a href=\"/en-US-v0.14.1/reference/model/par/#definitions-line-number-align\">alignment</a>\nor <a href=\"/en-US-v0.14.1/reference/model/par/#definitions-line-number-margin\">margin</a>. In addition, you can control whether\nthe numbering is reset on each page through the\n<a href=\"/en-US-v0.14.1/reference/model/par/#definitions-line-numbering-scope\"><code>numbering-scope</code></a> option.</p>"}],"self":false,"params":[{"name":"numbering","details":[{"kind":"html","content":"<p>How to number each line. Accepts a\n<a href=\"/en-US-v0.14.1/reference/model/numbering/\">numbering pattern or function</a> taking a single number.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;I&quot;</span><span class=\"typ-punct\">)</span>\n\nRoses are red. <span class=\"typ-escape\">\\</span>\nViolets are blue. <span class=\"typ-escape\">\\</span>\nTypst is there for you.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/3bea09a9873e3b0128c5aa69c4ae0064.png\" alt=\"Preview\"></div></div>","title":null}},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> i <span class=\"typ-op\">=&gt;</span> <span class=\"typ-key\">if</span> calc<span class=\"typ-punct\">.</span><span class=\"typ-func\">rem</span><span class=\"typ-punct\">(</span>i<span class=\"typ-punct\">,</span> <span class=\"typ-num\">5</span><span class=\"typ-punct\">)</span> <span class=\"typ-op\">==</span> <span class=\"typ-num\">0</span> <span class=\"typ-key\">or</span> i <span class=\"typ-op\">==</span> <span class=\"typ-num\">1</span> <span class=\"typ-punct\">{</span> i <span class=\"typ-punct\">}</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">lorem</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">60</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/f38712049b18265eea5643ccc8ab4ef0.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["none","str","function"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"number-align","details":[{"kind":"html","content":"<p>The alignment of line numbers associated with each line.</p>\n<p>The default of <code><span class=\"typ-key\">auto</span></code> indicates a smart default where numbers grow\nhorizontally away from the text, considering the margin they're in and\nthe current text direction.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;I&quot;</span><span class=\"typ-punct\">,</span>\n  number-align<span class=\"typ-punct\">:</span> left<span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\nHello world! <span class=\"typ-escape\">\\</span>\nToday is a beautiful day <span class=\"typ-escape\">\\</span>\nFor exploring the world.\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/5dfc01320623b767c6791805aff923e0.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["auto","alignment"],"strings":[],"default":"<code><span class=\"typ-key\">auto</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"number-margin","details":[{"kind":"html","content":"<p>The margin at which line numbers appear.</p>\n<p><em>Note:</em> In a multi-column document, the line numbers for paragraphs\ninside the last column will always appear on the <code>end</code> margin (right\nmargin for left-to-right text and left margin for right-to-left),\nregardless of this configuration. That behavior cannot be changed at\nthis moment.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;1&quot;</span><span class=\"typ-punct\">,</span>\n  number-margin<span class=\"typ-punct\">:</span> right<span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\n<span class=\"typ-heading\">= Report</span>\n<span class=\"typ-marker\">-</span> Brightness: Dark, yet darker\n<span class=\"typ-marker\">-</span> Readings: Negative\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/bdfd1906b97281550007248cb244da29.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["alignment"],"strings":[],"default":"<code>start</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"number-clearance","details":[{"kind":"html","content":"<p>The distance between line numbers and text.</p>\n<p>The default value of <code><span class=\"typ-key\">auto</span></code> results in a clearance that is adaptive to\nthe page width and yields reasonable results in most cases.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;1&quot;</span><span class=\"typ-punct\">,</span>\n  number-clearance<span class=\"typ-punct\">:</span> <span class=\"typ-num\">4pt</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\nTypesetting <span class=\"typ-escape\">\\</span>\nStyling <span class=\"typ-escape\">\\</span>\nLayout\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/3208940772e8c44d0944e5a81c93ec96.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["auto","length"],"strings":[],"default":"<code><span class=\"typ-key\">auto</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"numbering-scope","details":[{"kind":"html","content":"<p>Controls when to reset line numbering.</p>\n<p><em>Note:</em> The line numbering scope must be uniform across each page run (a\npage run is a sequence of pages without an explicit pagebreak in\nbetween). For this reason, set rules for it should be defined before any\npage content, typically at the very start of the document.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> par<span class=\"typ-punct\">.</span><span class=\"typ-func\">line</span><span class=\"typ-punct\">(</span>\n  numbering<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;1&quot;</span><span class=\"typ-punct\">,</span>\n  numbering-scope<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;page&quot;</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\nFirst line <span class=\"typ-escape\">\\</span>\nSecond line\n<span class=\"typ-func\">#</span><span class=\"typ-func\">pagebreak</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span>\nFirst line again <span class=\"typ-escape\">\\</span>\nSecond line again\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/3269883aef94076b02e0694e837a23f4-0.png\" alt=\"Preview page 1\"><img src=\"/en-US-v0.14.1/assets/3269883aef94076b02e0694e837a23f4-1.png\" alt=\"Preview page 2\"></div></div>","title":null}}],"types":["str"],"strings":[{"string":"document","details":"<p>Indicates that the line number counter spans the whole document, i.e.,\nit's never automatically reset.</p>"},{"string":"page","details":"<p>Indicates that the line number counter should be reset at the start of\nevery new page.</p>"}],"default":"<code><span class=\"typ-str\">&quot;document&quot;</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true}],"returns":["content"],"scope":[]}]}}}