%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2015/01/08 Patch to listings for LuaTeX-ja]
+\ProvidesPackage{lltjp-listings}[2015/09/08 Patch to listings for LuaTeX-ja]
\RequirePackage{listings,luatexbase-cctb}
%%%%%%%%%%%%%%%% Japanese support
% 白線対策
-\def\lst@OutputToken{%
- \lst@TrackNewLines \lst@OutputLostSpace
- \lst@ifgobbledws
- \lst@gobbledwhitespacefalse
- \lst@@discretionary
+\gdef\lst@frameInit{%
+ \ifx\lst@framelshape\@empty \let\lst@frameL\@empty \fi
+ \ifx\lst@framershape\@empty \let\lst@frameR\@empty \fi
+ \def\lst@framevrule{\vrule\@width\lst@framerulewidth\relax}%
+ \lst@ifframeround
+ \lst@frameCalcDimA\z@ \@getcirc\@tempdima
+ \@tempdimb\@tempdima \divide\@tempdimb\tw@
+ \advance\@tempdimb -\@wholewidth
+ \edef\lst@frametextsep{\the\@tempdimb}%
+ \edef\lst@framerulewidth{\the\@wholewidth}%
+ \lst@frameCalcDimA\@ne \@getcirc\@tempdima
+ \@tempdimb\@tempdima \divide\@tempdimb\tw@
+ \advance\@tempdimb -\tw@\@wholewidth
+ \advance\@tempdimb -\lst@frametextsep
+ \edef\lst@rulesep{\the\@tempdimb}%
\fi
- \lst@CheckMerge
- {\lst@thestyle{\lst@FontAdjust
- \setbox\@tempboxa\lst@hbox
- {\lsthk@OutputBox
- \lst@lefthss
- \expandafter\lst@FillOutputBox\the\lst@token\@empty
- \lst@righthss}%
- \ht\@tempboxa=0pt\dp\@tempboxa=0pt
- \lst@CalcLostSpaceAndOutput}}%
- \lst@ResetToken}
+ \lst@frameMakeBoxV\lst@framebox{\ht\strutbox}{\dp\strutbox}%
+ %%%% ここから
+ \@tempdima\z@
+ \ifdim\ht\strutbox<\cht\@tempdima=\dimexpr\cht-\ht\strutbox\relax\fi
+ \ifdim\dp\strutbox<\cdp\advance\@tempdima=\dimexpr\cdp-\dp\strutbox\relax\fi
+ \edef\lst@framelr{\lineskiplimit-\the\@tempdima\copy\lst@framebox}%
+ %%%% ここまで
+ \ifx\lst@frametshape\@empty\else
+ \lst@frameH T\lst@frametshape
+ \ifvoid\z@\else
+ \par\lst@parshape
+ \@tempdima-\baselineskip \advance\@tempdima\ht\z@
+ \ifdim\prevdepth<\@cclvi\p@\else
+ \advance\@tempdima\prevdepth
+ \fi
+ \ifdim\@tempdima<\z@
+ \vskip\@tempdima\vskip\lineskip
+ \fi
+ \noindent\box\z@\par
+ \lineskiplimit\maxdimen \lineskip\z@
+ \fi
+ \lst@frameSpreadV\lst@framextopmargin
+ \fi}
+
+
%%%%%%%%%%%%%%%% escape to \LaTeX
\lstloadaspects{escape}
%#!lualatex
\documentclass{article}
-\usepackage{luatexja-fontspec}
+\usepackage{luatexja-fontspec,amsmath}
\usepackage{listings,color,showexpl,comment}
\usepackage{luatexja-otf}\directlua{luatexja.otf.enable_ivs()}
\usepackage
\fi
}{}
\DeclareKanjiFamily{JY3}{koz}{}
-\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [0.92489] KozMinPr6N-Regular:jfm=ujis}{}
-\DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [0.92489] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
+\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [1.2] KozMinPr6N-Regular:jfm=ujis}{}
+\DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [1.2] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
\DeclareFontShape{JY3}{koz}{m}{it}{<-> ssub* koz/m/sl}{}
\def\mcdefault{koz}
\setmainfont{TeX Gyre Pagella}
\setmonofont{TeX Gyre Cursor}
+\def\cs#1{\hbox{\texttt{\textbackslash #1}}}
\begin{document}
This test file is based on a.tex\footnote{This can be downloaded from {\tt https://gist.github.com/1574793}.} by x19290.
\end{lstlisting}
\newpage
-We also avoid white band problem, by setting both the height and the depth of each
-letter/word to 0\,pt.
+We also avoid white band problem, by setting the value of \cs{lineskiplimit} to
+\begin{multline}
+ -\min(\cs{cht}-\cs{ht}\cs{strutbox}, 0)\\
+ -\min(\cs{cdp}-\cs{dp}\cs{strutbox}, 0).
+\end{multline}
+
\begin{env}{\relax}
#!/bin/sh
1234567890
1あ,23
1あ2,3
+1)2,3
1234567890
\end{lstlisting}
foo \lstinline[basicstyle=\tt]!あbar! baz あ
あ\lstinline[basicstyle=\tt]{いbar}hoge
+\bigskip
+\textbf{Ticket \#35484}
+\colorbox{red}{\lstinline!aiueoxyz!}
\end{document}