Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
218 lines (196 sloc) 6.03 KB
%
% LaTeX配置文件
%
\documentclass[UTF8, a4paper, 11pt, twoside, punct = CCT]{ctexbook}
% 页面设置
\usepackage[top=3.0cm, bottom=2.0cm, left=3.5cm, right=2.5cm]{geometry}
\ctexset{
contentsname = {目 \quad 录},
listfigurename = {图目录},
listtablename = {表目录},
chapter/number = \arabic{chapter},
section/format+ = \raggedright,
subsection/beforeskip = 0.25ex,
subsection/afterskip = 0.25ex,
subsubsection/beforeskip = -.1ex,
subsubsection/afterskip = .1ex,
}
\addtolength{\parskip}{3pt} % 段落间距
%设置SACTitle为subsection格式
\newcommand{\SACTitle}[1]{\subsection*{#1}}
\newcommand{\SACCMD}[1]{\section{\texttt{#1}}}
% 文档相关信息
\newcommand{\SACDOCTITLE}{SAC\textbf{参考手册}} % 文档标题
\newcommand{\SACDOCAUTHOR}{SeisMan} % 文档作者
\newcommand{\SACDOCVERSION}{3.6-dev} % 文档版本
\newcommand{\SACDOCDATE}{\today} % 文档更新日期
\newcommand{\SACVERSION}{101.6a} % SAC版本
\usepackage{datetime2} % \today格式为YYYY-MM-DD
\usepackage[dvipsnames, svgnames]{xcolor} % 颜色
\usepackage{titletoc} % 目录设置
\setcounter{tocdepth}{2} % 目录深度
\titlecontents{chapter}[0em] %
{\vspace{0.2em}\bfseries\large}
{\thecontentslabel\quad}
{\hspace*{0em}}
{\hfill \contentspage}
\titlecontents{section}[1em] %
{\normalsize}
{\thecontentslabel\quad}
{\hspace*{0em}}
{\ \dotfill \ \contentspage}
[\vspace{-0.3em}]
\titlecontents{subsection}[3em] % 小节
{\small}
{\thecontentslabel\quad}
{\hspace*{0em}}
{\ \dotfill \ \contentspage}
[\vspace{-0.3em}]
% 双栏目录
\usepackage{multicol}
\makeatletter
\renewcommand{\tableofcontents}{%
\setlength{\columnsep}{2.5em}
\begin{multicols}{2}[\chapter*{\contentsname}]%
\@starttoc{toc}%
\end{multicols}}
\makeatother
% 页眉页脚设置
\usepackage{titleps}
\newpagestyle{body}[\small]{
\sethead
[$\cdot$~\thepage~$\cdot$][][\S\,\thesection\quad\sectiontitle]
{\CTEXthechapter\quad\chaptertitle}{}{$\cdot$~\thepage~$\cdot$}
\setfoot{}{}{}\headrule
}
% 空白页
\makeatletter % copy from lnotes
\def\cleardoublepage{
\clearpage
\if@twoside
\ifodd
\c@page
\else
\hbox{}
\vspace*{\fill}
\begin{center}
保护环境,从阅读电子文档开始!
\end{center}
\vspace{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn
\hbox{}
\newpage
\fi
\fi
\fi
}
\makeatother
% 超链接及书签
\usepackage[
CJKbookmarks=true,
colorlinks=true,
linkcolor=blue,
citecolor=blue,
urlcolor=blue
]{hyperref}
\hypersetup{ % 文档元信息
pdftitle={\SACDOCTITLE v\SACDOCVERSION},
pdfauthor={\SACDOCAUTHOR},
}
% 代码宏包
\usepackage{listings}
\lstset{
basicstyle=\footnotesize\ttfamily,
xleftmargin=2pc, % 整体布局
xrightmargin=2pc,
backgroundcolor=\color{Lavender}, % 背景色
rulecolor=\color{Silver}, % 边框颜色
frame=single, % 边框
columns=flexible,
}
\lstdefinelanguage{SAC} {
keywords={SAC>}, % SAC提示符
otherkeywords={SAC>, SAC/SSS>}, % SAC提示符
sensitive=true,
comment=[l][{\color[rgb]{0,0.4,0}}]{//},
}
\lstnewenvironment{SACCode}{
\lstset{
language={SAC}, % 语言
keywordstyle=\color{blue}, % 关键字颜色
}
}{}
\lstnewenvironment{SACSTX}{
\lstset{delim=[is][\textcolor{gray}]{!}{!}}
}{}
\lstnewenvironment{SACDFT}{}{}
\usepackage{minted}
\setminted{linenos, frame=leftline, xleftmargin=2pc, numbersep=6pt, breaklines=true}
\setminted[console]{linenos=false, frame=none, fontsize=\small}
% 解决代码复制问题
% http://tex.stackexchange.com/questions/83204/
\usepackage{accsupp}
\newcommand\emptyaccsupp[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}}
\let\theHFancyVerbLine\theFancyVerbLine
\def\theFancyVerbLine{\rmfamily\tiny\emptyaccsupp{\arabic{FancyVerbLine}}}
\usepackage{enumitem} % 列表宏包
% itemsep 设置列表间距; topsep 设置列表前间距
\setenumerate{
itemsep=-3pt, partopsep=0pt, parsep=\parskip, topsep=0pt
}
\setitemize{
itemsep=-3pt, partopsep=0pt, parsep=\parskip, topsep=0pt
}
\setdescription{
itemsep=-3pt, partopsep=0pt, parsep=\parskip,
topsep=0pt, itemindent=0pt
}
\usepackage{float} % 图表浮动体
% 图片
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{longtable} % 长表格
\usepackage{booktabs} % 三线表
% 图表标题
\usepackage[labelfont={small,bf}, textfont=small]{caption}
\captionsetup[figure]{aboveskip=6pt, belowskip=-12pt}
\captionsetup[table]{aboveskip=6pt, belowskip=-6pt}
% 数学相关
\usepackage{siunitx} % 数字与单位
\sisetup{per-mode = symbol}
% 符号
\usepackage{pifont}
\usepackage[perpage]{footmisc} % 脚注在每一页单独编号
% 脚注中verb http://tex.stackexchange.com/questions/203
\usepackage{fancyvrb}
\VerbatimFootnotes
% 自定义quote环境
% http://tex.stackexchange.com/questions/16964/
\usepackage{framed}
\newcommand*\openquote{\makebox(25,-22){\scalebox{5}{``}}}
\newcommand*\closequote{\makebox(25,-22){\scalebox{5}{''}}}
\colorlet{shadecolor}{Azure}
\makeatletter
\newif\if@right
\def\shadequote{\@righttrue\shadequote@i}
\def\shadequote@i{\begin{snugshade}\begin{quote}\openquote}
\def\endshadequote{%
\if@right\hfill\fi\closequote\end{quote}\end{snugshade}}
\@namedef{shadequote*}{\@rightfalse\shadequote@i}
\@namedef{endshadequote*}{\endshadequote}
\makeatother
% https://github.com/ElegantLaTeX/elegant/blob/master/elegantnote.cls
\usepackage{manfnt}
\newenvironment{note}{
\par\ttfamily\itshape\noindent{
\makebox[0pt][r]{
\scriptsize\color{red!90}\textdbend\quad
}\textbf{Note:}
}
}{\par\vspace{.5\baselineskip}}
% 使用 !text! 代替 \texttt{text}
\lstMakeShortInline[basicstyle=\small\ttfamily]{!}