Last active
July 1, 2026 16:45
-
-
Save zr-tex8r/5647c5faac5a8e266c99 to your computer and use it in GitHub Desktop.
LaTeX: To make the combination upLaTeX + otf + pxbabel work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % upLaTeX での pxbabel はCJK言語の切替を | |
| % J20,J21,J22,J23,J30,J31,J32,J33 | |
| % という"和文エンコーディング"の切替で実現している. | |
| % これらのエンコーディングに対応する和文フォントは | |
| % pLaTeX の既定である mc, gt のファミリにのみ提供される. | |
| % | |
| % 一方で, otf パッケージ(noreplace非指定)は, 和文の | |
| % 総称ファミリの既定値(\mcdefault/\gtdefault)を | |
| % "hmc"/"hgt" に変更する. | |
| % 日本語の種々の"素敵な"フォントはこのファミリに | |
| % 存在し, 当然ながらこのファミリは標準の JY2/JT2 | |
| % エンコーディングを仮定している. | |
| % そのため, 両者を同時に使用すると, エンコーディングは | |
| % J2X/J3X、総称ファミリは hmc/hgt という困った状態に | |
| % なってしまう. | |
| % 日本語に関しては, pxbabel をハックして, 既定として | |
| % 使うエンコーディングを J20/J30 から JY2/JT2 に戻す. | |
| \def\pxbb@dflt@ja@enc{JY2} | |
| % 韓国語・中国語に関しては, hmc/hgt ファミリを定義して, | |
| % その全てのシェープが mc/gt のもので代替されるようにする. | |
| \begingroup | |
| \def\tcqbb@one#1#2#3#4{% | |
| \DeclareFontShape{#1}{h#2}{#3}{#4}{<->ssub*#2/#3/#4}{}} | |
| \@for\tcqbb@a:={J21,J22,J23,J31,J32,J33}\do{% | |
| \@for\tcqbb@b:={mc,gt}\do{% | |
| \DeclareFontFamily{\tcqbb@a}{h\tcqbb@b}{}% | |
| \@for\tcqbb@c:={m,bx}\do{% | |
| \@for\tcqbb@d:={n,it,sl,sc}\do{% | |
| \def\tcqbb@abcd{{\tcqbb@a}{\tcqbb@b}{\tcqbb@c}{\tcqbb@d}}% | |
| \expandafter\tcqbb@one\tcqbb@abcd | |
| }}}}% | |
| \endgroup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % cf. http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1504 | |
| \documentclass[a4j]{utarticle} | |
| %\documentclass[a4j]{tarticle} | |
| %\usepackage[bxutf8]{inputenc} | |
| \usepackage[uplatex,expert,jis2004]{otf} | |
| %\usepackage[uplatex,noreplace]{otf} | |
| %\usepackage[multi,jis2004]{otf} | |
| %\input{otf-hangul.dfu} | |
| \usepackage[english]{babel} | |
| \usepackage[main=japanese]{pxbabel} | |
| \usepackage{furikana} | |
| \usepackage{pxbabel-up-otf} | |
| % oefパッケージのバグ(?)の回避のため | |
| \DeclareFontShape{JY2}{ruby}{bx}{n}{<->s*[0.962216]uprubygothb-h}{} | |
| \DeclareFontShape{JT2}{ruby}{bx}{n}{<->s*[0.962216]uprubygothb-v}{} | |
| \begin{document} | |
| \kana{寒}{さむ}さ\kana{来}{き}たり\kana{暑}{あつ}さ\kana{往}{ゆ}き、\textgt{\kana{秋}{あき}\kana{収}{をさ}めて\kana{冬}{ふゆ}\kana{蔵}{ざう}す。} | |
| \Kana{閏,余}{じゅん,よ}もて\kana{歳}{とし}を\kana{成}{な}し、\textgt{\Kana{律,呂}{りつ,りょ}は\kana{陽}{やう}を\kana{調}{ととの}ふ} | |
| \selectlanguage{korean} | |
| 찰 寒 올 來 더울 暑 갈 往 \textgt{가을 秋 거둘 收 겨울 冬 감출 藏} | |
| 윤달 閏 남을 餘 이룰 成 해 歲 \textgt{가락 律 음률 呂 고를 調 별 陽} | |
| \selectlanguage{schinese} | |
| 寒来暑往 \textgt{秋收冬藏} | |
| 闰馀成岁 \textgt{律吕调阳} | |
| \selectlanguage{tchinese} | |
| 寒來暑往 \textgt{秋收冬藏} | |
| 閏餘成歲 \textgt{律呂調陽} | |
| \selectlanguage{japanese} | |
| “疑問?感嘆!平叙。”辻芦飴煎鄭 | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment