情報アイコン
情報 / Info
当サイトは、Typst GmbHの許諾を得て、日本語コミュニティ「Typst Japan Community」がTypst vdev.3ed92cdeの公式ドキュメントを翻訳したものです。誤訳や古い情報が含まれている可能性があるため、公式ドキュメントとの併用を推奨します。翻訳の改善やサイトの機能向上について、GitHubでのIssueやPull Requestを歓迎します。コミュニティにご興味のある方はDiscordサーバー「くみはんクラブ」にぜひご参加ください。
This site provides a Japanese translation of the Typst vdev.3ed92cde documentation maintained by the "Typst Japan Community" with permission from Typst GmbH. We recommend using this alongside the official documentation. We welcome contributions through Issues and Pull Requests on our GitHub repository for both translation improvements and website enhancements. Feel free to join our Discord server "Kumihan Club".
言語アイコン
翻訳率
21%
言語アイコン
未翻訳

このページはまだ翻訳されていません。原文の内容が表示されています。

Standard library

A module that contains all globally accessible items.

Using "shadowed" definitions

The std module is useful whenever you overrode a name from the global scope (this is called shadowing). For instance, you might have used the name text for a parameter. To still access the text element, write std.text.

#let par = [My special paragraph.]
#let special(text) = {
  set std.text(style: "italic")
  set std.par.line(numbering: "1")
  text
}

#special(par)

#lorem(10)
Preview

Conditional access

You can also use this in combination with the dictionary constructor to conditionally access global definitions. This can, for instance, be useful to use new or experimental functionality when it is available, while falling back to an alternative implementation if used on an older Typst version. In particular, this allows us to create polyfills.

This can be as simple as creating an alias to prevent warning messages, for example, conditionally using pattern in Typst version 0.12, but using tiling in newer versions. Since the parameters accepted by the tiling function match those of the older pattern function, using the tiling function when available and falling back to pattern otherwise will unify the usage across all versions. Note that, when creating a polyfill, sys.version can also be very useful.

#let tiling = if "tiling" in std { tiling } else { pattern }

...
原文(英語)を開く
右矢印アイコン

検索