#import "@preview/rubby:0.10.1": get-ruby
#let ruby = get-ruby(
size: 0.5em, // Ruby font size
dy: 0pt, // Vertical offset of the ruby
pos: top, // Ruby position (top or bottom)
alignment: "center", // Ruby alignment ("center", "start", "between", "around")
delimiter: "|", // The delimiter between words
auto-spacing: true, // Automatically add necessary space around words
)
// Ruby goes first, base text - second.
#ruby[ふりがな][振り仮名]
Treat each kanji as a separate word:
#ruby[とう|きょう|こう|ぎょう|だい|がく][東|京|工|業|大|学]
If you don't want automatically wrap text with delimiter:
#let ruby = get-ruby(auto-spacing: false)
See also https://github.com/rinmyo/ruby-typ/blob/main/manual.pdf and example.typ
.
Original project is at https://github.com/rinmyo/ruby-typ which itself is based on the post of 齊藤敦志 (Saito Atsushi). This project is a modified version of this commit.
auto-spacing
adds missing delimiter around the content
/string
which
then adds space around base text if ruby is wider than the base text.
Problems appear only if ruby is wider than its base text and auto-spacing
is
not set to true
(default is true
).
You can always use a one-letter function (variable) name to shorten the
function call length (if you have to use it a lot), e.g., #let r = get-ruby()
(or f
— short for furigana). But be careful as there are functions with names
v
and h
and there could be a new built-in function with a name r
or f
which may break your document (Typst right now is in beta, so breaking changes
are possible).
Although you can open issues or send PRs, I won't be able to always reply quickly (sometimes I'm very busy).
This repository should exist as a @local
package with the version from the typst.toml
.
Here is a short description of the development process:
git checkout dev && git pull
;just change-version <new semantic version>
;CHANGELOG.md
;@local
Typst package with the new version and test it;git push
;git checkout master && git merge dev
to sync master
to dev
;just create-release
.typst/packages
repository run
just mark-PR-version
;typst/packages
repository;git checkout main && git fetch upstream && git merge upstream/main
to sync fork with typst/packages
;git checkout -b <package-version>
;package:version
;gh pr create
and follow further CLI instructions.You can view the change log in the CHANGELOG.md
file in the root of the project.
This Typst package is licensed under AGPL v3.0. You can view the license in the LICENSE file in the root of the project or at https://www.gnu.org/licenses/agpl-3.0.txt. There is also a NOTICE file for 3rd party copyright notices.
Copyright (C) 2023 Andrew Voynov