Skip to content

Commit

Permalink
添加了封面,设置了整本书的格式
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 committed Oct 31, 2021
1 parent 2ebbfc9 commit 8d9f9d3
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
Binary file added fonts/Inconsolata-Bold.ttf
Binary file not shown.
Binary file added fonts/Inconsolata-Regular.ttf
Binary file not shown.
63 changes: 61 additions & 2 deletions src/_preamble.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
\documentclass{article}
\title{My Title}
\documentclass{book}

% Packages
\usepackage{xeCJK} % 中文支持
\usepackage{indentfirst} % 首段缩进
\usepackage{listings} % 代码环境
\usepackage{enumitem} % 列表环境
\usepackage{graphicx} % 插图
\usepackage{amsmath} % 某个包依赖
\usepackage[colorlinks,breaklinks,linktoc=page,allcolors=linkcolor]{hyperref} % 交叉引用
\usepackage{xcolor} % 颜色
\usepackage[font={it}]{caption} % 设置图表和代码文件标题
\usepackage[numbered]{bookmark} % 设置书签
\usepackage[pagestyles,clearempty]{titlesec} % 设置页眉格式
\usepackage[a4paper,left=2cm,right=2cm,bottom=3.67cm]{geometry} % 设置页边距

\setCJKmainfont[ItalicFont=楷体,BoldItalicFont=楷体]{宋体} % 设置中文正文字体
\setCJKmonofont{宋体} % 设置中文等宽字体
\setmainfont{Times New Roman} % 设置英文正文字体
\setmonofont[Path=../fonts/,BoldFont=Inconsolata-Bold.ttf]{Inconsolata-Regular.ttf} % 设置英文等宽字体

\linespread{1.4} % 设置行距
\CJKsetecglue{\,} % 设置中英文间的空格

\setlist{nosep} % 设置列表垂直间距为0
\setlist[enumerate,itemize]{leftmargin=*,listparindent=1em} % 设置列表项缩进

\newpagestyle{front}{ % 自定义页眉格式
\sethead[\thepage][][\chaptertitle] % 偶数页页眉格式
{\chaptertitle}{}{\thepage} % 奇数页页眉格式
\headrule % 页眉下水平分隔线
}

\newpagestyle{main}{ % 自定义页眉格式
\sethead[\thepage][][Chapter \thechapter: \quad \chaptertitle] % 偶数页页眉格式
{\thesection \quad \sectiontitle}{}{\thepage} % 奇数页页眉格式
\headrule % 页眉下水平分隔线
}

\definecolor{linkcolor}{RGB}{187, 92, 226} % 定义链接颜色
\definecolor{stringcolor}{RGB}{255, 77, 156} % 定义代码字符串颜色

\lstset{ % 设置代码环境格式
basicstyle = \ttfamily\footnotesize, % 字体大小
breaklines = true, % 允许折行
keywordstyle= \color{blue}, % 关键字样式
language = C, % 编程语言
stringstyle = \color{stringcolor}, % 字符串样式
commentstyle= \color{gray}\itshape, % 注释样式
frameround = tttt, % 圆角边框
rulecolor = \color{lightgray}, % 边框颜色
escapechar = `, % 逃逸字符
}

\lstnewenvironment{blacklisting} % 全黑代码环境,用于代码输出
{\lstset{keywordstyle=\color{black},stringstyle=\color{black},commentstyle=\color{black}}}
{}

\title{\textbf{xv6} \\ 一个简单的类Unix操作系统课程}
\author{Russ Cox \\ Frans Kaashoek \\ Robert Morris}

\begin{document}
Empty file added src/foreword.tex
Empty file.
12 changes: 11 additions & 1 deletion src/index.tex
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
Hello, world.
\maketitle

\setcounter{secnumdepth}{0}

\frontmatter
\pagestyle{front}
\tableofcontents
\include{foreword}

\mainmatter
\pagestyle{main}

0 comments on commit 8d9f9d3

Please sign in to comment.