开始使用Latex写作啦!不过目前处于测试摸索阶段,欢迎提issue~

This commit is contained in:
skyel1u
2018-01-13 23:29:42 +08:00
parent c68ed33d4c
commit bf8f3d4038
62 changed files with 1443 additions and 0 deletions

14
tex/config/colors.tex Normal file
View File

@ -0,0 +1,14 @@
% Required packages:
% \usepackage{xcolor}
\definecolor{brandcolor}{RGB}{0, 148, 134}
\definecolor{LightGray}{RGB}{235,235,235}
\definecolor{Gray}{RGB}{210,210,210}
\definecolor{Blue}{RGB}{48,129,238}
\definecolor{HyperlinkBlue}{RGB}{0,0,195}
\definecolor{VioletBlue}{RGB}{102,51,153}

33
tex/config/config.tex Normal file
View File

@ -0,0 +1,33 @@
% Define the used document language in ISO 639-1 code
% see for more info https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
%--------------------------------------
\def\CONFIGLanguage{ZH}
%--------------------------------------
\def\CONFIGEnableTitlePage{true} % true or false
\def\CONFIGEnableDisclaimer{true} % true or false
\def\CONFIGEnableCopyright{true} % true or false
\def\CONFIGEnableTableOfContents{true} % true or false
\def\CONFIGEnableListOfFigures{true} % true or false
\def\CONFIGEnableListOfTables{true} % true or false
\def\CONFIGEnableListOfSnippets{true} % true or false
\def\CONFIGEnableListOfAbbreviations{true} % true or false
\def\CONFIGEnableAppendix{true} % true or false
\def\CONFIGEnableTableOfAppendix{true} % true or false
\def\CONFIGEnableReferences{true} % true or false
\def\CONFIGEnableIndex{true} % true or false
% check if document is oneside or twoside
% The type is set in main.tex in \documentclass[...]{...} -> line 2
%--------------------------------------
\makeatletter
\if@twoside
\def\CONFIGOneTwoSided{twoside}
\else
\def\CONFIGOneTwoSided{oneside}
\fi
\makeatother
%--------------------------------------
% Load basic packages for layout
\input{config/layout}

7
tex/config/images.tex Normal file
View File

@ -0,0 +1,7 @@
\def\IMGTitlePage{images/favicon/favicon_white_padding_192.png}
\def\IMGHeader{images/favicon/favicon_32.png}
\def\IMGHeaderColored{images/favicon/favicon_white_32.png}
\def\IMGExampleOne{images/content/ben-kolde-367194.jpg}
\def\IMGExampleTwo{images/content/nate-grant-346782.jpg}

162
tex/config/layout.tex Normal file
View File

@ -0,0 +1,162 @@
\usepackage{ifthen}
% page dimensions
%--------------------------------------
% see https://de.sharelatex.com/learn/Page_size_and_margins
\ifthenelse{\equal{\CONFIGOneTwoSided}{oneside}}
{
\usepackage{geometry}\geometry{
a4paper, % a4 size 210x297 mm
left=35mm,
right=20mm,
top=35mm,
bottom=25mm,
footskip=10mm,
headheight=20mm % required for header
}
}
{
\usepackage{geometry}\geometry{
a4paper, % a4 size 210x297 mm
twoside,
left=35mm,
right=20mm,
top=35mm,
bottom=25mm,
footskip=10mm,
headheight=20mm % required for header
}
}
%--------------------------------------
% reduce chapter margin
\renewcommand*{\chapterheadstartvskip}{\vspace*{0mm}}
% Multi line comments
%--------------------------------------
\usepackage{verbatim}
%--------------------------------------
% font
%--------------------------------------
\usepackage{fontspec}
\setmainfont[ExternalLocation=fonts/Roboto/,
BoldFont = Roboto-Bold.ttf,
ItalicFont = Roboto-Italic.ttf ,
BoldItalicFont = Roboto-BoldItalic.ttf]{Roboto-Regular.ttf}
% language Japanese
%--------------------------------------
\usepackage{xeCJK}
\setCJKmainfont[ExternalLocation=fonts/NotoSansCJKSC/,
BoldFont = NotoSansCJKsc-Bold.otf]{NotoSansCJKsc-Regular.otf}
%--------------------------------------
% set line height/spacing
\renewcommand{\baselinestretch}{1.5}
\ifthenelse{\equal{\CONFIGLanguage}{DE}}
{
% German hyphenation
\usepackage[ngerman]{babel}
\usepackage{csquotes}
}{}
%--------------------------------------
% Remove indentation
%--------------------------------------
\parindent0pt
%-------------------------------------
% Landscape
%--------------------------------------
\usepackage{pdflscape}
%--------------------------------------
% dictionary
%--------------------------------------
\input{dictionary/dictionary}
%--------------------------------------
% colors
%--------------------------------------
\usepackage[table]{xcolor}
\input{config/colors}
%--------------------------------------
% images
%--------------------------------------
\usepackage{graphicx}
% \input{config/images}
%--------------------------------------
% Tables
%--------------------------------------
\usepackage{longtable}
% alternate rowcolors for all long-tables
\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
%--------------------------------------
% date
%--------------------------------------
\usepackage[yyyymmdd]{datetime}
% format date
\renewcommand{\dateseparator}{--}
%--------------------------------------
% Header & footer
%--------------------------------------
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{etoolbox}
%--------------------------------------
% Enable linking e.g. for table of contents
%--------------------------------------
\usepackage{hyperref}
\urlstyle{rm}
%--------------------------------------
% Listings - e.g. List of code snippets
%--------------------------------------
\usepackage{listings}
% load style
\input{config/lstdefinestyle}
% init file variables
%\input{config/snippets}
%--------------------------------------
% Abbreviations
%--------------------------------------
\usepackage[printonlyused]{acronym}
%--------------------------------------
% Bibliography/References
%--------------------------------------
\usepackage[
backend=biber,
style=numeric,
sorting=ynt
% citestyle=chicago-authordate
]{biblatex}
% define reference resource
\addbibresource{base/bibliography/references.bib}
%--------------------------------------
% Index
%--------------------------------------
\usepackage{imakeidx}
% uncomment to at numbering
%\indexsetup{level=\chapter}
% Activate index commands
\makeindex
%--------------------------------------
% Appendix
%--------------------------------------
\usepackage{appendix}
\usepackage[german]{minitoc}
\usepackage{titletoc}
%--------------------------------------

View File

@ -0,0 +1,150 @@
% Default code style
\lstset{
frame=single,
captionpos=b,
lineskip=0.5em,
xleftmargin=\parindent,
belowskip=0em
}
\lstdefinestyle{customStyleBashDark}{
language=Bash,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{255,255,255},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{33,36,33},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{153,153,153},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{143,217,68},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{101,197,222},
stringstyle=\color[RGB]{236,118,0},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=single,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleBashLight}{
language=Bash,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{0,0,0},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{255,255,255},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{52,121,54},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{138,18,130},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{0,0,0},
stringstyle=\color[RGB]{0,0,192},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=shadowbox,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
rulesepcolor=\color{black},
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleJavaDark}{
language=Java,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{255,255,255},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{33,36,33},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{153,153,153},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{143,217,68},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{101,197,222},
stringstyle=\color[RGB]{236,118,0},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=single,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleJavaLight}{
language=Java,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{0,0,0},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{255,255,255},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{52,121,54},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{138,18,130},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{0,0,0},
stringstyle=\color[RGB]{0,0,192},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=shadowbox,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
rulesepcolor=\color{black},
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleHTMLDark}{
language=HTML,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{255,255,255},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{33,36,33},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{153,153,153},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{143,217,68},%style of keywords in source language (e.g. keywordstyle=\color{red})
identifierstyle=\color[RGB]{101,197,222},
stringstyle=\color[RGB]{236,118,0},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=single,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
usekeywordsintag=false,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}
\lstdefinestyle{customStyleHTMLLight}{
language=HTML,
numbers=left,%position of line numbers (left/right/none, i.e. no line numbers)
basicstyle=\footnotesize\ttfamily\color[RGB]{0,0,0},%font size/family/etc. for source (e.g. basicstyle=\ttfamily\small)
numberstyle=\color[RGB]{0,0,0},%style used for line-numbers
backgroundcolor=\color[RGB]{255,255,255},%colour for the background. External color or xcolor package needed.
commentstyle=\itshape\color[RGB]{52,121,54},%style of comments in source language.
keywordstyle=\bfseries\color[RGB]{138,18,130},%style of keywords in source language (e.g. keywordstyle=\color{red})
stringstyle=\color[RGB]{0,0,238},%style of strings in source language
belowcaptionskip=1\baselineskip,%is the vertical space respectively above or below each caption
breaklines=true,%automatic line-breaking
frame=shadowbox,%showing frame outside code (none/leftline/topline/bottomline/lines/single/shadowbox)
rulesepcolor=\color{black},
xleftmargin=\parindent,
showstringspaces=false,
captionpos=b,%position of caption (t/b)
showspaces=false,%emphasize spaces in code (true/false)
showtabs=false,%emphasize tabulators in code (true/false)
tabsize=4,%default tabsize
lineskip=0.5em,
usekeywordsintag=false,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{VioletBlue}\hookrightarrow\space}}
}