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 / tcspingif.pl
Last active August 9, 2023 05:12
tcfaspinを利用した“回るLaTeX文書”からアニメGIF画像を生成する
#!/usr/bin/env perl
use v5.12;
my $program = "tcspingif";
my $version = "0.8.1";
my $mod_date = "2023/08/08";
use constant DEFAULT_TICKS => 32;
use constant CYCLE => 2; # seconds
my ($ticks, $in_file, $out_file);
my $engine = "pdflatex";
@zr-tex8r
zr-tex8r / example-1.tex
Last active August 8, 2023 13:58
LaTeX:“Macのヒラギノ”で平和に(u)pLaTeXするやつ(※ただし画期的)
% upLaTeX+dvipdfmx用の横組みの文書の例
\documentclass[uplatex,dvipdfmx,a4paper]{jsarticle}
\usepackage{schira}
\begin{document}
吾輩は{\schira}である。
意味はまだない。
\end{document}
@zr-tex8r
zr-tex8r / kokuji1-lualatex.tex
Created June 24, 2017 10:17
LaTeX: LuaLaTeXで花園明朝(AFDKO版)してみるテスト
% LuaLaTeX文書; UTF-8
\documentclass[a4paper]{ltjsarticle}
\usepackage{luatexja-fontspec}
% BMPはHanaMinA, SIPはHanaMinB, ただし可能ならIPAexMincho
% で置き換える, という設定
\setmainjfont[AltFont={
{Range="20000-"2FFFF, Font=HanaMinB},
{Range="0080-"FFFF, Font=IPAexMincho},
}]{HanaMinA}
% 花園明朝AFDKO版 2017-06-20
@zr-tex8r
zr-tex8r / bxdpx-tchack.sty
Created July 1, 2023 08:19
LaTeX: Hack for top-level color changes with dvipdfmx
% bxdpx-tchack.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bxdpx-tchack}[2023/07/01 v0.1]
\def\bxqcx@pkgname{bxdpx-tchack}
\ifx\currentgrouplevel\@undefined
\PackageError\bxqcx@pkgname{e-TeX extension not supported}\@ehc
\expandafter\endgroup\fi\relax
\AtBeginDocument{%
\def\bxqcx@org@set@color{\special{color pop}}
\ifx\bxqcx@org@set@color\reset@color
@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 / test.tex
Last active February 16, 2023 14:09
新しいLaTeXで(u)pLaTeXしたいやつ
\ExplSyntaxOn
%---------------------------------------
%% \token_if_jachar:N <token>
% Tests if <token> is a jachar token or not.
\bool_lazy_or:nnTF
{ \sys_if_engine_ptex_p: }
{ \sys_if_engine_uptex_p: }
{
\use:x
{
@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')