summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/kanaparser/examples.tex
blob: 6ab850c9ff7e48e36bf58b869fdead71c23783d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% This file shows various usage of this parser

\input luaotfload.sty % otf font loader
\input kanaparser % load the parser package

\font\jp = ipagp % ipagp.otf font is included in the ipafont font package: https://www.internationalphoneticassociation.org/content/ipa-fonts

\parserInit % initialize kana parser

% wrapper macros that change font automatically
\def\jchar#1{{\jp #1}}
\def\kpth#1{\jchar{\toHiragana{#1}}}
\def\kptk#1{\jchar{\toKatakana{#1}}}
\def\kptl#1{\jchar{\toLatin{#1}}}

Example of transliteration to Latin: \kptl{しゅんかしゅうとう しし}

Example of transliteration to katakana featuring prolongation dashes: \kptk{しゅんかしゅうとう しし}

Example of transliteration to hiragana converting prolongation dashes: \kpth{シュンカシュートー}

Example of transliteration of multiple-form syllables to hiragana using default settings: \kpth{jiji wewe}

\toggleChars{ji we} % toggles the kana representation of 'ji' and 'we' syllables
Example of transliteration of multiple-form syllables to hiragana using alternate settings: \kpth{jiji wewe}

Mixed example of transliteration to katakana: \kptk{shunkashuutouuuxxxxxchou}

Example of default transliteration to hiragana using ambiguous syllables after n: \kpth{renyoukei}

Example of isolated n-character to resolve ambiguity: \kpth{ren'youkkei}

Example of hiragana to Latin transliteration from previous example: \kptl{れんようけい}

Example of consonant gemination from hiragana to Latin: \kptl{にっぽん}

Example of consonant gemination from Latin to hiragana: \kpth{nippon}

Example of character preservation: \kptl{when transLating to Latin, ' and " are preserved}

Example of character preservation 2: \kptl{\kpth{when transLating to kana, ' is consumed, " is preserved}}

\bye