review-retrovert 0.3.3 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/retrovert.yml +39 -0
  3. data/.gitignore +2 -2
  4. data/.ruby-version +1 -0
  5. data/Gemfile +1 -0
  6. data/Gemfile.lock +67 -1
  7. data/README.md +6 -3
  8. data/lib/review/retrovert/converter.rb +231 -6
  9. data/lib/review/retrovert/version.rb +1 -1
  10. data/review-retrovert.gemspec +1 -1
  11. data/testdata/mybook/.gitignore +7 -0
  12. data/testdata/mybook/README.md +43 -0
  13. data/testdata/mybook/Rakefile +16 -0
  14. data/testdata/mybook/catalog.yml +33 -0
  15. data/testdata/mybook/config-starter.yml +139 -0
  16. data/testdata/mybook/config.yml +375 -0
  17. data/testdata/mybook/contents/00-preface.re +83 -0
  18. data/testdata/mybook/contents/01-install.re +272 -0
  19. data/testdata/mybook/contents/02-tutorial.re +1008 -0
  20. data/testdata/mybook/contents/03-syntax.re +2613 -0
  21. data/testdata/mybook/contents/04-customize.re +728 -0
  22. data/testdata/mybook/contents/05-faq.re +328 -0
  23. data/testdata/mybook/contents/06-bestpractice.re +971 -0
  24. data/testdata/mybook/contents/91-compare.re +18 -0
  25. data/testdata/mybook/contents/92-filelist.re +119 -0
  26. data/testdata/mybook/contents/93-background.re +267 -0
  27. data/testdata/mybook/contents/99-postface.re +38 -0
  28. data/testdata/mybook/css/normalize.css +349 -0
  29. data/testdata/mybook/css/webstyle.css +514 -0
  30. data/testdata/mybook/images/03-syntax/favicon-16x16.png +0 -0
  31. data/testdata/mybook/images/03-syntax/figure_heretop.png +0 -0
  32. data/testdata/mybook/images/03-syntax/tw-icon1.jpg +0 -0
  33. data/testdata/mybook/images/03-syntax/tw-icon2.jpg +0 -0
  34. data/testdata/mybook/images/03-syntax/tw-icon3.jpg +0 -0
  35. data/testdata/mybook/images/03-syntax/tw-icon4.jpg +0 -0
  36. data/testdata/mybook/images/04-customize/caption_pagebreak.png +0 -0
  37. data/testdata/mybook/images/04-customize/chaptitlepage_sample.png +0 -0
  38. data/testdata/mybook/images/05-faq/codeblock_rpadding1.png +0 -0
  39. data/testdata/mybook/images/05-faq/codeblock_rpadding2.png +0 -0
  40. data/testdata/mybook/images/06-bestpractice/figure_heretop.png +0 -0
  41. data/testdata/mybook/images/06-bestpractice/font_beramono.png +0 -0
  42. data/testdata/mybook/images/06-bestpractice/heading_design1.png +0 -0
  43. data/testdata/mybook/images/06-bestpractice/heading_design2.png +0 -0
  44. data/testdata/mybook/images/06-bestpractice/margin_book.png +0 -0
  45. data/testdata/mybook/images/06-bestpractice/multiline-title.png +0 -0
  46. data/testdata/mybook/images/06-bestpractice/preface_numbered.png +0 -0
  47. data/testdata/mybook/images/06-bestpractice/program_border.png +0 -0
  48. data/testdata/mybook/images/06-bestpractice/sechead_design_4.png +0 -0
  49. data/testdata/mybook/images/06-bestpractice/titlepage-samples.png +0 -0
  50. data/testdata/mybook/images/93-background/bug913.png +0 -0
  51. data/testdata/mybook/images/93-background/slide2.png +0 -0
  52. data/testdata/mybook/images/cover_a5.pdf +0 -0
  53. data/testdata/mybook/images/cover_b5.pdf +0 -0
  54. data/testdata/mybook/images/tw-icon.jpg +0 -0
  55. data/testdata/mybook/layouts/layout.epub.erb +29 -0
  56. data/testdata/mybook/layouts/layout.html5.erb +106 -0
  57. data/testdata/mybook/layouts/layout.tex.erb +546 -0
  58. data/testdata/mybook/lib/hooks/beforetexcompile.rb +55 -0
  59. data/testdata/mybook/lib/ruby/review-builder.rb +503 -0
  60. data/testdata/mybook/lib/ruby/review-cli.rb +58 -0
  61. data/testdata/mybook/lib/ruby/review-compiler.rb +523 -0
  62. data/testdata/mybook/lib/ruby/review-epubmaker.rb +606 -0
  63. data/testdata/mybook/lib/ruby/review-htmlbuilder.rb +661 -0
  64. data/testdata/mybook/lib/ruby/review-latexbuilder.rb +782 -0
  65. data/testdata/mybook/lib/ruby/review-maker.rb +235 -0
  66. data/testdata/mybook/lib/ruby/review-monkeypatch.rb +91 -0
  67. data/testdata/mybook/lib/ruby/review-pdfmaker.rb +468 -0
  68. data/testdata/mybook/lib/ruby/review-textbuilder.rb +36 -0
  69. data/testdata/mybook/lib/ruby/review-tocparser.rb +285 -0
  70. data/testdata/mybook/lib/ruby/review-webmaker.rb +433 -0
  71. data/testdata/mybook/lib/tasks/mytasks.rake +31 -0
  72. data/testdata/mybook/lib/tasks/review.rake +142 -0
  73. data/testdata/mybook/lib/tasks/review.rake.orig +72 -0
  74. data/testdata/mybook/lib/tasks/starter.rake +326 -0
  75. data/testdata/mybook/locale.yml +6 -0
  76. data/testdata/mybook/review-ext.rb +206 -0
  77. data/testdata/mybook/sty/jumoline.sty +310 -0
  78. data/testdata/mybook/sty/mycolophon.sty +81 -0
  79. data/testdata/mybook/sty/mystyle.sty +8 -0
  80. data/testdata/mybook/sty/mytextsize.sty +61 -0
  81. data/testdata/mybook/sty/mytitlepage.sty +103 -0
  82. data/testdata/mybook/sty/reviewmacro.sty +60 -0
  83. data/testdata/mybook/sty/starter-codeblock.sty +332 -0
  84. data/testdata/mybook/sty/starter-color.sty +79 -0
  85. data/testdata/mybook/sty/starter-font.sty +112 -0
  86. data/testdata/mybook/sty/starter-heading.sty +514 -0
  87. data/testdata/mybook/sty/starter-note.sty +127 -0
  88. data/testdata/mybook/sty/starter-section.sty +262 -0
  89. data/testdata/mybook/sty/starter-toc.sty +72 -0
  90. data/testdata/mybook/sty/starter.sty +554 -0
  91. data/testdata/mybook/style.css +597 -0
  92. metadata +100 -3
@@ -0,0 +1,127 @@
1
+ %%% -*- coding: utf-8 -*-
2
+
3
+ %%%
4
+ %%% ノート(//note)のブロックコマンド
5
+ %%%
6
+
7
+
8
+ %%% ノート
9
+ \newenvironment{starternote}[2][]{%
10
+ \addvspace{\bigskipamount}% % \bigskipと違い、直前の余白の高さも考慮してくれる
11
+ \@starter@notetrue%
12
+ \begin{starter@note}[#1]{#2}%
13
+ }{%
14
+ \end{starter@note}%
15
+ \@starter@notefalse%
16
+ \medskip%
17
+ \addvspace{\bigskipamount}%
18
+ }
19
+ %%% ノート内かどうか?
20
+ \newif\if@starter@note
21
+ \@starter@notefalse
22
+ %%% itemize環境やenumerate環境で使われる\listコマンドを保存
23
+ \let\original@list=\list
24
+ %%% ノートブロック
25
+ \newenvironment{starter@note}[2][]{%
26
+ %% ノートの左右に余白を空ける
27
+ \advance\rightskip\starter@note@sidemargin%
28
+ \advance\leftskip\starter@note@sidemargin%
29
+ %% プログラムやターミナルや引用の左右に余白を空ける
30
+ \setlength{\starter@codeblock@sidemargin}{\starter@note@sidemargin}%
31
+ \setlength{\starter@quote@sidemargin}{\starter@note@sidemargin}%
32
+ %% プログラムやターミナルの前後の余白を少し小さくする
33
+ \renewcommand{\starter@codeblock@vspace}{\addvspace{\smallskipamount}}%
34
+ %% 箇条書きの左右のスペースを調整
35
+ \def\list##1##2{%
36
+ \ifnum\@listdepth=0%
37
+ \advance\linewidth-\starter@note@sidemargin% % 右側の余白分だけ行を短く
38
+ \advance\linewidth-2zw% % インデント分だけ行を短く
39
+ \advance\@totalleftmargin 2zw% % 左側のインデント
40
+ \fi%
41
+ \original@list{##1}{##2}%
42
+ }%
43
+ %
44
+ \needvspace{2.5\Cvs}% % 2.5行分のスペースがなければ改行
45
+ \starter@note@font% % 文字を小さく、フォントをゴシック体に
46
+ %
47
+ \noindent\starter@note@line% % 点線
48
+ \smallskip%
49
+ \ifempty{#1}\else% % ノートに参照用ラベルがあれば
50
+ \phantomsection% % hyperref用
51
+ \hypertarget{#1}{}% % hyperref用
52
+ \label{#1}%
53
+ \fi%
54
+ \ifempty{#2}\else% % ノートにタイトルがあれば
55
+ \par\noindent%
56
+ \starter@note@title{#2}% % ノートのタイトルを表示
57
+ \smallskip%
58
+ \fi%
59
+ \par%
60
+ %
61
+ }{%
62
+ \vspace{-\lastskip}% % ノートの最後がプログラムやターミナルのときの空きを削除
63
+ \vspace{-0.2\baselineskip}% % 空きを少し減らす
64
+ \noindent\starter@note@line% % 点線
65
+ \par%
66
+ }
67
+ %%% ノートの左右のマージン幅
68
+ \newlength{\starter@note@sidemargin}
69
+ \setlength{\starter@note@sidemargin}{3\Cwd} % 左右に全角3文字分ずつ
70
+ %%% ノートの上下に入る点線
71
+ \newcommand{\starter@note@line}[1][-0.3zw]{{%
72
+ \rmfamily% % 点線の点を丸くする(ゴシック体だと四角になる)
73
+ \bfseries\large % 点線の点を少し太くする
74
+ %% 横幅いっぱいの点線を \dotfill で引く
75
+ %% (\dotfill だけだと左右に少しすき間ができてしまうので、
76
+ %% それを埋めるために左右を少し伸ばしている)
77
+ \textcolor{starter@notecolor}{%
78
+ \hspace{#1}\dotfill\hspace{#1}\mbox{}%
79
+ }%
80
+ }}
81
+ %%% ノートのフォント
82
+ \newcommand{\starter@note@font}{%
83
+ \gtfamily\sffamily % ゴシック体
84
+ \small % フォントを小さめに
85
+ }
86
+ %%% ノートのタイトル
87
+ \newcommand{\starter@note@title}[1]{{%
88
+ \gtfamily\sffamily\bfseries % 太字のゴシック体
89
+ \normalsize % 文字を通常の大きさにする(\smallにしない)
90
+ #1 % タイトルを表示
91
+ }}
92
+ %%% ノートタイトルの接頭辞をカスタマイズする
93
+ %\renewcommand{\starter@note@title}[1]{{%
94
+ % \gtfamily\sffamily\bfseries\normalsize ■ノート:#1
95
+ %}}
96
+
97
+
98
+ %%% @<noteref>{lable} でノートを参照する
99
+ \newcommand{\starternoteref}[2]{%
100
+ ノート「\hyperlink{#1}{#2}」(p.\pageref{#1})%
101
+ }
102
+
103
+
104
+
105
+ %%%
106
+ %%% ノート以外のブロック
107
+ %%%
108
+ \newenvironment{starter@miniblock}[1]{%
109
+ \addvspace{1.0\baselineskip}% 1行分空ける
110
+ \begin{oframed}% % 枠線で囲む
111
+ \ifempty{#1}\else% % 引数があれば
112
+ \noindent% % 字下げせずに
113
+ {\headfont #1}% % 太字のゴシック体で表示
114
+ \par\smallskip% % 縦方向に少しスペースを空ける
115
+ \fi%
116
+ }{%
117
+ \end{oframed}% % 枠線による囲みの終わり
118
+ \addvspace{1.0\baselineskip}% 1行分空ける
119
+ }
120
+
121
+ \newenvironment{startermemo}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
122
+ \newenvironment{startertip}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
123
+ \newenvironment{starterinfo}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
124
+ \newenvironment{starterwarning}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
125
+ \newenvironment{starterimportant}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
126
+ \newenvironment{startercaution}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
127
+ \newenvironment{starternotice}[1]{\begin{starter@miniblock}{#1}}{\end{starter@miniblock}}
@@ -0,0 +1,262 @@
1
+ %%% -*- coding: utf-8 -*-
2
+
3
+ %%% 章 (Chapter) の番号とタイトルと上下の余白を表示する
4
+ %\def\@makechapterhead#1{% (jsbook.clsでのオリジナル定義)
5
+ % \vspace*{2\Cvs}% 欧文は50pt
6
+ % {\parindent \z@ \raggedright \normalfont
7
+ % \ifnum \c@secnumdepth >\m@ne
8
+ % \if@mainmatter
9
+ % \huge\headfont \@chapapp\thechapter\@chappos
10
+ % \par\nobreak
11
+ % \vskip \Cvs % 欧文は20pt
12
+ % \fi
13
+ % \fi
14
+ % \interlinepenalty\@M
15
+ % \Huge \headfont #1\par\nobreak
16
+ % \vskip 3\Cvs}} % 欧文は40pt
17
+ %
18
+ \renewcommand{\@makechapterhead}[1]{%
19
+ \vspace*{-3zw}% % 章タイトル上部の余白を詰める
20
+ \starter@chapterhead{#1}% % 章タイトルを組み立てる
21
+ \addvspace{2\baselineskip}% % 章タイトルのあとに2行空ける
22
+ }
23
+ %%% 装飾する・しないを判断して、章の番号とタイトルを表示(上下の余白は除く)
24
+ \newcommand{\starter@chapterhead}[1]{%
25
+ {% % フォント変更などの影響範囲を限定する。
26
+ \setlength{\parindent}{0pt}% % 段落の最初のインデントをなしに。
27
+ \starter@chapterhead@align% % 左寄せ/右寄せ/中央揃え
28
+ \ifnum \c@secnumdepth >\m@ne%
29
+ \if@mainmatter% % まえがきや目次ではないなら
30
+ \starter@chapterhead@decorated{\thechapter}{#1}% 装飾つきで表示
31
+ \else% % まえがきや目次なら
32
+ \starter@chapterhead@plain{#1}% % 装飾なしで表示
33
+ \fi%
34
+ \else%
35
+ \starter@chapterhead@plain{#1}% % 装飾なしで表示
36
+ \fi%
37
+ \par% % 段落を改める
38
+ }%
39
+ }
40
+ \newcommand{\starter@chapterhead@align}{%
41
+ \edef\@align{\starter@chapter@align}% % left, right, or center
42
+ \ifstreq{\@align}{left}%
43
+ \raggedright% % 左寄せ
44
+ \else\ifstreq{\@align}{right}%
45
+ \raggedleft% % 右寄せ
46
+ \else\ifstreq{\@align}{center}%
47
+ \centering% % 中央寄せ
48
+ \fi%
49
+ }
50
+ %%% 装飾つきで章番号とタイトルを表示
51
+ \ifstreq{\starter@chapter@decoration}{underline}
52
+ \newcommand{\starter@chapterhead@decorated}[2]{% % #1: 章番号、#2: 章タイトル
53
+ \starter@chaphead{#1}{#2}% % 章番号と章タイトルを出力
54
+ \par\vspace{0pt}% % 余白
55
+ \textcolor{starter@chaptercolor}{\rule{\textwidth}{0.2pt}}% 章タイトルに細い下線
56
+ }
57
+ \else\ifstreq{\starter@chapter@decoration}{boldlines}
58
+ \newcommand{\starter@chapterhead@decorated}[2]{% % #1: 章番号、#2: 章タイトル
59
+ \textcolor{starter@chaptercolor}{\rule{\textwidth}{0.9zw}}% 章タイトル上部に太い横線
60
+ \par\vspace{1.7zw}% % 余白
61
+ \starter@chaphead{#1}{#2}% % 章番号と章タイトルを出力
62
+ \par\vspace{1.5zw}% % 余白
63
+ \textcolor{starter@chaptercolor}{\rule{\textwidth}{0.9zw}}% 章タイトル下部に太い横線
64
+ }
65
+ \else
66
+ \newcommand{\starter@chapterhead@decorated}[2]{% % #1: 章番号、#2: 章タイトル
67
+ \starter@chaphead{#1}{#2}% % 章番号と章タイトルを出力
68
+ }
69
+ \fi
70
+ %%% 装飾なしで章番号とタイトルを表示(まえがきや目次用)
71
+ \newcommand{\starter@chapterhead@plain}[1]{% % #1: 章タイトル
72
+ \starter@chaphead{}{#1}% % 章タイトルだけを出力
73
+ \ifstreq{\starter@chapter@decoration}{underline}%
74
+ \par\vspace{0pt}% % 余白
75
+ \textcolor{starter@chaptercolor}{\rule{\textwidth}{0.2pt}}% 章タイトルに細い下線
76
+ \fi%
77
+ }
78
+ %%% 章番号と章タイトルを表示
79
+ \newcommand{\starter@chaphead}[2]{% % #1: 章番号、#2: 章タイトル
80
+ \ifempty{#1}\else%
81
+ \starter@chaphead@number{#1}% % 章番号
82
+ \starter@chaphead@spacer% % 余白
83
+ \fi%
84
+ \starter@chaphead@title{#2}% % 章タイトル
85
+ }
86
+ %%% 章番号を表示
87
+ \newcommand{\starter@chaphead@number}[1]{% % #1: 章番号
88
+ %{\huge\headfont \@chapapp #1\@chappos}% % jsbook.clsのデフォルト
89
+ {\headfont\LARGE\@chapapp{\HUGE #1}\@chappos}% 番号を大きくして出力
90
+ }
91
+ %%% 章タイトルを表示
92
+ \newcommand{\starter@chaphead@title}[1]{% % #1: 章タイトル
93
+ {\Huge\headfont #1}% % 大きいサイズ、ゴシック体で出力
94
+ }
95
+ %%% 章番号と章タイトルの間のスペース
96
+ \newcommand{\starter@chaphead@spacer}{%
97
+ \ifx\starter@chapter@oneline\empty% % 章番号とタイトルで2行のとき
98
+ \par\vspace{1.5zw}% % 縦方向に余白を空ける
99
+ \else% % 章番号とタイトルで1行のとき
100
+ \hspace{1zw}% % 横方向に1文字空ける
101
+ \fi%
102
+ }
103
+
104
+
105
+
106
+ %%% 節 (Section) タイトルの上下のスペースを調整(jsbook.clsからコピーして変更)
107
+ \renewcommand{\section}{%
108
+ \edef\@newpage{\starter@section@newpage}% % Yなら節ごとに改ページする、空ならしない
109
+ \def\@beforeSkip{1.3\Cvs \@plus.5\Cdp \@minus.2\Cdp}% % 節タイトル直前の空白
110
+ \def\@afterSkip{0.9\Cvs \@plus.3\Cdp}% % 節タイトル直後の空白
111
+ \ifx\@newpage\empty\else% % 節ごとに改ページするときは
112
+ \def\@beforeSkip{0pt}% % 節タイトル直前の空白をゼロにする
113
+ \ifnum\value{section}>0% % 章の最初の節でなければ
114
+ \clearpage% % 改ページする
115
+ \fi%
116
+ \fi%
117
+ %% 節タイトルを開始
118
+ \@startsection{section}{1}{\z@}%
119
+ {\@beforeSkip}% % 前アキ
120
+ {\@afterSkip}% % 後アキ
121
+ {%
122
+ %% 節ごとに改ページする場合
123
+ \ifx\@newpage\empty\else% % 節ごとに改ページするときは
124
+ \ifnum\value{section}=1% % 章の最初の節なら
125
+ \vskip 0.5\Cvs \@plus.5\Cdp \@minus.2\Cdp\relax% スペースを空ける
126
+ \fi%
127
+ \fi%
128
+ %% 節タイトルの表示設定
129
+ \normalfont\Large\headfont\raggedright%
130
+ }%
131
+ }
132
+ %%% 節 (Section) 番号の表示をカスタマイズ
133
+ \let\original@seccntformat=\@seccntformat
134
+ \renewcommand\@seccntformat[1]{%
135
+ \@ifundefined{starter@#1@formatnumber}%
136
+ {\original@seccntformat{#1}}%
137
+ {\csname starter@#1@formatnumber\endcsname}%
138
+ }
139
+ %%% 節タイトルに下線を引く
140
+ \ifstreq{\starter@section@decoration}{underline}
141
+ \newcommand{\starter@section@formatnumber}{%
142
+ \textcolor{starter@sectioncolor}{% % 色を変える
143
+ \rule[-0.35zw]{\textwidth}{0.2pt}% % 横幅いっぱいの細い下線
144
+ \hspace{-\textwidth}% % もとの位置に戻る
145
+ \rule[-0.35zw]{0.7zw}{1.7zw}% % 行頭に縦長の「■」を追加
146
+ }%
147
+ \hspace{0.7zw}% % 節番号のまえにスペースを少し空ける
148
+ \thesection% % 節番号
149
+ \hspace{1.0zw}% % 節番号のあとに全角1文字分のスペース
150
+ }
151
+ \fi
152
+ %%% 節番号を白抜き、節タイトル背景を薄いグレーにする
153
+ \ifstreq{\starter@section@decoration}{grayback}
154
+ \newcommand{\starter@section@formatnumber}{%
155
+ \starter@section@background{starter@palecolor}{\textwidth}% % 幅いっぱいに灰色背景
156
+ \starter@section@background{starter@deepcolor}{3.5zw}% % 3.5文字分の黒色背景
157
+ \makebox[3.5zw][c]{\textcolor{white}{\thesection}}% % 白文字で節番号
158
+ \hspace{0.7zw}% % タイトル前のスペース
159
+ }
160
+ \fi
161
+ \newcommand{\starter@section@background}[2]{%
162
+ \makebox[0pt][l]{% % 幅をゼロ扱いにする
163
+ \textcolor{#1}{\rule[-0.6zw]{#2}{2zw}}% % 指定幅の背景を描く
164
+ }%
165
+ }
166
+ %%% 節タイトルの左側に縦線を引く(タイトルが二行になっても表示が崩れない)
167
+ \ifstreq{\starter@section@decoration}{leftline}
168
+ \newcommand{\starter@section@formatnumber}{%
169
+ \starter@section@background{starter@deepcolor}{0.5zw}% % 0.5文字幅の線
170
+ \hspace{1.1zw}\thesection\hspace{0.8zw}% % 節番号
171
+ }
172
+ \fi
173
+ %%% 節番号を黒い背景で白抜きにする(タイトルが二行になっても表示が崩れない)
174
+ \ifstreq{\starter@section@decoration}{numbox}
175
+ \newcommand{\starter@section@formatnumber}{%
176
+ \starter@section@background{starter@deepcolor}{3.2zw}% % 3.2文字分の黒色背景
177
+ \makebox[3.2zw][c]{\textcolor{white}{\thesection}}% % 白文字で節番号
178
+ \hspace{0.9zw}% % タイトル前のスペース
179
+ }
180
+ \fi
181
+
182
+
183
+
184
+ %%% 項 (Subsection) のデザインを変更(jsbook.clsからコピーして変更)
185
+ \renewcommand{\subsection}{%
186
+ \edef\@decoration{\starter@subsection@decoration}% % 'none' or 'symbol'
187
+ \@startsection{subsection}{2}{\z@}%
188
+ %{\Cvs \@plus.5\Cdp \@minus.2\Cdp}% % 前アキ(オリジナル)
189
+ %{.5\Cvs \@plus.3\Cdp}% % 後アキ(オリジナル)
190
+ {.7\Cvs \@plus.5\Cdp \@minus.2\Cdp}% % 前アキ(少し狭める)
191
+ {.3\Cvs \@plus.3\Cdp}% % 後アキ(少し狭める)
192
+ {%
193
+ \normalfont\large\headfont% % フォントを本文より少し大きめに
194
+ \def\@tempa{symbol}%
195
+ \ifx\@decoration\@tempa%
196
+ \textcolor{starter@subsectioncolor}{\startersubsectionsymbol}% 頭にクローバー
197
+ \fi%
198
+ }%
199
+ }
200
+ \newcommand{\starter@subsection@symbol}{$\clubsuit$}% クローバー
201
+ \ifstreq{\starter@subsection@decoration}{symbol}
202
+ \newcommand{\startersubsectionsymbol}{\starter@subsection@symbol{} }
203
+ \else
204
+ \newcommand{\startersubsectionsymbol}{}
205
+ \fi
206
+
207
+
208
+ %%% ページ先頭なら節や項のタイトル前にスペースを入れない
209
+ \ifx\starter@section@notopmargin\empty\else
210
+ %% ハック:スライドモードをonにするとページ先頭でのスペースが入らない
211
+ \let\original@startsection=\@startsection % コマンドを保存
212
+ \def\@startsection#1#2#3#4#5#6{% % コマンドを上書き
213
+ \@slidetrue% % スライドモードをonにする
214
+ \original@startsection{#1}{#2}{#3}{#4}{#5}{#6}% 元のコマンドを実行
215
+ }
216
+ %% \@startsection の最後で実行されるマクロ(その1)を上書き
217
+ \let\original@sect=\@sect % コマンドを保存
218
+ \def\@sect#1#2#3#4#5#6[#7]#8{% % コマンドを上書き
219
+ \@slidefalse% % スライドモードをoffに戻す
220
+ \original@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}% % 元のコマンドを実行
221
+ }
222
+ %% \@startsection の最後で実行されるマクロ(その2)を上書き
223
+ \let\original@ssect=\@ssect % コマンドを保存
224
+ \def\@ssect#1#2#3#4#5{% % コマンドを上書き
225
+ \@slidefalse% % スライドモードをoffに戻す
226
+ \original@ssect{#1}{#2}{#3}{#4}{#5}% % 元のコマンドを実行
227
+ }
228
+ \fi
229
+
230
+
231
+
232
+ %%% LaTeXのデフォルトでは、ページ最下部の段落が最初の1行だけになるのを嫌う。
233
+ %%% そのため、節(Section)のタイトル直後が1行だけで改ページされるくらいなら
234
+ %%% 節タイトルの直前で改ページすることをLaTeXは選ぶ。
235
+ %%% このせいで、十分な空きがあるのに節タイトル前で改ページされることがある。
236
+ %%% これを避けるには、config-starter.ymlで「page_clubline: true」を設定する。
237
+ \ifempty{\starter@page@clubline}\else
238
+ %% jsbook.styからコピーして変更
239
+ \def\@afterheading{%
240
+ \@nobreaktrue
241
+ \everypar{%
242
+ \if@nobreak
243
+ \@nobreakfalse
244
+ %\clubpenalty \@M % original: \@Mは100万
245
+ \clubpenalty \z@ % modified: \z@は0
246
+ \if@afterindent \else
247
+ {\setbox\z@\lastbox}%
248
+ \fi
249
+ \else
250
+ \clubpenalty \@clubpenalty
251
+ \everypar{\everyparhook}%
252
+ \fi\everyparhook}}
253
+ \fi
254
+
255
+
256
+ %%% 「//paragraphend」ブロック命令用
257
+ \newcommand\ParagraphEnd{%
258
+ \vspace{0.5\Cvs}%
259
+ }
260
+ \newcommand\SubparagraphEnd{%
261
+ \vspace{0.0\Cvs}%
262
+ }
@@ -0,0 +1,72 @@
1
+ %%% -*- coding: utf-8 -*-
2
+
3
+ %%%
4
+ %%% 目次
5
+ %%%
6
+
7
+
8
+ %%% 目次の上余白を狭める(jsbook.clsからコピー)
9
+ \renewcommand{\tableofcontents}{%
10
+ \settowidth\jsc@tocl@width{\headfont\prechaptername\postchaptername}%
11
+ \settowidth\@tempdima{\headfont\appendixname}%
12
+ \ifdim\jsc@tocl@width<\@tempdima \setlength\jsc@tocl@width{\@tempdima}\fi
13
+ \ifdim\jsc@tocl@width<2zw \divide\jsc@tocl@width by 2 \advance\jsc@tocl@width 1zw\fi
14
+ \if@twocolumn
15
+ \@restonecoltrue\onecolumn
16
+ \else
17
+ \@restonecolfalse
18
+ \fi
19
+ %
20
+ %\chapter*{\contentsname}%
21
+ %% 章も目次も右起こしにする or しない
22
+ \if@openleft\cleardoublepage\else
23
+ \if@openright\cleardoublepage\else\clearpage\fi\fi
24
+ %% 章が右起こしでも、目次は右起こしにしない
25
+ %\clearpage
26
+ %
27
+ \plainifnotempty
28
+ \@ifundefined{Chapter}{% % starter-section.sty を使っているとき
29
+ \@makechapterhead{\contentsname}%
30
+ }{% % starter-heading.sty を使っているとき
31
+ \Chapter*[]{\contentsname}%
32
+ }%
33
+ %
34
+ \@mkboth{\contentsname}{}%
35
+ \@starttoc{toc}%
36
+ \if@restonecol\twocolumn\fi
37
+ }
38
+
39
+ %%% 目次のページ番号にもリンクをつける
40
+ %\@ifundefined{@hyperref}{}{%
41
+ % \let\original@contentsline=\contentsline
42
+ % \renewcommand{\contentsline}[4]{%
43
+ % \original@contentsline{#1}{#2}{\hyperlink{#4}{#3}}{#4}
44
+ % }
45
+ %}
46
+
47
+ %%% 目次での章 (Chapter) 直後での改ページを防ぐ
48
+ \let\original@l@chapter=\l@chapter % もとの定義を保存
49
+ \renewcommand*{\l@chapter}[2]{{%
50
+ \needvspace{2.5zw}% % スペースがなければ改ページ
51
+ \original@l@chapter{#1}{#2}% % もとの定義を呼び出す
52
+ }}
53
+
54
+ %%% 目次での節 (Section) をゴシック体に変更
55
+ \let\original@l@section=\l@section % もとの定義を保存
56
+ \renewcommand*{\l@section}[2]{{%
57
+ \original@l@section{\gtfamily\sffamily #1}{#2}% % ゴシック体に変更
58
+ }}
59
+
60
+ %%% 目次での項 (Subsection) を少し小さくして行間を狭める
61
+ \let\original@l@subsection=\l@subsection % もとの定義を保存
62
+ \renewcommand*{\l@subsection}[2]{{%
63
+ \baselineskip=0.90\baselineskip% % 行間を狭める
64
+ \original@l@subsection{\hspace{2zw}\small #1}{\small #2}% 少し小さく、2文字分字下げ
65
+ }}
66
+
67
+ %%% 目次での目 (Subsubsection) を小さくして行間を狭める
68
+ \let\original@l@subsubsection=\l@subsubsection % もとの定義を保存
69
+ \renewcommand*{\l@subsubsection}[2]{{%
70
+ \baselineskip=0.85\baselineskip% % 行間を狭める
71
+ \original@l@subsection{\footnotesize #1}{\footnotesize #2}% フォントを小さく
72
+ }}