forked from y-yu/trpl-2nd-pdf
-
Notifications
You must be signed in to change notification settings - Fork 2
/
book.tex
151 lines (127 loc) · 3.93 KB
/
book.tex
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
\documentclass[10pt, a4paper, oneside]{ltjsbook}
\usepackage{amssymb,amsmath}
\usepackage{luatexja-fontspec}
\usepackage{letltxmacro}
\usepackage[Lenny]{fncychap}
% チャプターマークの設定
\makeatletter
\renewcommand{\DOCH}{%
\settowidth{\px}{\CNV\FmN{\@chapapp}}
\addtolength{\px}{2pt}
\settoheight{\py}{\CNV\FmN{\@chapapp}}
\addtolength{\py}{1pt}
\settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
\addtolength{\mylen}{1pt}
\settowidth{\pxx}{\CNoV\thechapter}
\addtolength{\pxx}{-1pt}
\settoheight{\pyy}{\CNoV\thechapter}
\addtolength{\pyy}{-2pt}
\setlength{\myhi}{\pyy}
\addtolength{\myhi}{-1\py}
\par
\parbox[b]{\textwidth}{%
\rule[\py]{\RW}{\myhi}%
\hskip -\RW%
\rule[\pyy]{\px}{\RW}%
\hskip -\px%
\raggedright%
\CNV\FmN{\@chapapp}\space\CNoV\thechapter\CNV\FmN{\@chappos}%
\hskip1pt%
\mghrulefill{\RW}%
\rule{\RW}{\pyy}\par\nobreak%
\vskip -\baselineskip%
\vskip -\pyy%
\hskip \mylen%
\mghrulefill{\RW}\par\nobreak%
\vskip \pyy}%
\vskip 20\p@}
\makeatother
\usepackage{luacode}
% フォント設定
% \ltjsetparameter{jacharrange={...}} の挙動が不安定
% うまくいかなければ \ltjalchar でしのぐ
\setmainfont{Noto Serif}
\setmainjfont{Noto Serif CJK JP}
\setmonofont{Source Code Pro}
\ltjsetparameter{jacharrange={-2}}
% \newcommadn\cyrillictext[1]{{\cyrillicfont #1}}
% \newfontfamily\cyrillicfont{Noto Serif}
\newcommand{\arabictext}[1]{{\arabicfont {\textdir TRT #1}}}
\newcommand{\cjkunifiedtext}[1]{{\cjkunifiedfont #1}}
\newcommand{\devanagaritext}[1]{{\devanagarifont #1}}
\newcommand{\emojitext}[1]{{\emojifont #1}}
\newcommand{\hangultext}[1]{{\hangulfont #1}}
\newcommand{\hebrewtext}[1]{{\hebrewfont {\textdir TRT #1}}}
\newcommand{\letterliketext}[1]{{\letterlikefont #1}}
\newfontfamily\arabicfont[Script=Arabic]{Noto Naskh Arabic}
\newfontfamily\cjkunifiedfont{Noto Serif CJK JP}
\newfontfamily\devanagarifont{Noto Sans Devanagari}
\newfontfamily\emojifont{Noto Emoji}
\newfontfamily\hangulfont{Noto Serif CJK JP}
\newfontfamily\hebrewfont{Noto Sans Hebrew}
\newfontfamily\letterlikefont{Noto Serif}
\usepackage[centering]{geometry}
\usepackage[%
unicode=true,
breaklinks=true
bookmarks=true,
pdfborder={0 0 0},
bookmarksnumbered=true,
bookmarkstype=toc,
bookmarksopen=true,
pdfauthor={Yuu YOSHIMURA},
pdftitle={The Rust Programming Language: 2018 Edition}]{hyperref}
\usepackage{xcolor}
\usepackage{fancyvrb}
\usepackage{mdframed}
\usepackage{listings}
\usepackage{enumitem}
\input{listings.tex}
\usepackage{longtable,booktabs,array}
\usepackage{calc}
\usepackage{graphicx,grffile}
\usepackage[some]{background}
% 画像の設定
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>.8\linewidth\linewidth\else\Gin@nat@width\fi}
\makeatother
\setkeys{Gin}{width=\maxwidth, keepaspectratio}
% Pandocが要求するマクロを定義
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% ヘッダーの長さを調整するワークアラウンド
\setlength{\fullwidth}{\textwidth}
% 画像がない場合にコンパイルを無理やり実行する設定
\usepackage{ifthen}
\LetLtxMacro\latexincludegraphics\includegraphics
\makeatletter
\renewcommand\includegraphics[2][]{%
\IfFileExists{#2}
{%
\latexincludegraphics[#1]{#2}}
{%
\fbox{Image File doesn't exist}%
\message{Image File #2 doesn't exist^^J}}
}
\makeatother
% リストを入れ子にできる限界を拡張
\setlistdepth{10}
% 強調をボールドにする
\let\emph\relax
\DeclareTextFontCommand{\emph}{\gtfamily\bfseries}
% Markdownソースの最終コミット時刻を取得
\input{markdown_date.tex}
\backgroundsetup{%
contents={Last Commit Date of Markdown Sources: \GitMarkdownDate},
placement=top,
opacity=0.8,
scale=1.5,
firstpage=true,
color=blue!40,
vshift=-2em
}
\begin{document}
% 本文
\input{body.tex}
\end{document}