-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvodnote.sty
More file actions
102 lines (91 loc) · 3.71 KB
/
vodnote.sty
File metadata and controls
102 lines (91 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{vodnote}[2018/06/29, VoD]
\RequirePackage{tikz,zref,zref-savepos}
\RequirePackage[nomessages]{fp}
\ifdefined\inv@mag\else
\FPdiv\inv@mag{1000}{\the\mag}
\fi
%%%ユーザーが指定できるパラメーター
\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 の定義
\newcommand{\notefill}{\par\bgroup
\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}
\VDNT@currentYPos\z@
\fill[white!70!black] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos+\inv@mag*4pt) -- ++(\inv@mag*3pt,-\inv@mag*4pt) -- ++(-\inv@mag*6pt,0) -- cycle;
\@whiledim\VDNT@currentYPos<\VDNT@notegoal\do{%
\VDNT@currentXPos\z@
\draw[white!70!black,line width=\noteLineWidth] (0,\VDNT@currentYPos) -- (\linewidth,\VDNT@currentYPos);
\foreach \k in{0,1,...,\VDNT@dotsNum}{%
\VDNT@currentXPos=\dimexpr\VDNT@Xinterval*\k\relax
\fill[white!70!black] (\VDNT@currentXPos,\VDNT@currentYPos) circle [radius=\dotsRadius];
}
\advance\VDNT@currentYPos\VDNT@Yinterval\relax
}
\fill[white!70!black] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos-\VDNT@Yinterval-\inv@mag*4pt) -- ++(\inv@mag*3pt,\inv@mag*4pt) -- ++(-\inv@mag*6pt,0) -- cycle;
\end{tikzpicture}%
}%
\egroup
%%座標管理用カウンタのインクリメント
\global\advance\VDNT@uniqe\@ne
\par
}
%%% \note の定義
\newcommand{\note}[1]{\par\bgroup
%%罫線間隔の算出
\@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}
\VDNT@currentYPos\z@
\fill[white!70!black] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos+\VDNT@Yinterval+\inv@mag*4pt) -- ++(\inv@mag*3pt,-\inv@mag*4pt) -- ++(-\inv@mag*6pt,0) -- cycle;
\foreach \i in{1,2,...,#1}{
\VDNT@currentXPos\z@
\global\VDNT@currentYPos=\dimexpr\VDNT@Yinterval*\i\relax
\draw[white!70!black,line width=\noteLineWidth] (0,\VDNT@currentYPos) -- (\linewidth,\VDNT@currentYPos);
\foreach \k in{0,1,...,\VDNT@dotsNum}{
\VDNT@currentXPos=\dimexpr\VDNT@Xinterval*\k\relax
\fill[white!70!black] (\VDNT@currentXPos,\VDNT@currentYPos) circle [radius=\dotsRadius];
}
}
\fill[white!70!black] (\VDNT@Xinterval*\VDNT@dotsNum/2,\VDNT@currentYPos-\inv@mag*4pt) -- ++(\inv@mag*3pt,\inv@mag*4pt) -- ++(-\inv@mag*6pt,0) -- cycle;
\end{tikzpicture}%
\egroup
\par
}