diff options
author | Karl Berry <karl@freefriends.org> | 2015-03-08 22:34:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-03-08 22:34:05 +0000 |
commit | 8d291def7999406c0274694b7235c94c1c1182ed (patch) | |
tree | 76f4c5728dadaa046e5c452bd10738df77c948b2 /Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty | |
parent | 24ef94ac17615157dda1e8ab34500b982dfd4a6c (diff) |
luatexja (8mar15)
git-svn-id: svn://tug.org/texlive/trunk@36466 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty index b2c7d9afea2..3017f08563a 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty @@ -3,12 +3,16 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjp-listings}[2014/01/09 Patch to listings for LuaTeX-ja] +\ProvidesPackage{lltjp-listings}[2015/01/07 Patch to listings for LuaTeX-ja] \RequirePackage{listings,luatexbase-cctb} %%%%%%%%%%%%%%%% Japanese support +%% whether letter-space in a fixed mode box is doubled or not +\newif\if@ltj@lst@double +\lst@Key{doubleletterspace}f[t]{\lstKV@SetIf{#1}\if@ltj@lst@double} + %% IVS support -\newif\if@ltj@lst@vsraw \@ltj@lst@vsrawfalse +\newif\if@ltj@lst@vsraw \def\ltj@lst@vscmd{} \lst@Key{vsraw}f[t]{\lstKV@SetIf{#1}\if@ltj@lst@vsraw} \lst@Key{vscmd}\relax{\def\ltj@lst@vscmd{#1}} @@ -30,17 +34,19 @@ local cat_str = luatexbase.catcodetables['string'] local cat_lp = luatexbase.catcodetables['latex-package'] local ubyte = unicode.utf8.byte + local spccmd = string.char(0x5C) .. 'ltj@lst@hss@normal' luatexja.lst = {} function luatexja.lst.althss(t) t = ubyte(t) if not (t>=0xE0100 and t<0xE01F0) then - tex.sprint(cat_lp, string.char(0x5C) .. 'lst@hss') + tex.sprint(cat_lp, spccmd) end end } -\gdef\ltj@lst@hss@ivs#1{% +\def\ltj@lst@hss@ivs#1{% \directlua{luatexja.lst.althss('\luatexluaescapestring{#1}')}#1% } +\def\ltj@lst@hss@double{\lst@hss\lst@hss} % lowest level \newif\if@ltj@lst@kanji @@ -64,7 +70,7 @@ \lst@Output \else \if@ltj@lst@kanji\else\lst@OutputOther\fi\lst@lettertrue - \fi} + \fi\@ltj@lst@kanjitrue} \def\ltj@lst@setopenflag{% \lst@ifletter @@ -173,6 +179,26 @@ \SetCatcodeRange{"FE00}{"FE0F}{13}% Variation Selector } +% redefine \lstinline@ and \lst@InlineG +% because \lstinline!あ...! causes ``Runaway argument?'' Error +\def\lstinline@#1{% + \lst@Init\relax + \ltj@lst@check@inline{\lst@InlineM#1}{\lst@InlineJ#1}} +\def\lst@InlineG{% + \lst@Init\relax + \ltj@lst@check@inline{\lst@InlineM\}}% + {\let\lst@arg\@empty \lst@InlineGJ}} + +\def\ltj@lst@check@inline#1#2#3{% + \begingroup \lccode`\~=`#3\lowercase{\endgroup + \ifx~}#3% + \def\lst@next{#1}% + \else\ifnum`#3>127\relax + \def\lst@next{#1}% + \else + \def\lst@next{#2}% + \fi\fi\lst@next #3} + % We redefine \lst@BeginDropInput, since now we have % two additional `process macros'. \def\lst@BeginDropInput#1{% @@ -192,7 +218,7 @@ % hook! -\lst@AddToHook{Init}{ +\lst@AddToHook{Init}{% \luatexcatcodetable\CatcodeTableLTJlistings\ltj@@listing@jpcmd \lccode`\~="FFFFF\lowercase{\def~{\ltj@lst@ProcessJALetter}}%" \directlua{luatexbase.add_to_callback('process_input_buffer', @@ -201,17 +227,22 @@ for i = 1, utf.len(buf) do local c = utf.sub(buf, i, i) local cu = utf.byte(c) - if cu > 0x80 and tex.getcatcode(cu) \string~= 13 then + if cu >= 0x80 and tex.getcatcode(cu) \string~= 13 then ret = ret .. utf.char(1048575) % U+FFFFF end ret = ret .. c end return ret end, 'ltj.listings_unicode', 1)}% + \if@ltj@lst@double + \let\ltj@lst@hss@normal=\ltj@lst@hss@double + \else + \let\ltj@lst@hss@normal=\lst@hss + \fi \if@ltj@lst@vsraw \let\ltj@lst@hss=\ltj@lst@hss@ivs \else - \let\ltj@lst@hss=\lst@hss + \let\ltj@lst@hss=\ltj@lst@hss@normal \fi } \lst@AddToHook{ExitVars}{% @@ -298,4 +329,4 @@ \def\lstlistingname{ソースコード} \def\lstlistlistingname{ソースコード目次} % \end{修正事項} -\endinput
\ No newline at end of file +\endinput |