初步将文档基础类初步迁移到ElegantBook

merge-requests/11/head
xphi 4 years ago
parent 7676abc0e8
commit 4b89a51914

@ -0,0 +1,43 @@
%# -*- coding: utf-8-unix -*-
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{url}
\usepackage{array}
\usepackage{multirow}
\usepackage{lscape}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{shapes,decorations}
\usetikzlibrary{intersections,decorations.text}
\definecolor{c1}{RGB}{116, 52, 129}
\definecolor{c2}{RGB}{130, 80, 140}
\tcbuselibrary{minted}
\newtcblisting{code}[1][]{
center,
width=0.95\linewidth,
listing only,
breakable=true,
minted language=#1,
% frame empty,
extras={frame empty},
% minted style=colorful,
fontupper=\small,
minted options={ %自动移除前置空白、制表为4字符、mathhe和||内的不处理
breaksymbol=,
autogobble,
tabsize=4,
startinline,
breaklines,
mathescape
}
}
\newcommand{\cndash}{\rule{0.0em}{0pt}\rule[0.35em]{1.4em}{0.05em}\rule{0.2em}{0pt}}
\newcommand{\ch}{\titleformat{\chapter}[display]{\centering}{}{-3mm}{\Huge\bfseries}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}}%用来将需要的章节标题居中
\newenvironment{pre}{
\ch\chapter{前~~~~言}{}}{}

@ -1,23 +0,0 @@
%# -*- coding: utf-8-unix -*-
%======================================================================
%% Book Configurations
%======================================================================
\ProvidesFile{qbook.cfg}[2019/03/19 v1.00 Qbook configuration file]
\def\q@contentsname{目~~~~录}
\def\q@figurename{图}
\def\q@listfigurename{插图索引}
\def\q@tablename{表}
\def\q@listtablename{表格索引}
\def\q@overviewname{概~~~~览}
\def\q@pre{前~~~~言}
\def\q@label@thm{定理}
\def\q@label@defn{定义}
\def\q@label@keypoint{关键点}
\def\q@label@rem{注}
\def\q@label@prop{性质}
\def\q@label@proof{证明}
\def\q@label@lem{引理}
\def\q@label@cor{推论}
\def\q@label@exmp{例}
\def\q@value@listingname{算法}
\endinput

@ -1,425 +0,0 @@
%# -*- coding: utf-8-unix -*-
%=========================================================================
% instructions.cls for Computer Network Assigenment & Project Instructions
%=========================================================================
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{instructions}[2019/05/16 v2.01 Qbook Template]
\def\version{v2.01}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions\relax
\PassOptionsToClass{scheme=chinese}{ctexbook}
\PassOptionsToClass{zihao=-4}{ctexbook}
\PassOptionsToPackage{no-math}{fontspec}
\LoadClass[a4paper,UTF8]{ctexbook}
%========================================================================
% instructions.cfg
\AtEndOfClass{\input{instructions.cfg}}
%========================================================================
% LaTeX
\RequirePackage{extarrows}
\RequirePackage{eso-pic}
\RequirePackage{url}
\RequirePackage{environ}
\RequirePackage{manfnt,pifont}
\RequirePackage{titlesec}
\RequirePackage{float}
\RequirePackage{wallpaper}
\RequirePackage[breakable,minted]{tcolorbox}
\RequirePackage{xpatch}
\RequirePackage[centering,a4paper,body={16cm,22cm}]{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\RequirePackage{amsmath,mathtools,amsthm,amsfonts,amssymb,bm}
% \RequirePackage{sourcecodepro}
\RequirePackage{upgreek}
\RequirePackage{wasysym}
\RequirePackage{anyfontsize}
\RequirePackage{metalogo,doc}
\RequirePackage{array}
\RequirePackage{threeparttable}
\RequirePackage{dcolumn}
\RequirePackage{multirow}
\RequirePackage{booktabs}
\RequirePackage{graphicx}
\RequirePackage[labelformat=empty]{caption}
\RequirePackage[list=off]{bicaption}
\RequirePackage{subcaption}
\RequirePackage[backend=biber, hyperref=auto,maxnames=4]{biblatex}
\RequirePackage{xcolor}
\RequirePackage{listings}
\RequirePackage[unicode, xetex, bookmarksnumbered, colorlinks, urlcolor=blue, linkcolor=purple, citecolor=red, plainpages=false, pdfstartview=FitH]{hyperref}
\RequirePackage{bookmark}
\bookmarksetup{
open,
numbered
}
\RequirePackage{longtable}
\RequirePackage[perpage, bottom]{footmisc}
\RequirePackage[inline]{enumitem}
\RequirePackage{pdfpages}
\RequirePackage{calc}
\RequirePackage{algorithm, algorithmicx, algpseudocode}
\RequirePackage{siunitx}
\RequirePackage{tikz}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\usepackage{setspace}
\usepackage{lscape}
% \usepackage{makecell}
%======================================================================
% tikz
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{shapes,decorations}
\usetikzlibrary{intersections,decorations.text}
%======================================================================
% PDF
\hypersetup{
pdfauthor = {},
pdftitle = {},
pdfkeywords = {}}
%======================================================================
%
\g@addto@macro\backmatter{
\renewcommand{\em}{\itshape} %
\renewcommand{\refname}{}
\renewcommand{\bibname}{}
}
\DefineBibliographyStrings{english}{%
in = {},
editor = {},
byeditor = {},
}
%======================================================================
%
\newcommand{\watermark}[3]{\AddToShipoutPictureBG{
\parbox[b][\paperheight]{\paperwidth}{
\vfill%
\centering%
\tikz[remember picture, overlay]%
\node [rotate = #1, scale = #2] at (8.5,-13)%
{\textcolor{gray!80!cyan!30}{#3}};
\vfill}}}
%======================================================================
%
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{LightGoldenrod}{RGB}{238,221,130}
\definecolor{sthlmGreen}{RGB}{0,134,127}
\definecolor{Gold}{RGB}{255,215,0}
\definecolor{C1}{RGB}{32,88,153}
\definecolor{C2}{RGB}{218,222,238}
\definecolor{tssteelblue}{RGB}{0,40,220}
\definecolor{tsorange}{RGB}{255,138,88}
\definecolor{tsblue}{RGB}{23,74,117}
\definecolor{tsforestgreen}{RGB}{21,122,81}
\definecolor{tsyellow}{RGB}{255,185,88}
\definecolor{tsgrey}{RGB}{200,200,200}
\definecolor{main}{RGB}{0,120,2}
\definecolor{seco}{RGB}{230,90,7}%
\definecolor{thid}{RGB}{0,160,152}%
\definecolor{bule}{RGB}{18,29,57}
\definecolor{bablue}{RGB}{248,248,248}
\definecolor{c1}{RGB}{116, 52, 129}
\definecolor{c2}{RGB}{130, 80, 140}
\definecolor{c3}{RGB}{230, 180, 240}
\definecolor{c4}{RGB}{100, 172, 174}
\definecolor{c5}{RGB}{95, 162, 162}
%======================================================================
% yyyy-mm-dd
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
\renewcommand{\today}{\number\year-\twodigits\month-\number\day}
%======================================================================
\setcounter{secnumdepth}{4} % (part -1)
\setcounter{tocdepth}{1} % (part -1)
\newcolumntype{d}[1]{D{.}{.}{#1}}% or D{.}{,}{#1} or D{.}{\cdot}{#1}
%======================================================================
\newcommand{\cndash}{\rule{0.0em}{0pt}\rule[0.35em]{1.4em}{0.05em}\rule{0.2em}{0pt}}
\newcommand{\ch}{\titleformat{\chapter}[display]{\centering}{}{-3mm}{\Huge\bfseries}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}}%
%======================================================================
%
\linespread{1.3}
%======================================================================
%
\ctexset{contentsname={\q@contentsname}}
\ctexset{listfigurename={\q@listfigurename}}
\ctexset{listtablename={\q@listtablename}}
\renewcommand{\lstlistingname}{\q@value@listingname}
%======================================================================
%
\ctexset{chapter/name={,}}
\titleformat{\chapter}[display]{\flushleft}{
\begin{tikzpicture}
\node[anchor=south west] (chap) at (0,1.3){
\Large\heiti {\zhnumber{\thechapter}}};
\path [left color=c1,right color=c3] (0,-0.3) rectangle (\textwidth,-0.5);
\path(0,-0.2);
\end{tikzpicture}
}{-30mm}{\Huge\heiti}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
%======================================================================
% section
\ctexset{section/break = \Needspace{\textheight}}
\ctexset{section={
name={},
format={\color{tssteelblue}\Large\bfseries\centering},
afterskip={1.0ex \@plus .2ex},
}
}
%======================================================================
% subection
\ctexset{subsection={
format={\color{tssteelblue}\bfseries\normalsize},
indent={0\ccwd},
afterskip={1.0ex \@plus .2ex},
number={\chinese{subsection}~.}
}
}
%======================================================================
% subsubection
\ctexset{subsubsection={
format={\bfseries\normalsize},
indent={0\ccwd},
afterskip={1.0ex \@plus .2ex},
number={\arabic{subsection}.\arabic{subsubsection}}
}
}
%======================================================================
% paragraph
\ctexset{paragraph={
format={\normalfont\normalsize},
indent={0\ccwd},
number={\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}}
}
}
%======================================================================
% itembullet
\renewcommand{\labelitemi}{\ensuremath{\RHD}}
%======================================================================
%
\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg,.jpeg}
%======================================================================
%
\DeclareCaptionFont{kaishu}{\kaishu}
\captionsetup{format=plain,labelformat=simple,labelsep=space,justification=centering,font={small,kaishu}}
\captionsetup[sub]{font=footnotesize}
\DeclareCaptionOption{bi-first}[]{
\def\tablename{\q@tablename}
\def\figurename{\q@figurename}
}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table}
\def\figurename{Figure}
}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}
%======================================================================
% Set fontnote font size in threeparttable
\appto\TPTnoteSettings{\footnotesize}
%======================================================================
%
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
%======================================================================
% "3.1"
\numberwithin{figure}{section}
\numberwithin{table}{section}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}--\arabic{figure}}
\renewcommand\p@subfigure{\thefigure}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{section}--\arabic{table}}
\AtBeginDocument{\renewcommand{\thelstlisting}{\arabic{chapter}--\arabic{lstlisting}}}
%======================================================================
% 使enumitem
\setlist{nosep} %
\setlist[itemize]{label=$\bullet$}
\setlist*{leftmargin=*} %
\setlist[1]{labelindent=\parindent} % Only the level 1
%======================================================================
% listings/lstlistings
\lstset{
tabsize=4, %
frame=shadowbox, %
commentstyle=\color{red!50!green!50!blue!50}, %
rulesepcolor=\color{red!20!green!20!blue!20}, %
keywordstyle=\color{blue!90}\bfseries, %
showstringspaces=false, %
stringstyle=\ttfamily, %
keepspaces=true, %
numbers=left, %
stepnumber=1, %
numberstyle=\tiny, %
basicstyle={\footnotesize\ttfamily}, %
showspaces=false, %
flexiblecolumns=true, %
breaklines=true, %
breakautoindent=true, %
breakindent=4em, %
aboveskip=1em, %
fontadjust,
captionpos=t,
framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-9pt,belowcaptionskip=9pt,
xleftmargin=2em,xrightmargin=2em, % listing
texcl=true,
% listing
extendedchars=false,columns=flexible,mathescape=true
numbersep=-1em
}
%======================================================================
% Setting Package siunitx
\sisetup{detect-all} % Detecting fonts
%======================================================================
% keypoint
\tcbset{
commondef/.style={
fontupper=\kaishu,
lower separated=false,
coltitle=white,
colback=yellow!20,
fonttitle=\heiti\bfseries,
enhanced,
breakable,
top=10pt,
left=8pt,
% bottom=6pt,
before skip=8pt,
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
},
commonthm/.style={
fontupper=\kaishu,
lower separated=false,
coltitle=white,
colback=blue!10,
fonttitle=\heiti\bfseries,
enhanced,
breakable,
top=10pt,
% bottom=6pt,
before skip=8pt,
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
},
common/.style={
fontupper=\kaishu,
lower separated=false,
coltitle=white,
colback=gray!10,
fonttitle=\heiti\bfseries,
enhanced,
breakable,
top=10pt,
% bottom=6pt,
before skip=8pt,
attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
},
defstyle/.style={
commondef,
colframe=seco,
colbacktitle=seco,
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{seco}{$\clubsuit$}}; },
separator sign none
},
thmstyle/.style={
common,
colframe=main,
colbacktitle=main,
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{main}{$\heartsuit$}}; },
separator sign none
},
propstyle/.style={
common,
colframe=thid,
colbacktitle=thid,
overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{thid}{$\spadesuit$}}; },
separator sign none
},
}
\newenvironment{remark}
{\begin{observation}} {\end{observation}}
%======================================================================
% x.y
\newcommand{\requ}[1]{(\ref{#1})}
\newcommand{\rremark}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rfig}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rtab}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rprop}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rdef}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\rthm}[1]{\text{{\color{purple}{}}} \ref{#1}}
\newcommand{\mylem}[1]{\text{} \ref{#1}}
\newcommand{\rexa}[1]{\text{{\color{purple}{}}} \ref{#1}}
\renewcommand{\proofname}{\bfseries\q@label@proof}
%======================================================================
%
\newcommand\q@fancyhead{\small\kaishu}
\def\markboxwidth{0.75\textwidth}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptername}{\zhnumber{\thechapter}}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ #1}{}}
\fancyhead[LE,RO]{\sffamily\normalsize\thepage} %
\fancyhead[LO]{\nouppercase{\q@fancyhead\rightmark}} %
\fancyhead[RE]{\nouppercase{\q@fancyhead\leftmark}} %
\renewcommand{\headrulewidth}{0.5pt}
\addtolength{\headheight}{2.5pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}
%======================================================================
% Removes the header from odd empty pages at the end of chapters
% \makeatletter
% \renewcommand{\cleardoublepage}{
% \clearpage\ifodd\c@page\else
% \hbox{}
% \vspace*{\fill}
% \thispagestyle{empty}
% \newpage
% \fi}
%======================================================================
%
\newenvironment{pre}{
\ch\chapter{\q@pre}{}}{}
%======================================================================
%
\newenvironment{overview}{
\ch\chapter{\q@overviewname}{}}{}
%======================================================================
%
\renewcommand\tableofcontents{%
\cleardoublepage
\pdfbookmark[0]{\contentsname}{toc}
\chapter*{\centerline{\contentsname}}
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
\@starttoc{toc}%
}
\addtocontents{toc}{\let\string\CTEX@spaceChar\relax}
%======================================================================
%
\newtcblisting{code}[1][]{
center,
width=0.95\linewidth,
listing only,
breakable=true,
minted language=#1,
% frame empty,
extras={frame empty},
% minted style=colorful,
fontupper=\small,
minted options={ %4mathhe||
breaksymbol=,
autogobble,
tabsize=4,
startinline,
breaklines,
mathescape
}
}
%======================================================================
\renewcommand{\baselinestretch}{1.5}
\endinput

@ -1,11 +1,9 @@
%# -*- coding: utf-8-unix -*-
%=========================================================================
% instructions.tex for Computer Network Assigenment & Project Instructions
%=========================================================================
% 双面打印
% \documentclass[fontset=fandol]{../format/instructions}
\documentclass[]{instructions}
\addbibresource{../bib/main.bib} % 导入参考文献数据库
\documentclass[cn]{elegantbook}
\input{config}
\begin{document}
\pagestyle{empty}
\input{../data/cover} % 载入封面
@ -46,7 +44,7 @@
%======================================================================
% 正文内容
\pagestyle{fancy}
% \pagestyle{fancy}
\setcounter{page}{1}
% “网络抓包与协议分析”
@ -86,21 +84,21 @@
\input{../data/ch_sdn-openbox/sec_ns}
%=========================================================================
% 附录
\appendix
\titleformat{\chapter}[display]{\flushleft}{
\begin{tikzpicture}
\node[anchor=south west] (chap) at (0,1.3){
\Large\heiti {附录\Alph{chapter}}};
\path [left color=c1,right color=c3] (0,-0.3) rectangle (\textwidth,-0.5);
\path(0,-0.2);
\end{tikzpicture}
}{-30mm}{\Huge\heiti}
\titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
\renewcommand{\thefigure}{\Alph{chapter}--\arabic{figure}}
\renewcommand{\thetable}{\Alph{chapter}--\arabic{table}}
\renewcommand{\chaptername}{附录\Alph{chapter}}
% % %=========================================================================
% % % 附录
% % \appendix
% % \titleformat{\chapter}[display]{\flushleft}{
% % \begin{tikzpicture}
% % \node[anchor=south west] (chap) at (0,1.3){
% % \Large\heiti {附录\Alph{chapter}}};
% % \path [left color=c1,right color=c3] (0,-0.3) rectangle (\textwidth,-0.5);
% % \path(0,-0.2);
% % \end{tikzpicture}
% % }{-30mm}{\Huge\heiti}
% % \titlespacing{\chapter}{0pt}{0pt}{2\baselineskip}
% % \renewcommand{\thefigure}{\Alph{chapter}--\arabic{figure}}
% % \renewcommand{\thetable}{\Alph{chapter}--\arabic{table}}
% % \renewcommand{\chaptername}{附录\Alph{chapter}}
% 速查手册
\graphicspath{{../figure/appendixes/cheat_sheet/}}

@ -1,48 +1,11 @@
%# -*- coding: utf-8-unix -*-
\thispagestyle{empty}
\begin{tikzpicture}[overlay,remember picture,font=\sffamily\bfseries]
% \draw[ultra thick,c4,name path=big arc] ([xshift=-2mm]current page.north) arc(150:285:11)
% coordinate[pos=0.225] (x0);
% \begin{scope}
% \clip ([xshift=-2mm]current page.north) arc(150:285:11) --(current page.north
% east);
% \fill[c4!50,opacity=0.25] ([xshift=4.55cm]x0) circle (4.55);
% \fill[c4!50,opacity=0.25] ([xshift=3.4cm]x0) circle (3.4);
% \fill[c4!50,opacity=0.25] ([xshift=2.25cm]x0) circle (2.25);
% \draw[ultra thick,c4!50] (x0) arc(-90:30:6.5);
% \draw[ultra thick,c4] (x0) arc(90:-30:8.75);
% \draw[ultra thick,c4!50,name path=arc1] (x0) arc(90:-90:4.675);
% \draw[ultra thick,c4!50] (x0) arc(90:-90:2.875);
% \path[name intersections={of=big arc and arc1,by=x1}];
% \draw[ultra thick,c4,name path=arc2] (x1) arc(135:-20:4.75);
% \draw[ultra thick,c4!50] (x1) arc(135:-20:8.75);
% \path[name intersections={of=big arc and arc2,by={aux,x2}}];
% \draw[ultra thick,c4!50] (x2) arc(180:50:2.25);
% \end{scope}
% \path[decoration={text along path,text color=c4,
% raise = -2.8ex,
% text along path,
% text = {|\sffamily\bfseries|计算机网络教案社区},
% text align = center,
% },
% decorate
% ] ([xshift=-2mm]current page.north) arc(150:245:11);
\begin{scope}
\path[clip,postaction={fill=c2}]
([xshift=2cm,yshift=2cm]current page.center) rectangle ++ (4.2,7.7);
% \fill[c2] ([xshift=0.5cm,yshift=2cm]current page.center)
% ([xshift=0.5cm,yshift=2cm]current page.center) arc(180:60:2)
% |- ++ (-3,6) --cycle;
% \draw[ultra thick,c4] ([xshift=-1.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \draw[ultra thick,c4] ([xshift=0.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \draw[ultra thick,c4] ([xshift=2.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \draw[ultra thick,c4] ([xshift=4.5cm,yshift=2cm]current page.center)
% arc(180:0:2);
% \fill[red] ([xshift=2.5cm,yshift=-8cm]current page.center) +(60:2) circle(1.5mm);
\path[clip,postaction={fill=c2}]
([xshift=2cm,yshift=2cm]current page.center) rectangle ++ (4.2,7.7);
\end{scope}
\fill[c1] ([xshift=2cm,yshift=2cm]current page.center) rectangle ++ (-13.7,7.7);

Loading…
Cancel
Save