summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easybook/pages/chapter3.tex
blob: 2c7c27ce7f173c330253eee80817a168a7662c68 (plain)
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
% Chapter 3
\documentclass[../easybook-demo]{subfiles}
\begin{document}

\chapter{其它格式}\label{chap1}

\section{代码}\index{d@代码}
使用 \lstinline{listings} 宏包可以对代码格式进行高度定制,默认语言为 \lstinline{LaTeX},这里以 \lstinline{Python} 为例
\begin{lstlisting}[language = Python,caption = {python程序练习题}]
#!/usr/bin/python
# -*- coding: UTF-8 -*-
    
if __name__ == '__main__':
    ptr = []
    for i in range(5):
        num = int(raw_input('please input a number:\n'))
        ptr.append(num)
    print ptr    
\end{lstlisting}

\section{物理量}\index{w@物理量}
\lstinline{siunitx} 宏包的 \lstinline{\num} 命令可以输出科学计数法 \num{-21x.3e5},而 \lstinline{\SI} 命令可用来输出带有单位的量,比如 \SI{.5}{mol}。

\section{化学式}\index{h@化学式}
除了以普通公式的方式,化学式还可用 \lstinline{chemformula} 实现,无机化学式例如\ch{(NH4)2S}、\ch{[Cu(NH3)4]^2+}。
\[\ch{$x$ Na(NH4)HPO4 ->[$\Delta$] (NaPO3)_{$x$} + $x$ NH3 ^ + $x$ H2O}\]
有机化学式推荐使用 \lstinline{chemfig} 完成。
\[\zihao{-5}\chemfig[cram width=5pt]{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]
HN-[::+60]CH_3)=-(-HO)=)}\]

\clearpage
\section{引用}\index{y@引用}
使用 \lstinline{cleveref} 宏包的 \lstinline{\cref} 命令进行引用,将会自动检测环境并添加相应的前缀。
\subsection{索引}\index{y@引用!s@索引}
使用 \lstinline{imakeidx} 生成索引,仅做了简单的设置如将索引设为双栏并加入目录,其他选项可另外配置。

\subsection{脚注}\index{y@引用!j@脚注}
脚注应在注释与正文之间加细线分隔,使用 \lstinline{footmisc} 宏包设置,选项为悬挂缩进(\lstinline{hang})形式\footnote{这是一个悬挂缩进的脚注。\par 这是分段将会缩进两字符。}。这是自定义标记的脚注且不影响正常编号\Footnote{*}{这是可以自定义标记的脚注。}。

\subsection{边注}\index{y@引用!b@边注}
命令 \lstinline{\marginnote} 可以生成简单的边注\marginnote{这是一个边注。}。

\subsection{引用章节}\label{sec1}\index{y@引用!s@索引}
如引用\cref{chap1}、\cref{sec1}。

\subsection{参考文献}\index{y@引用!c@参考文献}
这是一个参考文献引用的范例\cite{1979Prospect}。引用多个文献,将引用标号中的多个文献序号按升序排列,若其中有2个以上的连续序号,则改用范围序号,例如\cite{1979Prospect,1989The,2010An}。

\section{行内盒子}\index{h@行内盒子}
设置了两个行内盒子,这个盒子 \concise[Aqua][fontupper = \rmfamily]{concise} 可以为抄录盒子有三个参数 \lstinline{[<颜色>][<配置>][<内容>]},行内盒子内容是必选参数其他可选。设置等宽字体可在配置参数中 \lstinline{fontupper = \ttfamily}。这个盒子 \fuzzy[yellow][fontupper = \ttfamily,colupper = black]{fuzzy} 的参数选项与上个盒子相同,具有模糊边缘类似高亮的效果。

\end{document}