{"route":"/en-US-v0.13.1/reference/introspection/location/","title":"Location","description":"Documentation for the Location type.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"locatable","name":"Locatable","children":[]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-page","name":"Page","children":[]},{"id":"definitions-position","name":"Position","children":[]},{"id":"definitions-page-numbering","name":"Page Numbering","children":[]}]}],"body":{"kind":"type","content":{"name":"location","title":"Location","keywords":[],"oneliner":"Identifies an element in the document.","details":"<p>Identifies an element in the document.</p>\n<p>A location uniquely identifies an element in the document and lets you\naccess its absolute position on the pages. You can retrieve the current\nlocation with the <a href=\"/en-US-v0.13.1/reference/introspection/here/\" title=\"`here`\"><code>here</code></a> function and the location of a queried or shown\nelement with the <a href=\"/en-US-v0.13.1/reference/foundations/content/#definitions-location\"><code>location()</code></a> method on content.</p>\n<h2 id=\"locatable\">Locatable elements</h2>\n<p>Currently, only a subset of element functions is locatable. Aside from\nheadings and figures, this includes equations, references, quotes and all\nelements with an explicit label. As a result, you <em>can</em> query for e.g.\n<a href=\"/en-US-v0.13.1/reference/model/strong/\" title=\"`strong`\"><code>strong</code></a> elements, but you will find only those that have an explicit\nlabel attached to them. This limitation will be resolved in the future.</p>","constructor":null,"scope":[{"path":["location"],"name":"page","title":"Page","keywords":[],"oneliner":"Returns the page number for this location.","element":false,"contextual":false,"deprecation":null,"details":"<p>Returns the page number for this location.</p>\n<p>Note that this does not return the value of the <a href=\"/en-US-v0.13.1/reference/introspection/counter/\">page counter</a>\nat this location, but the true page number (starting from one).</p>\n<p>If you want to know the value of the page counter, use\n<code><span class=\"typ-func\">counter</span><span class=\"typ-punct\">(</span>page<span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">at</span><span class=\"typ-punct\">(</span>loc<span class=\"typ-punct\">)</span></code> instead.</p>\n<p>Can be used with <a href=\"/en-US-v0.13.1/reference/introspection/here/\" title=\"`here`\"><code>here</code></a> to retrieve the physical page position\nof the current context:</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">context</span> <span class=\"typ-punct\">[</span>\n  I am located on\n  page <span class=\"typ-func\">#</span><span class=\"typ-func\">here</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">page</span><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.13.1/assets/d13a1548b2d47ac4cb904c3f62c9c993.png\" alt=\"Preview\"></div></div>","self":true,"params":[],"returns":["int"],"scope":[]},{"path":["location"],"name":"position","title":"Position","keywords":[],"oneliner":"Returns a dictionary with the page number and the x, y position for this","element":false,"contextual":false,"deprecation":null,"details":"<p>Returns a dictionary with the page number and the x, y position for this\nlocation. The page number starts at one and the coordinates are measured\nfrom the top-left of the page.</p>\n<p>If you only need the page number, use <code>page()</code> instead as it allows\nTypst to skip unnecessary work.</p>","example":null,"self":true,"params":[],"returns":["dictionary"],"scope":[]},{"path":["location"],"name":"page-numbering","title":"Page Numbering","keywords":[],"oneliner":"Returns the page numbering pattern of the page at this location. This","element":false,"contextual":false,"deprecation":null,"details":"<p>Returns the page numbering pattern of the page at this location. This\ncan be used when displaying the page counter in order to obtain the\nlocal numbering. This is useful if you are building custom indices or\noutlines.</p>\n<p>If the page numbering is set to <code><span class=\"typ-key\">none</span></code> at that location, this function\nreturns <code><span class=\"typ-key\">none</span></code>.</p>","example":null,"self":true,"params":[],"returns":["none","str","function"],"scope":[]}]}}}