2 \documentclass{article}
4 \usepackage{luatexja-fontspec}
5 \usepackage{listings,color,showexpl}
6 \usepackage{luatexja-otf}
7 \directlua{luatexja.otf.enable_ivs()}
10 papersize={100mm,100mm},
18 language=sh, extendedchars=false,
19 backgroundcolor=\color[gray]{.75},
21 explpreset={columns=fixed},
22 basewidth={0.5\zw, 0.45em},
23 numbers=left,numberstyle=\tiny, numbersep=2pt,
26 \lstnewenvironment{env}[1]
29 \renewcommand{\lstlistingname}{ex}
36 \DeclareKanjiFamily{JY3}{koz}{}
37 \DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [0.92489] KozMinPr6N-Regular:jfm=ujis}{}
38 \DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [0.92489] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
39 \DeclareFontShape{JY3}{koz}{m}{it}{<-> ssub* koz/m/sl}{}
42 \setmainfont{TeX Gyre Pagella}
43 \setmonofont{TeX Gyre Cursor}
46 This test file is based on a.tex\footnote{This can be downloaded from {\tt https://gist.github.com/1574793}.} by x19290.
49 \textbf{SOLVED}: bad folding and not slanted problems are common in pLaTeX and LuaTeX-ja.
51 The cause of the latter problem is that Japanese fonts don't have italic shape by default.
52 In this document, we define them by
53 \begin{lstlisting}[language={[AlLaTeX]TeX}, basicstyle=\ttfamily]
54 \DeclareFontShape{JY3}{mc}{m}{sl}{<-> s * [0.92489] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
55 \DeclareFontShape{JY3}{mc}{m}{it}{<-> ssub* mc/m/sl}{}
59 We also avoid white band problem, by setting both the height and the depth of each
64 #長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い
65 長い長い長い長い長い長い長い長い長い長い長い長い,長い長い長い長い長い長い
66 #長い長い長い長い長い長い長い長い長い長い長い長い,長い長い長い長い長い長い
67 #I.長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長いI
68 長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い
69 #IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII
70 IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII
75 \textbf{SOLVED}: LuaTeX-ja specific problem:
76 when the \emph{begin} line of a listings environment ends with JAchar,
77 the first line of the listing is not rendered.
79 \begin{env}{problem; shebang not rendered --- 問題}
84 \begin{LTXexample}[language=TeX]
89 \lstinputlisting{test13-listings.tmp}
96 \textbf{Ticket \#29311}
99 長い長い長い長い長い長い長い長い長い長い長い長い#い長い
100 長い長い長い長い長い長い長い長い長い長い長い長aaaa#::い長い
101 長い長い長い長い長い長い長い長い長い長い長い長い,長い長い
102 長い長い長い長い長い長い長い長い長い長い長い長aa,::い長い
103 長い長い長い長い長い長い長い長い長い長い長い長,,::い長い
104 長い長い長い長い長い長い長い長い長い長い長い長(い長い
105 長い長い長い長い長い長い長い長い長い長い長いaa(い長い
106 長い長い長い長い長い長い長い長い長い長い長い長(aa長い
107 長い長い長い長い長い長い長い長い長い長い長い長い)(長い
111 \textbf{Ticket \#29604}
113 \setmonofont{DejaVu Sans Mono}
114 \ltjsetparameter{jacharrange={-2,-3,-8}}
117 \begin{lstlisting}[basewidth=.5em,basicstyle=\tt, emph={TeX}, emphstyle=\color{red}]
120 \TeX はギリシャ文字のΤ-Ε-Χ(タウ・イプシロン・カイ)であるから、……
121 \TeX is an abbreviation of τέχνη (ΤΕΧΝΗ – technē).
124 \ltjsetparameter{jacharrange={+2,+8,+3}}
127 \begin{lstlisting}[basewidth=.5em,basicstyle=\tt, emph={TeX}, emphstyle=\color{red}]
130 \TeX はギリシャ文字のΤ-Ε-Χ(タウ・イプシロン・カイ)であるから、……
131 \TeX is an abbreviation of τέχνη (ΤΕΧΝΗ – technē).
135 IVS対応1: \texttt{vsraw=false} (default)
137 \begin{LTXexample}[escapechar=\%, basicstyle=\tt]
143 IVS対応2: \texttt{vsraw=true}
145 \begin{LTXexample}[escapechar=\%,vsraw, basicstyle=\tt]
150 \begin{lstlisting}[escapechar=\%,vsraw, basewidth=1\zw, basicstyle=\tt]