diff --git a/src/content/blog-metas/1003.json b/src/content/blog-metas/1003.json index f5770f2..e03c427 100644 --- a/src/content/blog-metas/1003.json +++ b/src/content/blog-metas/1003.json @@ -1,3 +1,4 @@ { - "postDate": "2023-12-22T14:52:11.831Z" + "postDate": "2023-12-22T14:52:11.831Z", + "updateDate": "2024-11-24T04:18:44.722Z" } diff --git a/src/content/blogs/1003.md b/src/content/blogs/1003.md index 4943e57..b5f5753 100644 --- a/src/content/blogs/1003.md +++ b/src/content/blogs/1003.md @@ -1,6 +1,6 @@ --- title: 覚えておくと便利なTypstの文法 -description: 組版システムTypstのドキュメントにないけど覚えておくと便利な文法を紹介します。 +description: 組版システムTypstのドキュメントにないけど覚えておくと便利な小技を紹介します。 tags: [advent-calendar, typst] category: tech author: miyaji @@ -32,6 +32,11 @@ TypstはLatexの代替を目指して作られている新しい組版システ #myfunc()[ abc ] + +// 引数がなければカッコも省略可能 +#myfunc[ + abc +] ``` カスタム関数でネイティブ関数と同じように書けるようになるのでテンプレートを作るときに重宝します。 @@ -96,13 +101,21 @@ type myfunc_with = (value: number) => (() => number) #show: mysetting.with(title: "Typst 紹介", name: "みやじ") ``` -## 最後に +## 前後のスペースなしに参照を貼る -Typstはまだまだ機能があるのでうまく使いこなせるように勉強します。 +`#[@label]`のように`#[]`で囲むことで日本語のようなスペースがない言語でも参照を使えます。 -また、授業で使ったテンプレートはこちらに上げているので良かったら使用してください。 +```typst +#[@label]は比例の式です -https://github.com/miyaji255/Typst-Utilities +// #[]を使わないとスペースが必要になる +@label は比例の式です +$ f(x) = a x $