\documentclass[a4paper,12pt]{article} \usepackage[dvipsnames, svgnames, x11names]{xcolor} \usepackage{tikz} \usetikzlibrary{shapes, positioning, shadows, shadows.blur, patterns, decorations.text, decorations.pathmorphing, arrows.meta, calc, snakes, intersections} \usepackage{xparse, calc, ifthen} \usepackage{fp} \usepackage{zref-savepos} \usepackage{geometry} \usepackage{hyperref} \usepackage{lipsum} \usepackage[most]{tcolorbox} \usepackage{keisennote} \usepackage{listings} \lstset{ basicstyle=\ttfamily\small, keywordstyle=\color{blue}, commentstyle=\color{gray}, stringstyle=\color{red}, breaklines=true, breakatwhitespace=false, % 空白なしでも改行する columns=flexible % 幅に応じて文字幅を調整 } \usepackage{hyperref} %必ずラストに設定 \hypersetup{ luatex, pdfencoding=auto, colorlinks=true, linkcolor=black, % \ref などの色 citecolor=black, % \cite の色 urlcolor=DeepSkyBlue3, % URL の色 pdfborder={0 0 0}, % 「幅 水平オフセット 垂直オフセット」をすべてゼロに } \title{\texttt{keisennote} Package Documentation} \author{KKTeX} \date{Version 1.0.3 (2025/09/17)} \begin{document} \begin{titlepage} \maketitle \end{titlepage} \newpage \tableofcontents \newpage \section{Acknowledgements / Credit} This package is based on the code from \href{https://qiita.com/VoD/items/6849e63b978050218d2f}{VoD's Qiita article}, with some improvements. The original author has kindly granted permission to release this as a LaTeX package. \section{Installation} Place \texttt{keisennote.sty} in a directory where LaTeX can find it, e.g., your local \texttt{texmf} tree or alongside your document. Dependencies: \begin{itemize} \item \texttt{xcolor} \item \texttt{tikz} \item \texttt{xparse}, \texttt{calc}, \texttt{ifthen} \item \texttt{fp} \item \texttt{zref-savepos} \item \texttt{luatex85}, \texttt{url}, \texttt{expl3}, \texttt{xkeyval} \end{itemize} Load the package: \begin{verbatim} \usepackage{keisennote} \end{verbatim} \section{Commands} \subsection{\texttt{\textbackslash notefill}} \begin{verbatim} \notefill[][] \end{verbatim} Fills the current vertical space with ruled notebook lines and dots. \begin{itemize} \item \texttt{} (optional, default: 0.5pt): size of triangular end markers. \item \texttt{} (optional, default: white!70!black): color of lines and dots. \end{itemize} \textbf{Example:} \begin{verbatim} \notefill[0.6pt][Gray] \end{verbatim} \subsection{\texttt{\textbackslash note}} \begin{verbatim} \note{}[][] \end{verbatim} Typesets a short ruled block with a specified number of lines. \begin{itemize} \item \texttt{} (mandatory, integer $\ge$ 2): number of ruled lines. \item \texttt{} (optional, default: 0.5pt): size of triangular markers. \item \texttt{} (optional, default: white!70!black): color of lines and dots. \end{itemize} \textbf{Example:} \begin{verbatim} \note{5}[0.4pt][NavyBlue] \end{verbatim} This produces the following output.\bigskip \note{5}[0.4pt][NavyBlue] \bigskip Inserting \verb|\bigskip| before (and after) using the \verb|\note| command can sometimes improve the appearance. \subsection{\texttt{\textbackslash masumefill}} \begin{verbatim} \masume[][] \end{verbatim} Fills the current vertical space with grids and dots. \begin{itemize} \item \texttt{} (optional, default: 0.5pt): size of triangular end markers. \item \texttt{} (optional, default: white!70!black): color of lines and dots. \end{itemize} \textbf{Example:} \begin{verbatim} \notefill[0.6pt][Gray] \end{verbatim} \subsection{\texttt{\textbackslash masume}} \begin{verbatim} \masume{}[][] \end{verbatim} Typesets a short grid block with a specified number of lines. \begin{itemize} \item \texttt{} (mandatory, integer $\ge$ 2): number of ruled lines. \item \texttt{} (optional, default: 0.5pt): size of triangular markers. \item \texttt{} (optional, default: white!70!black): color of lines and dots. \end{itemize} \textbf{Example:} \begin{verbatim} \masume{5}[0.4pt][NavyBlue] \end{verbatim} This produces the following output.\bigskip \masume{5}[0.4pt][NavyBlue] \bigskip Inserting \verb|\bigskip| before (and after) using the \verb|\masume| command can sometimes improve the appearance. \section{Package Parameters} These dimensions can be adjusted: \begin{itemize} \item \texttt{\textbackslash noteLineWidth}: thickness of ruled lines (default: 0.5pt) \item \texttt{\textbackslash dotsRadius}: radius of intersection dots (default: 0.8pt) \item \texttt{\textbackslash noteLineDistance}: vertical distance between lines (default: 6mm) \end{itemize} Example: \begin{verbatim} \setlength{\noteLineDistance}{7truemm} % A-kei spacing \end{verbatim} \section{Examples} \subsection{Short Note Block} \begin{verbatim} \note{4} \end{verbatim} \note{4} \subsection{Full Page Fill} \begin{verbatim} \notefill \end{verbatim} \notefill \newpage\section{Implementation Notes} \begin{itemize} \item Notebook lines are drawn using TikZ, with dots placed at equal horizontal intervals. \item The number of dots per line is automatically calculated using the \texttt{fp} package. \item Triangular markers are added at the top and bottom of each ruled block. \item \texttt{\textbackslash notefill} measures available vertical space using \texttt{zref-savepos}. \end{itemize} \section{License} Released under the \href{https://www.latex-project.org/lppl/}{LaTeX Project Public License (LPPL) 1.3c}. \section{Version History} \begin{itemize} \item \textbf{v1.0.0 (2025/09/13)} --- Initial public release. \item \textbf{v1.0.3 (2025/09/13)} --- KKTeX added \texttt{\textbackslash masume} and \texttt{\textbackslash masumefill}. \end{itemize} \section{Source Code} \begin{lstlisting} \ProvidesPackage{keisennote}[2025/09/17, v1.0.3] \RequirePackage[dvipsnames, svgnames, x11names]{xcolor} \RequirePackage{luatex85, zref, zref-savepos, fp, url, expl3, xkeyval} \RequirePackage{tikz}\RequirePackage{graphicx} \usetikzlibrary{shapes, positioning, shadows, shadows.blur, patterns, decorations.text, decorations.pathmorphing, arrows.meta, calc, snakes, intersections} \RequirePackage{xparse, calc, ifthen} \newdimen\VoD@mag \VoD@mag=.5pt \newdimen\noteLineWidth \newdimen\dotsRadius \newdimen\noteLineDistance \noteLineWidth.5truept\relax% <- 罫線の太さ \dotsRadius.8truept\relax% <- ドットの半径 \noteLineDistance=6truemm\relax% <- 罫線間隔(A罫 : 7truemm,B罫 : 6truemm) %%%必要な内部レジスタの用意 \newdimen\VDNT@currentXPos \newdimen\VDNT@currentYPos \newdimen\VDNT@Xinterval \newdimen\VDNT@Yinterval \newdimen\VDNT@notegoal %%% \notefillで用いる座標管理用カウンタの準備 \def\VDNT@pkgname{vodnote} \global\newcount\VDNT@uniqe %%% \notefill の定義 \NewDocumentCommand{\notefill}{ O{.5pt} O{white!70!black} }{\par\bgroup \VoD@mag=#1 \parindent\z@ %%罫線間隔の算出 \@tempcnta\linewidth \@tempcntb\noteLineDistance \FPeval\VDNT@dotsNum{round(round(((\the)\@tempcnta/(\the)\@tempcntb)/2:0)*2:0)}% \VDNT@Xinterval\dimexpr(\linewidth)/\VDNT@dotsNum\relax \VDNT@Yinterval\VDNT@Xinterval %%上端の座標取得 \zsaveposy{\VDNT@pkgname.\the\VDNT@uniqe.TopPos}% %%下端の座標取得 \leavevmode\vfill\leavevmode \zsaveposy{\VDNT@pkgname.\the\VDNT@uniqe.BottomPos}% %%ノート罫線描画幅の決定 \VDNT@notegoal=\dimexpr \zposy{\VDNT@pkgname.\the\VDNT@uniqe.TopPos}sp -\zposy{\VDNT@pkgname.\the\VDNT@uniqe.BottomPos}sp \relax %%ノート罫線描画 \noindent\smash{% \begin{tikzpicture}[xscale=0.996] \VDNT@currentYPos\z@ \fill[#2] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos+\VoD@mag*4pt) -- ++(\VoD@mag*3pt,-\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; \@whiledim\VDNT@currentYPos<\VDNT@notegoal\do{ \VDNT@currentXPos\z@ \draw[#2,line width=\noteLineWidth] (0,\VDNT@currentYPos) -- (\linewidth,\VDNT@currentYPos); \foreach \k in{0,1,...,\VDNT@dotsNum}{% \VDNT@currentXPos=\dimexpr\VDNT@Xinterval*\k\relax \fill[#2] (\VDNT@currentXPos,\VDNT@currentYPos) circle [radius=\dotsRadius]; } \advance\VDNT@currentYPos\VDNT@Yinterval\relax } \fill[#2] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos-\VDNT@Yinterval-\VoD@mag*4pt) -- ++(\VoD@mag*3pt,\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; \end{tikzpicture}% }% \egroup %%座標管理用カウンタのインクリメント \global\advance\VDNT@uniqe\@ne \par } %%% \note の定義(2以上の整数を引数に) \NewDocumentCommand{\note}{ m O{.5pt} O{white!70!black} }{\par\bgroup %%三角形の大きさ \VoD@mag=#2 %%罫線間隔の算出 \@tempcnta\linewidth \@tempcntb\noteLineDistance \FPeval\VDNT@dotsNum{round(round(((\the)\@tempcnta/(\the)\@tempcntb)/2:0)*2:0)}% \VDNT@Xinterval\dimexpr\linewidth/\VDNT@dotsNum\relax \VDNT@Yinterval\VDNT@Xinterval %%ノート罫線描画 \noindent \begin{tikzpicture}[xscale=0.996] \VDNT@currentYPos\z@ \fill[#3] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos+\VDNT@Yinterval+\VoD@mag*4pt) -- ++(\VoD@mag*3pt,-\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; %上の三角形 \foreach \i in{1,2,...,#1}{ \VDNT@currentXPos\z@ \global\VDNT@currentYPos=\dimexpr\VDNT@Yinterval*\i\relax \draw[#3,line width=\noteLineWidth] (0,\VDNT@currentYPos) -- (\linewidth,\VDNT@currentYPos); \foreach \k in{0,1,...,\VDNT@dotsNum}{ \VDNT@currentXPos=\dimexpr\VDNT@Xinterval*\k\relax \fill[#3] (\VDNT@currentXPos,\VDNT@currentYPos) circle [radius=\dotsRadius]; } } \fill[#3] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos-\VoD@mag*4pt) -- ++(\VoD@mag*3pt,\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; %下の三角形 \end{tikzpicture}% \egroup \par } \NewDocumentCommand{\masumefill}{ O{.5pt} O{white!70!black} }{\par\bgroup \VoD@mag=#1 \parindent\z@ %%罫線間隔の算出 \@tempcnta\linewidth \@tempcntb\noteLineDistance \FPeval\VDNT@dotsNum{round(round(((\the)\@tempcnta/(\the)\@tempcntb)/2:0)*2:0)}% \VDNT@Xinterval\dimexpr(\linewidth)/\VDNT@dotsNum\relax \VDNT@Yinterval\VDNT@Xinterval %%上端の座標取得 \zsaveposy{\VDNT@pkgname.\the\VDNT@uniqe.TopPos}% %%下端の座標取得 \leavevmode\vfill\leavevmode \zsaveposy{\VDNT@pkgname.\the\VDNT@uniqe.BottomPos}% %%ノート罫線描画幅の決定 \VDNT@notegoal=\dimexpr \zposy{\VDNT@pkgname.\the\VDNT@uniqe.TopPos}sp -\zposy{\VDNT@pkgname.\the\VDNT@uniqe.BottomPos}sp \relax %%ノート罫線描画 \noindent\smash{% \begin{tikzpicture}[xscale=0.996] \VDNT@currentYPos\z@ \fill[#2] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos+\VoD@mag*4pt) -- ++(\VoD@mag*3pt,-\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; \@whiledim\VDNT@currentYPos<\VDNT@notegoal\do{ \VDNT@currentXPos\z@ \draw[#2,line width=\noteLineWidth] (0,\VDNT@currentYPos) -- (\linewidth,\VDNT@currentYPos); \foreach \k in{0,1,...,\VDNT@dotsNum}{% \VDNT@currentXPos=\dimexpr\VDNT@Xinterval*\k\relax \draw[#2,line width=\noteLineWidth] (\VDNT@currentXPos,0) -- (\VDNT@currentXPos,\VDNT@notegoal-.5\VDNT@Yinterval); \fill[#2] (\VDNT@currentXPos,\VDNT@currentYPos) circle [radius=\dotsRadius]; } \advance\VDNT@currentYPos\VDNT@Yinterval\relax } \fill[#2] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos-\VDNT@Yinterval-\VoD@mag*4pt) -- ++(\VoD@mag*3pt,\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; \end{tikzpicture}% }% \egroup %%座標管理用カウンタのインクリメント \global\advance\VDNT@uniqe\@ne \par } \NewDocumentCommand{\masume}{ m O{.5pt} O{white!70!black} }{\par\bgroup %%三角形の大きさ \VoD@mag=#2 %%罫線間隔の算出 \@tempcnta\linewidth \@tempcntb\noteLineDistance \FPeval\VDNT@dotsNum{round(round(((\the)\@tempcnta/(\the)\@tempcntb)/2:0)*2:0)}% \VDNT@Xinterval\dimexpr\linewidth/\VDNT@dotsNum\relax \VDNT@Yinterval\VDNT@Xinterval %%ノート罫線描画 \noindent \begin{tikzpicture}[xscale=0.996] \VDNT@currentYPos\z@ \fill[#3] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos+\VDNT@Yinterval+\VoD@mag*4pt) -- ++(\VoD@mag*3pt,-\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; %上の三角形 \foreach \i in{1,2,...,#1}{ \VDNT@currentXPos\z@ \global\VDNT@currentYPos=\dimexpr\VDNT@Yinterval*\i\relax \draw[#3,line width=\noteLineWidth] (0,\VDNT@currentYPos) -- (\linewidth,\VDNT@currentYPos); \foreach \k in{0,1,...,\VDNT@dotsNum}{ \VDNT@currentXPos=\dimexpr\VDNT@Xinterval*\k\relax \draw[#3,line width=\noteLineWidth] (\VDNT@currentXPos,\VDNT@Yinterval) -- (\VDNT@currentXPos,\VDNT@Yinterval*#1); \fill[#3] (\VDNT@currentXPos,\VDNT@currentYPos) circle [radius=\dotsRadius]; } } \fill[#3] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos-\VoD@mag*4pt) -- ++(\VoD@mag*3pt,\VoD@mag*4pt) -- ++(-\VoD@mag*6pt,0) -- cycle; %下の三角形 \end{tikzpicture}% \egroup \par } \endinput \end{lstlisting} \end{document}