\documentclass[luatex,fontsize=8pt,paper=b5,twoside]{jlreq}% \usepackage{luwa-ul} \usepackage{hyperref} \usepackage{caption} \usepackage[most]{tcolorbox} \usepackage{fp} \usepackage{lltjext} \usepackage{luatexja-ruby} \usepackage{KKsymbols} \usepackage{listings} \lstset{ basicstyle=\ttfamily\small, keywordstyle=\color{blue}, commentstyle=\color{gray}, stringstyle=\color{red}, breaklines=true, breakatwhitespace=false, columns=flexible } % You can omit these font settings. \RequirePackage[no-math]{fontspec} \RequirePackage[no-math,match,scale=1]{luatexja-fontspec} \RequirePackage[hiragino-pro,deluxe,expert]{luatexja-preset} \setmainfont{HiraMinPro-W3}[BoldFont=HiraMinPro-W6]\setmainjfont{HiraMinPro-W3}[BoldFont=HiraMinPro-W6] \renewfontfamily{\sffamily}{HiraKakuPro-W3}[BoldFont=HiraKakuPro-W6] \renewfontfamily{\mcfamily}{HiraMinPro-W3}[BoldFont=HiraMinPro-W6] \renewfontfamily{\gtfamily}{HiraKakuPro-W3}[BoldFont=HiraKakuPro-W6] \providefontfamily{\mgfamily}{HiraMaruPro-W4} \newfontfamily{\sfhira}{HiraKakuPro-W3}[BoldFont=HiraKakuPro-W6]\newjfontfamily{\sfhiraj}{HiraKakuPro-W3}[BoldFont=HiraKakuPro-W6] \newfontfamily{\mchira}{HiraMinPro-W3}[BoldFont=HiraMinPro-W6]\newjfontfamily{\mchiraj}{HiraMinPro-W3}[BoldFont=HiraMinPro-W6] \newfontfamily{\gthira}{HiraKakuPro-W3}[BoldFont=HiraKakuPro-W6,FontFace={eb}{\shapedefault}{HiraKakuStd-W8}]\newjfontfamily{\gthiraj}{HiraKakuPro-W3}[BoldFont=HiraKakuPro-W6,FontFace={eb}{\shapedefault}{HiraKakuStd-W8}] \newfontfamily{\mghira}{HiraMaruPro-W4}\newjfontfamily{\mghiraj}{HiraMaruPro-W4} \renewcommand{\sffamily}{\sfhira\sfhiraj} \renewcommand{\mcfamily}{\mchira\mchiraj} \renewcommand{\gtfamily}{\gthira\gthiraj} \renewcommand{\mgfamily}{\mghira\mghiraj} %%% \usepackage{hyperref} \hypersetup{ luatex, pdfencoding=auto, colorlinks=true, linkcolor=black, citecolor=black, urlcolor=DeepSkyBlue3, pdfborder={0 0 0}, } \colorlet{grayLight}{white!80!black} \NewTCBListing{SourceCode}{ O{Input} m !o !O{DeepSkyBlue3} }{% enhanced, colback=black!70, colframe=Snow4, toptitle=-1mm, bottomtitle=-1mm, righttitle=-1mm, lefttitle=-1mm, arc=.5mm, title={\tcbox[on line, arc=.5mm, boxsep=0pt, boxrule=0pt, top=1mm, bottom=0.8mm, left=2mm, right=2.2mm, colback=gray!80, coltext=white]{\raisebox{-0.1ex}{\vphantom{羅}\vphantom{j}#1}}},fonttitle=\gtfamily\footnotesize,boxrule=0.8pt, breakable,before upper={\color{white}},top=-0.5mm,bottom=-0.5mm, after title=\IfNoValueTF{#3}{}{{\hfill\tcbox[on line, arc=.5mm, boxsep=0pt, boxrule=0pt, top=1mm, bottom=0.8mm, left=2mm, right=2.2mm, colback=white!80!black, coltext=#4]{\raisebox{-0.1ex}{\vphantom{羅}\vphantom{j}#3}}}}, listing only, listing options={ language={#2}, basicstyle=\ttfamily, keywordstyle=\ttfamily\color{white}, stringstyle=\itshape\color{white}, commentstyle=\small\gtfamily\color{DeepSkyBlue2}, showspaces=false,showtabs=false, breaklines=true,breakindent=0pt, showstringspaces=false, columns=fullflexible, tabsize=2, numbers=left,numbersep=1.5pt, numberstyle=\scriptsize\gtfamily\color{gray}, } } \NewTColorBox{OutPut}{ m !o !O{DeepSkyBlue3} }{% enhanced, colframe=Snow4, toptitle=-1mm, bottomtitle=-1mm, righttitle=-1mm, lefttitle=-1mm, arc=.5mm, colback=white, title={\tcbox[on line, arc=.5mm, boxsep=0pt, boxrule=0pt, top=1mm, bottom=0.8mm, left=2mm, right=2.2mm, colback=gray!40, coltext=DeepSkyBlue3]{\raisebox{-0.1ex}{\vphantom{羅}\vphantom{j}#1}}},fonttitle=\gtfamily\footnotesize,boxrule=0.8pt, breakable,top=-0.5mm,bottom=-0.5mm, after title=\IfNoValueTF{#2}{}{{\hfill\tcbox[on line, arc=.5mm, boxsep=0pt, boxrule=0pt, top=1mm, bottom=0.8mm, left=2mm, right=2.2mm, colback=white!80!black, coltext=#3]{\raisebox{-0.1ex}{\vphantom{羅}\vphantom{j}#2}}}}, bottom=2mm, top=2mm, } \title{\texttt{luwa-ul} Package Documentation} \author{Kosei Kawaguchi a.k.a. KKTeX} \date{Version 1.0.1 (2025/10/26)} \begin{document} \begin{titlepage} \maketitle \end{titlepage} \newpage \tableofcontents \newpage \section{設置(Installation)} インストール方法は、適切な箇所に\texttt{luwa-ul.sty}を配置し、\verb|\usepackage{luwa-ul}|と書き込むだけで完了です。オプションはありません。 (Place \texttt{luwa-ul.sty} in a directory where LaTeX can find it.) 依存性についてです。(Dependencies: ) \begin{itemize} \item luacolor, xcolor \item lua-ul \item calc, tikz \end{itemize} \noindent を内部的に仕様しています。(This package uses them internally.) \section{注意(Caution)} このパッケージはその実装の上でLua言語を仕様しているので、LuaLaTeXの上でのみ仕様できるパッケージとなっています。(This package internally uses Lua, so it can be compiled only by LuaLaTeX.) \section{提供されるコマンド(Commands)} 提供されるコマンドは以下の通りです。要望に応じて追加されることもありえます。 (The provided commands are as follows. I would add some more commands upon requests.) \begin{itemize} \item \verb|\underLineKK|, \verb|\overLineKK| \item \verb|\nijyusen|, \verb|\keshinijyusen| \item \verb|\thinHighLight|, \verb|\thickHighLight| \item \verb|\stength|, \verb|\sdashgth|, \verb|\snamift| \item \verb|\LineNumbering| \end{itemize} \subsection{\textbackslash underLineKK} このコマンドは、\texttt{lua-ul}パッケージによって提供される\verb|\underLine|コマンドに対し、 \begin{itemize} \item 縦書き時のずれの解消 \item ルビがあった際の挙動の変化 \end{itemize} \noindent の2点において調整を施したものとなっています。 (This command is basically made out of \verb|\underLine| command, which is provided by \texttt{lua-ul} package. I added some adjustments on it in order to \begin{itemize} \item eliminate the misalignment in vertical writing mode. \item change its behavior when the argument includes phonetic guides. \end{itemize} ) 使い方は以下のようになります。(You can use it as follows: ) \begin{SourceCode}{TeX} \underLineKK[color=色, bottom=下線最下部の位置のずれ, heigth=下線の太さ(bottomの位置からの距離で計算)]{引数} \underLineKK[color=red]{あああああああああ} \underLineKK[bottom=.1em]{あああああああああ} \parbox[c][6cm][c]{3cm}{% \underLineKK{ああ\ruby{あ}{あ}あああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \underLineKK[color=red]{ああああ\footnote{あ}{ああああ}あああああ} \underLineKK[bottom=-.5em]{あああああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \underLineKK{ああ\ruby{あ}{あ}あああああ} \underLineKK{ああああああ} } \end{OutPut} \subsection{\textbackslash overLineKK} このコマンドは\verb|\underLineKK|を使用しても作成が可能ですが、ショートカットとして用意しておきました。このコマンドは縦書き環境においては通常の\verb|\underLineKK|につけてあったルビ補正を抜いてあります。(This command can also be created using \verb|\underLineKK|, but it has been provided as a shortcut. In a vertical writing environment, this command omits the ruby adjustment that was included in the standard \verb|\underLineKK|.) \begin{SourceCode}{TeX} \overLineKK[color=色]{引数} \overLineKK[color=red]{あああああああああ} \parbox[c][6cm][c]{3cm}{% \overLineKK{ああ\ruby{あ}{あ}あああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \overLineKK[color=red]{あああああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \overLineKK{ああ\ruby{あ}{あ}あああああ} } \end{OutPut} \subsection{\textbackslash nijyusen, \textbackslash keshinijyusen} これらのコマンドは\verb|\underLineKK|を入れ子にすることでも作成が可能ですが、\verb|keshinijyusen|に関してはルビの有無による補正をなくしてあります。(These commands can also be created by nesting \verb|\underLineKK|, but for \verb|keshinijyusen|, the adjustment for the presence or absence of ruby has been removed.) \begin{SourceCode}{TeX} \nijyusen[color=色, bottom=下線最下部の位置のずれ]{引数} \keshinijyusen[color=色]{引数} \nijyusen[color=red]{あああああああああ} \keshinijyusen{ああああああああ} \parbox[c][6cm][c]{3cm}{% \nijyusen[color=red]{ああ\ruby{あ}{あ}あああああ} \keshinijyusen{ああ\ruby{あ}{あ}あああああ} \nijyusen[color=red]{あああああああ} \keshinijyusen{あああああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \nijyusen[color=red]{あああああああああ} \keshinijyusen{ああああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \nijyusen[color=red]{ああ\ruby{あ}{あ}あああああ} \keshinijyusen{ああ\ruby{あ}{あ}あああああ} \nijyusen[color=red]{あああああああ} \keshinijyusen{あああああああ} } \end{OutPut} \subsection{\textbackslash thinHighLight, \textbackslash thickHighLight} これらは蛍光ペンを引いたような出力を提供するコマンドです。ルビの有無に対する挙動が\verb|\underLineKK|のそれとは少々異なり、単なる並行移動だけではなく線の太さ自体も追随して動くという仕様にしてあります。(These are commands that provide an output resembling a highlight made with a fluorescent marker. Their behavior regarding the presence or absence of ruby differs slightly from that of \verb|\underLineKK|, as they are designed not only to shift position but also to have the line thickness itself adjust accordingly.) \begin{SourceCode}{TeX} \thinHighLight[color=色]{引数} \thickHighLight[color=色]{引数} \thinHighLight{あああああああああ} \thickHighLight[color=green]{あああああああああ} \parbox[c][6cm][c]{3cm}{% \thinHighLight{あああ\ruby{あ}{あ}ああああ} \thickHighLight[color=green]{ああ\ruby{あ}{あ}あああああ} \thinHighLight{あああああああああ} \thickHighLight[color=green]{あああああああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \thinHighLight{あああああああああ} \thickHighLight[color=green]{あああああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \thinHighLight{あああ\ruby{あ}{あ}ああああ} \thickHighLight[color=green]{ああ\ruby{あ}{あ}あああああ} \thinHighLight{あああああああああ} \thickHighLight[color=green]{あああああああああ} } \end{OutPut} \subsection{\textbackslash snamift} このコマンドは波線を引くコマンドを提供します。ルビに対する挙動は\verb|\underLineKK|のそれに同じです。スターオプションありの時はフォントはそのまま、スターオプションありの場合にはゴシック体になります。(This command provides a wavy underline. Its behavior with respect to ruby is the same as that of \verb|\underLineKK|. When the star option is specified, the font remains unchanged; when the non-star version is used, the font is switched to a Gothic typeface.) \begin{SourceCode}{TeX} \snamift[bottom=下線最下部の位置のずれ]{引数} \snamift*[bottom=下線最下部の位置のずれ]{引数} \snamift*{あああああああああ} \snamift[bottom=.3em]{あああああああああ} \parbox[c][6cm][c]{3cm}{% \snamift*{あああ\ruby{あ}{あ}ああああ} \snamift[bottom=.3em]{あああああああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \snamift*{あああああああああ} \snamift[bottom=.5em]{あああああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \snamift*{あああ\ruby{あ}{あ}ああああ} \snamift[bottom=.3em]{あああああああああ} } \end{OutPut} \subsection{\textbackslash stength, \textbackslash sdashgth} これらはそれぞれ、点線、破線を提供します。ルビに対する挙動は\verb|\underLineKK|のそれに同じです。スターオプションありの時はフォントはそのまま、スターオプションありの場合にはゴシック体になります。(These commands provide dotted and dashed underlines, respectively. Their behavior toward ruby text is the same as that of \verb|\underLineKK|. When the starred option is used, the font remains unchanged; when the non-starred option is used, the text is typeset in a Gothic typeface.) \begin{SourceCode}{TeX} \stength[bottom=下線最下部の位置のずれ, radius=ドットの半径, distance=ドット間距離]{引数} % デフォルト:radius=.1ex, distance=.4ex \sdashgth[bottom=下線最下部の位置のずれ, width=破線の太さ, distance=破線間距離, length=破線の長さ]{引数} % デフォルト:width=.2pt, distance=.3ex, length=.4ex \stength*{あああああああああ} \stength[radius=.05ex, distance=.3ex]{あああああああああ} \sdashgth*{あああああああああ} \sdashgth[length=.01ex, distance=.1ex]{あああああああああ} \parbox[c][6cm][c]{3cm}{% \stength*{あああああ\ruby{あ}{あ}ああ} \stength[radius=.05ex, distance=.3ex]{あああああああああ} \sdashgth*{あああああ\ruby{あ}{あ}ああ} \sdashgth[length=.01ex, distance=.1ex]{あああああああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \stength*{あああああああああ} \stength[radius=.05ex, distance=.3ex]{あああああああああ} \sdashgth*{あああああああああ} \sdashgth[length=.01ex, distance=.1ex]{あああああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \stength*{あああああ\ruby{あ}{あ}ああ} \stength[radius=.05ex, distance=.3ex]{あああああああああ} \sdashgth*{あああああ\ruby{あ}{あ}ああ} \sdashgth[length=.01ex, distance=.1ex]{あああああああああ} } \end{OutPut} \subsection{\textbackslash LineNumbering} 下線に番号を振るためのコマンドです。これは私が作成した\texttt{KKsymbols}パッケージ(TeX Liveに収録済み)との併用をお勧めしています。スターオプションを付与すると、縦書きの時には引数の中身が回転します\footnote{横書きの時には出力に変化はありません。}。(This command assigns numbers to underlines. It is recommended to use it together with my \texttt{KKsymbols} package (already included in TeX Live). When the starred option is given, the contents of the argument are rotated in vertical writing\footnote{In horizontal writing, the output remains unchanged.}.) \begin{SourceCode}{TeX} \LineNumbering{\kakko{1}}\underLineKK{あああああああ} \parbox[c][6cm][c]{3cm}{% \LineNumbering{\kakko{1}}\underLineKK{あああああああ} \LineNumbering*{ア}\underLineKK{あああああああ} } \end{SourceCode} \begin{OutPut}{Output} 横書き: \LineNumbering{\kakko{1}}\underLineKK{あああああああ} 縦書き: \parbox[c][6cm][c]{3cm}{% \LineNumbering{\kakko{1}}\underLineKK{あああああああ} \LineNumbering*{ア}\underLineKK{あああああああ} } \end{OutPut} \section{ライセンス(License)} Released under the LaTeX Project Public License (LPPL) 1.3c. \section{Version History} \begin{itemize} \item \textbf{v1.0.1 (2025/10/26)} --- Initial public release. \end{itemize} \section{Source Code} \begin{lstlisting} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luwa-ul}[2025/10/26, Version 1.0.1] \RequirePackage{luacolor, lua-ul, calc, tikz} \RequirePackage[dvipsnames, svgnames, x11names]{xcolor} \definecolor{mygray@luwa-ul}{RGB}{60, 60, 60} \newlength{\underLine@KK@Adjust@tmp} \newlength{\KKUL@bottom} \newlength{\KKUL@height} \NewDocumentCommand{\underLine@KK@Adjust@bottom}{m}{% \setlength{\underLine@KK@Adjust@tmp}{\f@size pt}% \ifnum\ltjgetparameter{direction}=3% \def\underLine@KK@Adjust@use@bottom{\dimexpr -#1+\underLine@KK@Adjust@tmp/2\relax}% \else% \def\underLine@KK@Adjust@use@bottom{\dimexpr #1-\underLine@KK@Adjust@tmp/7\relax}% \fi } \NewDocumentCommand{\underLine@KK@Adjust@height}{m}{% \ifnum\ltjgetparameter{direction}=3% \def\underLine@KK@Adjust@use@height{#1}% \else% \def\underLine@KK@Adjust@use@height{#1}% \fi } \define@key{KKUL}{bottom}{% \underLine@KK@Adjust@bottom{#1}% \setlength{\KKUL@bottom}{\underLine@KK@Adjust@use@bottom}% } \define@key{KKUL}{height}{% \underLine@KK@Adjust@height{#1}% \setlength{\KKUL@height}{\underLine@KK@Adjust@use@height}% } \define@key{KKUL}{color}{% \def\KKUL@color{#1}% } % ルビが中に入っているときだけテキストを上昇させる \newlength{\KKUL@rubyraise} \directlua{ function RubyFlagKKUL(t) if string.find(t, "\\ruby") or string.find(t, "\\kenten") or string.find(t, "\\送り") or string.find(t, "\\振り") then tex.print("1") else tex.print("0") end end } \NewDocumentCommand{\underLineKK}{ O{} +m }{% % 初期化 \underLine@KK@Adjust@bottom{-.1em}% \underLine@KK@Adjust@height{0.3pt}% \setlength{\KKUL@bottom}{\underLine@KK@Adjust@use@bottom}% \setlength{\KKUL@height}{\underLine@KK@Adjust@use@height}% \def\KKUL@color{black}% \def\underLineKK@test@contents{#2}% \setkeys{KKUL}{#1}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\underLineKK@test@contents}}")}\relax}% % 縦書きの場合のみ傍線オフセット設定 \ifnum\ltjgetparameter{direction}=3% \ifnum\UL@rubyflag=1% \setlength{\KKUL@rubyraise}{.5em}% \else% \setlength{\KKUL@rubyraise}{0em}% \fi% \else% % 横書き時は補正なし \setlength{\KKUL@rubyraise}{0em}% \fi% % 実際の下線 \underLine[bottom=\KKUL@bottom+\KKUL@rubyraise, height=\KKUL@height, color=\KKUL@color]{#2}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %lua-ulで作ったsnamift%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newlength{\snamift@bottom}\setlength{\snamift@bottom}{0ex} \define@key{snamift}{bottom}{% \setlength{\snamift@bottom}{#1}% } \newcount\snamift@id % 呼び出しカウンタ \NewDocumentCommand{\snamift}{ s O{} +m }{% % 1:キーを先にセットして \snamift@bottom を更新 \setlength{\snamift@bottom}{0ex}% \def\snamift@test@contents{#3}% \setkeys{snamift}{#2}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\snamift@test@contents}}")}\relax}% % 縦書きの場合のみ傍線オフセット設定 \ifnum\ltjgetparameter{direction}=3% \ifnum\UL@rubyflag=1% \addtolength{\snamift@bottom}{.5em}% \fi% \fi% % 2:IDを進める \global\advance\snamift@id by 1\relax% % 3:ユニーク名で下線タイプを定義(正しく展開されるように \expandafter と \number を使用) \expandafter\newunderlinetype\csname beginUnderWavyS\number\snamift@id\endcsname{% \cleaders\hbox{% \begin{tikzpicture}[xscale=.8,baseline=\f@size/4 pt, x=\f@size/12 pt,y=\f@size/25 pt] \clip[yshift=\snamift@bottom] (1,\f@size/8 pt) rectangle (5,-\f@size/8 pt); \draw[line width=\f@size/24 pt,yshift=\snamift@bottom] (0,0) sin (1,1) cos (2,0) sin (3,-1) cos (4,0) sin (5,1) cos (6,0); \end{tikzpicture}% }% }% \expandafter\newunderlinetype\csname beginUnderWavyState\number\snamift@id\endcsname{% \cleaders\hbox{% \begin{tikzpicture}[xscale=.8,baseline=\f@size/4 pt, x=\f@size/12 pt,y=\f@size/25 pt] \begin{scope}[yshift=\f@size/1.2 pt] \clip[yshift=\snamift@bottom] (1,\f@size/8 pt) rectangle (5,-\f@size/8 pt); \draw[line width=\f@size/24 pt,yshift=\snamift@bottom] (0,0) sin (1,1) cos (2,0) sin (3,-1) cos (4,0) sin (5,1) cos (6,0); \end{scope} \end{tikzpicture}% }% }% % 4:使用(縦横の分岐。直接 csname を呼ぶ) \IfBooleanTF{#1}{{% \ifnum\ltjgetparameter{direction}=3 % \csname beginUnderWavyState\number\snamift@id\endcsname{#3}% \else% \csname beginUnderWavyS\number\snamift@id\endcsname{#3}% \fi% }}{{% \ifnum\ltjgetparameter{direction}=3 % \csname beginUnderWavyState\number\snamift@id\endcsname{\textgt{#3}}% \else% \csname beginUnderWavyS\number\snamift@id\endcsname{\textgt{#3}}% \fi% }}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %lua-ulで作ったstength,stendash%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newlength{\stength@radius} \newlength{\stength@distance} \newlength{\stength@bottom} \define@key{stength}{radius}{\setlength{\stength@radius}{#1}} \define@key{stength}{distance}{\setlength{\stength@distance}{#1}} \define@key{stength}{bottom}{\setlength{\stength@bottom}{#1}} \newcount\stength@id \NewDocumentCommand{\stength}{ s O{} +m }{% \setlength{\stength@radius}{.1ex}% \setlength{\stength@distance}{.4ex}% \setlength{\stength@bottom}{0ex}% \def\stength@test@contents{#3}% \setkeys{stength}{#2}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\stength@test@contents}}")}\relax}% \ifnum\ltjgetparameter{direction}=3 \ifnum\UL@rubyflag=1 \addtolength{\stength@bottom}{.5em}% \fi \fi% \global\advance\stength@id by 1\relax% \expandafter\newunderlinetype\csname beginUnderDot\number\stength@id\endcsname{% \xleaders\hbox{% \begin{tikzpicture}[x=0.8ex,y=.2ex,baseline=.7ex]% \fill[mygray@luwa-ul,yshift=\stength@bottom] (0.3,0) circle (\stength@radius); \path[use as bounding box,yshift=\stength@bottom] (0,0) rectangle (\stength@distance,0);%.8 \end{tikzpicture}% }% }% \expandafter\newunderlinetype\csname beginUnderDottate\number\stength@id\endcsname{% \xleaders\hbox{% \begin{tikzpicture}[x=0.8ex,y=.2ex,baseline=.7ex]% \begin{scope}[yshift=\f@size/1.2 pt] \fill[mygray@luwa-ul,yshift=\stength@bottom] (0.3,0) circle (\stength@radius); \path[use as bounding box,yshift=\stength@bottom] (0,0) rectangle (\stength@distance,0); \end{scope} \end{tikzpicture}% }% }% \IfBooleanTF{#1}{{% \ifnum\ltjgetparameter{direction}=3 % \csname beginUnderDottate\number\stength@id\endcsname{#3}% \else% \csname beginUnderDot\number\stength@id\endcsname{#3}% \fi% }}{{% \ifnum\ltjgetparameter{direction}=3 % \csname beginUnderDottate\number\stength@id\endcsname{\textgt{#3}}% \else% \csname beginUnderDot\number\stength@id\endcsname{\textgt{#3}}% \fi% }}% } \newlength{\underdash@length} \newlength{\underdash@distance} \newlength{\underdash@width} \newlength{\underdash@bottom} \define@key{underdashgth}{length}{\setlength{\underdash@length}{#1}} \define@key{underdashgth}{distance}{\setlength{\underdash@distance}{#1}} \define@key{underdashgth}{width}{\setlength{\underdash@width}{#1}} \define@key{underdashgth}{bottom}{\setlength{\underdash@bottom}{#1}} \newcount\underdash@id \NewDocumentCommand{\sdashgth}{ s O{} +m }{% \setlength{\underdash@length}{.4ex}% \setlength{\underdash@distance}{.3ex}% \setlength{\underdash@width}{.2pt}% \setlength{\underdash@bottom}{0ex}% \def\sdashgth@test@contents{#3}% \setkeys{underdashgth}{#2}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\sdashgth@test@contents}}")}\relax}% \ifnum\ltjgetparameter{direction}=3 \ifnum\UL@rubyflag=1 \addtolength{\underdash@bottom}{.5em}% \fi \fi% \global\advance\underdash@id by 1\relax% \expandafter\newunderlinetype\csname beginUnderDash\number\underdash@id\endcsname{% \xleaders\hbox{% \begin{tikzpicture}[x=0.8ex,y=.2ex,baseline=.7ex]% \draw[black,line width=\underdash@width,xshift=.25ex,yshift=\underdash@bottom] (0,0) -- (\underdash@length,0);% \path[use as bounding box,yshift=\underdash@bottom] (0,0) rectangle (\underdash@length+\underdash@distance,0);% \end{tikzpicture}% }% }% \expandafter\newunderlinetype\csname beginUnderDashtate\number\underdash@id\endcsname{% \xleaders\hbox{% \begin{tikzpicture}[x=0.8ex,y=.2ex,baseline=.7ex]% \begin{scope}[yshift=\f@size/1.2 pt]% \draw[black,line width=\underdash@width,xshift=.1ex,yshift=\underdash@bottom] (0,0) -- (\underdash@length,0);% \path[use as bounding box,yshift=\underdash@bottom] (0,0) rectangle (\underdash@length+\underdash@distance,0);% \end{scope}% \end{tikzpicture}% }% }% % \IfBooleanTF{#1}{{% \ifnum\ltjgetparameter{direction}=3 % \csname beginUnderDashtate\number\underdash@id\endcsname{#3}% \else% \csname beginUnderDash\number\underdash@id\endcsname{#3}% \fi% }}{{% \ifnum\ltjgetparameter{direction}=3 % \csname beginUnderDashtate\number\underdash@id\endcsname{\textgt{#3}}% \else% \csname beginUnderDash\number\underdash@id\endcsname{\textgt{#3}}% \fi% }}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %overLine%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \define@key{overLine}{color}{% \def\overLineKK@color{#1}% } \newlength{\overLineKK@KK@Adjust} \NewDocumentCommand{\overLineKK}{ O{} +m }{% \setlength{\overLineKK@KK@Adjust}{\f@size pt}% \def\overLineKK@color{black}% \def\overLineKK@test@contents{#2}% \setkeys{overLine}{#1}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\overLineKK@test@contents}}")}\relax}% \ifnum\ltjgetparameter{direction}=3% \ifnum\UL@rubyflag=1% \addtolength{\overLineKK@KK@Adjust}{.6em}% \else% \addtolength{\overLineKK@KK@Adjust}{.1em}% \fi% \else% \ifnum\UL@rubyflag=1% \addtolength{\overLineKK@KK@Adjust}{.6em}% \else% \addtolength{\overLineKK@KK@Adjust}{.1em}% \fi% \fi% \underLineKK[bottom=\overLineKK@KK@Adjust,color=\overLineKK@color]{#2}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %グレーの蛍光ペン(細くて下の方だけ塗るやつ)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newlength{\thinHighLight@KK@Adjust} \newlength{\thinHighLight@KK@Adjust@ruby} \newlength{\thinHighLight@KK@Adjust@ruby@yoko} \newcommand{\thinHighLight@KK@Adjust@tmp}{% \ifnum\ltjgetparameter{direction}=3% \setlength{\thinHighLight@KK@Adjust}{-.3\zw}% \else% \setlength{\thinHighLight@KK@Adjust}{0ex}% \fi } \DeclareDocumentCommand{\thinHighLight}{ O{color=gray} +m }{% \thinHighLight@KK@Adjust@tmp% \def\thinHighLight@test@contents{#2}% \setlength{\thinHighLight@KK@Adjust@ruby}{0em}% \setlength{\thinHighLight@KK@Adjust@ruby@yoko}{0em}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\thinHighLight@test@contents}}")}\relax}% \ifnum\ltjgetparameter{direction}=3 \ifnum\UL@rubyflag=1 \setlength{\thinHighLight@KK@Adjust@ruby}{-.5em}% \fi \fi \underLineKK[#1,height=.25\underLine@KK@Adjust@tmp-\thinHighLight@KK@Adjust@ruby,bottom=-.04\underLine@KK@Adjust@tmp+\thinHighLight@KK@Adjust+\thinHighLight@KK@Adjust@ruby]{#2}% } \newlength{\thickHighLight@KK@Adjust} \newlength{\thickHighLight@KK@Adjust@ruby} \newlength{\thickHighLight@KK@Adjust@ruby@yoko} \newcommand{\thickHighLight@KK@Adjust@tmp}{% \ifnum\ltjgetparameter{direction}=3% \setlength{\thickHighLight@KK@Adjust}{-1.1\zw}% \else% \setlength{\thickHighLight@KK@Adjust}{0ex}% \fi } \DeclareDocumentCommand{\thickHighLight}{ O{color=gray} +m }{% \thickHighLight@KK@Adjust@tmp% \def\thickHighLight@test@contents{#2}% \setlength{\thickHighLight@KK@Adjust@ruby}{0em}% \setlength{\thickHighLight@KK@Adjust@ruby@yoko}{0em}% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\thickHighLight@test@contents}}")}\relax}% \ifnum\ltjgetparameter{direction}=3 \ifnum\UL@rubyflag=1 \setlength{\thickHighLight@KK@Adjust@ruby}{-.5em}% \fi \else \ifnum\UL@rubyflag=1 \setlength{\thickHighLight@KK@Adjust@ruby}{-.5em}% \setlength{\thickHighLight@KK@Adjust@ruby@yoko}{.5em}% \fi \fi \underLineKK[#1,height=1.15\underLine@KK@Adjust@tmp-\thickHighLight@KK@Adjust@ruby,bottom=-.04\underLine@KK@Adjust@tmp+\thickHighLight@KK@Adjust+\thickHighLight@KK@Adjust@ruby+\thickHighLight@KK@Adjust@ruby@yoko]{#2}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %二重線%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newlength{\nijyusen@bottom} \newlength{\nijyusen@bottom@adjust} \define@key{nijyusen}{color}{\def\nijyusen@KK@color{#1}} \define@key{nijyusen}{bottom}{\setlength{\nijyusen@bottom}{#1}} \NewDocumentCommand\nijyusen{ O{} +m }{% \def\nijyusen@KK@color{black}% \setlength{\nijyusen@bottom}{0ex}% \setkeys{nijyusen}{#1}% \ifnum\ltjgetparameter{direction}=3% \setlength{\nijyusen@bottom@adjust}{-\nijyusen@bottom}% \else% \setlength{\nijyusen@bottom@adjust}{\nijyusen@bottom}% \fi% \underLineKK[bottom=-.1\underLine@KK@Adjust@tmp+\nijyusen@bottom,color=\nijyusen@KK@color]{\underLineKK[bottom=\nijyusen@bottom@adjust,color=\nijyusen@KK@color]{#2}}% } \newlength{\keshinijyuusen@KK@Adjust} \newcommand{\keshinijyuusen@KK@Adjust@tmp}{% \ifnum\ltjgetparameter{direction}=3% \setlength{\keshinijyuusen@KK@Adjust}{0ex}% \else% \setlength{\keshinijyuusen@KK@Adjust}{.15ex}% \fi } \define@key{keshinijyusen}{color}{\def\keshinijyusen@KK@color{#1}} \NewDocumentCommand\keshinijyusen{ O{} +m }{% \def\keshinijyusen@KK@color{color=black}% \def\keshinijyusen@test@contents{#2}% \setkeys{keshinijyusen}{#1}% \keshinijyuusen@KK@Adjust@tmp% \edef\UL@rubyflag{\numexpr\directlua{RubyFlagKKUL("\luaescapestring{\unexpanded\expandafter{\keshinijyusen@test@contents}}")}\relax}% % 縦書きの場合のみ傍線オフセット設定 \ifnum\ltjgetparameter{direction}=3 \ifnum\UL@rubyflag=1 \addtolength{\keshinijyuusen@KK@Adjust}{.5em}% \fi \fi \underLineKK[bottom=.57\underLine@KK@Adjust@tmp-\keshinijyuusen@KK@Adjust,#1]{\underLineKK[bottom=.47\underLine@KK@Adjust@tmp-\keshinijyuusen@KK@Adjust,#1]{#2}} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %下線の前に番号を振る%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\linenumbering@luwa}[1]{\raisebox{-1ex}{\scalebox{.6}{#1}}} \newdimen\overtline@f@size \NewDocumentCommand{\tlinenumbering@luwa}{s m}{% \setlength{\overtline@f@size}{\f@size pt}% \raisebox{.6\overtline@f@size}{\IfBooleanTF{#1}{\tikz[baseline=(char.base)]{\node[inner sep=0pt, anchor=center, scale=.6] (char) {#2};}}{\tikz[baseline=(char.base)]{\node[inner sep=0pt, anchor=center, scale=.6, rotate=90] (char) {#2};}% }}\hskip.15ex} \NewDocumentCommand{\LineNumbering}{ s m O{0ex} }{% 縦横両対応 \ifnum\ltjgetparameter{direction}=3% \IfBooleanTF{#1}{\raisebox{#3}{\tlinenumbering@luwa*{#2}}}{\raisebox{#3}{\tlinenumbering@luwa{#2}}}% \else \raisebox{#3}{\linenumbering@luwa{#2}}% \fi } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \endinput \end{lstlisting} \end{document}