ソースコードの管理場所
Revision | c2d8b32b20504d489c21ff2e877dc19262be49bb (tree) |
---|---|
Time | 2022-05-22 14:43:09 |
Author | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
Fix #44426
@@ -1,10 +1,11 @@ | ||
1 | 1 | % |
2 | -% lltjp-listings.sty 2020-03-23 | |
2 | +% lltjp-listings.sty 2022-05-22 | |
3 | 3 | % |
4 | 4 | |
5 | 5 | \NeedsTeXFormat{LaTeX2e} |
6 | 6 | \RequirePackage{etoolbox,listings,luatexbase-cctb} |
7 | 7 | |
8 | +\newcount\ltj@lst@japanese@min \ltj@lst@japanese@min=128 | |
8 | 9 | %%%%%%%%%%%%%%%% Japanese support |
9 | 10 | %% whether letter-space in a fixed mode box is doubled or not |
10 | 11 | \newif\if@ltj@lst@double |
@@ -197,9 +198,6 @@ | ||
197 | 198 | \lsthk@PreSet\lstset{flexiblecolumns,#1}% |
198 | 199 | \lsthk@TextStyle |
199 | 200 | \@ifnextchar\bgroup \ltj@lst@InlineG \ltj@lstinline@} |
200 | -\def\ltj@lstinline@#1{% | |
201 | - \edef\ltj@lst@temp{\the\catcode`#1}\lst@Init\relax\catcode`#1\ltj@lst@temp | |
202 | - \lst@InlineJ#1} | |
203 | 201 | \def\ltj@lst@InlineG{% |
204 | 202 | \lst@Init\relax\edef\ltj@lst@temp{\the\catcode`\}}\catcode`\}=2 \catcode`\ =12\relax |
205 | 203 | \let\lst@arg\@empty\afterassignment\ltj@lst@InlineG@@\@temptokena} |
@@ -207,9 +205,16 @@ | ||
207 | 205 | \catcode`\}=\ltj@lst@temp% |
208 | 206 | \expandafter\expandafter\expandafter\lst@InsideConvert% |
209 | 207 | \expandafter{\the\@temptokena}\lst@arg\lst@DeInit\egroup} |
210 | - | |
211 | -%%%%%%%%%%%%%%%% \lstMakeShortInline | |
212 | -\patchcmd\lstMakeShortInline@{\lst@shortinlinedef#1}{\lst@shortinlinedef~}{}{} | |
208 | +\def\ltj@lstinline@#1{% | |
209 | + \edef\ltj@lst@temp{\the\catcode`#1} | |
210 | + \lst@Init\relax\catcode`#1\ltj@lst@temp | |
211 | + \ifnum\ltj@lst@temp=\active | |
212 | + \begingroup\lccode`\~=`#1\relax | |
213 | + \lowercase{\xdef\lst@next{\noexpand\lst@InlineJ\noexpand~}}\endgroup% | |
214 | + \else | |
215 | + \edef\lst@next{\noexpand\lst@InlineJ\scantextokens{#1}}% | |
216 | + \fi\lst@next | |
217 | +} | |
213 | 218 | |
214 | 219 | % We redefine \lst@BeginDropInput, since now we have |
215 | 220 | % two additional `process macros'. |
@@ -239,7 +244,7 @@ | ||
239 | 244 | for i = 1, utf.len(buf) do |
240 | 245 | local c = utf.sub(buf, i, i) |
241 | 246 | local cu = utf.byte(c) |
242 | - if cu >= 0x80 and tex.getcatcode(cu) \string~= 13 then | |
247 | + if cu >= \the\ltj@lst@japanese@min\space and tex.getcatcode(cu) \string~= 13 then | |
243 | 248 | ret = ret .. utfchar(getcount('ltjlineendcomment')) |
244 | 249 | end |
245 | 250 | ret = ret .. c |
@@ -283,7 +288,7 @@ | ||
283 | 288 | \gdef\ltj@lst@MakeActive@#1{\let\lst@next\relax% |
284 | 289 | \ifx#1\relax |
285 | 290 | \else\let\lst@next\ltj@lst@MakeActive@ |
286 | - \ifnum`#1>127 | |
291 | + \ifnum`#1>\numexpr\ltj@lst@japanese@min-1 | |
287 | 292 | \lccode`\^^A=`#1 |
288 | 293 | \lowercase{\lst@lAddTo\lst@temp{$^^A}}%$ |
289 | 294 | \else |
@@ -1,8 +1,9 @@ | ||
1 | 1 | %#!lualatex |
2 | 2 | \documentclass{article} |
3 | 3 | |
4 | -\usepackage{luatexja-fontspec,amsmath} | |
5 | 4 | \usepackage{listings,color,showexpl,comment} |
5 | +\lstMakeShortInline÷ | |
6 | +\usepackage{luatexja-fontspec,amsmath} | |
6 | 7 | \usepackage{luatexja-otf}\directlua{luatexja.otf.enable_ivs()} |
7 | 8 | \usepackage |
8 | 9 | [ |
@@ -33,7 +34,7 @@ | ||
33 | 34 | \fi |
34 | 35 | }{} |
35 | 36 | \DeclareKanjiFamily{JY3}{koz}{} |
36 | -\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [1.2] HaranoAjiMincho-Regular:jfm=ujis}{} | |
37 | +\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [1.2] KozMinPr6N-Regular:jfm=ujis}{} | |
37 | 38 | \DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [1.2] psft:Ryumin-Light:jfm=ujis;slant=0.167}{} |
38 | 39 | \DeclareFontShape{JY3}{koz}{m}{it}{<-> ssub* koz/m/sl}{} |
39 | 40 | \def\mcdefault{koz} |
@@ -186,13 +187,17 @@ IVS対応2: \texttt{vsraw=true} | ||
186 | 187 | |
187 | 188 | foo \lstinline[basicstyle=\tt]!ba{}#shr! baz あ |
188 | 189 | |
189 | -あ\lstinline[basicstyle=\tt]{bar s}hoge | |
190 | +1あ\lstinline[basicstyle=\tt]{bar s}hoge | |
191 | + | |
192 | +2あ\lstinline[basicstyle=\tt]{bar..{a}hoge | |
190 | 193 | |
191 | -あ\lstinline[basicstyle=\tt]{bar..{a}hoge | |
194 | +foo \lstinline[basicstyle=\tt\gtfamily]!exit 0; #shbar! baz あ | |
192 | 195 | |
193 | -foo \lstinline[basicstyle=\tt\gtfamily]!あexit 0; #shbar! baz あ | |
196 | +foo \lstinline[basicstyle=\tt\gtfamily]!あreturn 0; #shbar! baz あ | |
194 | 197 | |
195 | -あ\lstinline[basicstyle=\tt]{いbexit #sh$ar}hoge | |
198 | +3あ\lstinline[basicstyle=\tt]{fexit #sh$ar}hoge | |
199 | + | |
200 | +4あ\lstinline[basicstyle=\tt]{いbexit #sh$ar}hoge | |
196 | 201 | |
197 | 202 | \bigskip |
198 | 203 | \textbf{Ticket \#35484} |
@@ -201,8 +206,8 @@ foo \lstinline[basicstyle=\tt\gtfamily]!あexit 0; #shbar! baz あ | ||
201 | 206 | \colorbox{red}{\lstinline!あいexit 0;#shうえお!} |
202 | 207 | |
203 | 208 | |
204 | -\colorbox{red}{\lstinline{aiu#sheoxyz}} | |
205 | -\colorbox{red}{\lstinline{あいexit 0;#shうえお}} | |
209 | +\colorbox{red}{\lstinline{aGiu#sheoxyz}} | |
210 | +\colorbox{red}{\lstinline{あGいexit 0;#shうえお}} | |
206 | 211 | |
207 | 212 | あおいうえお |
208 | 213 | \begin{lstlisting}[frame=single] |
@@ -216,29 +221,15 @@ aiu | ||
216 | 221 | 1234567890123457890 |
217 | 222 | aiu# \textcolor{red}{e} #o#\textcolor{red}{ka}#ki |
218 | 223 | \end{lstlisting} |
224 | +\typeout{AAAA} | |
219 | 225 | |
220 | - | |
221 | -\newpage | |
222 | -\lstset{basewidth=0.75\zw,basicstyle=\ttfamily,doubleletterspace,backgroundcolor=} | |
223 | -\noindent | |
224 | -\def\A{\leavevmode\smash{\hbox to 0.75\zw{\kern-.0625mm\vrule height 0pt depth 200pt width 0.125mm\hss}}}% | |
225 | -\textcolor{cyan}{\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A}% | |
226 | - | |
227 | -\begin{lstlisting} | |
228 | -a.b.c.d.e.f.g.h.i.j.k.l.m. | |
229 | -123(あいう@(カンジabc | |
230 | -a.b.c.d.e.f.g.h.i.j.k.l.m. | |
231 | -123あいう)@(カンジabc | |
232 | -a.b.c.d.e.f.g.h.i.j.k.l.m. | |
233 | -123あい:う@(カンジabc | |
234 | -\end{lstlisting} | |
235 | - | |
236 | -\begin{lstlisting}[columns={[l]flexible}] | |
237 | -a.b.c.d.e.f.g.h.i.j.k.l.m. | |
238 | -123(あいう@(カンジabc | |
239 | -a.b.c.d.e.f.g.h.i.j.k.l.m. | |
240 | -123あいう)@(カンジabc | |
241 | -a.b.c.d.e.f.g.h.i.j.k.l.m. | |
242 | -123あい:う@(カンジabc | |
243 | -\end{lstlisting} | |
226 | +\bigskip | |
227 | +\textbf{Ticket \#44426}\lstset{basicstyle=\itshape} | |
228 | +Foo ÷fo#shbarあ{#}o÷ Foo | |
229 | +\colorbox{green}{÷fo#shbarあ{#}o÷} | |
230 | + | |
231 | +\lstMakeShortInline あ | |
232 | +÷いfo#shbarあ{#}}o÷ | |
233 | +あえbazあ | |
234 | +あbaxあ | |
244 | 235 | \end{document} |