\documentclass[fontset = fandol, svgnames]{ctexrep}

\ctexset{
 chapter        = {
   format       = \huge\bfseries\raggedright,
   number       = \arabic{chapter},
   name         = {},
   tocline      = \CTEXifname{\protect\numberline{\thechapter}}{}#2,
 },
 section/format = \Large\bfseries\raggedright,
}

\usepackage[margin = 2.4cm]{geometry}
\usepackage{booktabs, array}
\usepackage{fontawesome6, fancyqr, hologo}
\usepackage[colorlinks, pdfpagelayout = SinglePage, bookmarksnumbered]{hyperref}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, calc}
\tikzset{
 score stars/.style = {
   % shape
   star, star points = 5, star point ratio = 2.25, scale = .8,
   % color
   draw = gray, fill = #1,
   % others
   inner sep = 0.14em, anchor = outer point 3
 }
}
\newcommand\stars[1]{%
 \begin{tikzpicture}
   % Draw five stars. For #1 = "2.3", fill the 1st and 2nd stars as gray,
   % and fill the 3rd to 5th stars as white.
   \foreach \i in {1, ..., 5} {
     \pgfmathsetmacro\starcolor{\i<=#1 ? "gray" : "white"}
     \node [score stars = \starcolor] (star\i) at (\i*0.8em, 0) {};
   }
   % For #1 = "2.3", let \partstar = "3" and \starpart = "0.3".
   % Then fill the left 30% part of the 3rd star as gray after clipping.
   \pgfmathsetmacro\partstar{#1>int(#1) ? int(#1+1) : 0}
   \ifnum\partstar>0
     \pgfmathsetmacro\starpart{#1-(int(#1))}
     \coordinate (upper left)
       at (star\partstar.outer point 2 |- star\partstar.outer point 1);
     \coordinate (upper right)
       at (star\partstar.outer point 5 |- star\partstar.outer point 1);
     \coordinate (lower right)
       at (star\partstar.outer point 5 |- star\partstar.outer point 4);
     \clip (upper left) rectangle
           ({$ (upper left)!\starpart!(upper right) $} |- lower right);
     \node [score stars = gray] at (\partstar*0.8em, 0) {};
   \fi
 \end{tikzpicture}%
}

\usepackage[os = win]{menukeys}
\renewmenumacro{\menu}[>]{angularmenus}
\renewmenumacro{\keys}[+]{shadowedroundedkeys}
\renewcommand\RSsmallest{5pt}
\protect\renewcommand\faWindows{%
 \tikz[rounded corners = .1pt, baseline = -.25em]
   \foreach \i in {0, 90, 180, 270}
     \fill [ rotate = \i ] (-.4em, .4em) rectangle (-.025em, .025em);
}

\usepackage{listings, fancyvrb}
\lstset{
 breaklines      = true,
 columns         = fullflexible,
 showstringspaces= false,
 tabsize         = 4,
 gobble          = 1,
 numbers         = left,
 numberstyle     = \tiny\ttfamily,
 numbersep       = \ccwd,
 frame           = lines,
 rulecolor       = \color{blue!40},
 backgroundcolor = \color{lightgray!20},
 language        = bash,
 alsoletter      = -,
 basicstyle      = \small\ttfamily,
 commentstyle    = \color{olive!80!black},
 stringstyle     = \color{brown},
 emph            = { bash, cd, cp, dpkg, find, grep, ln, md5sum, mkdir,
                     mount, rm, rmdir, set, sha512sum, sudo, umount },
 emphstyle       = \color{blue}\bfseries,
 morekeywords    = { add-apt-repository, apt, brew, certutil, evince,
                     fc-cache, fc-list, fmtutil, fmtutil-user, fmtutil-sys,
                     gedit, kpsewhich, l3build, latexmk, mkfontdir,
                     mkfontscale, notepad, tex, texdoc, tlmgr, pdflatex,
                     visudo, wget, wsl, xelatex },
 keywordstyle    = \color{teal}\bfseries
}
\lstdefinelanguage{json}{
 basicstyle   = \small\ttfamily\color{DarkBlue},
 numberstyle  = \tiny\ttfamily\color{black},
 alsoletter   = ",
 morecomment  = [l]{//},
 morekeywords = {"latexmk", "latexmkpdf", "latexmkxe", "never", "tab"},
 keywordstyle = \color{FireBrick}\bfseries,
 literate     ={*[{\textcolor{DarkGreen}{[ }}1  ]{\textcolor{DarkGreen}{ ]}}1
                \{{\textcolor{DarkRed}  {\{}}1 \}{\textcolor{DarkRed}  {\}}}1
                 :{\textcolor{black}    {:}} 1  ,{\textcolor{black}    {,}} 1}
}
\lstdefinelanguage{mwe}{
 language     = {[LaTeX]TeX},
 texcsstyle   = *\color{violet},
 morekeywords = {article, ctexart, document},
 literate     =*\{{\textcolor{magenta}\{}1 \}{\textcolor{magenta}\}}1
}
\lstMakeShortInline [ breaklines = true, basicstyle = \ttfamily,
                     emphstyle = {}, keywordstyle = {} ] {"}
\VerbatimFootnotes

\title{\bfseries 一份简短的关于 \LaTeX\ 安装的介绍%
 \thanks{\url{https://github.com/OsbertWang/install-latex-guide-zh-cn}}%
}
\author{王然%
 \thanks{\href{mailto:[email protected]}%
   {\texttt{[email protected]}}}%
}
\date{\today}

\begin{document}

\maketitle

\include{./chapter/preface}

\tableofcontents

\include{./chapter/windows}
\include{./chapter/ubuntu}
\include{./chapter/macos}
\include{./chapter/wsl}
\include{./chapter/editor}
\include{./chapter/overleaf}

\appendix

\include{./chapter/mirror}
\include{./chapter/addition}
\include{./chapter/offline}
\include{./chapter/updateinfo}

\end{document}