\documentclass[fontset=fandol]{ctexrep}
\usepackage{accsupp}
\usepackage[margin=2.4cm]{geometry}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{fontawesome5}
\usepackage[pdfpagelayout=SinglePage,bookmarksnumbered]{hyperref}
\usepackage[os=win,hyperrefcolorlinks]{menukeys}

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

\lstset{
  backgroundcolor = \color{lightgray!30},
  keywordstyle    = \color{blue},
  stringstyle     = \color{brown},
  basicstyle      = {\small\ttfamily},
  breaklines      = true,
  tabsize         = 4,
  gobble          = 2,
  numbers         = left,
  numberstyle     = \tiny\emptyaccsupp,
  frame           = single,
  xleftmargin     = \ccwd,
  numbersep       = \ccwd,
  columns         = fullflexible,
%  emphstyle       = {\color{blue}\small\ttfamily},
%  emph            = {mkdir,rmdir,sudo,mount,umount,rm},
}

\newcommand\emptyaccsupp[1]{%
  \BeginAccSupp{ActualText={}}#1\EndAccSupp{}%
}

\renewmenumacro{\menu}[>]{angularmenus}
\renewmenumacro{\keys}[+]{shadowedroundedkeys}

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

\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, calc}

\tikzset{
  score stars/.style={
    % shape
    star, star points=5, star point ratio=2.25, scale=0.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}%
}

\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{./appendix/mirror}
\include{./appendix/addition}
\include{./appendix/offline}
\include{./appendix/updateinfo}

\end{document}
