2 \documentclass{article}
4 \usepackage{luatexja-fontspec}
5 \usepackage{listings,color,showexpl}
8 papersize={100mm,100mm},
16 language=sh, extendedchars=false,
17 backgroundcolor=\color[gray]{.75},
19 basewidth={0.55\zw, 0.45em},
20 numbers=left,numberstyle=\tiny, numbersep=2pt,
23 \lstnewenvironment{env}[1]
26 \renewcommand{\lstlistingname}{ex}
33 \DeclareFontShape{JY3}{mc}{m}{sl}{<-> s * [0.92489] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
34 \DeclareFontShape{JY3}{mc}{m}{it}{<-> ssub* mc/m/sl}{}
36 \setmainfont{TeX Gyre Pagella}
37 \setmonofont{TeX Gyre Cursor}
39 This test file is based on a.tex\footnote{This can be downloaded from {\tt https://gist.github.com/1574793}.} by x19290.
42 \textbf{SOLVED}: bad folding and not slanted problems are common in pLaTeX and LuaTeX-ja.
44 The cause of the latter problem is that Japanese fonts don't have italic shape by default.
45 In this document, we define them by
46 \begin{lstlisting}[language={[AlLaTeX]TeX}, basicstyle=\ttfamily]
47 \DeclareFontShape{JY3}{mc}{m}{sl}{<-> s * [0.92489] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
48 \DeclareFontShape{JY3}{mc}{m}{it}{<-> ssub* mc/m/sl}{}
52 We also avoid white band problem, by setting both the height and the depth of each
57 #長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い
58 長い長い長い長い長い長い長い長い長い長い長い長い,長い長い長い長い長い長い
59 #I.長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長いI
60 長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い
61 #IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII
62 IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII IIII
65 Note that any \emph{kinsoku shori} is not performed inside \textsf{lstlisting} environment,
66 as the line~3 in output above. We leave it to further development.
69 \textbf{SOLVED}: LuaTeX-ja specific problem:
70 when the \emph{begin} line of a listings environment ends with JAchar,
71 the first line of the listing is not rendered.
73 \begin{env}{problem; shebang not rendered --- 問題}
78 \begin{LTXexample}[language=TeX]
83 \lstinputlisting{test13-listings.tmp}
90 \textbf{Ticket \#29311}
93 長い長い長い長い長い長い長い長い長い長い長い長い#い長い
94 長い長い長い長い長い長い長い長い長い長い長い長aaaa#::い長い
95 長い長い長い長い長い長い長い長い長い長い長い長い,長い長い
96 長い長い長い長い長い長い長い長い長い長い長い長aa,::い長い
97 長い長い長い長い長い長い長い長い長い長い長い長,,::い長い
98 長い長い長い長い長い長い長い長い長い長い長い長(い長い
99 長い長い長い長い長い長い長い長い長い長い長いaa(い長い
100 長い長い長い長い長い長い長い長い長い長い長い長(aa長い
101 長い長い長い長い長い長い長い長い長い長い長い長い)(長い
105 \textbf{Ticket \#29604}
107 \setmonofont{DejaVu Sans Mono}
108 \ltjsetparameter{jacharrange={-2,-3,-8}}
111 \begin{lstlisting}[basewidth=.5em,basicstyle=\tt, emph={TeX}, emphstyle=\color{red}]
114 \TeX はギリシャ文字のΤ-Ε-Χ(タウ・イプシロン・カイ)であるから、……
115 \TeX is an abbreviation of τέχνη (ΤΕΧΝΗ – technē).
118 \ltjsetparameter{jacharrange={+2,+8,+3}}
121 \begin{lstlisting}[basewidth=.5em,basicstyle=\tt, emph={TeX}, emphstyle=\color{red}]
124 \TeX はギリシャ文字のΤ-Ε-Χ(タウ・イプシロン・カイ)であるから、……
125 \TeX is an abbreviation of τέχνη (ΤΕΧΝΗ – technē).