-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodebook.tex
203 lines (178 loc) · 6.53 KB
/
codebook.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
\documentclass[a4paper,10pt,twocolumn,oneside]{article}
\setlength{\columnsep}{10pt} %兩欄模式的間距
\setlength{\columnseprule}{0pt} %兩欄模式間格線粗細
\usepackage{amsthm} %定義,例題
\usepackage{amssymb}
%\usepackage[margin=2cm]{geometry}
%\usepackage[margin=2cm]{geometry}
\usepackage{fontspec} %設定字體
\usepackage{color}
\usepackage[x11names]{xcolor}
\usepackage{listings} %顯示code用的
%\usepackage[Glenn]{fncychap} %排版,頁面模板
\usepackage{fancyhdr} %設定頁首頁尾
\usepackage{graphicx} %Graphic
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{titlesec}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage[CheckSingle, CJKmath]{xeCJK}
\usepackage{savetrees}
\usepackage{array}
\usepackage{xparse}
% \usepackage{CJKulem}
%\usepackage[T1]{fontenc}
\usepackage{amsmath, courier, listings, fancyhdr, graphicx}
\topmargin=0pt
\headsep=5pt
\textheight=780pt
\footskip=0pt
\voffset=-40pt
\textwidth=545pt
\marginparsep=0pt
\marginparwidth=0pt
\marginparpush=0pt
\oddsidemargin=0pt
\evensidemargin=0pt
\hoffset=-42pt
\titlespacing\section{0pt}{-2pt plus 0pt minus 2pt}{-1pt plus 0pt minus 2pt}
\titlespacing\subsection{0pt}{-2pt plus 0pt minus 2pt}{-1pt plus 0pt minus 2pt}
\titlespacing\subsubsection{0pt}{-2pt plus 0pt minus 2pt}{-1pt plus 0pt minus 2pt}
%\renewcommand\listfigurename{圖目錄}
%\renewcommand\listtablename{表目錄}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setmainfont [ %主要字型
Path = .fonts/ttf/,
UprightFont = *-R,
BoldFont = *-B,
ItalicFont = *-RI
] {Ubuntu}
\setmonofont [
Path = .fonts/ttf/,
UprightFont = *-R
] {UbuntuMono}
% \setmainfont{.fonts/ttf/Ubuntu-R.ttf} %主要字型
% \setmonofont{.fonts/ttf/UbuntuMono-R.ttf}
\XeTeXlinebreaklocale "zh" %中文自動換行
\XeTeXlinebreakskip = 0pt plus 1pt %設定段落之間的距離
\setcounter{secnumdepth}{3} %目錄顯示第三層
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\digitstyle{\color{DarkOrchid3}}
\makeatletter
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
\@empty\z@\@empty
\newtoks\BBQube@token
\newcount\BBQube@length
\def\BBQube@ResetToken{\BBQube@token{}\BBQube@length\z@}
\def\BBQube@Append#1{\advance\BBQube@length\@ne
\BBQube@token=\expandafter{\the\BBQube@token#1}}
\def\BBQube@ProcessChar#1{%
\ifnum\lst@mode=\lst@Pmode%
\ifnum 9<1#1%
\expandafter\BBQube@Append{\begingroup\digitstyle #1 \endgroup}%
\else%
\expandafter\BBQube@Append{#1}%
\fi%
\else%
\expandafter\BBQube@Append{#1}%
\fi%
}
\def\BBQube@ProcessStringInner#1#2\BBQube@nil{%
\expandafter\BBQube@ProcessChar{#1}%
\if\relax\detokenize{#2}\relax%
\else%
\expandafter\BBQube@ProcessStringInner#2\BBQube@nil%
\fi%
}
\def\BBQube@ProcessString#1{\expandafter\BBQube@ProcessStringInner#1\BBQube@nil}
\lst@AddToHook{OutputOther}{%
\BBQube@ResetToken%
\expandafter\BBQube@ProcessString{\the\lst@token}%
\lst@token=\expandafter{\the\BBQube@token}%
}
\makeatother
\lstset{ % Code顯示
language=C++, % the language of the code
basicstyle=\footnotesize\ttfamily, % the size of the fonts that are used for the code
%numbers=left, % where to put the line-numbers
numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1, each line will be numbered
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=false, % adds a frame around the code
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)}, % if you want to add a comment within your code
morekeywords={constexpr}, % if you want to add more keywords to the set
keywordstyle=\bfseries\color{Blue1},
commentstyle=\itshape\color{Red4},
stringstyle=\itshape\color{Green4},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\NewDocumentCommand{\captureshell}{som}
{
\sdaau_captureshell:Ne \l__sdaau_captureshell_out_tl { #3 }
\IfBooleanT { #1 }
{% we may need to stringify the result
\tl_set:Nx \l__sdaau_captureshell_out_tl
{ \tl_to_str:N \l__sdaau_captureshell_out_tl }
}
\IfNoValueTF { #2 }
{
\tl_use:N \l__sdaau_captureshell_out_tl
}
{
\tl_set_eq:NN #2 \l__sdaau_captureshell_out_tl
}
}
\tl_new:N \l__sdaau_captureshell_out_tl
\cs_new_protected:Nn \sdaau_captureshell:Nn
{
\sys_get_shell:nnN { #2 } { } #1
\tl_trim_spaces:N #1 % remove leading and trailing spaces
}
\cs_generate_variant:Nn \sdaau_captureshell:Nn { Ne }
\ExplSyntaxOff
\begin{document}
\pagestyle{fancy}
\fancyfoot{}
%\fancyfoot[R]{\includegraphics[width=20pt]{ironwood.jpg}}
\fancyhead[L]{National Tsing Hua University Kenapsack}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\contentsname}{Contents}
\newcommand{\inputcode}[2]{
\subsection[#1]{#1}
\lstinputlisting{#2}
}
\textbf{
\scriptsize
\tableofcontents
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \newpage
\footnotesize
\input{content.tex}
\clearpage
\begin{tikzpicture}[every node/.style={minimum size=1cm-\pgflinewidth, outer sep=10pt}, scale=2]
\draw[step=0.2cm,color=gray] (0,0) grid (9,13);
\draw[step=1cm,color=black,line width=0.4mm] (0,0) grid (9,13);
\end{tikzpicture}
\clearpage
\begin{tikzpicture}[every node/.style={minimum size=1cm-\pgflinewidth, outer sep=10pt}, scale=2]
\draw[step=0.2cm,color=gray] (0,0) grid (9,13);
\draw[step=1cm,color=black,line width=0.4mm] (0,0) grid (9,13);
\end{tikzpicture}
\clearpage
\begin{tikzpicture}[every node/.style={minimum size=1cm-\pgflinewidth, outer sep=10pt}, scale=2]
\draw[step=0.2cm,color=gray] (0,0) grid (9,13);
\draw[step=1cm,color=black,line width=0.4mm] (0,0) grid (9,13);
\end{tikzpicture}
\end{document}