情報アイコン
情報 / Info
当サイトは、Typst GmbHの許諾を得て、日本語コミュニティ「Typst Japan Community」がTypst v0.13.1の公式ドキュメントを翻訳したものです。誤訳や古い情報が含まれている可能性があるため、公式ドキュメントとの併用を推奨します。翻訳の改善やサイトの機能向上について、GitHubでのIssueやPull Requestを歓迎します。コミュニティにご興味のある方はDiscordサーバー「くみはんクラブ」にぜひご参加ください。
This site provides a Japanese translation of the Typst v0.13.1 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".
言語アイコン
未翻訳

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

length

A size or distance, possibly expressed with contextual units.

Typst supports the following length units:

  • Points: 72pt
  • Millimeters: 254mm
  • Centimeters: 2.54cm
  • Inches: 1in
  • Relative to font size: 2.5em

You can multiply lengths with and divide them by integers and floats.

Example

#rect(width: 20pt)
#rect(width: 2em)
#rect(width: 1in)

#(3em + 5pt).em \
#(20pt).em \
#(40em + 2pt).abs \
#(5em).abs
Preview

Fields

  • abs: A length with just the absolute component of the current length (that is, excluding the em component).
  • em: The amount of em units in this length, as a float.

定義
ヘルプアイコン

pt

Converts this length to points.

Fails with an error if this length has non-zero em units (such as 5em + 2pt instead of just 2pt). Use the abs field (such as in (5em + 2pt).abs.pt()) to ignore the em component of the length (thus converting only its absolute component).

self.pt(
)->

mm

Converts this length to millimeters.

Fails with an error if this length has non-zero em units. See the pt method for more details.

self.mm(
)->

cm

Converts this length to centimeters.

Fails with an error if this length has non-zero em units. See the pt method for more details.

self.cm(
)->

inches

Converts this length to inches.

Fails with an error if this length has non-zero em units. See the pt method for more details.

self.inches(
)->

to-absolute

Resolve this length to an absolute length.

self.to-absolute(
)->
右矢印アイコン
例を表示
#set text(size: 12pt)
#context [
  #(6pt).to-absolute() \
  #(6pt + 10em).to-absolute() \
  #(10em).to-absolute()
]

#set text(size: 6pt)
#context [
  #(6pt).to-absolute() \
  #(6pt + 10em).to-absolute() \
  #(10em).to-absolute()
]
Preview

検索