#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:
- run
git checkout dev && git pull
; - make changes;
- test changes, if not done or something isn't working then go to step 1;
- when finished, run
just change-version <new semantic version>
; - document changes in the
CHANGELOG.md
; - commit all changes (only locally);
- create a
@local
Typst package with the new version and test it; - if everything is working then run
git push
; - realize that you've missed something and fix it (then push changes again);
- run
git checkout master && git merge dev
to syncmaster
todev
; - run
just create-release
.
- To make a new package version for merging into
typst/packages
repository runjust mark-PR-version
; - copy newly created directory (with a version name) and place it in the
appropriate place in your fork of the
typst/packages
repository; - run
git checkout main && git fetch upstream && git merge upstream/main
to sync fork withtypst/packages
; - go to a new branch with
git checkout -b <package-version>
; - commit newly added directory with commit message:
package:version
; - run
gh pr create
and follow further CLI instructions.
justfile snippet
sync:
git checkout main
git fetch upstream
git merge upstream/main
pr:
gh pr create --no-maintainer-edit
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