Skip to content

Instantly share code, notes, and snippets.

View aminophen's full-sized avatar
☃️
☃️⛄️🍣🦆🐦🤯🤮😱🤔🙃

Hironobu Yamashita aminophen

☃️
☃️⛄️🍣🦆🐦🤯🤮😱🤔🙃
View GitHub Profile
@zr-tex8r
zr-tex8r / bxoldfontcmd.sty
Last active July 21, 2016 13:00
LaTeX: Much ado about the old font commands
% bxoldfontcmd.sty
%% package declaration
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bxoldfontcmd}
\def\bxof@pkgname{bxoldfontcmd}
%% code guards
\@onlypreamble\bxof@restore@codes
\edef\bxof@restore@codes{%
\catcode33=\the\catcode33%
@munepi
munepi / list-cid-otf-moripass.txt
Created September 27, 2016 09:34
モリサワパスポート2016に含まれる{A,AP,G}-OTF*.otfに対する family name, CIDFont name, full path のリスト
A-OTF A1 Mincho Std Bold A1MinchoStd-Bold /Library/Fonts/A-OTF-A1MinchoStd-Bold.otf
A-OTF Akashi Std L AkashiStd-Light /Library/Fonts/A-OTF-AkashiStd-Light.otf
A-OTF Antique Std AN1 AntiqueStd-AN1 /Library/Fonts/A-OTF-AntiqueStd-AN1.otf
A-OTF Antique Std AN2 AntiqueStd-AN2 /Library/Fonts/A-OTF-AntiqueStd-AN2.otf
A-OTF Antique Std AN3 AntiqueStd-AN3 /Library/Fonts/A-OTF-AntiqueStd-AN3.otf
A-OTF Antique Std AN4 AntiqueStd-AN4 /Library/Fonts/A-OTF-AntiqueStd-AN4.otf
A-OTF Antique Std AN B AntiqueStd-ANB /Library/Fonts/A-OTF-AntiqueStd-ANB.otf
A-OTF Antique Std AN DB AntiqueStd-ANDB /Library/Fonts/A-OTF-AntiqueStd-ANDB.otf
A-OTF Antique Std AN H AntiqueStd-ANH /Library/Fonts/A-OTF-AntiqueStd-ANH.otf
A-OTF Antique Std AN L AntiqueStd-ANL /Library/Fonts/A-OTF-AntiqueStd-ANL.otf
@zr-tex8r
zr-tex8r / basename.lua
Created June 3, 2017 05:29
Lua: CP932なWindowsでbasename
-- 文字コードはCP932
function basename(path)
if type(path) ~= "string" or not lfs.isfile(path) then
return path -- 引数が不適切
end
local k, cs = 0, path:gsub("/", "\\"):explode("\\")
for i = 1, #cs - 1 do
local d = table.concat({ table.unpack(cs, 1, i) }, "\\")
if lfs.isdir(d) then k = i end
@zr-tex8r
zr-tex8r / slashify.lua
Created June 3, 2017 05:52
Lua: CP932の文字列で ’\’→’/’ の変換を行う
-- 文字コードはCP932
function slashify(str)
return (tostring(str):gsub("[\x81-\x9f\xe0-\xfc]?.", { ["\\"] = "/" }))
end
print(slashify([[ふが\ほげ/予定表\アレ/コレ\ソレ]]))
-- ふが/ほげ/予定表/アレ/コレ/ソレ
@h-kitagawa
h-kitagawa / atbegshi_tate.tex
Created September 2, 2017 21:11
atbegshi.sty + 縦組クラス
\documentclass{tarticle}
\usepackage[word]{continue}% これは atbegshi 依存
\usepackage{etoolbox}
\makeatletter
\patchcmd{\AtBegShi@Output}%
{\let\AtBegShi@OrgProtect\protect}%
{\setbox\z@\hbox\bgroup\yoko\let\AtBegShi@OrgProtect\protect}%
{}{}
@zr-tex8r
zr-tex8r / fixfixjfm.sty
Created September 19, 2017 00:14
TeX: fixjfm的なアレ
% fixjfm.sty
% Copyright 2017 Yue ZHANG
% License: Knuth License (https://ctan.org/license/knuth)
\csname ENDINPUTFIXJFMDOTSTY\endcsname
\let\ENDINPUTFIXJFMDOTSTY=\endinput
@wtsnjp
wtsnjp / sctexdoc.lua
Last active August 10, 2020 13:12
画期的な Texdoc
#!/usr/bin/env texlua
--
-- This is file 'sctexdoc.lua'.
--
-- Copyright 2017-2020 Takuto ASAKURA (wtsnjp)
-- GitHub: https://github.com/wtsnjp
-- Twitter: @wtsnjp
--
-- This package is distributed under the MIT License.
@zr-tex8r
zr-tex8r / test-zrjapunct1.tex
Created November 24, 2017 12:33
LaTeX: 和文を欧文扱いして和文扱いする件
% upLaTeX文書; 文字コードはUTF-8
\documentclass[uplatex,a5paper]{utarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{otf}% <?>で自動空白挿入
\usepackage[prefercjkvar]{pxcjkcat}
\usepackage{zrjapunct1}
\cjkcategory{latn1}{noncjk}% <é>は欧文
\begin{document}
@zr-tex8r
zr-tex8r / README.md
Last active March 26, 2018 12:01
LaTeX: シフトJISの半角カナを“直接出力”するアレなやつ

記事: inputenc しないアレなやつの話

  • 文書ファイル shiftjis.tex をUTF-8からShift_JISに変換する

  • 入力・内部の漢字コードがsjisのplatexでコンパイルする

    platex -kanji=sjis -kanji-internal=sjis shiftjis
    

   ↑ここで -kanji-internal を使うのもアレだけど、元々バッドなので……。

@zr-tex8r
zr-tex8r / test-dvips-cropbox.tex
Created April 12, 2018 00:23
LaTeX: dvipsでPDFを作る際にナントカBoxのサイズを指定する
% LaTeX + dvips
\documentclass[a4paper]{article}
\textwidth=250bp \oddsidemargin=-1in \evensidemargin=-1in
\textheight=250bp \topmargin=-1in \headheight=0pt \headsep=0pt
\AtBeginDvi{%
\special{papersize=250bp 250bp}%
\special{ps:SDict begin
[ /CropBox [0 0 200 200] /PAGE pdfmark
[ /BleedBox [0 0 150 150] /PAGE pdfmark
[ /TrimBox [0 0 100 100] /PAGE pdfmark