\documentclass[12pt]{article}
\usepackage[a4paper, margin=1in]{geometry}
% \usepackage{xeCJK}
\usepackage{amsfonts,amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref} 
\hypersetup{colorlinks,breaklinks,urlcolor=blue!50!black,linkcolor=blue}


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page layout 
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{titlesec}
\usepackage{extramarks,fancyhdr}

\pagestyle{fancy}
\lhead{\StudentName~\StudentNumber}
\chead{\Course: \Title}
\rhead{\firstxmark}
\lfoot{\lastxmark}
\cfoot{}
\rfoot{Page\ \thepage}
\renewcommand\headrulewidth{0.4pt}
\renewcommand\footrulewidth{0.4pt}


\titleformat{\section}{\normalfont\Large\bfseries}{Problem~\thesection.}{1em}{}

\newenvironment{homeworkProblem}[2][]%
  {
    \enterProblemHeader{Problem \the\numexpr\value{section}+1\relax}%
    \section{\ifx&#1&\else#1\hskip2ex\relax\fi\ifx&#2&\else {\normalfont\slshape\normalsize Collaborator(s): #2}\fi}%{#2}%
  }{%
    \exitProblemHeader{Problem \thesection}%
    \clearpage%
  }%

\newcommand{\enterProblemHeader}[1]{\extramarks{#1}{#1 continued on next page\ldots}
                                    \extramarks{#1 (conti.)}{#1 continued on next page\ldots}}%
\newcommand{\exitProblemHeader}[1]{\extramarks{#1 (conti.)}{}\extramarks{#1}{}}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% General macros
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\clap#1{\hbox to 0pt{\hss#1\hss}}

\newcommand\textunderset[2]{%
  \leavevmode
  \vtop{\offinterlineskip
    \halign{%
      \hfil##\hfil\cr % center
      \strut#2\cr
      \noalign{\kern-.3ex}
      #1\strut\cr
    }%
  }%
}
\newcommand\textoverset[2]{%
  \leavevmode
  \vbox{\offinterlineskip
    \halign{%
      \hfil##\hfil\cr % center
      \dynscriptsize\strut#1\cr
      \noalign{\kern-.3ex}
      #2\strut\cr
    }%
  }%
}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Math macros
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\providecommand{\deq}{\mathrel{:=}}
% \newcommand{\Tr}{\mathop{\operatorname{Tr}}}
% \newcommand{\Var}{\mathop{\operatorname{Var}}}
\providecommand\Ex{\mathop{\operatorname{\mathbb E}}}
\providecommand\IP[1]{\langle #1 \rangle}
\providecommand\bigIP[1]{\bigl\langle #1 \bigr\rangle}
\providecommand\BigIP[1]{\Bigl\langle #1 \Bigr\rangle}
\providecommand\biggIP[1]{\biggl\langle #1 \biggr\rangle}
\providecommand\BiggIP[1]{\Biggl\langle #1 \Biggr\rangle}
\providecommand{\getsr}{\stackrel{\smash{\$}}\gets}
% \providecommand{\pf}{\mathop{}\!p} % probability funciton, p.m.f. or p.d.f.
% \providecommand{\dKL}{\mathop{d_{\rm KL}}}
% \providecommand{\proj}{\operatorname{proj}}

\makeatletter
\def\metadef#1#2{%
% #1 csname
% #2 content
  \def\metadef@iter##1{\ifx##1;\else \expandafter\newcommand\csname#1\endcsname{#2}\expandafter\metadef@iter\fi}%
  \expandafter\metadef@iter%
}
\makeatother

% Vector
\metadef{vec#1}{\mathbf #1}abcdefghijklmnopqrstuvwxyz;
\newcommand\veczero{\mathbf 0}

% Tensor
\metadef{ten#1}{\mathbf #1}ABCDEFGHIJKLMNOPQRSTUVWXYZ;

% frak -> \mathfrak
\metadef{frak#1}{\mathfrak #1}ABCDEFGHIJKLMNOPQRSTUVWXYZ;

% c -> \mathcal
\metadef{c#1}{\mathcal #1}ABCDEFGHIJKLMNOPQRSTUVWXYZ;

% s -> \mathsf
\metadef{s#1}{\mathsf #1}ABCDEFGHIJKLMNOPQRSTUVWXYZ;

% double -> \mathbb
\metadef{#1#1}{\mathbb #1}ZRCFGHNQ;

\makeatletter
\@ifpackageloaded{mathtools}{}{
  \def\clap#1{\hbox to 0pt{\hss#1\hss}}
  \def\mathllap{\mathpalette\mathllapinternal}
  \def\mathrlap{\mathpalette\mathrlapinternal}
  \def\mathclap{\mathpalette\mathclapinternal}
  \def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}}
  \def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}
  \def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}}
}
\makeatother

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theoritial CS macros
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\negl}{\operatorname{negl}}
\newcommand{\poly}{\operatorname{poly}}
\newcommand{\bit}{\{0,1\}}
\providecommand{\lang}[1]{\textnormal{\textsf{#1}}}
\providecommand{\comp}[1]{\textnormal{\textbf{#1}}}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Other macros
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\providecommand{\Gen}{\textnormal{\textsf{Gen}}}
\providecommand{\Enc}{\textnormal{\textsf{Enc}}}
\providecommand{\Dec}{\textnormal{\textsf{Dec}}}
\providecommand{\Sign}{\textnormal{\textsf{Sign}}}
\providecommand{\Eval}{\textnormal{\textsf{Eval}}}

\renewcommand{\theequation}{\thesection.\arabic{equation}}
\numberwithin{equation}{section}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Personal info
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\Course}{Cryptography}
\newcommand{\Title}{Pset 100}
\newcommand{\StudentName}{Tianren Liu}
\newcommand{\StudentNumber}{1234567890}
\newcommand{\StudentClass}{}


\begin{document}
% \maketitle

\begin{homeworkProblem}{WEI Luojian, LIU Liqiang, YANG Xinye} %1

\paragraph{Part A.}
Environment \verb|homeworkProblem| is defined.
It takes an argument for announcing your collaborator(s).

To support Chinese, use package \texttt{xeCJK} and compile the tex file using \texttt{xelatex}.

\paragraph{Part B.}
Some macros are defined in this template, including
\begin{itemize}
  \item \verb|\deq|, is defined as

    This notion has other well-received variants, such as 
    $ \stackrel{\textnormal{\textit{\clap{def}}}}= $, or
    $ \stackrel{\triangle}= $

  \item \verb|\Ex|, expectation, $\Ex[X] \deq \sum_{x} x \Pr[X=x]$
  \item \verb|\IP|, inner product
  \item \verb|\getsr|, randomly sampled from a set, $b\getsr\bit$

    This notion has other well-received variants, such as 
    $b \stackrel{\smash{\textnormal{\textsc{r}}}}\gets \bit$,
    $b \stackrel{\smash{\textnormal{\textit{r}}}}\gets \bit$
  \item vectors, $\veca,\vecb,\dots$

    Anther well-received variant is $\vec a,\vec b,\dots$
  \item Real number $\RR$, rational number $\QQ$, integer $\ZZ$, finite field $\FF$
  \item \verb|\poly|, polynomial functions
  \item \verb|\negl|, negligible functions
  \item \verb|\Gen|, \verb|\Enc|, \verb|\Dec|, \dots, some common cryptography operations' names
\end{itemize}

\end{homeworkProblem}


\refstepcounter{section}%

\begin{homeworkProblem}{}

\paragraph{Part A.}
  \verb|\refstepcounter{section}| let you skip one problem.

\paragraph{Part B.}
  If you are interested in producing nice vector graphics,
  I recommend \texttt{tikz}.

\paragraph{Part C.}
  $\ell,\varepsilon,\varphi$
  are the ``more beautiful'' replacements of $l,\epsilon,\phi$.

\end{homeworkProblem}



\end{document}