-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathpreamble.tex
164 lines (144 loc) · 3.93 KB
/
preamble.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
% vim: ts=4 sts=4 sw=4 et tw=75
% preamble here.
\documentclass[nofonts,oneside,fancyhdr]{ctexbook}
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{xeCJK}
\usepackage{amssymb}
\usepackage{hyperref}
% for number of footnote
\usepackage{pifont}
% 一页结束时, 脚注编号清零
\usepackage[perpage]{footmisc}
% verbatim and endverbatim
\usepackage{graphicx}
\usepackage{listings}
\usepackage{multicol}
\usepackage{tocloft}
\usepackage{fancyhdr}
% for bracketframe environment
\usepackage[tikz]{bclogo,rotating}
\usepackage{tikz}
\usepackage{mdframed}
\usepackage{minted}
\usepackage{pdfpages}
% for fixing "Unable to load picture or PDF file 'bc-book.mps'"
\DeclareGraphicsRule{.mps}{eps}{*}{}
% 脚注编号带圈
\renewcommand\thefootnote{\ding{\numexpr171+\value{footnote}}}
% from package geometry
% 为边注加边框
\let\oldmarginpar=\marginpar
\renewcommand\marginpar[1]{%
\oldmarginpar{\framebox{#1}}%
}
\geometry{%
margin=1cm,
marginparsep = 0.5cm,
marginparwidth=1cm,
top = 2.5cm,
bottom = 2cm,
outer = 1.8cm,
inner = 1.8cm
}
% 页面风格
\pagestyle{fancy}
\fancyhead[LE,RO]{\rightmark}
\fancyhead[LO,RE]{\leftmark}
\fancyfoot[C]{\thepage}
% from package hyperref
\hypersetup{
bookmarksnumbered = true,
pdftitle = {Hacking Vim 7.2},
pdfcreator = {wuzhouhui250@gmail.com},
pdfauthor = {Kim Schulz},
pdfsubject = {Vim},
colorlinks = false,
pdfborder = 0 0 0,
pdfkeywords = {vim, text editing}
}
\setCJKfamilyfont{heiti}{FandolHei}
% 章节格式
\CTEXsetup[format+={\CJKfamily{heiti}}]{section}
\CTEXsetup[format+={\textmd}]{section}
\CTEXsetup[format={\CJKfamily{heiti}\large\upshape}]{subsection}
\CTEXsetup[numberformat={\CJKfamily{heiti}\large\upshape\bfseries}]{subsection}
\CTEXsetup[format={\CJKfamily{heiti}}]{subsubsection}
% 目录格式
\renewcommand\cftchapfont{\CJKfamily{heiti}}
\settowidth\cftchapnumwidth{第几章} % 最宽的可能编号
% from package fontspec and xeCJK
\setCJKmainfont{FandolSong}
\setCJKsansfont{FandolSong}
\setCJKmonofont{FandolFang}
\setmainfont{Nimbus Roman No9 L}
\setsansfont{FreeSans}
% "Mapping={}" make quote symbol straight
\setmonofont[Mapping={}]{Courier 10 Pitch}
\newcommand\vi{\texttt{vi}}
\newcommand\vim{\texttt{vim}}
\usetikzlibrary{calc}
\newenvironment{bracketframe}[1]
{\par\medskip\noindent
\begin{tikzpicture}
\node[inner sep = 0pt] (box) \bgroup%
\begin{minipage}[t]{44em}
\begin{minipage}{6em}
\centering
\includegraphics[scale=1.8]{#1}
\end{minipage}%
\begin{minipage}{36em}
\par\smallskip
\surroundwithmdframed
[topline=false, bottomline=false, leftline=false, rightline=false,
backgroundcolor=lbcolor]
{minted}}% former part
{%
\end{minipage}\hfill
\end{minipage}%
\egroup;
\draw[black,line width=3pt]
( $ (box.north east) + (-5pt,3pt) $ ) -- ( $ (box.north east) + (0,3pt) $ )
-- ( $ (box.south east) + (0,-3pt) $ ) -- + (-5pt,0);
\draw[black,line width=3pt]
( $ (box.north west) + (5pt,3pt) $ ) -- ( $ (box.north west) + (0,3pt) $ )
-- ( $ (box.south west) + (0,-3pt) $ ) -- + (5pt,0);
\end{tikzpicture}
\par\medskip}
\newenvironment{warning}%
{
\begin{center}
\begin{minipage}{44em}
\begin{bracketframe}{./images/bc-book.mps}
}
{
\end{bracketframe}
\end{minipage}
\end{center}
}
\newenvironment{tips}%
{
\begin{center}
\begin{minipage}{44em}
\begin{bracketframe}{./images/bc-lampe.mps}
}
{
\end{bracketframe}
\end{minipage}
\end{center}
}
\newcommand\file[1]{\texttt{#1}}
\newcommand\newterm[1]{#1}
\newcommand\email[1]{\href{mailto:#1}{#1}}
\newcommand\key[1]{\textit{#1}}
\newenvironment{vimcmdform}
{\list{}{\leftmargin=2em\rightmargin=0em}\item[]}
{\endlist}
\lstnewenvironment{vimcode}
{\lstset{basicstyle=\ttfamily,
xleftmargin=2em,
breaklines=true,
tabsize=4}}
{}
\title{深入 Vim 7.2}
\author{Kim Schulz \and \url{https://github.com/wuzhouhui/hacking_vim} }