日本語 in LATEX
Seldom is it a pleasant experience to discover that you are wrong and need to
adapt. But unpleasant experiences make life… well, Life. In a good way;
let's say, spices that give some perspective on the sweet things, to make a
somewhat pityful attempt at poetry. Or WebKit security issues that make us
abandon old and unmaintained web browser—ah yes, there, I think I'm
slowly getting the hang of this. What would Life be without stories to tell of
past disasters, both little and greatLet us live through the little ones and tell stories of the
great ones! Or so.
… OK, I'll stop..
The other day in particular, I found myself defending my use of pdflatex
to a
much wiser person, stating that
\usepackage[utf8]{inputenc}
would indeed allow UTF-8-encoded characters in in
LATEX documents to be treated correctly. That was until I was gently told that
inputenc
is really only a hack: try to use something marginally exotic, and
pdflatex
will show you the metaphoric door.
I got shown that door without much seeking:
ん | わ | ら | や | ま | は | な | た | さ | か | あ |
り | み | ひ | に | ち | し | き | い | |||
る | ゆ | む | ふ | ぬ | つ | す | く | う | ||
れ | め | へ | ね | て | せ | け | え | |||
を | ろ | よ | も | ほ | の | と | そ | こ | お |
Ever since I have managed to make Japanese input work again with
IBus, I seem to constantly seek
excuses to type it everywhere. And yes, pdflatex
did not cope with it.
So I have tinkered around on my playground-LATEX file, hunting it through
various incarnations (while letting it produce the same blank page over and
over), incidentally switching to xelatex
—until it finally decided to
give a glimpse at what Hiragana, Katakana and Kanji might actually look
like if typeset by Knuth: And behold!, the
Source.
publishing
Of course, the vanity in person that I am, I wanted to share this, so I had to
adapt a few things in ayekat.ch
, too:
-
Specify the Minchō font typefaces
"IPAMincho"
and"Sazanami Mincho"
in the site's CSS, to have the Japanese fonts be more in line with the rest of the site's serif font—not sure what this actually looks like on a system that does not have these fonts installed. -
Add a "token substitution" system to my markup handler, so that I can simply type
@LaTeX@
to conveniently get the stylised LATEX logo printed. To do so, I had to Spaghetti-code some workarounds in order to get rid of those pesky HTML tags in the site's title;… yes, I would like some Bolognese sauce and Parmigiano cheese with that Spaghetti code, thank you very much. precisely speaking, I use an additional, "stripped" variable + a little condition checking for when to print which title variant. -
Put in a hack to have the
text/x-tex
MIME type be recognised as being encoded with UTF-8 (as python doesn't detect that properly, apparently)… yes, yes, I would really love some sauce and cheese!, so the web browsers would properly show the LATEX source file for abovementioned outcome.
Coding at its finest, eh?
read more
2019
2017
- Hierarchaeology
- Sketches
- Epoch
- Shadows
- 日本語 in LATEX
- /var/log/computers
- Tufte CSS