Development build 586e1bd4
Typst文档简体中文版v0.15.1 + dev 586e1bd4

here上下文相关函数
Question mark
0.11.0起可用Go to source

Provides the current location in the document.

You can think of here as a low-level building block that directly extracts the current location from the active context. Some other functions use it internally: For instance, counter.get() is equivalent to counter.at(here()).

Within show rules on locatable elements, here() will match the location of the shown element.

If you want to display the current page number, refer to the documentation of the counter type. While here can be used to determine the physical page number, typically you want the logical page number that may, for instance, have been reset after a preface.

Examples

Determining the current position in the document in combination with the position method:

#context [ I am located at #here().position() ]

Running a query for elements before the current position:

= Introduction = Background There are #context query( selector(heading).before(here()) ).len() headings before me. = Conclusion

Refer to the selector type for more details on before/after selectors.

参数
Question mark

here() → location