-
Notifications
You must be signed in to change notification settings - Fork 12
/
Codebook-setup.tex
115 lines (106 loc) · 4.3 KB
/
Codebook-setup.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
% **************************************************
% Packages
% **************************************************
\usepackage{amsthm} % 定義,例題
\usepackage{amssymb} % 特殊符號
\usepackage{amsmath} % 數學排版
\usepackage{fontspec} % 設定字體
%\usepackage[T1]{fontenc}
\usepackage{xeCJK} % 使用中文字體
\usepackage{geometry} % 版面配置
\usepackage{color}
\usepackage[x11names]{xcolor}
\usepackage{listings} % 顯示code用的
%\usepackage[Glenn]{fncychap} % 排版,頁面模板
\usepackage{fancyhdr} % 設定頁首頁尾
\usepackage{graphicx} % Graphic
\usepackage{ifthen}
\usepackage{enumerate}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{multicol}
% **************************************************
% Information and Commands for Reuse
% **************************************************
\newboolean{UsingGeometryLandscape}
\setboolean{UsingGeometryLandscape}{true} % 是否使用橫版頁面
\newcommand{\NumberOfColumn}{4} % 每頁有幾欄
\newcommand{\UniversityName}{National Tsing Hua University} % 學校名稱
\newcommand{\TeamName}{Angry Crow Takes Flight!} % 隊名
\newcommand{\includecpp}[2]{ % 支援 C++ (.cpp)
\subsection{#1}
\lstinputlisting[language=C++]{#2}
}
\newcommand{\includepy}[2]{ % 支援 Python (.py)
\subsection{#1}
\lstinputlisting[language=python]{#2}
}
\newcommand{\includetex}[2]{ % 支援 Latex (.tex)
\subsection{#1}
\input{#2}
}
% for debug
\newcommand{\geometrylen}[1]{\csname Gm@#1\endcsname}
% **************************************************
% Load and Configure
% **************************************************
\ifthenelse{\boolean{UsingGeometryLandscape}}{\geometry{landscape}}{}
\geometry{
left=30pt,
top=50pt,
}
\setlength{\columnsep}{15pt} % 兩欄之間的間距
\setlength{\columnseprule}{0pt}
\setlength{\textheight}{\paperheight-67pt}
\setlength{\textwidth}{\paperwidth-45pt}
%\topmargin=0pt
%\headsep=5pt
%\footskip=0pt
%\marginparsep=0pt
%\marginparwidth=0pt
%\marginparpush=0pt
%\oddsidemargin=0pt
%\evensidemargin=0pt
%\setmainfont{Consolas}
%\setmainfont{Linux Libertine G}
%\setmainfont{sourcecodepro}
\setromanfont[Path=fonts/]{times new roman.ttf}[ % 為了顯示國際歌
BoldFont = times new roman bold.ttf,
]
\setmonofont[Path=fonts/]{consola.ttf}[ % 等寬字型
BoldFont = consolab.ttf,
ItalicFont = consolai.ttf,
]
\setCJKmainfont[Path=fonts/]{msjh.ttc} % 中文字型
\setCJKmonofont[Path=fonts/]{msjh.ttc} % 中文等寬字型
\XeTeXlinebreaklocale "zh" % 中文自動換行
\XeTeXlinebreakskip = 0pt plus 1pt % 設定段落之間的距離
\setcounter{secnumdepth}{3} % 目錄顯示第三層
\makeatletter
\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
\@empty\z@\@empty
\makeatother
% **************************************************
% Listing Format (程式碼顯示)
% **************************************************
\lstset{
basicstyle=\scriptsize\ttfamily, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\tiny, % 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={*}, % if you want to add more keywords to the set
keywordstyle=\bfseries\color{Blue1},
commentstyle=\itshape\color{Red4},
stringstyle=\itshape\color{Green4},
}