review-retrovert 0.3.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/retrovert.yml +61 -0
  3. data/.gitignore +2 -2
  4. data/.ruby-version +1 -0
  5. data/Dockerfile +1 -1
  6. data/Gemfile +1 -0
  7. data/Gemfile.lock +82 -17
  8. data/README.md +6 -3
  9. data/lib/review/retrovert/cli.rb +4 -0
  10. data/lib/review/retrovert/converter.rb +375 -9
  11. data/lib/review/retrovert/version.rb +1 -1
  12. data/lib/review/retrovert/yamlconfig.rb +13 -1
  13. data/review-retrovert.gemspec +2 -2
  14. data/testdata/mybook/.gitignore +7 -0
  15. data/testdata/mybook/README.md +43 -0
  16. data/testdata/mybook/Rakefile +16 -0
  17. data/testdata/mybook/catalog.yml +33 -0
  18. data/testdata/mybook/config-starter.yml +139 -0
  19. data/testdata/mybook/config.yml +375 -0
  20. data/testdata/mybook/contents/00-preface.re +83 -0
  21. data/testdata/mybook/contents/01-install.re +272 -0
  22. data/testdata/mybook/contents/02-tutorial.re +1008 -0
  23. data/testdata/mybook/contents/03-syntax.re +2613 -0
  24. data/testdata/mybook/contents/04-customize.re +728 -0
  25. data/testdata/mybook/contents/05-faq.re +328 -0
  26. data/testdata/mybook/contents/06-bestpractice.re +971 -0
  27. data/testdata/mybook/contents/91-compare.re +18 -0
  28. data/testdata/mybook/contents/92-filelist.re +119 -0
  29. data/testdata/mybook/contents/93-background.re +267 -0
  30. data/testdata/mybook/contents/99-postface.re +38 -0
  31. data/testdata/mybook/css/normalize.css +349 -0
  32. data/testdata/mybook/css/webstyle.css +514 -0
  33. data/testdata/mybook/images/03-syntax/favicon-16x16.png +0 -0
  34. data/testdata/mybook/images/03-syntax/figure_heretop.png +0 -0
  35. data/testdata/mybook/images/03-syntax/tw-icon1.jpg +0 -0
  36. data/testdata/mybook/images/03-syntax/tw-icon2.jpg +0 -0
  37. data/testdata/mybook/images/03-syntax/tw-icon3.jpg +0 -0
  38. data/testdata/mybook/images/03-syntax/tw-icon4.jpg +0 -0
  39. data/testdata/mybook/images/04-customize/caption_pagebreak.png +0 -0
  40. data/testdata/mybook/images/04-customize/chaptitlepage_sample.png +0 -0
  41. data/testdata/mybook/images/05-faq/codeblock_rpadding1.png +0 -0
  42. data/testdata/mybook/images/05-faq/codeblock_rpadding2.png +0 -0
  43. data/testdata/mybook/images/06-bestpractice/figure_heretop.png +0 -0
  44. data/testdata/mybook/images/06-bestpractice/font_beramono.png +0 -0
  45. data/testdata/mybook/images/06-bestpractice/heading_design1.png +0 -0
  46. data/testdata/mybook/images/06-bestpractice/heading_design2.png +0 -0
  47. data/testdata/mybook/images/06-bestpractice/margin_book.png +0 -0
  48. data/testdata/mybook/images/06-bestpractice/multiline-title.png +0 -0
  49. data/testdata/mybook/images/06-bestpractice/preface_numbered.png +0 -0
  50. data/testdata/mybook/images/06-bestpractice/program_border.png +0 -0
  51. data/testdata/mybook/images/06-bestpractice/sechead_design_4.png +0 -0
  52. data/testdata/mybook/images/06-bestpractice/titlepage-samples.png +0 -0
  53. data/testdata/mybook/images/93-background/bug913.png +0 -0
  54. data/testdata/mybook/images/93-background/slide2.png +0 -0
  55. data/testdata/mybook/images/cover_a5.pdf +0 -0
  56. data/testdata/mybook/images/cover_b5.pdf +0 -0
  57. data/testdata/mybook/images/tw-icon.jpg +0 -0
  58. data/testdata/mybook/layouts/layout.epub.erb +29 -0
  59. data/testdata/mybook/layouts/layout.html5.erb +106 -0
  60. data/testdata/mybook/layouts/layout.tex.erb +546 -0
  61. data/testdata/mybook/lib/hooks/beforetexcompile.rb +55 -0
  62. data/testdata/mybook/lib/ruby/review-builder.rb +503 -0
  63. data/testdata/mybook/lib/ruby/review-cli.rb +58 -0
  64. data/testdata/mybook/lib/ruby/review-compiler.rb +523 -0
  65. data/testdata/mybook/lib/ruby/review-epubmaker.rb +606 -0
  66. data/testdata/mybook/lib/ruby/review-htmlbuilder.rb +661 -0
  67. data/testdata/mybook/lib/ruby/review-latexbuilder.rb +782 -0
  68. data/testdata/mybook/lib/ruby/review-maker.rb +235 -0
  69. data/testdata/mybook/lib/ruby/review-monkeypatch.rb +91 -0
  70. data/testdata/mybook/lib/ruby/review-pdfmaker.rb +468 -0
  71. data/testdata/mybook/lib/ruby/review-textbuilder.rb +36 -0
  72. data/testdata/mybook/lib/ruby/review-tocparser.rb +285 -0
  73. data/testdata/mybook/lib/ruby/review-webmaker.rb +433 -0
  74. data/testdata/mybook/lib/tasks/mytasks.rake +31 -0
  75. data/testdata/mybook/lib/tasks/review.rake +142 -0
  76. data/testdata/mybook/lib/tasks/review.rake.orig +72 -0
  77. data/testdata/mybook/lib/tasks/starter.rake +326 -0
  78. data/testdata/mybook/locale.yml +6 -0
  79. data/testdata/mybook/review-ext.rb +206 -0
  80. data/testdata/mybook/sty/jumoline.sty +310 -0
  81. data/testdata/mybook/sty/mycolophon.sty +81 -0
  82. data/testdata/mybook/sty/mystyle.sty +8 -0
  83. data/testdata/mybook/sty/mytextsize.sty +61 -0
  84. data/testdata/mybook/sty/mytitlepage.sty +103 -0
  85. data/testdata/mybook/sty/reviewmacro.sty +60 -0
  86. data/testdata/mybook/sty/starter-codeblock.sty +332 -0
  87. data/testdata/mybook/sty/starter-color.sty +79 -0
  88. data/testdata/mybook/sty/starter-font.sty +112 -0
  89. data/testdata/mybook/sty/starter-heading.sty +514 -0
  90. data/testdata/mybook/sty/starter-note.sty +127 -0
  91. data/testdata/mybook/sty/starter-section.sty +262 -0
  92. data/testdata/mybook/sty/starter-toc.sty +72 -0
  93. data/testdata/mybook/sty/starter.sty +554 -0
  94. data/testdata/mybook/style.css +597 -0
  95. metadata +100 -10
  96. data/.travis.yml +0 -6
@@ -0,0 +1,79 @@
1
+ %%% -*- coding: utf-8 -*-
2
+
3
+ %%%
4
+ %%% 色の設定
5
+ %%%
6
+
7
+
8
+ %%% config-starter.ymlの「target:」によって、カラーにするか決める
9
+ \iffalse
10
+ \else\ifstreq{\starter@target}{pbook} % pbook (printing book) なら
11
+ \def\starter@colormode{mono} % 白黒
12
+ \else\ifstreq{\starter@target}{ebook} % ebook (electric book) なら
13
+ \def\starter@colormode{rgb} % カラー (RGB)
14
+ %\def\starter@colormode{cmyk} % カラー (CMYK)
15
+ \else\ifstreq{\starter@target}{tablet} % tablet なら
16
+ \def\starter@colormode{rgb} % カラー (RGB)
17
+ %\def\starter@colormode{cmyk} % カラー (CMYK)
18
+ \else % それら以外なら
19
+ \def\starter@colormode{mono} % 白黒
20
+ \fi
21
+
22
+
23
+ %%% 白黒 (白黒印刷用、0.0が黒で1.0が白)
24
+ \ifstreq{\starter@colormode}{mono}
25
+ \definecolor{starter@deepcolor}{gray}{0.1} % dark gray
26
+ \definecolor{starter@palecolor}{gray}{0.9} % light gray
27
+ \definecolor{starter@chaptercolor}{gray}{0.4} % gray
28
+ \definecolor{starter@sectioncolor}{gray}{0.1} % gray
29
+ \definecolor{starter@subsectioncolor}{gray}{0.1} % dark gray
30
+ \definecolor{starter@notecolor}{gray}{0.0} % black
31
+ \definecolor{starter@captioncolor}{gray}{0.4} % gray
32
+ \definecolor{starter@quotecolor}{gray}{0.4} % gray
33
+ \colorlet{starter@linkcolor}{black} % black
34
+ \colorlet{starter@chaptitlepagecolor}{white} % white
35
+ \definecolor{starter@programcolor}{gray}{0.9} % light gray
36
+ \definecolor{starter@terminalcolor}{gray}{0.1} % dark black
37
+ \definecolor{starter@program@indentcolor}{gray}{0.95} % ultra light gray
38
+ \definecolor{starter@terminal@indentcolor}{gray}{0.18}% dark black
39
+ \definecolor{starter@userinputcolor}{gray}{0.35} % dark gray
40
+ \fi
41
+
42
+ %%% カラー(RGB、PCやタブレット向け)
43
+ \ifstreq{\starter@colormode}{rgb}
44
+ \definecolor{starter@deepcolor}{HTML}{990000} % red
45
+ %\definecolor{starter@deepcolor}{HTML}{006699} % blue
46
+ \definecolor{starter@palecolor}{HTML}{E5E5E5} % light gray
47
+ \colorlet{starter@chaptercolor}{starter@deepcolor}
48
+ \colorlet{starter@sectioncolor}{starter@deepcolor}
49
+ \colorlet{starter@subsectioncolor}{starter@deepcolor}
50
+ \colorlet{starter@notecolor}{starter@deepcolor}
51
+ \definecolor{starter@captioncolor}{HTML}{999999} % gray
52
+ \definecolor{starter@quotecolor}{HTML}{999999} % gray
53
+ \colorlet{starter@linkcolor}{starter@deepcolor}% red
54
+ \colorlet{starter@chaptitlepagecolor}{starter@palecolor}
55
+ \definecolor{starter@programcolor}{HTML}{E5E5E5} % light gray
56
+ \definecolor{starter@terminalcolor}{HTML}{191919} % dark black
57
+ \definecolor{starter@program@indentcolor}{HTML}{F2F2F2} % ultra light gray
58
+ \definecolor{starter@terminal@indentcolor}{HTML}{2E2E2E} % dark black
59
+ \definecolor{starter@userinputcolor}{HTML}{595959}% dark gray
60
+ \fi
61
+
62
+ %%% カラー(CYMK、カラー印刷向け)
63
+ \ifstreq{\starter@colormode}{cmyk}
64
+ \definecolor{starter@deepcolor}{cmyk}{0.0,1.0,1.0,0.4} % red
65
+ \definecolor{starter@palecolor}{cmyk}{0.0,0.0,0.0,0.1} % light gray
66
+ \colorlet{starter@chaptercolor}{starter@deepcolor}
67
+ \colorlet{starter@sectioncolor}{starter@deepcolor}
68
+ \colorlet{starter@subsectioncolor}{starter@deepcolor}
69
+ \colorlet{starter@notecolor}{starter@deepcolor}
70
+ \definecolor{starter@captioncolor}{cmyk}{0.0,0.0,0.0,0.5} % gray
71
+ \definecolor{starter@quotecolor}{cmyk}{0.0,0.0,0.0,0.5} % gray
72
+ \colorlet{starter@linkcolor}{starter@deepcolor} % red
73
+ \colorlet{starter@chaptitlepagecolor}{starter@palecolor}
74
+ \definecolor{starter@programcolor}{cmyk}{0.0,0.0,0.0,0.1} % light gray
75
+ \definecolor{starter@terminalcolor}{cmyk}{0.0,0.0,0.0,0.9} % dark black
76
+ \definecolor{starter@program@indentcolor}{cmyk}{0.0,0.0,0.0,0.95} % ultra light gray
77
+ \definecolor{starter@terminal@indentcolor}{cmyk}{0.0,0.0,0.0,0.18}% dark black
78
+ \definecolor{starter@userinputcolor}{cmyk}{0.0,0.0,0.0,0.35}% dark gray
79
+ \fi
@@ -0,0 +1,112 @@
1
+ %%% -*- coding: utf-8 -*-
2
+
3
+ %%%
4
+ %%% 本文のフォントを設定
5
+ %%%
6
+ %%% (参考までに)
7
+ %%% ・日本語は「明朝体」(\mcfamily)と「ゴシック体」(\gtfamily)がある。
8
+ %%% ・英数字は「ローマン体」(\rmfamily)と「サンセリフ体」(\sffamily)と「タイプライター体」(\ttfamily)がある。
9
+ %%% ・通常は「明朝体とローマン体」「ゴシック体とサンセリフ体」の組で使う。
10
+ %%%
11
+ \ifstreq{\starter@fontweight@ja}{light}
12
+ %% 日本語フォントの太さを細くする
13
+ %% (Notoフォントを使っていることが前提なので、Docker環境を使うか、
14
+ %% Notoフォントを自分でインストールすること)
15
+ %% 参考:https://tm23forest.com/contents/veryeasy-latex-meiryo-font
16
+ \special{pdf:mapline uphminr-h unicode NotoSerifCJK-Light.ttc} % 明朝体
17
+ \special{pdf:mapline uphgothr-h unicode NotoSansCJK-Light.ttc} % ゴシック体
18
+ \special{pdf:mapline uphminb-h unicode NotoSerifCJK-Medium.ttc} % 明朝体(太字)
19
+ \special{pdf:mapline uphgothb-h unicode NotoSansCJK-Medium.ttc} % ゴシック体(太字)
20
+ \else
21
+ %% 英数字のサンセリフ体をHelveticaに変更
22
+ %% (LaTeXのデフォルトであるComputerModernより少し太めなので、
23
+ %% 日本語フォントを細くした場合は使わないほうがいい)
24
+ \renewcommand{\sfdefault}{phv}
25
+ \fi
26
+ \ifstreq{\starter@fontweight@en}{light}
27
+ %% 英語のローマン体フォントを細いものに変更
28
+ %% 参考:https://tug.org/FontCatalogue/sourceserifprolight/
29
+ %% https://tug.org/FontCatalogue/iwonalight/
30
+ \usepackage[light,math]{iwona}
31
+ \renewcommand{\bfdefault}{bx} % 日本語の太字が効くように修正(iwona)
32
+ %\usepackage[light,semibold]{sourceserifpro}
33
+ %\renewcommand{\bfseries@rm}{bx} % 日本語の太字が効くように修正(sourceserifpro)
34
+ %% 英語のサンセリフ体フォントを細いものに変更
35
+ %% 参考:https://tug.org/FontCatalogue/robotolight/
36
+ %% https://tug.org/FontCatalogue/firasanslight/
37
+ \usepackage[light,medium]{roboto}
38
+ %\usepackage[light]{FiraSans}
39
+ \renewcommand{\bfseries@sf}{bx} % 日本語の太字が効くように修正(roboto,FiraSans)
40
+ \fi
41
+ \ifstreq{\starter@fontfamily@ja}{gothic}
42
+ \renewcommand\kanjifamilydefault{\gtdefault} % 日本語のデフォルトをゴシック体に変更
43
+ \fi
44
+ \ifstreq{\starter@fontfamily@en}{sansserif}
45
+ \renewcommand\familydefault{\sfdefault} % 英数字のデフォルトをサンセリフ体に変更
46
+ %% 英数字のデフォルトフォントを細いサンセリフ体に変更しても、
47
+ %% 脚注の英数字が細くならないバグを回避するハック
48
+ %% see https://twitter.com/_kauplan/status/1223641864189857793
49
+ \let\original@@footnotetext=\@footnotetext
50
+ \long\def\@footnotetext#1{%
51
+ \original@@footnotetext{{\mdseries #1}}% % フォントの太さを明示する
52
+ }
53
+ \fi
54
+
55
+
56
+
57
+ %%% プログラムやターミナルの表示で使う等幅フォント。
58
+ %%% 参考: http://www.tug.dk/FontCatalogue/typewriterfonts.html
59
+
60
+ %%% 等幅フォントを読み込む
61
+ \newcommand\starter@loadttfont[2]{% % #1: 等幅フォント名、#2: 実行するコード
62
+ \ifstreq{\starter@program@ttfont}{#1} % プログラム用等幅フォント名が第1引数と一致したら
63
+ #2 % 第2引数を実行
64
+ \fi
65
+ \ifstreq{\starter@terminal@ttfont}{#1} % ターミナル用等幅フォント名が第1引数と一致したら
66
+ #2 % 第2引数を実行
67
+ \fi
68
+ }
69
+
70
+ %%% lmodern … LaTeXのデフォルト。1とl、0とOが見分けにくい。太字が目立たない。
71
+ \starter@loadttfont{lmodern}{
72
+ \usepackage{lmodern}
73
+ }
74
+ %%% lmodern-lighttt … 細字にするオプションをつけたlmodern。太字が目立つ。
75
+ \starter@loadttfont{lmodern-lighttt}{
76
+ \usepackage[lighttt]{lmodern}
77
+ %\usepackage{lmodern}
78
+ %\let\lmtt@use@light@as@normal\@empty % enable 'lighttt' option
79
+ }
80
+ %%% courier … 文字が細い。文字幅が広め。1とl、0とOが見分けにくい。
81
+ \starter@loadttfont{courier}{
82
+ \usepackage{courier}
83
+ }
84
+ %%% beramono … 1とl、0とOが見分けやすい。「'」と「`」が見分けにくい。
85
+ \starter@loadttfont{beramono}{
86
+ \usepackage[scaled]{beramono}
87
+ }
88
+ %%% inconsolata … 文字幅が狭め。0と0が見分けやすい、varlつけると1とlが見分けやすい。
89
+ \starter@loadttfont{inconsolata}{
90
+ \usepackage[varl,varqu,mono]{inconsolata}
91
+ }
92
+ %%% inconsolata-narrow … 文字幅をより狭くするオプションをつけたinconsolata。
93
+ \starter@loadttfont{inconsolata-narrow}{
94
+ %\usepackage[varl,varqu,mono,narrow]{inconsolata}
95
+ \usepackage[varl,varqu,mono]{inconsolata}
96
+ \def\zifour@narrow{n} % enable 'narrow' option
97
+ }
98
+
99
+ %%% 指定した等幅フォントを有効にする
100
+ \newcommand{\starter@enablettfont}[1]{
101
+ \iffalse
102
+ \else\ifstreq{#1}{beramono} \renewcommand{\ttdefault}{fvm}
103
+ \else\ifstreq{#1}{inconsolata} \renewcommand{\ttdefault}{zi4}
104
+ \else\ifstreq{#1}{inconsolata-narrow} \renewcommand{\ttdefault}{zi4}
105
+ \else\ifstreq{#1}{lmodern} \renewcommand{\ttdefault}{lmtt}
106
+ \else\ifstreq{#1}{lmodern-lighttt} \renewcommand{\ttdefault}{lmtt}
107
+ \else\ifstreq{#1}{courier} \renewcommand{\ttdefault}{pcr}
108
+ \fi
109
+ }
110
+
111
+ %%% デフォルトの等幅フォントとしてプログラム用(//list)のものを使う
112
+ \starter@enablettfont{\starter@program@ttfont}
@@ -0,0 +1,514 @@
1
+ %%% -*- coding: utf-8 -*-
2
+
3
+ %%%
4
+ %%% 見出し(章・節・項・目・段・小段)
5
+ %%%
6
+
7
+
8
+
9
+ %%% hyperref.styが\refstepcounterを上書きするのでその対策
10
+ \newcommand{\@refstepcounter}{%
11
+ \@ifundefined{@hyperref}{%
12
+ \refstepcounter%
13
+ }{%
14
+ \H@refstepcounter%
15
+ }%
16
+ }
17
+
18
+ %%% 目次をクリックしたときのジャンプ先となるアンカー
19
+ \newcommand{\Heading@anchor}[2]{% #1: chapter, section, ..., 2: number
20
+ \@ifundefined{@hyperref}{%
21
+ }{%
22
+ \ifempty{#2}% % 章番号や節番号がなければ
23
+ \Hy@MakeCurrentHrefAuto{#1*}% % 自動採番してアンカーを作成
24
+ \else% % 章番号や節番号があれば
25
+ \Hy@MakeCurrentHref{#1.#2}% % それを使ってアンカーを作成
26
+ \fi%
27
+ \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}%
28
+ }%
29
+ }
30
+
31
+ %%% 目次のエントリをtocファイルに出力する
32
+ \newcommand{\Heading@toc}[3]{% #1: chapter, section, ..., #2: number, #3: toc title
33
+ \ifempty{#2}% % 章番号や節番号がなければ
34
+ \addcontentsline{toc}{#1}{#3}% % 目次エントリを出力
35
+ \else% % 章番号や節番号があれば
36
+ \addcontentsline{toc}{#1}{\protect\numberline{#2}#3}% 番号つきで出力
37
+ \fi%
38
+ }
39
+
40
+ %%%
41
+ \newcommand{\Heading@heading}[4]{% #1: Chapter, Section, etc, #2: 番号, #3: タイトル, #4: 目次用タイトル
42
+ %% タイトル前の余白
43
+ \@eval{#1@topmargin}{#2}% % #2: 番号
44
+ \pagebreak[0]% % 必要なら改ページをする
45
+ %% 目次をクリックしたときのジャンプ先(アンカー)
46
+ \@eval{#1@anchor}{#2}% % #2: 番号
47
+ %% 番号とタイトル
48
+ {%
49
+ \setlength{\parindent}{0pt}% % タイトルでは段落のインデントをなくす
50
+ \@eval{#1@font}{#2}% % フォントを設定
51
+ \@eval{#1@title}{#2}{#3}% % #2: 番号、#3: タイトル
52
+ \par\nobreak% % 改段落はするが、改ページは禁止
53
+ }%
54
+ %% 目次用のエントリ(タイトルよりあとに置くこと)
55
+ \def\@tempc{#4}% % #4: 目次用タイトル
56
+ \def\@relax{\relax}% % (\relaxは他言語のnullに相当)
57
+ \ifx\@tempc\empty% % 空文字列なら目次に出さない
58
+ \else\ifx\@tempc\@relax% % \relaxなら
59
+ \@eval{#1@toc}{#2}{#3}% % タイトルをそのまま目次に使う
60
+ \else% % それ以外なら
61
+ \@eval{#1@toc}{#2}{#4}% % 目次用タイトルを目次に使う
62
+ \fi\fi%
63
+ \nobreak% % 改ページ禁止
64
+ %% タイトル後の余白
65
+ \@eval{#1@bottommargin}{#2}%
66
+ %% 後処理
67
+ \@eval{#1@aftertitle}{#2}%
68
+ }
69
+
70
+
71
+
72
+
73
+ %%% 章 (Chapter) のタイトル
74
+ \newcommand{\Chapter}{%
75
+ \@ifstar{\Chapter@star}{\Chapter@nostar}%
76
+ }
77
+ \newcommand{\Chapter@star}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
78
+ \Chapter@heading{}{#2}{#1}%
79
+ }
80
+ \newcommand{\Chapter@nostar}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
81
+ \ifnum\c@secnumdepth<0%
82
+ \Chapter@heading{}{#2}{#1}%
83
+ \else\if@mainmatter%
84
+ \@refstepcounter{chapter}%
85
+ \Chapter@heading{\thechapter}{#2}{#1}%
86
+ \else%
87
+ \Chapter@heading{}{#2}{#1}%
88
+ \fi\fi%
89
+ }
90
+ \newcommand{\Chapter@heading}[3]{%
91
+ \Heading@heading{Chapter}{#1}{#2}{#3}%
92
+ }
93
+ \newcommand{\Chapter@anchor}[1]{% #1: 章番号
94
+ \Heading@anchor{chapter}{#1}%
95
+ }
96
+ \newcommand{\Chapter@toc}[2]{% #1: 章番号, #2: 目次用タイトル
97
+ \@ifundefined{minitoc}{}{\stepcounter{mtc}}% 章扉の目次用
98
+ \def\@tempa{#1}%
99
+ \def\@tempb{#2}%
100
+ \ifnum\c@tocdepth<0%
101
+ \else\ifx\@tempb\empty%
102
+ \else\ifx\@tempa\empty%
103
+ \Heading@toc{chapter}{}{#2}%
104
+ \else%
105
+ \Heading@toc{chapter}{\@chapapp#1\@chappos}{#2}%
106
+ \fi\fi\fi%
107
+ \chaptermark{#2}% % ページヘッダに章タイトルを設定
108
+ }
109
+ \newcommand{\Chapter@topmargin}[1]{%
110
+ \if@openleft\cleardoublepage\else%
111
+ \if@openright\cleardoublepage\else\clearpage\fi\fi%
112
+ \plainifnotempty% 元: \thispagestyle{plain}%
113
+ \global\@topnum\z@%
114
+ %\vspace*{2.0\Cvs}% % (jsbook.cls) 2\Cvs
115
+ }
116
+ \newcommand{\Chapter@bottommargin}[1]{% #1: 章番号
117
+ \addvspace{2.0\Cvs}% % (jsbook.cls) 3\Cvs
118
+ }
119
+ \newcommand{\Chapter@aftertitle}[1]{% #1: 章番号
120
+ \@FirstSectionPerChapter@true% % 最初の章を表すフラグをオン
121
+ }
122
+ \newcommand{\Chapter@font}[1]{% #1: 章番号
123
+ \headfont\Huge%
124
+ }%
125
+ \newcommand{\Chapter@title}[2]{% #1: 章番号, #2: 章タイトル
126
+ \Chapter@align% % 左寄せ/右寄せ/中央揃え
127
+ \edef\@tempa{#1}%
128
+ \ifx\@tempa\empty% % 章番号がないなら何もしない
129
+ \else\ifx\starter@chapter@oneline\empty% % 章番号とタイトルを別行にするなら
130
+ \Chapter@number{#1}% % 章番号(例:第1章)
131
+ \else% % 章番号とタイトルを横に並べるなら
132
+ \@hangfrom{% % タイトルが複数行になったときの対策
133
+ \Chapter@number{#1}% % 章番号(例:第1章)
134
+ }%
135
+ \fi\fi%
136
+ #2% % 章タイトル
137
+ }
138
+ \newcommand{\Chapter@number}[1]{% #1: 章番号
139
+ %{\headfont\huge\@chapapp#1\@chappos}% % 章番号(例:第1章)
140
+ {\headfont\LARGE\@chapapp{\HUGE #1}\@chappos}% 番号を大きくして出力
141
+ \ifempty{\starter@chapter@oneline}%
142
+ \par\vspace{0.50\Cvs}% % 縦方向に余白を空ける
143
+ \else%
144
+ \hspace{1zw}% % 横方向に1文字分空ける
145
+ \fi%
146
+ }
147
+ \newcommand{\Chapter@align}{%
148
+ \def\@align{\starter@chapter@align}% % left/right/center
149
+ \ifstreq{\@align}{left}\raggedright\fi % 左寄せ
150
+ \ifstreq{\@align}{right}\raggedleft\fi % 右寄せ
151
+ \ifstreq{\@align}{center}\centering\fi % 中央寄せ
152
+ }
153
+ \newif\if@FirstSectionPerChapter@ % 章における最初の節ならtrue
154
+
155
+ %%% 章タイトルのカスタマイズ:下に細い下線
156
+ \iffalse
157
+ \else\ifstreq{\starter@chapter@decoration}{underline}
158
+
159
+ \let\original@Chapter@title=\Chapter@title
160
+ \renewcommand{\Chapter@title}[2]{% #1: 章番号、#2: 章タイトル
161
+ \original@Chapter@title{#1}{#2}%
162
+ \par%
163
+ \textcolor{starter@chaptercolor}{\rule{\textwidth}{0.2pt}}%
164
+ }
165
+
166
+ %%% 章タイトルのカスタマイズ:上下に太い横線
167
+ \else\ifstreq{\starter@chapter@decoration}{boldlines}
168
+
169
+ \let\original@Chapter@title=\Chapter@title
170
+ \renewcommand{\Chapter@title}[2]{% #1: 章番号、#2: 章タイトル
171
+ \def\@@boldline{%
172
+ \textcolor{starter@chaptercolor}{\rule{\textwidth}{0.5\Cvs}}% 太い横線
173
+ }
174
+ %\ifempty{#1}% % TeX言語仕様の制限によりエラーになるので使わないこと
175
+ \edef\@tempa{#1}% % 章番号(例:1)
176
+ \ifx\@tempa\empty%
177
+ \original@Chapter@title{#1}{#2}% % 章番号(例:第1章)
178
+ \else%
179
+ \@@boldline\par% % 太い横線
180
+ \vspace{0.75\Cvs}% % 余白
181
+ \original@Chapter@title{#1}{#2}% % 章番号(例:第1章)
182
+ \vspace{0.25\Cvs}% % 余白
183
+ \par\@@boldline% % 太い横線
184
+ \fi%
185
+ }
186
+
187
+ \else
188
+ \fi
189
+
190
+
191
+
192
+ %%% 節 (Section) のタイトル
193
+ \newcommand{\Section}{%
194
+ \@ifstar{\Section@star}{\Section@nostar}%
195
+ }
196
+ \newcommand{\Section@star}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
197
+ \Section@heading{}{#2}{#1}%
198
+ }
199
+ \newcommand{\Section@nostar}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
200
+ \ifnum\c@secnumdepth<1%
201
+ \Section@heading{}{#2}{#1}%
202
+ \else\if@mainmatter%
203
+ \@refstepcounter{section}%
204
+ \Section@heading{\thesection}{#2}{#1}%
205
+ \else%
206
+ \Section@heading{}{#2}{#1}%
207
+ \fi\fi%
208
+ }
209
+ \newcommand{\Section@heading}[3]{%
210
+ \Heading@heading{Section}{#1}{#2}{#3}%
211
+ }
212
+ \newcommand{\Section@anchor}[1]{% #1: 節番号
213
+ \Heading@anchor{section}{#1}%
214
+ }
215
+ \newcommand{\Section@toc}[2]{% #1: 節番号, #2: 目次用タイトル
216
+ \def\@tempb{#2}%
217
+ \ifnum\c@tocdepth<1%
218
+ \else\ifx\@tempb\empty%
219
+ \else%
220
+ \Heading@toc{section}{#1}{#2}%
221
+ \fi\fi%
222
+ %\sectionmark{#2} % まえがきの章で使うとページヘッダに「0.1」と出てしまう
223
+ \def\@tempa{#1}%
224
+ \ifx\@tempa\empty%
225
+ \markright{#2}% % ページヘッダに節タイトルだけを設定
226
+ \else%
227
+ \markright{#1\hspace{1zw}#2}% % ページヘッダに節番号と節タイトルを設定
228
+ \fi%
229
+ }
230
+ \newcommand{\Section@topmargin}[1]{% #1: 節番号
231
+ %\addvspace{1.0\Cvs}% % (jsbook.cls) \Cvs \@plus.5\Cdp \@minus.2\Cdp
232
+ \edef\@newpage{\starter@section@newpage}% % Yなら改ページする
233
+ \edef\@tempa{#1}%
234
+ \ifx\@tempa\empty% % 節番号なしなら
235
+ \def\@newpage{}% % 改ページしない
236
+ \fi%
237
+ \if@FirstSectionPerChapter@ % 章における最初の節なら
238
+ \def\@newpage{}% % 改ページしない
239
+ \fi%
240
+ \ifx\@newpage\empty% % 改ページが必要ないなら
241
+ \Section@@topmargin{#1} % 節タイトルの上に余白を空ける
242
+ \else% % 改ページが必要なら
243
+ \clearpage% % 改ページする
244
+ \fi%
245
+ }%
246
+ \newcommand{\Section@@topmargin}[1]{% #1: 節番号
247
+ \ifempty{#1}\addvspace{1.0\Cvs}% 節番号なしなら装飾しないので少し狭く
248
+ \else \addvspace{1.5\Cvs}% 節番号ありなら装飾するので少し広く
249
+ \fi%
250
+ }
251
+ \newcommand{\Section@bottommargin}[1]{% #1: 節番号
252
+ %\addvspace{0.5\Cvs}% % (jsbook.cls) .5\Cvs \@plus.3\Cdp
253
+ \ifempty{#1}\addvspace{0.5\Cvs}% 節番号なしなら装飾しないので少し狭く
254
+ \else \addvspace{1.0\Cvs}% 節番号ありなら装飾するので少し広く
255
+ \fi%
256
+ }%
257
+ \newcommand{\Section@aftertitle}[1]{% 節番号
258
+ \@FirstSectionPerChapter@false% % 最初の章を表すフラグをオフ
259
+ }
260
+ \newcommand{\Section@font}[1]{% #1: 節番号
261
+ \headfont\Large
262
+ }%
263
+ \newcommand{\Section@title}[2]{% #1: 節番号, #2: 節タイトル
264
+ \ifempty{#1}\else%
265
+ \@hangfrom{% % タイトルが複数行になったときの対策
266
+ \Section@number{#1}%
267
+ }%
268
+ \fi%
269
+ #2%
270
+ }
271
+ \newcommand{\Section@number}[1]{% #1: 節番号
272
+ #1\hspace{1zw}% % 節番号と全角1文字分の空白
273
+ }
274
+
275
+ %%% 節タイトルのカスタマイズ:節番号を白抜き、背景を薄いグレー
276
+ \iffalse
277
+ \else\ifstreq{\starter@section@decoration}{grayback}
278
+
279
+ \renewcommand{\Section@number}[1]{% #1: 章番号
280
+ \textcolor{starter@palecolor}{% % タイトルの背景色(薄いグレー)
281
+ \rlap{\rule[-0.6zh]{\textwidth}{2zh}}% % 本文幅の背景色
282
+ }%
283
+ \textcolor{starter@sectioncolor}{% % 章番号の背景色(主色)
284
+ \rlap{\rule[-0.6zh]{3.5zw}{2zh}}%% 全角3.5文字分の背景色
285
+ }%
286
+ \makebox[3.5zw][c]{\textcolor{white}{#1}}% 白抜き文字で章番号
287
+ \hspace{0.9zw}% % 空白
288
+ }
289
+
290
+ %%% 節タイトルのカスタマイズ:節番号を白抜き(背景色がないので複数行向き)
291
+ \else\ifstreq{\starter@section@decoration}{numbox}
292
+
293
+ \renewcommand{\Section@number}[1]{% #1: 章番号
294
+ \textcolor{starter@sectioncolor}{% % 章番号の背景色(主色)
295
+ \rlap{\rule[-0.6zh]{3.5zw}{2zh}}%% 全角3.5文字分の背景色
296
+ }%
297
+ \makebox[3.5zw][c]{\textcolor{white}{#1}}% 白抜き文字で章番号
298
+ \hspace{0.9zw}% % 空白
299
+ }
300
+
301
+ %%% 節タイトルのカスタマイズ:節タイトルに下線を引く
302
+ \else\ifstreq{\starter@section@decoration}{underline}
303
+
304
+ \renewcommand{\Section@number}[1]{% #1: 章番号
305
+ \textcolor{starter@sectioncolor}{% % 線の色
306
+ \rlap{\rule[-0.6zh]{\textwidth}{0.2pt}}% 本文幅の下線
307
+ \rlap{\rule[-0.6zh]{0.75zw}{2zh}}% % 左端に太い縦線
308
+ }%
309
+ \hspace{1.5zw}#1\hspace{1.0zw}% % 章番号(と空白)
310
+ }%
311
+
312
+ %%% 節タイトルのカスタマイズ:節タイトル右に太い縦線(下線がないので複数行向き)
313
+ \else\ifstreq{\starter@section@decoration}{leftline}
314
+
315
+ \renewcommand{\Section@number}[1]{% #1: 章番号
316
+ \textcolor{starter@sectioncolor}{% % 線の色
317
+ \rlap{\rule[-0.6zh]{0.75zw}{2zh}}% 左端に太い縦線
318
+ }%
319
+ \hspace{1.5zw}#1\hspace{1.0zw}% % 章番号(と空白)
320
+ }%
321
+
322
+ %%% 節タイトルのカスタマイズ:装飾なし
323
+ \else
324
+
325
+ \renewcommand{\Section@@topmargin}[1]{%
326
+ \addvspace{1.0\Cvs}% % 装飾ありと比べて、節タイトル上のスペースを狭める
327
+ }%
328
+ \renewcommand{\Section@bottommargin}[1]{%
329
+ \addvspace{0.5\Cvs}% % 装飾ありと比べて、節タイトル下のスペースを狭める
330
+ }%
331
+
332
+ \fi
333
+
334
+
335
+
336
+ %%% 項 (Subsection) のタイトル
337
+ \newcommand{\Subsection}{%
338
+ \@ifstar{\Subsection@star}{\Subsection@nostar}%
339
+ }
340
+ \newcommand{\Subsection@star}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
341
+ \Subsection@heading{}{#2}{#1}%
342
+ }
343
+ \newcommand{\Subsection@nostar}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
344
+ \ifnum\c@secnumdepth<2%
345
+ \Subsection@heading{}{#2}{#1}%
346
+ \else\if@mainmatter%
347
+ \@refstepcounter{subsection}%
348
+ \Subsection@heading{\thesubsection}{#2}{#1}%
349
+ \else%
350
+ \Subsection@heading{}{#2}{#1}%
351
+ \fi\fi%
352
+ }
353
+ \newcommand{\Subsection@heading}[3]{%
354
+ \Heading@heading{Subsection}{#1}{#2}{#3}%
355
+ }
356
+ \newcommand{\Subsection@anchor}[1]{% #1: 項番号
357
+ \Heading@anchor{subsection}{#1}%
358
+ }
359
+ \newcommand{\Subsection@toc}[2]{% #1: 項番号, #2: 目次用タイトル
360
+ \def\@tempb{#2}%
361
+ \ifnum\c@tocdepth<2%
362
+ \else\ifx\@tempb\empty%
363
+ \else\ifnum\c@secnumdepth<2%
364
+ \Heading@toc{subsection}{#1}{\startersubsectionsymbol#2}%
365
+ \else%
366
+ \Heading@toc{subsection}{#1}{#2}%
367
+ \fi\fi\fi%
368
+ }
369
+ \newcommand{\Subsection@topmargin}[1]{% #1: 項番号
370
+ \addvspace{0.7\Cvs}% % (jsbook.cls) \Cvs \@plus.5\Cdp \@minus.2\Cdp
371
+ }
372
+ \newcommand{\Subsection@bottommargin}[1]{% #1: 項番号
373
+ \addvspace{0.3\Cvs}% % (jsbook.cls) .5\Cvs \@plus.3\Cdp
374
+ }
375
+ \newcommand{\Subsection@aftertitle}[1]{} % 何もしない
376
+ \newcommand{\Subsection@font}[1]{% #1: 項番号
377
+ \headfont\large
378
+ }%
379
+ \newcommand{\Subsection@title}[2]{% #1: 項番号, #2: 項タイトル
380
+ \ifempty{#1}\else%
381
+ \@hangfrom{% % タイトルが複数行になったときの対策
382
+ \Subsection@number{#1}%
383
+ }%
384
+ \fi%
385
+ #2%
386
+ }
387
+ \newcommand{\Subsection@number}[1]{% #1: 項番号
388
+ #1\hspace{1zw}% % 項番号と全角1文字分の空白
389
+ }
390
+
391
+ %%% 項 (Subsection) タイトルのカスタマイズ:クローバー
392
+ \newcommand{\starter@subsection@symbol}{$\clubsuit$}% クローバー
393
+ \newcommand{\startersubsectionsymbol}{}
394
+ \ifstreq{\starter@subsection@decoration}{symbol} % 'none' or 'symbol'
395
+
396
+ \let\original@Subsection@title=\Subsection@title% もとの定義を保存
397
+ \renewcommand{\Subsection@title}[2]{% % #1: 項番号, #2: 項タイトル
398
+ \startersubsectionsymbol% % タイトル先頭にクローバー
399
+ \original@Subsection@title{#1}{#2}% % もとの定義を呼び出す
400
+ }
401
+ \renewcommand{\startersubsectionsymbol}{%
402
+ \textcolor{starter@subsectioncolor}{\starter@subsection@symbol}% クローバーの記号
403
+ ~% % 半角空白空けるけど改行はしない
404
+ }%
405
+
406
+ \fi
407
+
408
+
409
+
410
+ %%% 目 (Subsubsection) のタイトル
411
+ \newcommand{\Subsubsection}{%
412
+ \@ifstar{\Subsubsection@star}{\Subsubsection@nostar}%
413
+ }
414
+ \newcommand{\Subsubsection@star}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
415
+ \Subsubsection@heading{}{#2}{#1}%
416
+ }
417
+ \newcommand{\Subsubsection@nostar}[2][\relax]{% #1: 目次用タイトル, #2: タイトル
418
+ \ifnum\c@secnumdepth<3%
419
+ \Subsubsection@heading{}{#2}{#1}%
420
+ \else\if@mainmatter%
421
+ \@refstepcounter{subsubsection}%
422
+ \Subsubsection@heading{\thesubsubsection}{#2}{#1}%
423
+ \else%
424
+ \Subsubsection@heading{}{#2}{#1}%
425
+ \fi\fi%
426
+ }
427
+ \newcommand{\Subsubsection@heading}[3]{%
428
+ \Heading@heading{Subsubsection}{#1}{#2}{#3}%
429
+ }
430
+ \newcommand{\Subsubsection@anchor}[1]{% #1: 目番号
431
+ \Heading@anchor{subsubsection}{#1}%
432
+ }
433
+ \newcommand{\Subsubsection@toc}[2]{% #1: 目番号, #2: 目次用タイトル
434
+ \def\@tempb{#2}%
435
+ \ifnum\c@tocdepth<3%
436
+ \else\ifx\@tempb\empty%
437
+ \else%
438
+ \Heading@toc{subsubsection}{#1}{#2}%
439
+ \fi\fi%
440
+ }
441
+ \newcommand{\Subsubsection@topmargin}[1]{% #1: 目番号
442
+ \addvspace{0.4\Cvs}% % (jsbook.cls) \Cvs \@plus.5\Cdp \@minus.2\Cdp
443
+ }
444
+ \newcommand{\Subsubsection@bottommargin}[1]{% #1: 目番号
445
+ \addvspace{0.1\Cvs}% % (jsbook.cls) \z@
446
+ }
447
+ \newcommand{\Subsubsection@aftertitle}[1]{} % 何もしない
448
+ \newcommand{\Subsubsection@font}[1]{% #1: 目番号
449
+ \headfont\normalsize
450
+ }%
451
+ \newcommand{\Subsubsection@title}[2]{% #1: 目番号, #2: 目タイトル
452
+ \ifempty{#1}\else%
453
+ \@hangfrom{% % タイトルが複数行になったときの対策
454
+ \Subsubsection@number{#1}%
455
+ }%
456
+ \fi%
457
+ #2%
458
+ }
459
+ \newcommand{\Subsubsection@number}[1]{% #1: 目番号
460
+ #1\hspace{1zw}% % 目番号と全角1文字分の空白
461
+ }
462
+
463
+
464
+
465
+ %%% 段 (Paragraph)
466
+ \newcommand\Paragraph{%
467
+ \@ifstar{\Paragraph@title}{\@Paragraph@title}% '*' がついていたら読み飛ばす
468
+ }
469
+ \newcommand\Paragraph@title[1]{% % #1: タイトル
470
+ \Paragraph@separator% % 少しだけ余白を空ける
471
+ \noindent% % タイトルはインデントしない
472
+ {\headfont #1}% % タイトルを表示(太字のゴシック体)
473
+ \par\nobreak% % 改行する(直後の改ページは禁止)
474
+ }
475
+ \newcommand\Paragraph@separator{%
476
+ \par\addvspace{0.25\baselineskip}% % 1/4行分の余白
477
+ }
478
+
479
+
480
+
481
+ %%% 小段 (Subparagraph)
482
+ \newcommand\Subparagraph{%
483
+ \@ifstar{\Subparagraph@title}{\@Subparagraph@title}% '*' がついていたら読み飛ばす
484
+ }
485
+ \newcommand\Subparagraph@title[1]{% % #1: タイトル
486
+ \Subparagraph@separator% % 少しだけ余白を空ける
487
+ \noindent% % タイトルはインデントしない
488
+ {\headfont #1}% % タイトルを表示(太字のゴシック体)
489
+ \hspace{1zw}% % 改行せず、全角1文字分空ける
490
+ }
491
+ \newcommand\Subparagraph@separator{%
492
+ %\par\addvspace{0.25\baselineskip}% % 1/4行分の余白
493
+ \par\addvspace{0.00\baselineskip}% % 余白を空けない
494
+ }
495
+
496
+
497
+
498
+ %%% 「//paragraphend」ブロック命令用
499
+ \newcommand\ParagraphEnd{%
500
+ \Paragraph@separator%
501
+ }
502
+ \newcommand\SubparagraphEnd{%
503
+ \Subparagraph@separator%
504
+ }
505
+
506
+
507
+
508
+ %%% LaTeXの見出し用マクロを上書きする
509
+ \def\chapter{\Chapter}
510
+ \def\section{\Section}
511
+ \def\subsection{\Subsection}
512
+ \def\subsubsection{\Subsubsection}
513
+ \def\paragraph{\Paragraph}
514
+ \def\subparagraph{\Subparagraph}