%% ******************************************************
%% * This work may be distributed and/or modified under *
%% * the conditions of the LaTeX Project Public License *
%% *     http://www.latex-project.org/lppl.txt          *
%% * either version 1.3c of this license or any later   *
%% * version.                                           *
%% ******************************************************
\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage{pdfpages}
\usepackage[level]{datetime}
\usepackage{unicode-math}
\usepackage{authblk}
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{NotoSansMono}[
  Scale=MatchLowercase,
  Extension=.ttf,
  UprightFont=*-Light,
  BoldFont=*-Medium
]
\makeatletter
\usepackage{listings,dirtree}
\lstdefinestyle{TeX}{
    language      =  [LaTeX]TeX,
    texcsstyle    =  *\color{H7},
    numbers       =  none,
    basicstyle    =  {\small\color{H6}\tt},
    mathescape    =  false,
    breaklines    =  true,
    columns       =  fixed,
    keywordstyle  =  \color{H3},
    commentstyle  =  \color{darkgray},
    tabsize       =  2,
    keywords      =  {mail,flyleaf,sticker,logo,notebook,chapter,newnote,newnotesss,newnotessss,emptynote,emptyhdunote}
}
\usepackage{hyperref,xcolor,verbatim}
\definecolor{pkgcolor}{Hsb}{103,.8,.5}
\definecolor{moducolor}{Hsb}{290,.8,.5}
\definecolor{cmdcolor}{Hsb}{188,.8,.5}
\definecolor{filecolor}{Hsb}{207,.6,.7}
\definecolor{H1}{Hsb}{349,.8,.8}% 海棠紅 (Hangzhou MTR L 1 )
\definecolor{H2}{Hsb}{23, .8,.8}% 丹桂橙 (Hangzhou Metro 2 )
\definecolor{H3}{Hsb}{48, .8,.8}% 柠檬黄 (Hangzhou Metro 3 )
\definecolor{H4}{Hsb}{103,.8,.8}% 香樟绿 (Hangzhou Metro 4 )
\definecolor{H5}{Hsb}{188,.8,.8}% 青藍色 (Hangzhou MTR L 5 )
\definecolor{H6}{Hsb}{207,.8,.8}% 海洋蓝 (Hangzhou Metro 6 )
\definecolor{H7}{Hsb}{290,.8,.8}% 浪漫紫 (Hangzhou Metro 7 )
\hypersetup{colorlinks,urlcolor=H1,linkcolor=H2,filecolor=filecolor,pdfstartview=FitH,pdfview=FitH,pdfcreator=XeTeX output}

\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.1em}}
\def\@pkg#1{\texorpdfstring{\href{https://www.ctan.org/pkg/#1}{\textcolor{pkgcolor}{\textsf{#1}}}}{“#1”}}
\def\s@pkg#1{\texorpdfstring{\textcolor{pkgcolor}{\textsf{#1}}}{“#1”}}
\DeclareRobustCommand\pkg{\@ifstar\s@pkg\@pkg}
\def\mode#1{\texorpdfstring{\textcolor{moducolor}{\textsf{#1}}}{“#1”}}
\def\cmd#1{\texorpdfstring{\textcolor{cmdcolor}{\textsf{#1}}}{“#1”}}
\def\datechange#1#2{%
  \noindent{\makebox[\textwidth][r]{\color{H7}\rule{1.15\textwidth}{.4pt}}}
  \noindent\makebox[0pt][r]{\makebox[-3em][r]{\small\textbf{\textcolor{H7}{#1}}}\;\;}{\sffamily Update: \ignorespaces#2}}
\makeatother

\title{The \pkg{NoteBeamer} Template}
\author[1]{Xia Ming Yu, \href{https://www.hdu.edu.cn}{Hangzhou Dianzi University}}
\yyyymmdddate
\date{\today}
\affil[1]{\href{mailto:xiamyphys@gmail.com}{\texttt{xiamyphys@gmail.com}}}
\date{\today\quad Version 2.3a}
\begin{document}
\maketitle

\begin{abstract}
This is the document for \pkg{NoteBeamer} template, which provides a method to input Beamers on note papers and make notebook quickly.

GitHub issues: \url{https://github.com/xiamyphys/NoteBeamer/issues}

\end{abstract}

\tableofcontents

\section{Introduction}

\subsection{The purpose of this template}
This template provides an easy way to input Beamers on note papers and make notebook quickly. It's optimized for Goodnotes' default paper size and there won't have difference between papers.

If you meet bugs when using this template, or you have better suggestions or ideas, or you want to participate in the development of the template or other templates by me, feel free to contact me on GitHub \href{https://github.com/xiamyphys/NoteBeamer/issues}{issues} or via email \href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com}.

Also, you can join my \textsf\LaTeX{} Template Discussion \href{https://qm.qq.com/q/OnHzbNvVAG}{QQ Group: 760570712} to communicate with me and get the insider preview edition of the template.

\subsection{Packages required}
This template is based on the template \pkg{standalone}. And it requires \pkg{tikz} package to plot some graphics, \pkg{kvoptions} and \pkg{etoolbox} packages to provide global options, \pkg{graphics} package to provide the \mode{draft} mode, \pkg{hyperref} package provides link jump function, \pkg{ctex} package to support the \textbf{Chinese, Simplified} language and \pkg{fontawesome5} package to provide a set of beautiful icons.

I strongly suggest that you should use cmd to implement the commands to update all the packages to the latest version or switch to portable version instead.
\begin{verbatim}
    tlmgr update --self
    tlmgr update --all
\end{verbatim}

Remember to choose the proper mirror source in your region. To learn more, please refer to \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my TEX distribution?}

\subsection{Loading \pkg{NoteBeamer} and its modes}
Update your \sffamily\TeX distribution or just save the file \verb|notebeamer.cls| to your project's root directory, then create a \verb|.tex| file, just input the command \verb|\documentclass{notebeamer}| on the first line.

The template provides three modes: \mode{draft}, \mode{color} and \mode{font}. Just add the options of the modes separately by commas in the square bracket of the command in your \verb|.tex| file, such as

\begin{verbatim}
    \documentclass[draft,darker,libertinus]{notebeamer}
\end{verbatim}

\section{Modes of \pkg{NoteBeamer}}


\subsection{The \mode{draft} mode}
Like most of the templates, this template also provide all modes provided by \pkg{graphics} package such as \mode{draft}, \sffamily\TeX{} will only read for size info of pages you input, and a box of the correct size is printed with the filename in.

This can accelerate the speed of compile, and you can preview the effect quickly when you input a file with too many pages and (or) its size is too large. After you make sure that there's no formatting errors, you can cancel this mode just to wait until compiled.

The files corresponding to the commands \cmd{sticker}, \cmd{logo} and \cmd{flyleaf} can be stored in a folder named \verb|figure(s)|, \verb|image(s)|, \verb|graphic(s)| or \verb|picture(s)|, and you needn't to write these directories again in these commands because this template has already set these directories as indexes. Just as shown in the file tree in the example in \nameref{dirtree}.

\subsection{The \mode{saturation} mode}
This mode has three options, \mode{lighter} \mode{light}, \mode{normal}, \mode{dark} and \mode{darker}, which can make the color of the covers you create in this template get lighter or darker, and the default option is \mode{normal}.

\subsection{The \mode{color} mode}
This mode has two options, \mode{main} and \mode{colorful}, which can make the color of the note line remains or keep the same hues as the cover, and the default option is \mode{main}.

\subsection{The \mode{font} mode}
This mode has two options, \mode{times} and \mode{libertinus}, which can deside which font the notebook will use: The default \emph{New Times Roman} font or the \emph{Libertinus} font. You can use Libertinus fonts if you've installed it on your computer, and the default option is \mode{times}.

\section{Commands of \pkg{NoteBeamer}}

\subsection{The \cmd{author}, \cmd{mail}, \cmd{flyleaf}, \cmd{sticker} and \cmd{logo} commands}
\begin{verbatim}
    \author{Your Name}          \mail{Your Mail Address}
    \flyleaf{titlepage.pdf}     \sticker{sticker.png}
    \logo[link]{logofile.pdf}[info]
\end{verbatim}
\begin{itemize}
    \item \cmd{author}, \cmd{mail} and \cmd{flyleaf} command.
    
    There will be an author's name or (and) mail on the cover page after you use the command \cmd{author} or (and) \cmd{mail}, also a hyperlink will be added to the email address. A title page will automatically be added after the cover page after you use the command \cmd{flyleaf}.

    \item  \cmd{sticker} and \cmd{logo} command.
    
    There will be a sticker on the southeast of the note paper after you add, and there will be a logo on the northwest corner of the cover page and HDU note paper; otherwise it won't.

    The first and third variable of the command \cmd{logo} can assign the link and info of the logo, which are optional.
\end{itemize}

\paragraph{The commands above are all repeatable, which can reassign the values that these commands assigned before.}

\subsection{The \cmd{notebook} command}

\begin{verbatim}
    \notebook[color]{title}[subtitle]
\end{verbatim}

This command can create a cover. There are 7 colors for the cover, these colors' Hues are from Hangzhou MTR line 1 -- 7, they are \textcolor{H1}{H1. \textsf{\href{https://en.wikipedia.org/wiki/Malus_spectabilis}{Haitang} Red}}, \textcolor{H2}{H2. \textsf{Dangui orange}}, \textcolor{H3}{H3. \textsf{Lemon yellow}}, \textcolor{H4}{H4. \textsf{Camphor green}}, \textcolor{H5}{H5. \textsf{Cyan}}, \textcolor{H6}{H6.\textsf{ Ocean Blue}} and \textcolor{H7}{H7. \textsf{Romantic purple}}.

Here, the second value \verb|title| is mandatory, and it can add the title above the center of the cover page while the third value \verb|subtitle| is optional, and it can add the subtitle vertically to the lower left of the center. The first variable is from \textcolor{H1}{H1} to \textcolor{H7}{H7} and the default value is \textcolor{H5}{H5}.

If a star (*) is added after this command, there will be an empty note after the cover page (or the title page if you assigned in the command \cmd{flyleaf}) automatically.

\subsection{The \cmd{chapter} command}
\begin{verbatim}
    \chapter[chaptertitle]{filename}  \chapter*[chaptertitle]{filename}
\end{verbatim}

This command has 2 variables: \verb|chaptertitle| and \verb|filename|, will assign the following chapter title and the file (such as PDF made from \textsf\LaTeX{}) will be inputted. Here, the value \verb|chaptertitle| is optional.

If a star (*) is added after this command, the counter \verb|chap| won't take effect.

\subsection{The \cmd{emptynote} \& \cmd{emptyhdunote} commands}
\begin{verbatim}
    \emptynote    \emptynote*    \emptyhdunote    \emptyhdunote*
    \emptynote[1] \emptynote*[2] \emptyhdunote[3] \emptyhdunote*[4]
\end{verbatim}

Command \cmd{emptynote} will create an empty note paper with the chapter title before and page number following the previous page, and command \cmd{emptyhdunote} will create an empty note paper with logo (may include link) and info were assigned by the command \cmd{logo} but without chapter title on the top of the note paper.

If a star (*) is added after this command, then the note paper created won't include the chapter title and page number. Also, the counter \verb|page| won't take effect.

There's one optional variable of these command, it decides the number of note papers you will create, and the default value is 1, certainly.

\subsection{The \cmd{newnote (sss) (ssss)} commands}
\begin{verbatim}
    \newnote{start page}{end page}      % insert 1 image per page
    \newnotesss{start page}{end page}   % insert 3 images per page
    \newnotessss{start page}{end page}  % insert 4 images per page
\end{verbatim}

These commands will create note papers that were inserted images on the left side, the two variables is the start page number and the end page number of the file that was already assigned by the second variable of the command \cmd{chapter}.

\section{Version History}

In the Advanced Quantum Mechanics class on 19 October 2023, my \emph{obsessive-compulsive disorder} forced me to copy all the content projected by the teacher onto the whiteboard on my iPad, and I found that I only got a few pages full of notes without any knowledge understood in my brain after a class is over. Then, an idea suddenly occurred me: Why not create an automated program to quickly insert the Beamers given by the teacher before class with the format of several images per page? So I can just annotate on it and pay more attention to listen to the teacher. After the class ended that day, I went back to my dormitory and started writing programs in \textsf\LaTeX{}.

\textsf{\bfseries Version 1.0} was finished developing on 22 October 2023 and released on \href{https://www.latexstudio.net/index/details/index/mid/3720.html}{LaTeX Studio} (Xiaoshan, Hangzhou) and \href{https://www.xiaohongshu.com/user/profile/61e7ad870000000010005642}{Xiaohongshu}, where won the favor of many people and even some people who have already retired from \textsf\LaTeX{} want to re-enter.

On 24 October 2023, a member in the CMC competition WeChat group praised for my template, and proposed his idea: the template could be magically changed to insert a slightly smaller page of notes on the left side and take notes on the right side, because he found that he can only write in the corners when annotating some notes. It's a good idea, then I'm setting about developing the next version of the template.

While considering the suggestions from friends, I am also thinking about how to simplify the previous code. Because in version 1.0, if one want to insert a Beamer with 78 images and make 3 images per page, then he should write the command \cmd{newnotesss} for 26 times, it's so inelegant... However, no matter how I write the loop, it can't meet my expectations or report errors. Then, I asked stackexchange for help, and finally a LaTeX programmer \href{https://tex.stackexchange.com/users/51799/wipet}{wipet} wrote the loop module for me. Here, I want to express my gratitude to him.

\textsf{\bfseries Version 2.0a} was finished developing on 1 November 2023. This version not only simplified the commands to insert Beamers from to dozens of commands to only 1 command, but redesigned some details and functions. Firstly, this version supports to insert only one page of notes on the left side. What's more, this version supports to insert your school's logo on the cover page and empty note paper. Also, this version supports insert empty note papers without page number and chapter title with just add a star (*) after the command. Finally, this version can add a subtitle on the cover page, and redesign the colors (chosen from Hangzhou MTR) of the cover pages.

\textsf{\bfseries Version 2.1a} was finished developing on 9 November 2023. This version has fixed some bugs, and now supports inserting non-consecutive page numbers of the same file, and you can insert a certain number of empty note papers with only one command. Also, this version has redesigned the top and bottom margins and the height between note lines in response to the suggestion from \href{https://qm.qq.com/q/OnHzbNvVAG}{QQ Group} member. What's more, this version supports the `Libertinus' font, which can make users have a better visual effect.

\textsf{\bfseries Version 2.2b} was finished developing on 11 November 2023. This version has fixed some bugs, and partial commands in this version has changed to use \sffamily\LaTeX{2e} original commands.

\textsf{\bfseries Version 2.3a} was finished developing on 15 November 2023. This version added the option to make the note lines colorful, and removed the packages that already available in the kernel.

\newpage
\datechange{2023/11/01}{Version 2.0a}
\begin{itemize}
    \item Simplify the command of inserting 3 \& 4 images per page.
    \item Redesign the cover page \& note paper title.
    \item Add commands to create empty note paper with(out) chapter title \& page number.
    \item Add commands to create empty note paper with logo and info on the top.
\end{itemize}

\datechange{2023/11/09}{Version 2.1a}
\begin{itemize}
    \item Fixed the bug of page number errors when inserting the title page.
    \item Fixed the bug of picture string position when inserting the first page number of courseware when the page number is not 1.
    \item Supports inserting non-consecutive page numbers of the same file.
    \item Supports inserting a certain number of empty note papers \& HDU empty note papers with only one command.
    \item Support the `Libertinus' font.
    \item Increased the top and bottom margins of the page by 18.8\% than before.
    \item Other detailed adjustments.
\end{itemize}

\datechange{2023/11/11}{Version 2.2b}
\begin{itemize}
    \item Fixed the image position error when inserting 3 and 4 images per note page.
    \item Partially using \sffamily\LaTeX{2e} original commands.
\end{itemize}

\datechange{\today}{Version 2.3a}
\begin{itemize}
    \item Added the option to make the note lines colorful.
    \item Added another options in the mode \mode{saturation}.
    \item Removed the packages that already available in the kernel.
\end{itemize}

\newpage
\appendix
\section{Document Example}
\lstinputlisting[style=TeX]{notebeamer-demo.tex}

\vspace{0.5em}\hrule\vspace{0.5em}

\label{dirtree}
\begin{minipage}{0.48\textwidth}
    \dirtree{%
    .1 notebeamer/.
    .2 doc/.
    .3 images/.
    .3 notebeamer-demo.tex.
    .3 notebeamer-demo.pdf.
    .3 notebeamer-doc.tex.
    .3 notebeamer-doc.pdf.
    .2 tex/.
    .3 notebeamer.cls.
    .2 License.
    .2 README.md.
    }
\end{minipage}
\hfill
\begin{minipage}{0.48\textwidth}
    \dirtree{%
    .1 doc/.
    .2 images/.
    .3 HDU.pdf.
    .3 Inuyasa.jpg.
    .3 titlepage1.pdf.
    .3 titlepage2.pdf.
    .3 newnotedemo.pdf.
    .3 newnote3sdemo.pdf.
    .3 newnote4sdemo.pdf.
    .2 notebeamer-demo.tex.
    .2 notebeamer-demo.pdf.
    }
\end{minipage}


\includepdf[pages=-,nup=4x4]{notebeamer-demo.pdf}
\end{document}