% !TeX program = xelatex
% Build from the repository root: l3build doc
\makeatletter
\def\input@path{{docs/}}
\makeatother
\documentclass[10pt,a4paper,fontset=fandol]{ctexart}
\usepackage[margin=18mm,top=19mm,bottom=20mm,headheight=15pt]{geometry}
\usepackage{siunitx}
\usepackage{gradbars}
\usepackage{tabularray}
\UseTblrLibrary{gradbars}
\usegradbarslibrary{distribution,legend,reports}
\usepackage{booktabs,array,tabularx,amsmath}
\usepackage{tcolorbox}
\tcbuselibrary{listings,skins}
\usepackage{fancyhdr}
\usepackage[colorlinks=true,linkcolor=gradbarsBlue,urlcolor=gradbarsTeal,
  pdftitle={gradbars 宏包手册},pdfauthor={SuFan}]{hyperref}
\definecolor{manualCode}{HTML}{EEEEFF}
\definecolor{manualResult}{HTML}{FAFAE6}
\definecolor{manualLine}{HTML}{DCE3ED}
\definecolor{manualMuted}{HTML}{64748B}
\usepackage{indentfirst}
\setlength{\parindent}{2em}
\setlength{\emergencystretch}{2em}
% Tables occupy their declared width; only prose paragraphs are indented.
\AddToHook{env/tabular/before}{\noindent}
\AddToHook{env/tabularx/before}{\noindent}
\setlength{\parskip}{5pt}
\setcounter{tocdepth}{1}
\renewcommand{\arraystretch}{1.3}
\ctexset{
  section={format=\Large\bfseries\color{gradbarsInk},beforeskip=0pt,afterskip=10pt},
  subsection={format=\normalsize\bfseries\color{gradbarsInk},beforeskip=12pt,afterskip=4pt}
}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\small\sffamily\color{manualMuted}gradbars\quad 宏包手册}
\fancyhead[R]{\small\sffamily\color{manualMuted}v1.1.0}
\fancyfoot[L]{\footnotesize\color{manualMuted}效果与源码对照 \enspace / \enspace XeLaTeX}
\fancyfoot[R]{\small\thepage}
\renewcommand{\headrulewidth}{.3pt}
\input{Chapter/zh-cn/code-style-cn}
\newcommand{\note}[1]{\begin{tcolorbox}[colback=gradbarsTrack,colframe=gradbarsTrack,
  boxrule=0pt,arc=0pt,left=3mm,right=3mm,top=2mm,bottom=2mm]
  \small #1\end{tcolorbox}}
\lstdefinestyle{manual}{
  language=[LaTeX]TeX,
  basicstyle=\gradbarscodefont\fontsize{8}{10.6}\selectfont,
  texcsstyle=*\color{blue!70!black},
  keywordstyle=\color{green!40!black},
  commentstyle=\color{manualMuted},
  moretexcs={gradheat,gradheader,gradspan,gradgroup,gradtablestyle,gradtableschema,graduseschema,gradcolumn,gradrow,gradbullet,gradintervals,graddumbbell,gradspark,gradbarscategory,gradcompare,gradrange,gradbarsloadcsv,gradbarscsvtable,gradbarscsvstyle,gradbarcsv,gradbarscsvcell,gradbarscolumn,gradbarslegend,gradbar,gradstack,gradbarsstyle,gradbarssetup,toprule,midrule,bottomrule,arraystretch},
  morekeywords={theme,max,width,height,label,precision,unit,text,blue,teal,solid,gray,percent},
  columns=fullflexible,keepspaces=true,showstringspaces=false,
  breaklines=true,breakatwhitespace=false,tabsize=2,
  aboveskip=0pt,belowskip=0pt
}
\newtcblisting{example}[2][]{
  enhanced,skin=bicolor,listing engine=listings,text side listing,
  listing options={style=manual},
  title={#2},fonttitle=\small\bfseries,
  coltitle=gradbarsInk,colbacktitle=gradbarsTrack,
  colback=manualResult,colbacklower=manualCode,colframe=manualLine,
  boxrule=.3pt,arc=0pt,lefthand width=49mm,sidebyside gap=5mm,
  left=3mm,right=3mm,top=3mm,bottom=3mm,
  before skip=8pt,after skip=8pt,
  sidebyside align=top,
  before upper={\small\setlength{\parskip}{5pt}},
  #1
}
\newtcblisting{codeonly}{
  listing only,listing engine=listings,listing options={style=manual},
  colback=manualCode,colframe=manualCode,boxrule=0pt,arc=0pt,
  left=3mm,right=3mm,top=2mm,bottom=2mm
}
\newtcblisting{coverexample}[1]{
  enhanced,skin=bicolor,listing engine=listings,text side listing,
  listing options={style=manual,basicstyle=\gradbarscodefont\fontsize{7.5}{9}\selectfont},
  title={#1},fonttitle=\scriptsize\bfseries,
  coltitle=gradbarsInk,colbacktitle=gradbarsTrack,
  colback=manualResult,colbacklower=manualCode,colframe=manualLine,
  boxrule=.25pt,arc=0pt,lefthand width=59mm,sidebyside gap=4mm,
  left=2mm,right=2mm,top=1mm,bottom=1mm,
  before skip=3pt,after skip=3pt,sidebyside align=center,
  before upper={\small\setlength{\parskip}{2pt}}
}
% Optional partial build after a full build (in the preamble):
% \includeonly{Chapter/zh-cn/install-cn,Chapter/zh-cn/selection-cn}
\gradbarsdeclarelibrary{manual-demo}{table}{docs/libraries/gradbars-contrib-demo.sty}
\usegradbarslibrary{manual-demo}
\begin{document}
\input{Chapter/zh-cn/cover-cn}

\clearpage
\begingroup
\setlength{\parskip}{0pt}
\linespread{1}\selectfont
\hypersetup{linkcolor=gradbarsInk}
\makeatletter
\renewcommand*{\l@part}[2]{%
  \addpenalty\@secpenalty
  \addvspace{.7em}%
  {\bfseries\@dottedtocline{-1}{0pt}{0pt}{#1}{#2}}%
  \nobreak}
\renewcommand*{\l@section}[2]{\@dottedtocline{1}{0pt}{2em}{\bfseries #1}{#2}}
\makeatother
\fontsize{9}{11}\selectfont\tableofcontents
\endgroup
\par\vspace{4mm}
{\small\color{manualMuted}\textbf{阅读指南}\par
本手册把安装说明、参数、77 个编号示例、选型指南与常见问题集中在同一文档中。
其中包括六个应用表格，以及双栏论文、跨页长表、黑白打印和幻灯片的真实排版案例。
浅黄色区域展示实际排版效果，浅紫色区域展示生成该效果的源码。
全书按入门、图形、外观、专属表格、案例与参考六部分组织。源码中的空行用于区分示例。
示例框内的效果与源码来自同一段代码，避免两者脱节。\par
\vspace{3mm}
适用于 gradbars 1.1.0。示例数据仅用于演示，不代表真实实验结果。\par}

% Chapters, in reading order.
\include{Chapter/zh-cn/install-cn}
\include{Chapter/zh-cn/libraries-cn}
\include{Chapter/zh-cn/extensions-cn}
\include{Chapter/zh-cn/selection-cn}
\include{Chapter/zh-cn/values-cn}
\include{Chapter/zh-cn/styles-cn}
\include{Chapter/zh-cn/number-format-cn}
\include{Chapter/zh-cn/signed-bars-cn}
\include{Chapter/zh-cn/stack-cn}
\include{Chapter/zh-cn/stack-legend-cn}
\include{Chapter/zh-cn/compare-cn}
\include{Chapter/zh-cn/dumbbell-cn}
\include{Chapter/zh-cn/change-cn}
\include{Chapter/zh-cn/spark-cn}
\include{Chapter/zh-cn/distribution-cn}
\include{Chapter/zh-cn/references-cn}
\include{Chapter/zh-cn/heat-cn}
\include{Chapter/zh-cn/legends-cn}
\include{Chapter/zh-cn/themes-cn}
\include{Chapter/zh-cn/labels-cn}
\include{Chapter/zh-cn/collision-cn}
\include{Chapter/zh-cn/rounded-targets-cn}
\include{Chapter/zh-cn/overflow-cn}
\include{Chapter/zh-cn/conditional-colors-cn}
\include{Chapter/zh-cn/quality-cn}
\include{Chapter/zh-cn/categories-cn}
\include{Chapter/zh-cn/patterns-cn}
\include{Chapter/zh-cn/presets-cn}
\include{Chapter/zh-cn/table-cn}
\include{Chapter/zh-cn/table-graphics-cn}
\include{Chapter/zh-cn/table-alignment-cn}
\include{Chapter/zh-cn/column-scales-cn}
\include{Chapter/zh-cn/table-width-cn}
\include{Chapter/zh-cn/headers-cn}
\include{Chapter/zh-cn/groups-cn}
\include{Chapter/zh-cn/summaries-cn}
\include{Chapter/zh-cn/table-themes-cn}
\include{Chapter/zh-cn/table-definitions-cn}
\include{Chapter/zh-cn/reports-cn}
\include{Chapter/zh-cn/longtable-cn}
\include{Chapter/zh-cn/tabularray-cn}
\include{Chapter/zh-cn/csv-cn}
\include{Chapter/zh-cn/research-numbers-cn}
\include{Chapter/zh-cn/example-models-cn}
\include{Chapter/zh-cn/example-overview-cn}
\include{Chapter/zh-cn/example-palettes-cn}
\include{Chapter/zh-cn/example-comparisons-cn}
\include{Chapter/zh-cn/example-contributions-cn}
\include{Chapter/zh-cn/example-trends-cn}
\include{Chapter/zh-cn/layouts-cn}
\include{Chapter/zh-cn/faq-cn}
\include{Chapter/zh-cn/reference-cn}

\end{document}
