% -----------------------
% CUSTOM PREAMBLE STUFF
% -----------------------
\usepackage{xeCJK}
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{float}
\usepackage[normalem]{ulem}
\usepackage{hyperref}
\usepackage{nameref} %needed by zref-xr
\usepackage{xr-hyper}
\usepackage[normalem]{ulem}
\usepackage{setspace}
\usepackage{lineno}
\usepackage{caption}
\captionsetup{singlelinecheck=off}
\usepackage[UTF8, scheme=plain]{ctex}
\usepackage{orcidlink}
\usepackage{eso-pic}

\usepackage{ctexcap}  % 中文标题处理
\usepackage[perpage]{footmisc} % 脚注每页重置
\setlength{\parindent}{2em}  % 中文段落缩进2字符

\setCJKmainfont[AutoFakeBold=true]{SimHei}
\setCJKsansfont[AutoFakeBold]{Microsoft YaHei}
% \setCJKmonofont[AutoFakeBold]{KaiTi}



% -----------------
% Title block stuff
% -----------------

% Title
\makeatletter
\renewcommand{\title}[1]{\gdef\@title{\Huge\textbf{#1}}} % Adjust \Huge or other font commands
\makeatother


% ------------------
% Section headings
% ------------------
\usepackage{titlesec}
\titleformat*{\section}{\Large\sffamily\bfseries\raggedright}
\titleformat*{\subsection}{\large\sffamily\bfseries\raggedright}
\titleformat*{\subsubsection}{\normalsize\sffamily\bfseries\raggedright}
\titleformat*{\paragraph}{\small\sffamily\bfseries\raggedright}

%\titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>}
% Starred version removes indentation in following paragraph
\titlespacing*{\section}{0em}{2em}{0.1em}
\titlespacing*{\subsection}{0em}{1.25em}{0.1em}
\titlespacing*{\subsubsection}{0em}{0.75em}{0em}

% ------------------
% Headers/Footers
% ------------------
\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhf{}
\fancyhead[L,C,R]{}
\fancyfoot[L,C]{}
\fancyfoot[R]{\thepage}
  \fancyfootoffset{3.5cm}
\renewcommand{\headrulewidth}{1pt}
\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}%
    \fancyhf{}%
    \fancyfoot[R]{\thepage}%
}
\renewcommand\footnoterule{\rule{\linewidth}{0.1pt}\vspace{5pt}}

% ------------------
% Captions
% ------------------
\usepackage[labelfont=bf,labelsep=period]{caption}
\captionsetup[figure]{font=footnotesize,justification=raggedright,singlelinecheck=false,format=hang}


% ---------------------------
% END CUSTOM PREAMBLE STUFF
% ---------------------------
%
%
%% Let's define some colours
\definecolor{light}{HTML}{ECF1EC}
\definecolor{highlight}{HTML}{800080}
\definecolor{dark}{HTML}{330033}

%% Let's add the border on the left hand side 
\AddToShipoutPicture{% 
    \AtPageLowerLeft{% 
        \put(0,0){% % 从页面左下角(0,0)开始
            \color{light}\rule{2.4cm}{\LenToUnit\paperheight}% % 左侧3cm宽的边框
          }%
     }%
     % logo
    \AtPageLowerLeft{% start the bar at the bottom left of the page
        \put(0.5cm,27.2cm){% % 从左侧边缘向右移动0.75cm，垂直位置27.2cm
            \color{light}\includegraphics[width=1.5cm]{_extensions/drwater/dwbk/logo.png}
          }%
     }%
}

