ソースコードの管理場所
Revision | 3d5cee68961b97a658514c0cbebed41df1c50ff7 (tree) |
---|---|
Time | 2015-03-03 14:47:22 |
Author | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
Cherry-picked several commits from kitagawa_tfont branch
c021eb1 - Wed Dec 3 16:06:58 2014 +0900: match option in luatexja-preset.sty.
8156de2 - Wed Dec 3 16:27:15 2014 +0900: updated manuals
96f2016 - Wed Dec 24 21:54:57 2014 +0900: ltjsclasses: \@setfontsize should not set xkanjiskip if
xkanjiskip<=0
fe9ceab - Wed Jan 7 11:06:52 2015 +0900: lltjp-listings.sty: fix \lstinline@
b4be058 - Wed Jan 7 11:19:19 2015 +0900: ... and more
117099f - Thu Jan 8 21:23:52 2015 +0900: lltjp-listings.sty: added 'doubleletterspace' key.
ec6db6e - Fri Jan 9 10:29:29 2015 +0900: Manual: added doubleletterspace key.
@@ -917,9 +917,25 @@ Note that the bold series in both family are same as the medium series of \emph{ | ||
917 | 917 | また,どちらのファミリでもイタリック体・スラント体は定義されない. |
918 | 918 | %</ja> |
919 | 919 | |
920 | - | |
921 | 920 | %<en>\item Japanese characters in math mode are typeset by the font family \texttt{mc}. |
922 | 921 | %<ja>\item 数式モード中の和文文字は明朝体(\texttt{mc})で出力される. |
922 | + | |
923 | +%<*en> | |
924 | +\item If you use the \Pkg{beamer} class with the default font theme (which uses sans serif | |
925 | + fonts) and with \LuaTeX-ja, you might want to change default Japanese fonts to | |
926 | + \emph{gothic} family. The following line changes the default Japanese font family | |
927 | + to \emph{gothic}: | |
928 | +%</en> | |
929 | +%<*ja> | |
930 | +\item \Pkg{beamer}クラスを既定のフォント設定で使う場合,既定欧文フォントがサンセリフなの | |
931 | + で,既定和文フォントもゴシック体にしたいと思うかもしれない.その場合はプリアンブルに | |
932 | +次を書けばよい: | |
933 | +%</ja> | |
934 | +\begin{lstlisting} | |
935 | + \renewcommand{\kanjifamilydefault}{\gtdefault} | |
936 | +\end{lstlisting} | |
937 | + | |
938 | + | |
923 | 939 | \end{itemize} |
924 | 940 | |
925 | 941 | %<*en> |
@@ -1075,6 +1091,7 @@ auto select&\cs{fontencoding}&\cs{fontfamily}&---&---&\cs{usefont}\\ | ||
1075 | 1091 | \ref{ssec-altfont}節の \cs{ltjdeclarealtfont} と,その\LaTeX 版の\ |
1076 | 1092 | \cs{DeclareAlternateKanjiFont}(\ref{ssec-nfsspat}節)を参照せよ. |
1077 | 1093 | %</ja> |
1094 | + | |
1078 | 1095 | \end{itemize} |
1079 | 1096 | |
1080 | 1097 | %<*en> |
@@ -6967,7 +6984,7 @@ then the patch \Pkg{lltjp-listings} is loaded automatically at \verb+\begin{docu | ||
6967 | 6984 | 意識する必要はない. |
6968 | 6985 | %</ja> |
6969 | 6986 | |
6970 | -%<en>\subsection{Notes} | |
6987 | +%<en>\subsection{Notes and additional keys} | |
6971 | 6988 | %<ja>\subsection{注意} |
6972 | 6989 | %<*en> |
6973 | 6990 | \paragraph{Escaping to \LaTeX} |
@@ -7009,6 +7026,20 @@ instead of ``\verb+\ほげ+''. | ||
7009 | 7026 | 「\cs{}\IVSA FFFFF」というcontrol symbolが実行されることになる. |
7010 | 7027 | %</ja> |
7011 | 7028 | |
7029 | +%<*en> | |
7030 | +\paragraph{Variation selectors} | |
7031 | +\Pkg{lltjp-listings} add two keys, namely \texttt{vsraw}~and~\texttt{vscmd}, | |
7032 | +which specify how variation selectors are treated in | |
7033 | +\texttt{lstlisting} or other enviroments. | |
7034 | +Note that these additional keys are not usable in the preamble, | |
7035 | +since \Pkg{lltjp-listings} is loaded at \verb+\begin{document}+. | |
7036 | + | |
7037 | +\texttt{vsraw} is a key which takes a boolean value, and its default value is | |
7038 | +false. | |
7039 | +\begin{itemize} | |
7040 | + \item If the \texttt{vsraw} key is true, then | |
7041 | +variation selectors are ``combined'' with the previous character. | |
7042 | +%</en> | |
7012 | 7043 | %<*ja> |
7013 | 7044 | \paragraph{異体字セレクタの扱い} |
7014 | 7045 | \texttt{lstlisting} 環境などの内部にある異体字セレクタを扱うため, |
@@ -7021,21 +7052,31 @@ instead of ``\verb+\ほげ+''. | ||
7021 | 7052 | \item trueの場合は,異体字セレクタは「直前の文字に続けて」出力される. |
7022 | 7053 | もしもIVSサポート(\ref{ssec-ltjotf}節)が有効になっていた場合は, |
7023 | 7054 | 以下の例(左側は入力,右側はその出力)のようになる. |
7055 | +%</ja> | |
7024 | 7056 | \begin{LTXexample} |
7025 | 7057 | \begin{lstlisting}[vsraw=true] |
7026 | 7058 | 葛󠄀城市,葛󠄁飾区,葛西 |
7027 | 7059 | \end{lstlisting} |
7028 | 7060 | \end{LTXexample} |
7061 | +%<*en> | |
7062 | +\item If the \texttt{vsraw} key is false, then | |
7063 | +variation selectors are typeset by an appropriate command, which is specified by | |
7064 | + the \texttt{vscmd} key. | |
7065 | +The default setting of the \texttt{vscmd} key produces the following. | |
7066 | +%</en> | |
7067 | +%<*ja> | |
7029 | 7068 | \item falseの場合は,異体字セレクタは適当な命令によって「見える形で」出力される. |
7030 | 7069 | どのような形で出力されるかを規定するのが \texttt{vscmd} キーであり, |
7031 | 7070 | \Pkg{lltjp-listings} の標準設定では以下の例の右側のように出力される. |
7071 | +%</ja> | |
7032 | 7072 | \begin{LTXexample} |
7033 | 7073 | \begin{lstlisting}[vsraw=false, |
7034 | 7074 | vscmd=\ltjlistingsvsstdcmd] |
7035 | 7075 | 葛󠄀城市,葛󠄁飾区,葛西 |
7036 | 7076 | \end{lstlisting} |
7037 | 7077 | \end{LTXexample} |
7038 | -ちなみに,本ドキュメントでは次のようにしている: | |
7078 | +%<ja> ちなみに,本ドキュメントでは次のようにしている: | |
7079 | +%<en> For example, the following code is the setting of the \texttt{vscmd} key in this document. | |
7039 | 7080 | \begin{lstlisting}[numbers=left] |
7040 | 7081 | \def\IVSA#1#2#3#4#5{% |
7041 | 7082 | \textcolor{blue}{\raisebox{3.5pt}{\tt% |
@@ -7049,10 +7090,56 @@ instead of ``\verb+\ほげ+''. | ||
7049 | 7090 | \lstset{vscmd=\IVSB} |
7050 | 7091 | \end{lstlisting} |
7051 | 7092 | \end{itemize} |
7052 | -既定の出力命令を復活させたい場合は\ \verb+vsraw=\ltjlistingsvsstdcmd+\ | |
7093 | +%<*en> | |
7094 | +The default output command of variation selectors is stored in \verb+\ltjlistingsvsstdcmd+. | |
7095 | +%</en> | |
7096 | +%<*ja> | |
7097 | +既定の出力命令を復活させたい場合は\ \verb+vscmd=\ltjlistingsvsstdcmd+\ | |
7053 | 7098 | とすれば良い. |
7054 | 7099 | %</ja> |
7055 | 7100 | |
7101 | +%<*en> | |
7102 | +\paragraph{The \texttt{doubleletterspace} key} | |
7103 | +Even the column format is \texttt{[c]fixed}, sometimes characters are not vertically aligned. | |
7104 | +The following example is typeset with \texttt{basewidth=2em}, and | |
7105 | +you'll see the leftmost ``\texttt{H}'' are not vertically aligned. | |
7106 | +\begin{lstlisting}[basewidth=2em, basicstyle=\tt,numbers=left] | |
7107 | +:H: | |
7108 | +:HHHH: | |
7109 | +\end{lstlisting} | |
7110 | + | |
7111 | +\Pkg{lltjp-listing} adds the \texttt{doubleletterspace} key (not activated by default, for | |
7112 | +compatibility) to | |
7113 | +improve the situation, namely doubles inter-character space in each output unit. | |
7114 | +With this key, the above input now produces better output. | |
7115 | +\begin{lstlisting}[basewidth=2em, basicstyle=\tt,numbers=left, doubleletterspace] | |
7116 | +:H: | |
7117 | +:HHHH: | |
7118 | +\end{lstlisting} | |
7119 | +%</en> | |
7120 | +%<*ja> | |
7121 | +\paragraph{\texttt{doubleletterspace}キー} | |
7122 | +\Pkg{listings}パッケージで列揃えが \texttt{[c]fixed} となっている場合でも, | |
7123 | +場合によっては文字が縦に揃わない場合もある. | |
7124 | +例を以下に示そう.これは強調するために \texttt{basewidth=2em} を設定している. | |
7125 | +\begin{lstlisting}[basewidth=2em, basicstyle=\tt,numbers=left] | |
7126 | +:H: | |
7127 | +:HHHH: | |
7128 | +\end{lstlisting} | |
7129 | +1行目と2行目の「\texttt{H}」の位置が揃っていないが, | |
7130 | +これは出力単位ごとに,先頭・末尾・各文字間に同じ量の空白を挿入することによる. | |
7131 | + | |
7132 | +\Pkg{lltjp-listing}では,このような症状を改善させるために \texttt{doubleletterspace} キー | |
7133 | +を追加した(標準では互換性のために無効になっている).このキーを有効にすると, | |
7134 | +出力単位中の各文字間の空白を2倍にすることで文字を揃いやすくしている. | |
7135 | +上と同じものを \texttt{doubleletterspace} キーを有効にして組んだものが以下であり, | |
7136 | +きちんと「\texttt{H}」の位置が揃っていることが分かる. | |
7137 | +\begin{lstlisting}[basewidth=2em, basicstyle=\tt,numbers=left, doubleletterspace] | |
7138 | +:H: | |
7139 | +:HHHH: | |
7140 | +\end{lstlisting} | |
7141 | +%</ja> | |
7142 | + | |
7056 | 7143 | %<en>\subsection{Class of Characters} |
7057 | 7144 | %<ja>\subsection{文字種} |
7058 | 7145 |
@@ -7182,7 +7269,7 @@ are classified into above 5~classes by the following rules: | ||
7182 | 7269 | Letter, Other, Kanji, Open, Closeのどれに属するかは次によって決まる: |
7183 | 7270 | %</ja> |
7184 | 7271 | \begin{itemize} |
7185 | -%<en>\item \textbf{ALchar}s above \texttt{U+0080} are classified as Letter. | |
7272 | +%<en>\item \textbf{ALchar}s above or equal to~\texttt{U+0080} are classified as Letter. | |
7186 | 7273 | %<ja>\item (\texttt{U+0080}以降の)\textbf{ALchar}は,すべてLetter扱いである. |
7187 | 7274 | |
7188 | 7275 | %<en>\item \textbf{JAchar}s are classified in the order as follows: |
@@ -7394,10 +7481,11 @@ OpenTypeフォントでもTrueTypeフォントでもIVS情報が格納されて | ||
7394 | 7481 | \texttt{fontloader} の呼び出しでかなり時間を消費することから, |
7395 | 7482 | %%% to_table を使わなくしたことで,メモリ使用量は減った |
7396 | 7483 | IVS情報をキャッシュに保存することで2回目以降の実行時間を節約している. |
7484 | +%</ja> | |
7397 | 7485 | |
7398 | 7486 | |
7487 | +%<*ja> | |
7399 | 7488 | \section{複数フォントの「合成」(未完)} |
7400 | - | |
7401 | 7489 | \section{\LuaTeX-jaにおけるキャッシュ} |
7402 | 7490 | \Pkg{luaotfload}パッケージが,各TrueType・OpenTypeフォントの情報を |
7403 | 7491 | キャッシュとして保存しているのと同様の方法で, |
@@ -3,13 +3,12 @@ | ||
3 | 3 | % |
4 | 4 | |
5 | 5 | \NeedsTeXFormat{LaTeX2e} |
6 | -\ProvidesPackage{luatexja-fontspec-24}[2014/06/19 fontspec support of LuaTeX-ja] | |
6 | +\ProvidesPackage{luatexja-fontspec-24}[2014/12/03 fontspec support of LuaTeX-ja] | |
7 | 7 | \RequirePackage{l3keys2e,luatexja} |
8 | 8 | \ExplSyntaxOn |
9 | 9 | |
10 | 10 | %%%%%%%% Change Japanese font family by \rmfamily or not |
11 | -\bool_if:NTF \ltj_fontspec_match | |
12 | -{ | |
11 | +\cs_new:Npn \ltj_fontspec_match_cmd { | |
13 | 12 | \renewcommand\jttdefault{\gtdefault} |
14 | 13 | \DeclareRobustCommand\rmfamily |
15 | 14 | {\not@math@alphabet\rmfamily\mathrm |
@@ -21,12 +20,11 @@ | ||
21 | 20 | {\not@math@alphabet\ttfamily\mathtt |
22 | 21 | \romanfamily\ttdefault\kanjifamily\jttdefault\selectfont} |
23 | 22 | \DeclareDocumentCommand \setmonojfont { O{} m } { |
24 | - \ltj_fontspec_set_family:Nnn \jttdefault {#1}{#2} | |
23 | + \ltj_fontspec_set_family:Nnn \jttdefault {##1}{##2} | |
25 | 24 | \normalfont |
26 | 25 | } |
27 | -}{ | |
28 | 26 | } |
29 | - | |
27 | +\bool_if:NT \ltj_fontspec_match_bool \ltj_fontspec_match_cmd | |
30 | 28 | %%%%%%%% Messages |
31 | 29 | |
32 | 30 | \msg_new:nnn {luatexja-fontspec} {addjfontfeatures-ignored} |
@@ -3,7 +3,7 @@ | ||
3 | 3 | % |
4 | 4 | |
5 | 5 | \NeedsTeXFormat{LaTeX2e} |
6 | -\ProvidesPackage{luatexja-fontspec}[2014/06/19 fontspec support of LuaTeX-ja] | |
6 | +\ProvidesPackage{luatexja-fontspec}[2014/12/03 fontspec support of LuaTeX-ja] | |
7 | 7 | \RequirePackage{l3keys2e,luatexja} |
8 | 8 | \ExplSyntaxOn |
9 | 9 |
@@ -11,16 +11,16 @@ | ||
11 | 11 | \cs_set:Nn \ltj_fontspec_pass_opts: {} |
12 | 12 | \keys_define:nn { luatexja-fontspec } |
13 | 13 | { |
14 | - match .bool_set:N = \ltj_fontspec_match, | |
14 | + match .bool_set:N = \ltj_fontspec_match_bool, | |
15 | 15 | match .default:n = true, |
16 | - pass .code:n = \cs_set:Nn \ltj_fontspec_pass_opts: {#1}, | |
16 | + pass .code:n = \cs_set:Nn \ltj_fontspec_pass_opts: {#1},% 互換性 | |
17 | 17 | } |
18 | 18 | \ProcessKeysOptions { luatexja-fontspec } |
19 | -\RequirePackage[\ltj_fontspec_pass_opts:]{fontspec}[2011/09/13] | |
20 | -\cs_if_exist:NTF \fontspec_update_featstr:n { | |
21 | - \RequirePackage{luatexja-fontspec-23} | |
22 | -} { | |
19 | +\RequirePackage[\ltj_fontspec_pass_opts:]{fontspec}[2014/06/01] | |
20 | +%\cs_if_exist:NTF \fontspec_update_featstr:n { | |
21 | +% \RequirePackage{luatexja-fontspec-23} | |
22 | +%} { | |
23 | 23 | \RequirePackage{luatexja-fontspec-24} |
24 | -} | |
24 | +%} | |
25 | 25 | |
26 | 26 | \endinput |
@@ -1,5 +1,5 @@ | ||
1 | 1 | % luatexja-preset.sty |
2 | -\ProvidesPackage{luatexja-preset}[2013/10/28 Japanese font presets] | |
2 | +\ProvidesPackage{luatexja-preset}[2014/12/03 Japanese font presets] | |
3 | 3 | |
4 | 4 | \RequirePackage{expl3} |
5 | 5 | \RequirePackage{luatexja-fontspec} |
@@ -195,6 +195,14 @@ | ||
195 | 195 | } |
196 | 196 | |
197 | 197 | \ExecuteOptions{ipaex} |
198 | + | |
199 | +% match | |
200 | +\DeclareOption{match} { | |
201 | + \bool_if:NF \ltj_fontspec_match_bool { | |
202 | + \ltj_fontspec_match_cmd | |
203 | + \bool_set_true:N \ltj_fontspec_match_bool | |
204 | + } | |
205 | +} | |
198 | 206 | \ProcessOptions* |
199 | 207 | |
200 | 208 | %% KozMinPr6N の場合はjp04 feature がないので,nlck にする |
@@ -38,7 +38,7 @@ | ||
38 | 38 | %% Right brace \} Tilde \~} |
39 | 39 | \NeedsTeXFormat{LaTeX2e} |
40 | 40 | \ProvidesClass{ltjsarticle} |
41 | - [2014/05/14 ] | |
41 | + [2014/12/24 ] | |
42 | 42 | \RequirePackage{luatexja} |
43 | 43 | \newif\if@restonecol |
44 | 44 | \newif\if@titlepage |
@@ -364,11 +364,14 @@ | ||
364 | 364 | \fi |
365 | 365 | \fi |
366 | 366 | \ltj@setpar@global |
367 | - \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} | |
368 | - \if@slide | |
369 | - \ltjsetxkanjiskip{0.1em} | |
370 | - \else | |
371 | - \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
367 | + \ltjsetkanjiskip{\z@ plus .1\zw minus .01\zw} | |
368 | + \@tempskipa=\ltjgetparameter{xkanjiskip} | |
369 | + \ifdim\@tempskipa>\z@ | |
370 | + \if@slide | |
371 | + \ltjsetxkanjiskip{0.1em} | |
372 | + \else | |
373 | + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
374 | + \fi | |
372 | 375 | \fi} |
373 | 376 | \emergencystretch 3\zw |
374 | 377 | \newif\ifnarrowbaselines |
@@ -38,7 +38,7 @@ | ||
38 | 38 | %% Right brace \} Tilde \~} |
39 | 39 | \NeedsTeXFormat{LaTeX2e} |
40 | 40 | \ProvidesClass{ltjsbook} |
41 | - [2014/05/14 ] | |
41 | + [2014/12/24 ] | |
42 | 42 | \RequirePackage{luatexja} |
43 | 43 | \newif\if@restonecol |
44 | 44 | \newif\if@titlepage |
@@ -371,11 +371,14 @@ | ||
371 | 371 | \fi |
372 | 372 | \fi |
373 | 373 | \ltj@setpar@global |
374 | - \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} | |
375 | - \if@slide | |
376 | - \ltjsetxkanjiskip{0.1em} | |
377 | - \else | |
378 | - \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
374 | + \ltjsetkanjiskip{\z@ plus .1\zw minus .01\zw} | |
375 | + \@tempskipa=\ltjgetparameter{xkanjiskip} | |
376 | + \ifdim\@tempskipa>\z@ | |
377 | + \if@slide | |
378 | + \ltjsetxkanjiskip{0.1em} | |
379 | + \else | |
380 | + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
381 | + \fi | |
379 | 382 | \fi} |
380 | 383 | \emergencystretch 3\zw |
381 | 384 | \newif\ifnarrowbaselines |
@@ -22,7 +22,7 @@ | ||
22 | 22 | % ----------------------------------------- |
23 | 23 | % |
24 | 24 | % \fi |
25 | -% \CheckSum{5203} | |
25 | +% \CheckSum{5210} | |
26 | 26 | %% \CharacterTable |
27 | 27 | %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
28 | 28 | %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
@@ -50,7 +50,7 @@ | ||
50 | 50 | %<*driver> |
51 | 51 | \ProvidesFile{ltjsclasses.dtx} |
52 | 52 | %</driver> |
53 | - [2014/05/14 ] | |
53 | + [2014/12/24 ] | |
54 | 54 | %<*driver> |
55 | 55 | \documentclass{ltjsarticle} |
56 | 56 | \usepackage{doc} |
@@ -132,6 +132,8 @@ | ||
132 | 132 | % |
133 | 133 | % [2014-02-07 LTJ] jsclasses 2014-02-07 ベースにしました. |
134 | 134 | % |
135 | +% [2014-12-24 LTJ] |\@setfontsize| 中の和欧文間空白の設定で if 文が抜けていたのを直しました. | |
136 | +% | |
135 | 137 | % \StopEventually{} |
136 | 138 | % |
137 | 139 | % 以下では実際のコードに即して説明します。 |
@@ -960,6 +962,10 @@ | ||
960 | 962 | % |\ltjsetkanjiskip| と |\ltjsetxkanjiskip|(両者とも, |
961 | 963 | % 実行前には |\ltj@setpar@global| の実行が必要)にしました. |
962 | 964 | % |
965 | +% [2014-12-24 LTJ] |jsclasses| では,|\@setfontsize| 中で |xkanjiskip| を | |
966 | +% 設定するのは現在の和欧文間空白の自然長が正の場合だけでした. | |
967 | +% |ltjsclasses| では最初からこの判定が抜けてしまっていたので,復活させます. | |
968 | +% | |
963 | 969 | % \begin{macrocode} |
964 | 970 | \def\@setfontsize#1#2#3{% |
965 | 971 | % \@nomath#1% |
@@ -975,11 +981,14 @@ | ||
975 | 981 | \fi |
976 | 982 | \fi |
977 | 983 | \ltj@setpar@global |
978 | - \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} | |
979 | - \if@slide | |
980 | - \ltjsetxkanjiskip{0.1em} | |
981 | - \else | |
982 | - \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
984 | + \ltjsetkanjiskip{\z@ plus .1\zw minus .01\zw} | |
985 | + \@tempskipa=\ltjgetparameter{xkanjiskip} | |
986 | + \ifdim\@tempskipa>\z@ | |
987 | + \if@slide | |
988 | + \ltjsetxkanjiskip{0.1em} | |
989 | + \else | |
990 | + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
991 | + \fi | |
983 | 992 | \fi} |
984 | 993 | % \end{macrocode} |
985 | 994 | % \end{macro} |
@@ -38,7 +38,7 @@ | ||
38 | 38 | %% Right brace \} Tilde \~} |
39 | 39 | \NeedsTeXFormat{LaTeX2e} |
40 | 40 | \ProvidesClass{ltjskiyou} |
41 | - [2014/05/14 ] | |
41 | + [2014/12/24 ] | |
42 | 42 | \RequirePackage{luatexja} |
43 | 43 | \newif\if@restonecol |
44 | 44 | \newif\if@titlepage |
@@ -366,11 +366,14 @@ | ||
366 | 366 | \fi |
367 | 367 | \fi |
368 | 368 | \ltj@setpar@global |
369 | - \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} | |
370 | - \if@slide | |
371 | - \ltjsetxkanjiskip{0.1em} | |
372 | - \else | |
373 | - \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
369 | + \ltjsetkanjiskip{\z@ plus .1\zw minus .01\zw} | |
370 | + \@tempskipa=\ltjgetparameter{xkanjiskip} | |
371 | + \ifdim\@tempskipa>\z@ | |
372 | + \if@slide | |
373 | + \ltjsetxkanjiskip{0.1em} | |
374 | + \else | |
375 | + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
376 | + \fi | |
374 | 377 | \fi} |
375 | 378 | \emergencystretch 3\zw |
376 | 379 | \newif\ifnarrowbaselines |
@@ -38,7 +38,7 @@ | ||
38 | 38 | %% Right brace \} Tilde \~} |
39 | 39 | \NeedsTeXFormat{LaTeX2e} |
40 | 40 | \ProvidesClass{ltjspf} |
41 | - [2014/05/14 ] | |
41 | + [2014/12/24 ] | |
42 | 42 | \RequirePackage{luatexja} |
43 | 43 | \newif\if@restonecol |
44 | 44 | \newif\if@titlepage |
@@ -364,11 +364,14 @@ | ||
364 | 364 | \fi |
365 | 365 | \fi |
366 | 366 | \ltj@setpar@global |
367 | - \ltjsetkanjiskip{0pt plus .1\zw minus .01\zw} | |
368 | - \if@slide | |
369 | - \ltjsetxkanjiskip{0.1em} | |
370 | - \else | |
371 | - \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
367 | + \ltjsetkanjiskip{\z@ plus .1\zw minus .01\zw} | |
368 | + \@tempskipa=\ltjgetparameter{xkanjiskip} | |
369 | + \ifdim\@tempskipa>\z@ | |
370 | + \if@slide | |
371 | + \ltjsetxkanjiskip{0.1em} | |
372 | + \else | |
373 | + \ltjsetxkanjiskip{0.25em plus 0.15em minus 0.06em} | |
374 | + \fi | |
372 | 375 | \fi} |
373 | 376 | \emergencystretch 3\zw |
374 | 377 | \newif\ifnarrowbaselines |
@@ -7,8 +7,12 @@ | ||
7 | 7 | \RequirePackage{listings,luatexbase-cctb} |
8 | 8 | |
9 | 9 | %%%%%%%%%%%%%%%% Japanese support |
10 | +%% whether letter-space in a fixed mode box is doubled or not | |
11 | +\newif\if@ltj@lst@double | |
12 | +\lst@Key{doubleletterspace}f[t]{\lstKV@SetIf{#1}\if@ltj@lst@double} | |
13 | + | |
10 | 14 | %% IVS support |
11 | -\newif\if@ltj@lst@vsraw \@ltj@lst@vsrawfalse | |
15 | +\newif\if@ltj@lst@vsraw | |
12 | 16 | \def\ltj@lst@vscmd{} |
13 | 17 | \lst@Key{vsraw}f[t]{\lstKV@SetIf{#1}\if@ltj@lst@vsraw} |
14 | 18 | \lst@Key{vscmd}\relax{\def\ltj@lst@vscmd{#1}} |
@@ -30,17 +34,19 @@ | ||
30 | 34 | local cat_str = luatexbase.catcodetables['string'] |
31 | 35 | local cat_lp = luatexbase.catcodetables['latex-package'] |
32 | 36 | local ubyte = unicode.utf8.byte |
37 | + local spccmd = string.char(0x5C) .. 'ltj@lst@hss@normal' | |
33 | 38 | luatexja.lst = {} |
34 | 39 | function luatexja.lst.althss(t) |
35 | 40 | t = ubyte(t) |
36 | 41 | if not (t>=0xE0100 and t<0xE01F0) then |
37 | - tex.sprint(cat_lp, string.char(0x5C) .. 'lst@hss') | |
42 | + tex.sprint(cat_lp, spccmd) | |
38 | 43 | end |
39 | 44 | end |
40 | 45 | } |
41 | -\gdef\ltj@lst@hss@ivs#1{% | |
46 | +\def\ltj@lst@hss@ivs#1{% | |
42 | 47 | \directlua{luatexja.lst.althss('\luatexluaescapestring{#1}')}#1% |
43 | 48 | } |
49 | +\def\ltj@lst@hss@double{\lst@hss\lst@hss} | |
44 | 50 | |
45 | 51 | % lowest level |
46 | 52 | \newif\if@ltj@lst@kanji |
@@ -64,7 +70,7 @@ | ||
64 | 70 | \lst@Output |
65 | 71 | \else |
66 | 72 | \if@ltj@lst@kanji\else\lst@OutputOther\fi\lst@lettertrue |
67 | - \fi} | |
73 | + \fi\@ltj@lst@kanjitrue} | |
68 | 74 | |
69 | 75 | \def\ltj@lst@setopenflag{% |
70 | 76 | \lst@ifletter |
@@ -173,6 +179,26 @@ | ||
173 | 179 | \SetCatcodeRange{"FE00}{"FE0F}{13}% Variation Selector |
174 | 180 | } |
175 | 181 | |
182 | +% redefine \lstinline@ and \lst@InlineG | |
183 | +% because \lstinline!あ...! causes ``Runaway argument?'' Error | |
184 | +\def\lstinline@#1{% | |
185 | + \lst@Init\relax | |
186 | + \ltj@lst@check@inline{\lst@InlineM#1}{\lst@InlineJ#1}} | |
187 | +\def\lst@InlineG{% | |
188 | + \lst@Init\relax | |
189 | + \ltj@lst@check@inline{\lst@InlineM\}}% | |
190 | + {\let\lst@arg\@empty \lst@InlineGJ}} | |
191 | + | |
192 | +\def\ltj@lst@check@inline#1#2#3{% | |
193 | + \begingroup \lccode`\~=`#3\lowercase{\endgroup | |
194 | + \ifx~}#3% | |
195 | + \def\lst@next{#1}% | |
196 | + \else\ifnum`#3>127\relax | |
197 | + \def\lst@next{#1}% | |
198 | + \else | |
199 | + \def\lst@next{#2}% | |
200 | + \fi\fi\lst@next #3} | |
201 | + | |
176 | 202 | % We redefine \lst@BeginDropInput, since now we have |
177 | 203 | % two additional `process macros'. |
178 | 204 | \def\lst@BeginDropInput#1{% |
@@ -201,17 +227,22 @@ | ||
201 | 227 | for i = 1, utf.len(buf) do |
202 | 228 | local c = utf.sub(buf, i, i) |
203 | 229 | local cu = utf.byte(c) |
204 | - if cu > 0x80 and tex.getcatcode(cu) \string~= 13 then | |
230 | + if cu >= 0x80 and tex.getcatcode(cu) \string~= 13 then | |
205 | 231 | ret = ret .. utf.char(1048575) % U+FFFFF |
206 | 232 | end |
207 | 233 | ret = ret .. c |
208 | 234 | end |
209 | 235 | return ret |
210 | 236 | end, 'ltj.listings_unicode', 1)}% |
237 | + \if@ltj@lst@double | |
238 | + \let\ltj@lst@hss@normal=\ltj@lst@hss@double | |
239 | + \else | |
240 | + \let\ltj@lst@hss@normal=\lst@hss | |
241 | + \fi | |
211 | 242 | \if@ltj@lst@vsraw |
212 | 243 | \let\ltj@lst@hss=\ltj@lst@hss@ivs |
213 | 244 | \else |
214 | - \let\ltj@lst@hss=\lst@hss | |
245 | + \let\ltj@lst@hss=\ltj@lst@hss@normal | |
215 | 246 | \fi |
216 | 247 | } |
217 | 248 | \lst@AddToHook{ExitVars}{% |
@@ -298,4 +329,4 @@ | ||
298 | 329 | \def\lstlistingname{ソースコード} |
299 | 330 | \def\lstlistlistingname{ソースコード目次} |
300 | 331 | % \end{修正事項} |
301 | -\endinput | |
\ No newline at end of file | ||
332 | +\endinput |
@@ -2,9 +2,8 @@ | ||
2 | 2 | \documentclass{article} |
3 | 3 | |
4 | 4 | \usepackage{luatexja-fontspec} |
5 | -\usepackage{listings,color,showexpl} | |
6 | -\usepackage{luatexja-otf} | |
7 | -\directlua{luatexja.otf.enable_ivs()} | |
5 | +\usepackage{listings,color,showexpl,comment} | |
6 | +\usepackage{luatexja-otf}\directlua{luatexja.otf.enable_ivs()} | |
8 | 7 | \usepackage |
9 | 8 | [ |
10 | 9 | papersize={100mm,100mm}, |
@@ -96,15 +95,20 @@ the first line of the listing is not rendered. | ||
96 | 95 | \textbf{Ticket \#29311} |
97 | 96 | |
98 | 97 | \begin{env}{\relax} |
99 | -長い長い長い長い長い長い長い長い長い長い長い長い#い長い | |
100 | -長い長い長い長い長い長い長い長い長い長い長い長aaaa#::い長い | |
101 | -長い長い長い長い長い長い長い長い長い長い長い長い,長い長い | |
102 | -長い長い長い長い長い長い長い長い長い長い長い長aa,::い長い | |
103 | -長い長い長い長い長い長い長い長い長い長い長い長,,::い長い | |
98 | +長い長い長い長い長い長い長い長い長い長い長い長aaa長い::い長い | |
99 | +長い長い長い長い長い長い長い長い長い長い長い長aaaa長い::い長い | |
100 | +長い長い長い長い長い長い長い長い長い長い長い長い長い,長い長い | |
101 | +あ長い長い長い長い長い長い長い長い長い長い長い長い長い,長い長い | |
102 | +長い長い長い長い長い長い長い長い長い長い長い長い長a,::い長い | |
103 | +長い長い長い長い長い長い長い長い長い長い長い長い長aa,::い長い | |
104 | +長い長い長い長い長い長い長い長い長い長い長い長い長aaa,::い長い | |
105 | +長い長い長い長い長い長い長い長い長い長い長い長い長aaaa,::い長い | |
106 | +長い長い長い長い長い長い長い長い長い長い長い長い長い,,::い長い | |
104 | 107 | 長い長い長い長い長い長い長い長い長い長い長い長(い長い |
105 | 108 | 長い長い長い長い長い長い長い長い長い長い長いaa(い長い |
106 | 109 | 長い長い長い長い長い長い長い長い長い長い長い長(aa長い |
107 | 110 | 長い長い長い長い長い長い長い長い長い長い長い長い)(長い |
111 | +あ長い長い長い長い長い長い長い長い長い長い長い長い)(長い | |
108 | 112 | \end{env} |
109 | 113 | |
110 | 114 | \newpage |
@@ -147,9 +151,37 @@ IVS対応2: \texttt{vsraw=true} | ||
147 | 151 | 1葛󠄀城,葛󠄁飾アイウ |
148 | 152 | \end{LTXexample} |
149 | 153 | |
154 | +\newpage | |
155 | + | |
156 | +下の行において,最初の「1」の場所がずれてしまうのは半ば仕方がないとも言える. | |
157 | +1行目では,「1234567890」が前後・文字間に計11箇所の等量の空白を入れて10全角の領域に | |
158 | +出力されているのに対し,2,~3行目では「1」が全角幅に左右中央で出力されているからである. | |
150 | 159 | \begin{lstlisting}[escapechar=\%,vsraw, basewidth=1\zw, basicstyle=\tt] |
151 | 160 | 1234567890 |
152 | 161 | 1あ,23 |
153 | 162 | 1あ2,3 |
163 | +1234567890 | |
164 | +\end{lstlisting} | |
165 | + | |
166 | +\texttt{doubleletterspace}オプションを指定すると,出力単位中の文字と文字の間隔を2倍にするため, | |
167 | +下の例の「1」のように,各文字の垂直位置が揃いやすくなる. | |
168 | +\begin{lstlisting}[escapechar=\%,doubleletterspace, basewidth=1\zw, basicstyle=\tt] | |
169 | +1234567890 | |
170 | +1あ,23 | |
171 | +1あ2,3 | |
172 | +1234567890 | |
154 | 173 | \end{lstlisting} |
174 | + | |
175 | + | |
176 | +\newpage | |
177 | +\textbf{Ticket \#34786} | |
178 | +\ltjsetparameter{autoxspacing=false} | |
179 | + | |
180 | +foo \lstinline[basicstyle=\tt]!bar! baz あ | |
181 | +あ\lstinline[basicstyle=\tt]{bar}hoge | |
182 | + | |
183 | +foo \lstinline[basicstyle=\tt]!あbar! baz あ | |
184 | +あ\lstinline[basicstyle=\tt]{いbar}hoge | |
185 | + | |
186 | + | |
155 | 187 | \end{document} |