Skip to content

Instantly share code, notes, and snippets.

View zr-tex8r's full-sized avatar
💭
🍣🦆⛄

Takayuki YATO zr-tex8r

💭
🍣🦆⛄
View GitHub Profile
@zr-tex8r
zr-tex8r / nabeazz.typ
Created June 11, 2023 04:28
Typst:NabeAzzする文書
#import "zrsimple.typ"
#show: zrsimple.doc.with(
paper: "a5",
title: "NabeAzz with Typst",
author: "ZR"
)
#let aho-font = "Allura"
#let nabeazz(lmt) = {
@zr-tex8r
zr-tex8r / ddsk.typ
Created June 11, 2023 04:26
Typst:ドドスコ(ラブ注入♡)する文書
#import "zrjasimple.typ"
#show: zrjasimple.doc.with(
title: "Typst でドドスコしてみた",
author: "某 ZR"
)
// ddsk(seed)は, 乱数種を seed としたときの
// "ドドスコ問題"の出力の文字列.
#let ddsk(seed) = {
@zr-tex8r
zr-tex8r / scjaart0.typ
Last active June 8, 2023 14:22
Typst:日本語入力に対応したテンプレート(※ただし画期的)
#let doc(title: "", author: "", body) = {
set document(author: author, title: "☃")
set page(paper: "a5", numbering: none)
set text(size: 320pt)
v(2fr)
align(center)[#emoji.snowman.snow]
v(3fr)
}
@zr-tex8r
zr-tex8r / 00README-quiz.md
Last active May 31, 2023 10:04
\futurelet 芸人クイズ

問題

ファイルquiz.texのコードは
「引数に指定したトークン列に“ある変換”を適用した結果のトークン列を\Parsedに代入する」
という仕様のマクロ\Parseの実装である。

コードを読んで“ある変換”の内容を把握した上で、\Parse\futurelet使わずに実装せよ。

※LaTeXまたはplain TeXを前提とする。

@zr-tex8r
zr-tex8r / sample.tex
Created January 20, 2023 04:51
LuaLaTeX+LuaTeX-jaの下でイロイロな文字を出力してみるやつ
% LuaLaTeX文書; 文字コードはUTF-8
\documentclass[a4paper]{ltjsarticle}
\usepackage[noto-jp]{luatexja-preset}
% 欧文はLatin Modernのまま
\usepackage{newunicodechar,luacode}
%↓入力中のU+FFFDを一旦U+F8FDに置き換える
\begin{luacode*}
luatexbase.add_to_callback('process_input_buffer', function (s)
if s:match('\xef\xbf\xbd') then
return s:gsub('\xef\xbf\xbd', '\xef\xa3\xbd')
@zr-tex8r
zr-tex8r / nyc2023.tex
Created December 27, 2022 15:28
LaTeX: New year post card of the year 2023
%#!lualatex
\documentclass{article}
\usepackage[papersize={100mm,148mm},margin=0cm,
noheadfoot]{geometry}
\usepackage{luatexja-fontspec}
\usepackage{amsmath,tikz,graphicx,xcolor,xparse,pgfmath}
\ltjsetparameter{jacharrange={-2}}
\usetikzlibrary{calc,positioning}
\colorlet{k}{black}
\newcommand{\cLet}{\pgfmathsetmacro}
@zr-tex8r
zr-tex8r / texmas2022.md
Last active December 17, 2023 19:15
TeX: Merry TeXmas 2022

Compile with:

pdftex "\catcode64=11 \input texmas2022.tex"

@zr-tex8r
zr-tex8r / 00addrite.md
Last active December 25, 2022 10:30
SATySFI: 年賀状宛名印刷用文書クラス

年賀状宛名印刷用文書クラス Addrite

全体構成

  • document : config list?→ block-text → block-text → document
    document ?:cfgs from to で全ての宛先面の印刷からなる文書を出力する。

    cfgs には設定項目のリストを指定し、既定値は空リスト(つまり既定の設定を使う)である。

from は高々1個の+address-fromコマンドのみからなるブロックテキストで、この+address-fromの出力は全てのページ(宛先面)に共通して配置される。

@zr-tex8r
zr-tex8r / hanoi.satyh
Created December 3, 2022 13:22
The Tower of Hanoi with graphics, in SATySFi
% hanoi.satyh: Tower of Hanoi with graphics
%
% Copyright (c) 2022 Takayuki YATO (aka. "ZR")
% GitHub: https://github.com/zr-tex8r
% Twitter: @zr_tex8r
% Distributed under the MIT License.
%=========================================================== module Hanoi
module Hanoi : sig
@zr-tex8r
zr-tex8r / count100k.saty
Created December 3, 2022 13:15
SATySFi: A simple 100000-page document
let text-box-board w h ib =
let (tw, th, _) = get-natural-metrics ib in
let gtxt = draw-text ((w -' tw) *' 0.5, (h -' th) *' 0.5) ib in
inline-graphics w h 0pt (fun p -> [shift-graphics p gtxt])
let text-board ctx w h fname fsize str =
let ctx = ctx |> (set-font-size fsize)
|> (set-font Latin (fname, 1., 0.)) in
let ib = read-inline ctx (embed-string str) in
text-box-board w h ib