LaTex笔记001-借助nexus模板

主要内容

最近在看 cs61a,原版的 textbook 中很多地方想做标注,就顺便利用 LaTex 整理了笔记。

主要借助了 nexus 模板和 xeboiboites 模板,简要记录下主要的 LaTex 语法。

nexus
(1) 封面

nexus 模板的 cover 主要在 titlepage.tex 文件中,由多个 textblock 组合成,在正文中通过 include{titlepage} 插入;

1
2
3
4
5
% textblock example
\begin{textblock}{1}(.1,.09)
\noindent{\fontsize{24.88}{2}\selectfont
\bfseries\textcolor{white}{SICP Notes}}
\end{textblock}
1
2
% insert titlepage into main text
\include{titlepage}
(2) 正文部分

主要的 latex 语法和注释如下:

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
% 定义文档类型
\documentclass[12pt,oneside]{book}

% bib引文
\usepackage[backend=bibtex]{biblatex}

% 借助宏包定义文档Geometry
\usepackage[a4paper,left=1.91cm,right=1.91cm, bottom=2.5cm,top=2.5cm]{geometry}

% 一些必备的宏包
\usepackage[utf8]{inputenc}
\usepackage{xeboiboites}
\usepackage{verbatim}
\usepackage{amsmath,amssymb}
\DeclareTextFontCommand{\emph}{\bfseries}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{ctex} % chinese
\usepackage{fontspec}
\setmainfont{Times New Roman}

%采用nexus模板并设置主题
\usepackage[palette=munch]{nexus}

% color
\usepackage{xcolor}

% hyperref
\usepackage[verbose]{hyperref}
\hypersetup{
hidelinks
}
%\usepackage[colorlinks,linkcolor=blue]{hyperref}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

% main text
\begin{document}

% titlepage
\include{titlepage}

% 设置行距
\renewcommand{\baselinestretch}{1.5}

% contents
\tableofcontents

% chapter & section & subsection
\chapter{}
\section{}
\subsection{}

% appendix
\begin{appendices}
'there also are multiple sections'
\end{appendices}
...
\end{document}
xeboiboites
(1) 构建组件

在文章中添加一些摘抄段落和代码部分,可通过 xeboiboites 实现,首先构建 boxes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
% 定义不同类型的box和使用方式

%定义摘抄的box格式
\newboxedtheorem[small box style={fill=blue!20,draw=black, line width=.7pt,
decoration={penciline},decorate},%
big box style={fill=blue!10,draw=black,thick,
decoration={penciline},decorate},
headfont=\bfseries]%
{propb}{Excerpts}{}

%定义想法的box格式
\newspanning[image=bulb,headfont=\bfseries,%
spanning style={very thick,decoration=penciline,decorate}]%
{method}{Thoughts}{}
(2) 使用组件

在文章使用 boxes:

1
2
3
4
5
6
7
8

% 添加摘抄
\begin{prob}[...]
\end{propb}

% 添加想法
\begin{method}[...]
\end{method}
(3) 组件效果

摘抄

想法

完整笔记示例

学习笔记示例:


LaTex笔记001-借助nexus模板
https://codingyyao.github.io/2022/12/27/latex-init/
作者
yuyao yang
发布于
2022年12月27日
许可协议