% ============================================================
%  tikz-chemlab-zh-doc.tex
%  tikz-chemlab 中文使用手册
%  对应 tikz-chemlab-doc.tex 的中文翻译
% ============================================================
\documentclass[11pt,a4paper,oneside]{ctexart}

\usepackage{microtype}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{array}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{enumitem}
\usepackage{caption}
\usepackage{marginnote}
\usepackage{colortbl}
\usepackage{tabularx}

\usetikzlibrary{arrows.meta,calc,patterns,patterns.meta,shadings,decorations.pathmorphing,decorations.pathreplacing}
\usepackage{tikz-chemlab}

% --- 颜色定义 ---
\definecolor{hellgelb}{rgb}{1,1,0.8}
\definecolor{shadecolor}{rgb}{0.92,0.92,0.92}
\definecolor{codebg}{rgb}{0.96,0.96,0.96}
\definecolor{keywordcolor}{rgb}{0.13,0.29,0.53}
\definecolor{commentcolor}{rgb}{0.5,0.5,0.5}
\definecolor{stringcolor}{rgb}{0.63,0.12,0.12}
\definecolor{linkblue}{rgb}{0.1,0.3,0.7}
\definecolor{tableheadcolor}{gray}{0.85}
\definecolor{tablerowcolor}{gray}{0.95}

% --- listings 设置 ---
\lstset{
  basicstyle=\ttfamily\footnotesize,
  backgroundcolor=\color{codebg},
  keywordstyle=\color{keywordcolor}\bfseries,
  commentstyle=\color{commentcolor}\itshape,
  stringstyle=\color{stringcolor},
  showstringspaces=false,
  breaklines=true,
  breakatwhitespace=false,
  postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
  tabsize=2,
  columns=flexible,
  keepspaces=true,
  frame=single,
  framerule=0pt,
  rulecolor=\color{gray!30},
  xleftmargin=8pt,
  xrightmargin=8pt,
  aboveskip=8pt,
  belowskip=8pt,
  morekeywords={tkzTestTube,tkzRoundFlask,tkzHeatTube,tkzHeatFlask,
    tkzTitration,tkzDistillation,tkzGraduatedCylinder,tkzPipette,tkzLargePipette,
    tkzFunnel,tkzSeparatoryFunnel,tkzStand,tkzChampagneBubbles,tkzBubbles,
    tkzFilaments,tkzBalls,tkzBubblesThreeD,tkzIronNail,tkzCopperTurnings,
    tkzZincGranules,tkzColumn,tkzRoundFlaskReflux,tkzHeaterRoundFlask,
    chemlabset,chemlabUpdateLineWidths,
    tikzpicture,begin,end,scope,shift,scale,rotate,draw,fill,node,at,
    useasboundingbox,rectangle,ellipse,arc,clip,foreach,pgfkeys,
    line width,line cap,line join,fill,draw,filldraw,pattern,
    bottom color,top color,inner color,outer color,shading,ball color,
    rounded corners,arrow,Stealth,->,--,cycle,controls,and},
  literate={\\}{{\textcolor{keywordcolor}\textbackslash}}1
}

% --- hyperref 设置 ---
\hypersetup{
  colorlinks=true,
  linkcolor=linkblue,
  urlcolor=linkblue,
  citecolor=linkblue,
  pdftitle={tikz-chemlab 中文使用手册},
  pdfauthor={tikz-chemlab},
}

% --- 自定义命令 ---
\newcommand{\Lpack}[1]{\texttt{#1}}
\newcommand{\Lcmd}[1]{\texttt{\textbackslash#1}}
\newcommand{\Lopt}[1]{\texttt{#1}}
\newcommand{\Lfile}[1]{\texttt{#1}}
\newcommand{\Lenv}[1]{\texttt{#1}}
\newcommand{\Larg}[1]{\texttt{\{#1\}}}

% --- 表格行颜色 ---
\let\oldtabularnewline\tabularnewline
\renewcommand{\arraystretch}{1.15}

% --- 表格宽度辅助 ---
\newlength{\tblw}
\setlength{\tblw}{0.8\textwidth}

% --- 标题信息 ---
\title{\textbf{tikz-chemlab}\\[4pt]
\large 化学实验室仪器绘图 TikZ 宏包（基于 \texttt{pst-labo} 移植）}
\author{Aihua Wang（王爱华）\\
\small \texttt{https://github.com/aihua/tikz-chemlab}\\
\small 移植自 \texttt{pst-labo}（原作者：Denis Girou, Christophe Jorssen,\\
Manuel Luque, Herbert Vo\ss）}
\date{\today}

\begin{document}
\maketitle

\sloppy
\emergencystretch=3em

\begin{abstract}
\noindent
\Lpack{tikz-chemlab} 是著名 \Lpack{pst-labo} 宏包的 TikZ 重实现版本。
它提供了一组高级宏命令，用于绘制化学实验室玻璃器皿——试管、烧瓶、
烧杯、滴定管、蒸馏装置、分液漏斗等——使用 TikZ 绘图引擎而非 PSTricks。

与 \Lpack{pst-labo} 的主要区别如下：

\begin{itemize}[nosep,leftmargin=1.5em]
  \item 命令名：\texttt{pst} 前缀 $\to$ \texttt{tkz} 前缀；
        法语词汇 $\to$ 英语（例如 \texttt{TubeEssais}
        $\to$ \texttt{TestTube}，\texttt{Eprouvette} $\to$
        \texttt{GraduatedCylinder}，\texttt{Ballon} $\to$
        \texttt{RoundFlask}）。
  \item 选项键名：法语 $\to$ 英语（例如 \texttt{niveauLiquide1}
        $\to$ \texttt{liquidLevel1}，\texttt{tubePenche} $\to$
        \texttt{tiltAngle}，\texttt{bouchon} $\to$ \texttt{stopper}）。
  \item \Lenv{pspicture} 环境替换为 \Lenv{tikzpicture} 环境。
  \item \Lcmd{rput} 替换为 \Lcmd{begin}\Larg{scope}\texttt{[shift=\Larg{\Larg{x,y}}]}
        或 \Lcmd{node}\texttt{ at (x,y)}。
  \item \Lcmd{psset}\Larg{unit=Ncm} 替换为
        \Lenv{tikzpicture}\texttt{[scale=N]} 或
        \Lcmd{begin}\Larg{scope}\texttt{[scale=N]}。
  \item PSTricks 的 \Lcmd{psline}、\Lcmd{psframe}、\Lcmd{psellipse}
        替换为对应的 TikZ 命令（\Lcmd{draw}、\Lcmd{fill}、
        \Lcmd{filldraw}）。
  \item \Lcmd{newpsstyle} 替换为 \Lcmd{tikzset}\Larg{\dots}。
\end{itemize}

本手册描述了所有宏命令、选项、预定义颜色与样式，并提供了可直接编译的示例。
\end{abstract}

\vfill
\noindent\textit{感谢原 \texttt{pst-labo} 作者的杰出工作，使本移植成为可能。}

\medskip
\noindent\textbf{代码仓库：} \url{https://github.com/aihua/tikz-chemlab}\\
\textbf{技术支持：} \url{https://github.com/aihua/tikz-chemlab/issues}

\clearpage
\tableofcontents
\clearpage

% ============================================================
\section{安装与加载}\label{sec:install}
% ============================================================

本宏包由三个文件组成，需放置在同一目录或 TeX 搜索路径中：

\begin{center}
\footnotesize
\begin{tabularx}{0.8\textwidth}{@{}l X@{}}
\toprule
\textbf{文件} & \textbf{作用} \\
\midrule
\Lfile{tikz-chemlab.sty}      & LaTeX 宏包封装（加载 TikZ 和主文件） \\
\Lfile{tikz-chemlab.tex}      & 主实现（参数系统 + 高级宏命令） \\
\Lfile{tikz-chemlabObj.tex}   & 形状库（底层绘图原语） \\
\bottomrule
\end{tabularx}
\end{center}

在导言区加载宏包：

\begin{lstlisting}
\usepackage{tikz-chemlab}
\end{lstlisting}

这将自动加载 \Lpack{tikz} 及所需库（\texttt{arrows.meta}、\texttt{calc}、
\texttt{patterns}、\texttt{shadings}、\texttt{decorations.pathmorphing}、
\texttt{decorations.pathreplacing}）。

% ============================================================
\section{快速入门}\label{sec:quickstart}
% ============================================================

最小示例：

\begin{lstlisting}
\documentclass{standalone}
\usepackage{tikz-chemlab}
\begin{document}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube
\end{tikzpicture}
\end{document}
\end{lstlisting}

这会以 50\% 缩放绘制一个标准试管。\Lpack{pst-labo} 与 \Lpack{tikz-chemlab}
的对应关系如下：

\begin{center}
\footnotesize
\begin{tabularx}{0.78\textwidth}{@{}XX@{}}
\toprule
\textbf{pst-labo} & \textbf{tikz-chemlab} \\
\midrule
\Lcmd{psset}\Larg{unit=0.5cm}    & \Lenv{tikzpicture}\texttt{[scale=0.5]} \\
\Lcmd{psset}\Larg{glassType=ballon} & 作为选项传入：\texttt{[glassType=roundFlask]} \\
\Lcmd{rput}\texttt{(x,y)}\Larg{obj} & \Lcmd{begin}\Larg{scope}\texttt{[shift=\{(x,y)\}]} \dots\Lcmd{end}\Larg{scope} \\
\Lcmd{psline}\texttt{\{->\}(a,b)(c,d)} & \Lcmd{draw}\texttt{[-\{Stealth\}] (a,b) -- (c,d);} \\
\Lcmd{psgrid}                     & \texttt{[help lines]} 或 \Lcmd{draw}\texttt{[help lines] (0,0) grid (N,N);} \\
\bottomrule
\end{tabularx}
\end{center}

% ============================================================
\section{参数}\label{sec:parameters}
% ============================================================

表~\ref{tab:parameters} 列出了 \Lpack{tikz-chemlab} 识别的所有参数。
可通过 \Lcmd{chemlabset}\Larg{\dots} 全局设置（等价于
\Lcmd{psset}\texttt{[pst-labo]}\Larg{\dots}），或作为单个宏命令的可选参数传入。

{\footnotesize
\begin{longtable}{@{}l l p{0.42\textwidth}@{}}
\caption{tikz-chemlab 全部参数}\label{tab:parameters} \\
\toprule
\textbf{参数} & \textbf{默认值} & \textbf{说明} \\
\midrule
\endfirsthead
\multicolumn{3}{c}{{\bfseries 表~\ref{tab:parameters}（续）}} \\
\toprule
\textbf{参数} & \textbf{默认值} & \textbf{说明} \\
\midrule
\endhead
\rowcolor{tablerowcolor}
\Lopt{glassType} & \texttt{tube} & 玻璃容器类型：\texttt{tube}、\texttt{roundFlask}、\texttt{beaker}、\texttt{erlenmeyer}、\texttt{reagentBottle}、\texttt{volumetricFlask}、\texttt{watchGlass} \\
\Lopt{stopper} & \texttt{false} & 插入塞子 \\
\rowcolor{tablerowcolor}
\Lopt{clamp} & \texttt{false} & 添加木质试管夹 \\
\Lopt{straightTube} & \texttt{false} & 插入直玻璃导管 \\
\rowcolor{tablerowcolor}
\Lopt{elbowTube} & \texttt{false} & 插入直角弯玻璃管 \\
\Lopt{uTube} & \texttt{false} & 插入 U 形玻璃管 \\
\rowcolor{tablerowcolor}
\Lopt{uTubeLong} & \texttt{false} & 延伸至底部的 U 形管 \\
\Lopt{curvedTube} & \texttt{false} & 创建带本生灯的气体收集装置 \\
\rowcolor{tablerowcolor}
\Lopt{curvedTubeShort} & \texttt{false} & 不带本生灯的气体收集装置 \\
\Lopt{doubleTube} & \texttt{false} & 两根导管，其中一根带活塞 \\
\rowcolor{tablerowcolor}
\Lopt{condenserBulbs} & \texttt{false} & 球形冷凝器（回流装置） \\
\Lopt{label} & \texttt{false} & 显示由 \Lopt{Number} 定义的标签 \\
\rowcolor{tablerowcolor}
\Lopt{Number} & \texttt{(空)} & 标签文本（与 \Lopt{label} 配合使用） \\
\Lopt{tiltAngle} & \texttt{0} & 倾斜角度（度，$-65\ldots+65$） \\
\rowcolor{tablerowcolor}
\Lopt{liquidLevel1} & \texttt{50} & 液位 1（0--100，百分比） \\
\Lopt{liquidLevel2} & \texttt{0} & 液位 2 \\
\rowcolor{tablerowcolor}
\Lopt{liquidLevel3} & \texttt{0} & 液位 3 \\
\Lopt{liquidStyle1} & \texttt{liquidStyle1} & 液体 1 的样式 \\
\rowcolor{tablerowcolor}
\Lopt{liquidStyle2} & \texttt{liquidStyle2} & 液体 2 的样式 \\
\Lopt{liquidStyle3} & \texttt{liquidStyle3} & 液体 3 的样式 \\
\rowcolor{tablerowcolor}
\Lopt{substance} & \texttt{(空)} & 物质宏命令（如 \Lcmd{tkzChampagneBubbles}） \\
\Lopt{solid} & \texttt{(空)} & 固体物质宏命令 \\
\rowcolor{tablerowcolor}
\Lopt{burette} & \texttt{true} & 显示/隐藏滴定管（在 \Lcmd{tkzTitration} 中） \\
\Lopt{pHMeter} & \texttt{false} & 显示 pH 计 \\
\rowcolor{tablerowcolor}
\Lopt{magneticStirrer} & \texttt{true} & 显示磁力搅拌器/加热板 \\
\Lopt{bunsenBurner} & \texttt{true} & 显示本生灯 \\
\rowcolor{tablerowcolor}
\Lopt{bubbling} & \texttt{false} & 添加鼓泡试管 \\
\Lopt{gasCollection} & \texttt{false} & 添加气体收集容器 \\
\rowcolor{tablerowcolor}
\Lopt{tubeOnly} & \texttt{false} & 取消额外容器空间 \\
\Lopt{buretteLevel} & \texttt{20} & 滴定管液位 \\
\rowcolor{tablerowcolor}
\Lopt{buretteColor} & \texttt{VeryPaleOrange} & 滴定管液体颜色 \\
\Lopt{reagentLevel} & \texttt{2} & 试剂液位（移液管） \\
\rowcolor{tablerowcolor}
\Lopt{reagentColor} & \texttt{PaleOrange} & 试剂颜色 \\
\Lopt{MixtureStyle} & \texttt{BlueDiffusion} & 蒸馏混合物样式 \\
\rowcolor{tablerowcolor}
\Lopt{DistillateColor} & \texttt{yellow} & 馏出液颜色 \\
\Lopt{TapOpen} & \texttt{false} & 分液漏斗活塞开/关 \\
\rowcolor{tablerowcolor}
\Lopt{buretteReagent} & \texttt{(空)} & 滴定管试剂标签文本 \\
\Lopt{beakerReagent} & \texttt{(空)} & 烧杯试剂标签文本 \\
\bottomrule
\end{longtable}
}

% ============================================================
\subsection{\texttt{glassType}（玻璃容器类型）}\label{subsec:glassType}
% ============================================================

\Lopt{glassType} 选择玻璃容器的类型，默认为标准试管。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube
\end{tikzpicture}

\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=roundFlask]
\end{tikzpicture}

\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=erlenmeyer]
\end{tikzpicture}

\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=beaker]
\end{tikzpicture}

\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=reagentBottle]
\end{tikzpicture}

\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=volumetricFlask]
\end{tikzpicture}

\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=watchGlass]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{stopper}（塞子）}\label{subsec:stopper}
% ============================================================

\Lopt{stopper} 选项为玻璃容器加上塞子。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.45]
  \tkzTestTube[glassType=tube,stopper=true]

  \begin{scope}[xshift=3cm]
    \tkzTestTube[glassType=roundFlask,stopper=true]
  \end{scope}

  \begin{scope}[xshift=6cm]
    \tkzTestTube[glassType=erlenmeyer,stopper=true]
  \end{scope}

  \begin{scope}[xshift=9cm]
    \tkzTestTube[glassType=reagentBottle,stopper=true]
  \end{scope}

  \begin{scope}[xshift=12cm]
    \tkzTestTube[glassType=watchGlass,stopper=true]
  \end{scope}
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{clamp}（试管夹）}\label{subsec:clamp}
% ============================================================

\Lopt{clamp} 选项添加木质试管夹。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=tube,stopper=true,clamp=true]
  \tkzTestTube[glassType=erlenmeyer,stopper=true,clamp=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{straightTube}（直导管）}\label{subsec:straightTube}
% ============================================================

\Lopt{straightTube} 插入一根细直玻璃导管，通常与 \Lopt{stopper=true} 配合使用。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[straightTube=true]
  \tkzTestTube[glassType=roundFlask,straightTube=true]
  \tkzTestTube[glassType=erlenmeyer,straightTube=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{elbowTube}（直角弯管）}\label{subsec:elbowTube}
% ============================================================

\Lopt{elbowTube} 与 \Lopt{straightTube} 类似，但绘制直角弯玻璃管。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[glassType=erlenmeyer,elbowTube=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{uTube} 与 \texttt{uTubeLong}（U 形管）}\label{subsec:uTube}
% ============================================================

\Lopt{uTube} 绘制 U 形玻璃管。\Lopt{uTubeLong} 将 U 形管延伸至底部
（用于 \Lcmd{tkzHeatFlask}）。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatFlask[glassType=roundFlask,uTube=true]
  \tkzHeatFlask[glassType=roundFlask,uTubeLong=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{label} 与 \texttt{Number}（标签与编号）}\label{subsec:label}
% ============================================================

\Lopt{label} 开关控制由 \Lopt{Number} 定义的标签显示。

\textit{重要提示：}在 \Lpack{tikz-chemlab} 中，\Lcmd{tkzTestTube} 每次调
用都会将参数重置为默认值。因此即使全局设置了
\Lcmd{chemlabset}\Larg{label}，也必须显式传入 \Lopt{label} 选项。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[label=true,Number=1]
  \tkzTestTube[label=true,Number=2]
  \tkzTestTube[glassType=reagentBottle,stopper=true,%
                 label=true,Number={\small Cu$^{2+}$}]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{tiltAngle}（倾斜角度）}\label{subsec:tiltAngle}
% ============================================================

\Lopt{tiltAngle} 将器皿倾斜到 $-65\ldots+65$ 度范围内的任意角度，
同时保持液面水平。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[straightTube=true,tiltAngle=40]
  \tkzTestTube[tiltAngle=-20,stopper=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{tubeOnly}（仅管）}\label{subsec:tubeOnly}
% ============================================================

\Lopt{tubeOnly} 影响 \Lcmd{tkzHeatTube} 的边界框。设置后不保留右侧
额外容器的空间。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatTube[bunsenBurner=true,bubbling=true,glassType=roundFlask]
\end{tikzpicture}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatTube[tubeOnly=true,glassType=roundFlask]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{bunsenBurner}（本生灯）}\label{subsec:bunsenBurner}
% ============================================================

\Lopt{bunsenBurner} 切换本生灯的显示。\Lcmd{tkzHeatTube} 默认为
\texttt{true}，\Lcmd{tkzHeatFlask} 默认为 \texttt{false}。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatTube[tubeOnly=true]
  \tkzHeatTube[tubeOnly=true,bunsenBurner=false]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{bubbling}（鼓泡）}\label{subsec:bubbling}
% ============================================================

\Lopt{bubbling} 创建一个通过细玻璃管连接的额外试管。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatTube[tubeOnly=true]
  \tkzHeatTube[bubbling=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{substance}（物质）}\label{subsec:substance}
% ============================================================

\Lopt{substance} 选择容器内物质的类型。表~\ref{tab:substance} 列出了
可用的宏命令。

\begin{table}[htb]
\centering
\caption{substance 选项可用的宏命令}\label{tab:substance}
\footnotesize
\begin{tabular}{@{}p{0.48\tblw}p{0.12\tblw}p{0.2\tblw}@{}}
\toprule
\textbf{宏命令} & \textbf{默认值} & \textbf{说明} \\
\midrule
\rowcolor{tablerowcolor}
\Lcmd{tkzChampagneBubbles}\texttt{[N]} & 25 & 香槟气泡 \\
\Lcmd{tkzFilaments}\texttt{[N]}\Larg{color} & 5 & 丝状物 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzBalls}\texttt{[N]} & 50 & 二维球体 \\
\Lcmd{tkzBubblesThreeD}\texttt{[N]}\Larg{color} & 50 & 三维球体 \\
\bottomrule
\end{tabular}
\end{table}

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube
  \tkzTestTube[substance=\tkzChampagneBubbles]
  \tkzTestTube[substance=\tkzFilaments{red}]
  \tkzTestTube[substance=\tkzBalls]
  \tkzTestTube[substance=\tkzBubblesThreeD{white}]
\end{tikzpicture}
\end{lstlisting}

使用内部循环次数的可选参数时，需将宏调用用花括号括起：

\begin{lstlisting}
\tkzTestTube[substance={\tkzChampagneBubbles[80]}]
\tkzTestTube[substance={\tkzFilaments[20]{black}}]
\tkzTestTube[substance={\tkzBalls[80]}]
\tkzTestTube[substance={\tkzBubblesThreeD[20]{white}}]
\end{lstlisting}

% ============================================================
\subsection{\texttt{solid}（固体）}\label{subsec:solid}
% ============================================================

\Lopt{solid} 描述固体物质。表~\ref{tab:solid} 列出了可用的宏命令。

\begin{table}[htb]
\centering
\caption{solid 选项可用的宏命令}\label{tab:solid}
\begin{tabular}{@{}p{0.5\tblw}p{0.2\tblw}@{}}
\toprule
\textbf{宏命令} & \textbf{默认值} \\
\midrule
\rowcolor{tablerowcolor}
\Lcmd{tkzCopperTurnings}\texttt{[N]} & 30 \\
\Lcmd{tkzIronNail}\texttt{[N]} & 60 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzZincGranules}\texttt{[N]} & 25 \\
\bottomrule
\end{tabular}
\end{table}

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube[solid=\tkzCopperTurnings]
  \tkzTestTube[solid=\tkzIronNail]
  \tkzTestTube[solid=\tkzZincGranules]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{curvedTube} 与 \texttt{curvedTubeShort}（弯管）}\label{subsec:curvedTube}
% ============================================================

\Lopt{curvedTube} 创建带本生灯的气体收集装置。
\Lopt{curvedTubeShort} 创建不带本生灯的版本。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatFlask[glassType=erlenmeyer,
                gasCollection=true,substance=\tkzCopperTurnings]
  \tkzHeatFlask[glassType=erlenmeyer,
                gasCollection=true,substance=\tkzCopperTurnings,
                curvedTube=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{doubleTube}（双管）}\label{subsec:doubleTube}
% ============================================================

\Lopt{doubleTube} 排列两根细玻璃管，其中一根带活塞。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzRoundFlask
  \tkzRoundFlask[doubleTube=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{condenserBulbs}（球形冷凝器）}\label{subsec:condenserBulbs}
% ============================================================

\Lopt{condenserBulbs} 输出带球形冷凝器的回流装置。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzRoundFlask[condenserBulbs=true,glassType=roundFlask,substance=\tkzIronNail]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{gasCollection}（气体收集）}\label{subsec:gasCollection}
% ============================================================

\Lopt{gasCollection} 添加收集膨胀气体的装置。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatFlask[glassType=reagentBottle,curvedTube=true,
                substance={\tkzFilaments[10]{red}}]
  \tkzHeatFlask[glassType=reagentBottle,curvedTube=true,
                substance={\tkzFilaments[10]{red}},
                gasCollection=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{burette}（滴定管）}\label{subsec:burette}
% ============================================================

\Lcmd{tkzTitration} 默认显示滴定管，\Lopt{burette=false} 可隐藏。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.4]
  \tkzTitration[glassType=erlenmeyer]
  \tkzTitration[glassType=erlenmeyer,burette=false]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{buretteLevel} 与 \texttt{buretteColor}（滴定管液位与颜色）}\label{subsec:buretteLevel}
% ============================================================

这两个参数控制滴定管内液体的量和颜色。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.4]
  \tkzTitration[buretteLevel=25,buretteColor=cyan]
  \tkzTitration[buretteLevel=10]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{MixtureStyle} 与 \texttt{DistillateColor}（混合物样式与馏出液颜色）}\label{subsec:MixtureStyle}
% ============================================================

\Lopt{MixtureStyle} 定义蒸馏瓶中化学混合物的颜色（必须是渐变样式）。
\Lopt{DistillateColor} 定义馏出液颜色（无此限制）。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.4]
  \tkzDistillation
  \tkzDistillation[MixtureStyle=Diffusion,DistillateColor=red]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{pHMeter}（pH 计）}\label{subsec:pHMeter}
% ============================================================

\Lopt{pHMeter} 显示 pH 计（仅用于 \Lcmd{tkzTitration}）。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTitration
  \tkzTitration[pHMeter=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{magneticStirrer}（磁力搅拌器）}\label{subsec:magneticStirrer}
% ============================================================

\Lopt{magneticStirrer} 默认启用，显示带磁力搅拌器的加热板。
停用时只绘制一个普通矩形。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTitration
  \tkzTitration[magneticStirrer=false]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\texttt{liquidLevel1/2/3} 与 \texttt{liquidStyle1/2/3}（液位与液体样式）}\label{subsec:niveauLiquide}
% ============================================================

这些参数定义最多三层液体的液位（0--100）和样式，且\texttt{liquidLevel1} > \texttt{liquidLevel2} > \texttt{liquidLevel3}。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.4]
  \tkzTitration[buretteLevel=18,liquidLevel1=30,%
             liquidStyle1=Champagne,pHMeter=true]
  \tkzTitration[buretteLevel=20,liquidLevel1=40,%
             liquidStyle1=Champagne,pHMeter=false,%
             magneticStirrer=false]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\section{预定义颜色与样式}\label{sec:styles}
% ============================================================

以下颜色和样式在 \Lpack{tikz-chemlab} 中预定义，用户可自行重定义。

\subsection*{颜色}

\begin{lstlisting}
\definecolor{Beige}          {rgb}{0.96,0.96,0.86}
\definecolor{LightGray}      {gray}{0.80}
\definecolor{VeryLightGray}  {cmyk}{0,0,0,0.1}
\definecolor{VeryPaleOrange} {cmyk}{0,0.1,0.3,0}
\definecolor{PaleOrange}     {rgb}{1.00,0.78,0.55}
\definecolor{LightBlue1}      {rgb}{0.60,0.80,1.00}
\definecolor{LightBlue}      {rgb}{0.68,0.85,0.90}
\definecolor{Copper}         {cmyk}{0,0.9,0.9,0.2}
\definecolor{Brown}         {rgb}{0.50,0.25,0.00}
\definecolor{woodColor}      {rgb}{0.957,0.84,0.69}
\definecolor{AqueousPhaseColor}{cmyk}{0.215686,0.062745,0,0}
\definecolor{OrganicPhaseColor}{cmyk}{0.223529,0.094118,0.501961,0}
\end{lstlisting}

\subsection*{液体样式（TikZ \texttt{\textbackslash tikzset}）}

\begin{lstlisting}
\tikzset{
  liquidStyle1/.style={fill=cyan,draw=none},
  liquidStyle2/.style={fill=yellow,draw=none},
  liquidStyle3/.style={fill=magenta,draw=none},
  Ball3D/.style={shading=ball,ball color=cyan,draw=none},
  Champagne/.style={fill=Beige,draw=none},
  Blood/.style={fill=red,draw=none},
  Cobalt/.style={fill=blue,line width=0.2cm},
  Oil/.style={fill=yellow,draw=none},
  Vinegar/.style={fill=magenta,draw=none},
  Diffusion/.style={bottom color={rgb,255:red,0;green,25;blue,242},
                    top color=cyan,draw=none},
  MixtureDiffusion2/.style={bottom color=white,top color=red,draw=red},
  flameAndGrill/.style={bottom color=PaleOrange,top color=yellow,draw=none},
  YellowStripes/.style={pattern=north east lines,pattern color=yellow},
  BlueDiffusion/.style={bottom color=green,top color=cyan,draw=none},
  AqueousPhase/.style={fill=AqueousPhaseColor,draw=none},
  OrganicPhase/.style={fill=OrganicPhaseColor,draw=none},
}
\end{lstlisting}

\subsection*{自定义样式}

使用 \Lcmd{tikzset} 定义新的液体样式：

\begin{lstlisting}
\tikzset{Nickel/.style={fill=green,draw=none}}
\tkzTestTube[liquidStyle1=Nickel]
\end{lstlisting}

% ============================================================
\section{线宽与样式}\label{sec:linewidth}
% ============================================================

\Lpack{tikz-chemlab} 提供了一套完善的线宽系统，可随 TikZ \Lopt{scale}
自动缩放。通过 \Lcmd{chemlabset}\Larg{style=\dots} 可使用六种预设样式：

\begin{table}[htb]
\centering
\caption{预设线宽样式}\label{tab:linestyles}
\footnotesize
\begin{tabularx}{0.8\textwidth}{@{}l l l l l@{}}
\toprule
\textbf{样式} & \textbf{轮廓} & \textbf{椭圆} & \textbf{管口椭圆} & \textbf{刻度} \\
\midrule
\rowcolor{tablerowcolor}
\texttt{default}      & 0.053\,cm & 0.07\,cm & 0.08\,cm & 0.02\,cm \\
\texttt{publication}  & 0.4\,pt   & 0.6\,pt  & 0.8\,pt  & 0.4\,pt \\
\rowcolor{tablerowcolor}
\texttt{presentation} & 0.8\,pt   & 1.2\,pt  & 1.6\,pt  & 0.6\,pt \\
\texttt{schematic}    & 0.6\,pt   & 0.8\,pt  & 1.2\,pt  & 0.4\,pt \\
\rowcolor{tablerowcolor}
\texttt{draft}        & 0.4\,pt   & 0.4\,pt  & 0.4\,pt  & 0.4\,pt \\
\texttt{bold}         & 1.2\,pt   & 1.6\,pt  & 1.6\,pt  & 0.8\,pt \\
\bottomrule
\end{tabularx}
\end{table}

\begin{lstlisting}
\chemlabset{style=publication}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube
\end{tikzpicture}
\end{lstlisting}

也可单独设置各类线宽：

\begin{lstlisting}
\chemlabset{outline line width=0.04cm}
\chemlabset{graduation line width=thick}
\chemlabset{line width=0.5pt}  % 同时设置四类线宽
\end{lstlisting}

命名线宽的可选值：\texttt{thin}（0.4\,pt）、\texttt{semithick}（0.6\,pt）、
\texttt{thick}（0.8\,pt）、\texttt{very thick}（1.2\,pt）、
\texttt{ultra thick}（1.6\,pt），或任意数值（如 \texttt{0.04cm}、\texttt{1pt}）。

% ============================================================
\section{宏命令}\label{sec:macros}
% ============================================================

% ============================================================
\subsection{\textbackslash tkzTestTube（试管）}\label{sec:tkzTestTube}
% ============================================================

显示最简单的玻璃容器，默认为试管（\texttt{glassType=tube}）。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTestTube
  \tkzTestTube[glassType=beaker]
  \tkzTestTube[glassType=erlenmeyer,liquidLevel1=80]
  \tkzTestTube[glassType=reagentBottle]
  \tkzTestTube[glassType=roundFlask,liquidLevel1=20,liquidStyle1=BlueDiffusion]
  \tkzTestTube[glassType=volumetricFlask]
  \tkzTestTube[glassType=watchGlass]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzHeatTube（加热试管）}\label{sec:tkzHeatTube}
% ============================================================

在 \Lcmd{tkzTestTube} 基础上增加加热块、本生灯或第二根细玻璃管。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatTube[tubeOnly=true]
  \tkzHeatTube[glassType=roundFlask,bunsenBurner=false,tubeOnly=true]
  \tkzHeatTube[glassType=erlenmeyer,bunsenBurner=true,clamp=true,tubeOnly=true]
  \tkzHeatTube[bunsenBurner=true,bubbling=true,glassType=reagentBottle]
  \tkzHeatTube[bunsenBurner=true,elbowTube=true,glassType=roundFlask,%
                    liquidLevel1=20,liquidStyle1=BlueDiffusion,%
                    tubeOnly=true,clamp=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzRoundFlask（圆底烧瓶）}\label{sec:tkzRoundFlask}
% ============================================================

与 \Lcmd{tkzTestTube} 类似，但增加了回流冷凝器、双管等选项。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzRoundFlask
  \tkzRoundFlask[glassType=erlenmeyer]
  \tkzRoundFlask[condenserBulbs=true]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzHeatFlask（加热烧瓶）}\label{sec:tkzHeatFlask}
% ============================================================

在 \Lcmd{tkzRoundFlask} 基础上默认显示本生灯。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzHeatFlask
  \tkzHeatFlask[bubbling=true,uTubeLong=true,bunsenBurner=true,%
                       substance=\tkzBalls]
  \tkzHeatFlask[glassType=reagentBottle,gasCollection=true,%
                       curvedTubeShort=true,%
                       substance={\tkzFilaments[10]{red}}]
  \tkzHeatFlask[doubleTube=true,gasCollection=true,%
                       substance=\tkzIronNail]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzFunnel（漏斗）}\label{sec:tkzFunnel}
% ============================================================

显示漏斗，无参数时与试管组合使用。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzFunnel
  \tkzFunnel[glassType=beaker,tiltAngle=-20]
  \tkzFunnel[glassType=reagentBottle,label=true,Number={37},%
                liquidStyle1=BlueDiffusion,liquidLevel1=80]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzGraduatedCylinder（量筒）}\label{sec:tkzGraduatedCylinder}
% ============================================================

显示量筒，可通过 TikZ \Lopt{scale} 因子改变大小。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzGraduatedCylinder
  \tkzGraduatedCylinder[liquidLevel1=100,liquidLevel2=60,liquidLevel3=30]
\end{tikzpicture}
\end{lstlisting}

\begin{lstlisting}
% yunit=0.5cm -> yscale=0.5 (仅 y 方向, x 保持不变)
\begin{tikzpicture}
  \begin{scope}[yscale=0.5]\tkzGraduatedCylinder\end{scope}
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzPipette（移液管）}\label{sec:tkzPipette}
% ============================================================

显示移液管，可通过 TikZ 缩放因子调整大小。

\begin{lstlisting}
% unit=0.5cm -> scale=0.5
\begin{tikzpicture}[scale=0.5]
  \tkzPipette
\end{tikzpicture}

% yunit=0.5cm -> yscale=0.5 (仅 y 方向, x 保持不变)
\begin{tikzpicture}[yscale=0.5]
  \tkzPipette
\end{tikzpicture}
\end{lstlisting}

\textit{注意：}\Lopt{tiltAngle} 对 \Lcmd{tkzPipette} 无效，
这与原 \Lpack{pst-labo} 行为一致。

% ============================================================
\subsection{\textbackslash tkzTitration（滴定装置）}\label{sec:tkzTitration}
% ============================================================

显示带滴定管（最大 25\,mL）的滴定装置，可选择 pH 计或加热板。
同一 \Lenv{tikzpicture} 中多次调用 \Lcmd{tkzTitration} 会自动横向排列。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzTitration
  \tkzTitration[glassType=beaker,pHMeter=true]
  \tkzTitration[buretteLevel=10,liquidLevel1=60,%
             liquidStyle1=Champagne,glassType=reagentBottle,%
             magneticStirrer=false]
  \tkzTitration[glassType=erlenmeyer,burette=false]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzDistillation（蒸馏装置）}\label{sec:tkzDistillation}
% ============================================================

显示分馏装置。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzDistillation
  \tkzDistillation[MixtureStyle=Diffusion,DistillateColor=red]
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzSeparatoryFunnel（分液漏斗）}\label{sec:tkzSeparatoryFunnel}
% ============================================================

在支架上显示分液漏斗。选项：\Lopt{TapOpen}（活塞开/关）、\Lopt{stopper}（塞子）、
\Lopt{liquidLevel1}（水相液位）、\Lopt{liquidLevel2}（有机相液位）。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \useasboundingbox (-2,-6) rectangle (6,16);
  \tkzStand
  \tkzSeparatoryFunnel[TapOpen=false,stopper=true]
\end{tikzpicture}
\quad
\begin{tikzpicture}[scale=0.5]
  \useasboundingbox (-2,-6) rectangle (6,16);
  \tkzStand
  \tkzSeparatoryFunnel[TapOpen=false,stopper=false,%
                     liquidLevel1=-1,liquidLevel2=10]
  % 下方烧杯
  \begin{scope}[shift={(-0.25,-4.4)}]
    \tkzTestTube[glassType=beaker,liquidStyle1=AqueousPhase]
  \end{scope}
\end{tikzpicture}
\quad
\begin{tikzpicture}[scale=0.5]
  \useasboundingbox (-2,-6) rectangle (6,16);
  \tkzSeparatoryFunnel[TapOpen=true,stopper=false,%
                     liquidLevel1=1,liquidLevel2=1]
  \begin{scope}[shift={(-0.25,-4.4)}]
    \tkzTestTube[glassType=beaker,liquidStyle1=OrganicPhase,%
                   liquidLevel1=30]
  \end{scope}
  \tkzStand
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{\textbackslash tkzStand（支架）}\label{sec:tkzStand}
% ============================================================

显示带夹子的支撑架（铁架台），与 \Lcmd{tkzSeparatoryFunnel} 配合使用。

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \tkzStand
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\section{定位与坐标映射}\label{sec:positioning}
% ============================================================

\subsection{从 \texttt{\textbackslash rput} 到 TikZ \texttt{shift}}

在 PSTricks 中，\Lcmd{rput}\texttt{(x,y)}\Larg{obj} 将 \texttt{obj} 的
\textbf{bbox 中心}放到 \texttt{(x,y)}（默认 \Lopt{ref=c}）。在 TikZ 中，
\Lcmd{begin}\Larg{scope}\texttt{[shift=\{(x,y)\}]} 将\textbf{局部原点}
\texttt{(0,0)} 放到 \texttt{(x,y)}。

转换公式为：

\begin{quote}
\texttt{shift = rput 位置 $-$ bbox 中心}
\end{quote}

\subsubsection*{示例：\texttt{\textbackslash tkzGraduatedCylinder}}

\Lcmd{tkzGraduatedCylinder} 的 bbox：\texttt{(-2,0)(2,6)}，中心 \texttt{(0,3)}。
对于 \Lcmd{rput}\texttt{(-4.5,4.0)}：

\begin{lstlisting}
% pst-labo: \rput(-4.5,4.0){\pstEprouvette[...]}
% shift = (-4.5 - 0, 4.0 - 3) = (-4.5, 1.0)
\begin{scope}[shift={(-4.5,1.0)}]
  \tkzGraduatedCylinder[...]
\end{scope}
\end{lstlisting}

\subsubsection*{示例：\texttt{\textbackslash tkzTestTube}（烧杯）}

\Lcmd{tkzTestTube} 的 bbox（烧杯，tiltAngle=0）：
\texttt{(-0.5,0)(1,2.8)}，中心 \texttt{(0.25,1.4)}。
对于 \Lcmd{rput}\texttt{(0,-3)}：

\begin{lstlisting}
% pst-labo: \rput(0,-3){\pstTubeEssais[glassType=becher,...]}
% shift = (0 - 0.25, -3 - 1.4) = (-0.25, -4.4)
\begin{scope}[shift={(-0.25,-4.4)}]
  \tkzTestTube[glassType=beaker,...]
\end{scope}
\end{lstlisting}

\subsubsection*{bbox 中心对照表}

\begin{table}[htb]
\centering
\caption{各命令的 bbox 中心（用于 \texttt{\textbackslash rput} 对齐）}
\footnotesize
\begin{tabular}{@{}p{0.36\tblw}p{0.24\tblw}p{0.2\tblw}@{}}
\toprule
\textbf{条件} & \textbf{Bbox} & \textbf{中心} \\
\midrule
\rowcolor{tablerowcolor}
\multicolumn{3}{l}{\Lcmd{tkzTestTube}（tiltAngle=0）：} \\
\quad glassType=beaker          & (-0.5,0)(1,2.8)   & (0.25, 1.4) \\
\rowcolor{tablerowcolor}
\quad 其他（tube, roundFlask, \dots） & (-1.5,0)(1.5,4) & (0, 2) \\
\multicolumn{3}{l}{\Lcmd{tkzTestTube}（tiltAngle$\neq$0）：} \\
\rowcolor{tablerowcolor}
\quad tiltAngle$>$0            & (-3,0)(1,4)       & (-1, 2) \\
\quad tiltAngle$<$0            & (-1,0)(3,4)       & (1, 2) \\
\rowcolor{tablerowcolor}
\quad elbowTube=true            & (-1,0)(6,4)       & (2.5, 2) \\
\Lcmd{tkzGraduatedCylinder}            & (-2,0)(2,6)       & (0, 3) \\
\rowcolor{tablerowcolor}
\Lcmd{tkzFunnel}             & (-2,-2)(2,5)      & (0, 1.5) \\
\Lcmd{tkzTitration}（滴定管, pH计） & (-5,0)(3,16) & (-1, 8) \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTitration}（滴定管, 无pH计） & (-2,0)(2,16) & (0, 8) \\
\Lcmd{tkzTitration}（无滴定管, pH计） & (-5,0)(3,5) & (-1, 2.5) \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTitration}（无滴定管, 无pH计） & (-2,0)(2,5) & (0, 2.5) \\
\bottomrule
\end{tabular}
\end{table}

\subsection{缩放映射：\texttt{unit=Ncm} 到 \texttt{scale=N}}

PSTricks 的 \Lcmd{psset}\Larg{unit=N} 将单位设为 $N$\,cm。在 TikZ 中，
\Lopt{scale=N} 将所有坐标乘以 $N$。

当 \Lopt{scale=N} 应用于包含宏命令的 scope 时，宏命令内部坐标被乘以 $N$。
\Lcmd{shift} 值在\textbf{父级}（未缩放）坐标系中。

\begin{lstlisting}
% pst-labo: \rput(3,0){\pstDosage[...,unit=0.5]}
% tkzTitration bbox 中心（pHMeter）= (-1,8)
% scale=0.5, 物理中心 = (0.5*(-1), 0.5*8) = (-0.5, 4)
% shift = (3 - (-0.5), 0 - 4) = (3.5, -4)
\begin{scope}[shift={(3.5,-4)},scale=0.5]
  \tkzTitration[...,pHMeter=true]
\end{scope}
\end{lstlisting}

\subsection{\texttt{xunit} / \texttt{yunit} 映射}

PSTricks 的 \Lopt{xunit} 和 \Lopt{yunit} 仅缩放一个轴：

\begin{center}
\begin{tabular}{@{}p{0.3\tblw}p{0.3\tblw}@{}}
\toprule
\textbf{PSTricks} & \textbf{TikZ} \\
\midrule
\rowcolor{tablerowcolor}
\Lopt{unit=N}    & \Lopt{scale=N} \\
\Lopt{xunit=N}   & \Lopt{xscale=N} \\
\rowcolor{tablerowcolor}
\Lopt{yunit=N}   & \Lopt{yscale=N} \\
\bottomrule
\end{tabular}
\end{center}

% ============================================================
\section{示例}\label{sec:examples}
% ============================================================

% ============================================================
\subsection{带标签的滴定装置}\label{sec:ex-dosage}
% ============================================================

\begin{lstlisting}
\begin{tikzpicture}
  \useasboundingbox (0,-4) rectangle (7,4);
  % \rput(3,0){\pstDosage[...,unit=0.5]}
  \begin{scope}[shift={(3.5,-4)},scale=0.5]
    \tkzTitration[buretteLevel=25,liquidLevel1=30,%
    liquidStyle1=Champagne,glassType=beaker,pHMeter=true]
  \end{scope}

  \node at (2,3) {B\"urette};
  \node at (4.7,3.6) {25 mL};
  \node at (5.2,-2.2) {H$_3$O$^+$+Cl$^-$};
  \node at (.8,-3) {PH-Messer};
  \node at (5,-2.8) {20 mL};
  \node at (5,1) {Na$^+$+OH$^-$};
  \node at (6.4,-3.6) {Heizplatte};
  \draw[-{Stealth}] (2.7,2.9) -- (3.4,2.9);
\end{tikzpicture}
\begin{tikzpicture}
  \useasboundingbox (-3,-2) rectangle (2,3);
  \begin{scope}[scale=0.5]
    \begin{scope}[shift={(-4.25,1.5)}]
      \tkzGraduatedCylinder[tiltAngle=-60,liquidLevel1=90,liquidLevel2=50]
    \end{scope}
    \begin{scope}[shift={(0.25,-0.75)}]
      \tkzFunnel[glassType=reagentBottle,liquidLevel1=30]
    \end{scope}
  \end{scope}
  \node[draw] at (0.25,3.75) {%
  \begin{minipage}{3.2cm}Nach der Dekantation
    sind die einzelnen Phasen getrennt.
  \end{minipage}};
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{带标签的试管架}\label{sec:ex-rack}
% ============================================================

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5,
  Nickel/.style={fill=green,draw=none}]
  \tkzTestTube[liquidLevel1=20,liquidStyle1=Champagne,%
    Number=1,label=true]
  \begin{scope}
    \tkzTestTube[liquidLevel1=30,liquidStyle1=Cobalt,%
      Number=2,label=true]
  \end{scope}
  \begin{scope}[xshift=2cm]
    \tkzTestTube[liquidLevel1=40,liquidStyle1=Blood,%
      Number=3,label=true]
  \end{scope}
  \begin{scope}[xshift=4cm]
    \tkzTestTube[Number=4,label=true]
  \end{scope}
  \begin{scope}[xshift=6cm]
    \tkzTestTube[liquidStyle1=Vinegar,%
      Number={\footnotesize MnO$_4^-$},%
      label=true,stopper=true,glassType=reagentBottle]
  \end{scope}
  \begin{scope}[xshift=8.2cm]
    \tkzTestTube[liquidStyle1=Oil,%
      Number={\footnotesize Ce$^{4+}$},%
      label=true,stopper=true,glassType=reagentBottle]
  \end{scope}
  \begin{scope}[xshift=10.5cm]
    \tkzTestTube[liquidStyle1=Nickel,%
      Number={\footnotesize Ni$^{2+}$},%
      label=true,stopper=true,glassType=reagentBottle]
  \end{scope}
  \begin{scope}[xshift=13cm]
    \tkzTestTube[Number={\footnotesize Cu$^{2+}$},%
      label=true,stopper=true,glassType=reagentBottle]
    \end{scope}
  \begin{scope}[xshift=15.5cm]
    \tkzTestTube[liquidLevel1=30,liquidStyle1=Champagne,%
      Number={\footnotesize NaOH},%
      label=true,stopper=true,glassType=reagentBottle]
  \end{scope}
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\subsection{分液漏斗与烧杯}\label{sec:ex-funnel}
% ============================================================

\begin{lstlisting}
\begin{tikzpicture}[scale=0.5]
  \useasboundingbox (-2,-6) rectangle (6,16);
  \tkzStand
  \tkzSeparatoryFunnel[TapOpen=false,stopper=true]
\end{tikzpicture}
\quad
\begin{tikzpicture}[scale=0.5]
  \useasboundingbox (-2,-6) rectangle (6,16);
  \tkzStand
  \tkzSeparatoryFunnel[TapOpen=false,stopper=false,%
                     liquidLevel1=-1,liquidLevel2=10]
  \begin{scope}[shift={(-0.25,-4.4)}]
    \tkzTestTube[glassType=beaker,liquidStyle1=AqueousPhase]
  \end{scope}
\end{tikzpicture}
\quad
\begin{tikzpicture}[scale=0.5]
  \useasboundingbox (-2,-6) rectangle (6,16);
  \tkzSeparatoryFunnel[TapOpen=true,stopper=false,%
                     liquidLevel1=1,liquidLevel2=1]
  \begin{scope}[shift={(-0.25,-4.4)}]
    \tkzTestTube[glassType=beaker,liquidStyle1=OrganicPhase,%
                   liquidLevel1=30]
  \end{scope}
  \tkzStand
\end{tikzpicture}
\end{lstlisting}

% ============================================================
\section{从 pst-labo 迁移}\label{sec:migration}
% ============================================================

\subsection{迁移清单}

\begin{enumerate}[nosep,leftmargin=2em]
  \item 将 \Lcmd{usepackage}\Larg{pst-labo} 替换为
        \Lcmd{usepackage}\Larg{tikz-chemlab}。
  \item 重命名所有命令：\texttt{pst} 前缀 $\to$ \texttt{tkz} 前缀；
        法语词汇 $\to$ 英语。完整映射见表~\ref{tab:cmd-mapping}。
  \item 重命名所有选项键名：法语 $\to$ 英语。见表~\ref{tab:key-mapping}。
  \item 重命名 \texttt{glassType} 的值：法语 $\to$ 英语（如
        \texttt{ballon} $\to$ \texttt{roundFlask}，\texttt{becher}
        $\to$ \texttt{beaker}）。
  \item 将 \Lenv{pspicture} 替换为 \Lenv{tikzpicture}。
  \item 将 \Lcmd{psset}\Larg{unit=Ncm} 替换为
        \Lenv{tikzpicture}\texttt{[scale=N]} 或
        \Lcmd{begin}\Larg{scope}\texttt{[scale=N]}。
  \item 将 \Lcmd{rput}\texttt{(x,y)}\Larg{obj} 替换为
        \Lcmd{begin}\Larg{scope}\texttt{[shift=\{(x,y)\}]} \dots{}
        \Lcmd{end}\Larg{scope}（注意需减去 bbox 中心）。
  \item 将 \Lcmd{psline}、\Lcmd{psframe}、\Lcmd{psellipse} 替换为
        \Lcmd{draw}、\Lcmd{fill}、\Lcmd{filldraw}。
  \item 将 \Lcmd{newpsstyle}\Larg{name}\Larg{\dots} 替换为
        \Lcmd{tikzset}\Larg{name/.style=\dots}。
  \item 将 \Lcmd{psgrid} 替换为 \Lcmd{draw}\texttt{[help lines]
        (0,0) grid (N,N);} 或 \Lopt{help lines} 选项。
  \item 显式传入 \Lopt{label=true} 给每次 \Lcmd{tkzTestTube} 调用
        （全局 \Lcmd{chemlabset} 设置会被 \Lcmd{tikzchemlabdefaults} 重置）。
\end{enumerate}

\subsection{命令名映射}\label{sec:cmd-mapping}

表~\ref{tab:cmd-mapping} 展示了 pst-labo 命令名到 tikz-chemlab 命令名的完整映射。

\begin{center}
\scriptsize
\textbf{表~\ref{tab:cmd-mapping}：命令名映射（pst-labo $\to$ tikz-chemlab）}\label{tab:cmd-mapping}
\medskip
\begin{tabularx}{0.8\textwidth}{@{}ll@{}}
\toprule
\textbf{pst-labo} & \textbf{tikz-chemlab} \\
\midrule
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstTubeEssais}       & \texttt{\textbackslash tkzTestTube} \\
\texttt{\textbackslash pstChauffageTube}    & \texttt{\textbackslash tkzHeatTube} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstChauffageBallon}  & \texttt{\textbackslash tkzHeatFlask} \\
\texttt{\textbackslash pstDosage}           & \texttt{\textbackslash tkzTitration} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstEprouvette}       & \texttt{\textbackslash tkzGraduatedCylinder} \\
\texttt{\textbackslash pstpipette}          & \texttt{\textbackslash tkzPipette} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstBigPipette}       & \texttt{\textbackslash tkzLargePipette} \\
\texttt{\textbackslash pstBallon}           & \texttt{\textbackslash tkzRoundFlask} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstEntonnoir}        & \texttt{\textbackslash tkzFunnel} \\
\texttt{\textbackslash pstSeparateFunnel}   & \texttt{\textbackslash tkzSeparatoryFunnel} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstDistillation}     & \texttt{\textbackslash tkzDistillation} \\
\texttt{\textbackslash pstSupport}          & \texttt{\textbackslash tkzStand} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pscolon}             & \texttt{\textbackslash tkzColumn} \\
\texttt{\textbackslash pstBullesChampagne}  & \texttt{\textbackslash tkzChampagneBubbles} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstBULLES}           & \texttt{\textbackslash tkzBubblesThreeD} \\
\texttt{\textbackslash pstbulles}           & \texttt{\textbackslash tkzBubbles} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstFilaments}        & \texttt{\textbackslash tkzFilaments} \\
\texttt{\textbackslash pstBilles}           & \texttt{\textbackslash tkzBalls} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstClouFer}          & \texttt{\textbackslash tkzIronNail} \\
\texttt{\textbackslash pstTournureCuivre}   & \texttt{\textbackslash tkzCopperTurnings} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstGrenailleZinc}    & \texttt{\textbackslash tkzZincGranules} \\
\texttt{\textbackslash pstBecBunsen}        & \texttt{\textbackslash tkzBunsenBurner} \\
\rowcolor{tablerowcolor}
\texttt{\textbackslash pstFlammeGrille}     & \texttt{\textbackslash tkzFlameGrill} \\
\texttt{\textbackslash pstThermo}           & \texttt{\textbackslash tkzThermometer} \\
\bottomrule
\end{tabularx}
\end{center}

\subsection{选项键映射}\label{sec:key-mapping}

表~\ref{tab:key-mapping} 展示了 pst-labo 选项键到 tikz-chemlab 选项键的映射。

\begin{center}
\footnotesize
\textbf{表~\ref{tab:key-mapping}：选项键映射（pst-labo $\to$ tikz-chemlab）}\label{tab:key-mapping}
\medskip
\begin{tabularx}{0.8\textwidth}{@{}ll@{}}
\toprule
\textbf{pst-labo} & \textbf{tikz-chemlab} \\
\midrule
\rowcolor{tablerowcolor}
\texttt{tubePenche}              & \texttt{tiltAngle} \\
\texttt{niveauLiquide1/2/3}     & \texttt{liquidLevel1/2/3} \\
\rowcolor{tablerowcolor}
\texttt{aspectLiquide1/2/3}     & \texttt{liquidStyle1/2/3} \\
\texttt{niveauReactif}          & \texttt{reagentLevel} \\
\rowcolor{tablerowcolor}
\texttt{couleurReactif}         & \texttt{reagentColor} \\
\texttt{niveauReactifBurette}   & \texttt{buretteLevel} \\
\rowcolor{tablerowcolor}
\texttt{couleurReactifBurette}  & \texttt{buretteColor} \\
\texttt{reactifBurette}         & \texttt{buretteReagent} \\
\rowcolor{tablerowcolor}
\texttt{reactifBecher}          & \texttt{beakerReagent} \\
\texttt{CouleurDistillat}       & \texttt{DistillateColor} \\
\rowcolor{tablerowcolor}
\texttt{AspectMelange}          & \texttt{MixtureStyle} \\
\texttt{bouchon}                & \texttt{stopper} \\
\rowcolor{tablerowcolor}
\texttt{pince}                  & \texttt{clamp} \\
\texttt{tubeDroit}              & \texttt{straightTube} \\
\rowcolor{tablerowcolor}
\texttt{tubeCoude}              & \texttt{elbowTube} \\
\texttt{tubeCoudeU}             & \texttt{uTube} \\
\rowcolor{tablerowcolor}
\texttt{tubeCoudeUB}            & \texttt{uTubeLong} \\
\texttt{tubeRecourbe}           & \texttt{curvedTube} \\
\rowcolor{tablerowcolor}
\texttt{tubeRecourbeCourt}      & \texttt{curvedTubeShort} \\
\texttt{doubletube}             & \texttt{doubleTube} \\
\rowcolor{tablerowcolor}
\texttt{refrigerantBoulles}     & \texttt{condenserBulbs} \\
\texttt{becBunsen}              & \texttt{bunsenBurner} \\
\rowcolor{tablerowcolor}
\texttt{barbotage}              & \texttt{bubbling} \\
\texttt{recuperationGaz}        & \texttt{gasCollection} \\
\rowcolor{tablerowcolor}
\texttt{tubeSeul}               & \texttt{tubeOnly} \\
\texttt{tubeDegagementDroit}    & \texttt{gasTubeStraight} \\
\rowcolor{tablerowcolor}
\texttt{etiquette}              & \texttt{label} \\
\texttt{Numero}                 & \texttt{Number} \\
\rowcolor{tablerowcolor}
\texttt{phmetre}                & \texttt{pHMeter} \\
\texttt{agitateurMagnetique}    & \texttt{magneticStirrer} \\
\rowcolor{tablerowcolor}
\texttt{OpenTap}                & \texttt{TapOpen} \\
\texttt{solide}                 & \texttt{solid} \\
\bottomrule
\end{tabularx}
\end{center}

\subsection{\texttt{glassType} 值映射}

\Lopt{glassType} 的值也已翻译为英语：

\begin{center}
\begin{tabular}{@{}p{0.3\tblw}p{0.3\tblw}@{}}
\toprule
\textbf{pst-labo} & \textbf{tikz-chemlab} \\
\midrule
\rowcolor{tablerowcolor}
\texttt{tube}（不变） & \texttt{tube} \\
\texttt{ballon} & \texttt{roundFlask} \\
\rowcolor{tablerowcolor}
\texttt{becher} & \texttt{beaker} \\
\texttt{erlen} & \texttt{erlenmeyer} \\
\rowcolor{tablerowcolor}
\texttt{flacon} & \texttt{reagentBottle} \\
\texttt{fioleJauge} & \texttt{volumetricFlask} \\
\rowcolor{tablerowcolor}
\texttt{verre} & \texttt{watchGlass} \\
\bottomrule
\end{tabular}
\end{center}

\subsection{常见陷阱}

\begin{description}[nosep,leftmargin=2em]
  \item[\texttt{\textbackslash useasboundingbox}] 在 tikz-chemlab 中，
        顶层宏命令如 \Lcmd{tkzTitration} 内部使用
        \Lcmd{useasboundingbox}。如果将它们放在也有
        \Lcmd{useasboundingbox} 的 \Lenv{tikzpicture} 中，内部的
        \textbf{不会}覆盖外部的（scope 局部有效）。但对于嵌套宏命令
        如 figure 内的 \Lcmd{tkzGraduatedCylinder}，
        \Lcmd{useasboundingbox} 已被有意移除以避免冲突。
  \item[\texttt{label}] 全局 \Lcmd{chemlabset}\Larg{label}
        \textbf{不会}传递到 \Lcmd{tkzTestTube} 中，因为
        \Lcmd{tikzchemlabdefaults} 会重置它。务必显式传入
        \Lopt{label=true} 作为宏选项。
  \item[\texttt{tiltAngle} 对 \texttt{\textbackslash tkzPipette} 无效]
        原 \Lpack{pst-labo} 的 \Lcmd{tkzPipette} 不读取
        \Lopt{tiltAngle}，此行为被忠实保留。
  \item[\texttt{unit} 与 \texttt{scale}] PSTricks 的 \Lopt{unit=N}
        缩放所有内容包括线宽。TikZ 的 \Lopt{scale=N} 默认不缩放线宽，
        但 \Lpack{tikz-chemlab} 通过 \Lcmd{chemlabUpdateLineWidths}
        拦截并自动缩放线宽。
\end{description}

% ============================================================
\section{底层对象（内部）}\label{sec:objects}
% ============================================================

文件 \Lfile{tikz-chemlabObj.tex} 包含所有底层形状原语。这些通常不直接
由用户调用，但可用于自定义扩展。表~\ref{tab:objects} 给出了概览。

{\scriptsize
\begin{longtable}{@{}p{0.5\tblw}p{0.3\tblw}@{}}
\caption{tikz-chemlabObj.tex 中的底层对象}\label{tab:objects} \\
\toprule
\textbf{宏命令} & \textbf{说明} \\
\midrule
\endfirsthead
\toprule
\textbf{宏命令} & \textbf{说明} \\
\midrule
\endhead
\rowcolor{tablerowcolor}
\Lcmd{tkzBuretteBody}        & 滴定管主体 \\
\Lcmd{tkzBuretteStopcock}     & 滴定管活塞 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzBuretteGraduation}   & 滴定管刻度 \\
\Lcmd{tkzTitrationPHMeter}       & pH 计箱体 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTitrationStand}       & 加热板/搅拌器支架 \\
\Lcmd{tkzTitrationStirBar}        & 磁力搅拌子 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzPipetteBody}        & 移液管主体 \\
\Lcmd{tkzLargePipetteBody}          & 大移液管 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzDrop}              & 液滴 \\
\Lcmd{tkzGraduatedCylinderBody}     & 量筒主体 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzGraduatedCylinderRim}    & 量筒边缘 \\
\Lcmd{tkzGraduatedCylinderBase}      & 量筒底座 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzGraduatedCylinderGraduation} & 量筒刻度 \\
\Lcmd{tkzDistillationFractionated} & 分馏装置 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzBunsenBurner}           & 本生灯 \\
\Lcmd{tkzFlameGrill}        & 带格栅火焰 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzBunsenBurnerGrill}     & 带格栅本生灯 \\
\Lcmd{tkzRoundFlaskSimple}        & 圆底烧瓶主体 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzRoundFlaskGrill}        & 带格栅圆底烧瓶 \\
\Lcmd{tkzTestTubeStopper}   & 试管塞 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTestTubeBody}     & 试管主体 \\
\Lcmd{tkzTestTubeStraightTube}     & 直导管 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTestTubeElbowTube}     & 直角弯管 \\
\Lcmd{tkzTestTubeUTube}    & U 形管 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTestTubeUTubeLong}   & 延伸至底部的 U 形管 \\
\Lcmd{tkzCurvedTube}        & 弯曲排气管（带本生灯） \\
\rowcolor{tablerowcolor}
\Lcmd{tkzCurvedTubeShort}   & 短弯曲排气管 \\
\Lcmd{tkzTestTubeDoubleTube} & 双管组件 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTestTubeClamp}     & 试管夹 \\
\Lcmd{tkzVolumetricFlask}          & 容量瓶 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzCrystallizingDish}       & 结晶皿 \\
\Lcmd{tkzBeakerRim}        & 烧杯边缘 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzBeakerBody}         & 烧杯主体 \\
\Lcmd{tkzErlenmeyerBody}          & 锥形瓶主体 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzReagentBottleBody}         & 试剂瓶主体 \\
\Lcmd{tkzWatchGlassBody}          & 表面皿主体 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzWatchGlassBase}           & 表面皿底座 \\
\Lcmd{tkzFunnelBody}      & 漏斗主体 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzCondenserStem}         & 球形冷凝器杆 \\
\Lcmd{tkzCondenserBulbs}  & 球形冷凝器 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzHeaterRoundFlask}       & 烧瓶加热器（加热套） \\
\Lcmd{tkzRoundFlaskReflux}        & 回流烧瓶组件 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzSeparatoryFunnelBody}        & 分液漏斗主体 \\
\Lcmd{tkzSeparatoryFunnelOutlineClip}  & 分液漏斗裁剪路径 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzStopper}             & 塞子（漏斗） \\
\Lcmd{tkzTapOpen}             & 开启活塞 \\
\rowcolor{tablerowcolor}
\Lcmd{tkzTapClosed}           & 关闭活塞 \\
\Lcmd{tkzStand}             & 支架 \\
\bottomrule
\end{longtable}
}

% ============================================================
\section{版本历史与致谢}\label{sec:credits}
% ============================================================

\Lpack{tikz-chemlab}（v1.0.0）是 \Lpack{pst-labo}（v2.07, 2025/07/15，作者
Denis Girou、Christophe Jorssen、Manuel Luque、Herbert Vo\ss）的 TikZ 移植版。
本移植由 Aihua Wang（王爱华）创建。

\noindent\textbf{代码仓库：} \url{https://github.com/aihua/tikz-chemlab}\\
\textbf{技术支持：} \url{https://github.com/aihua/tikz-chemlab/issues}

本移植尽可能保留了原始命令名、选项键名、默认值和视觉外观。所有形状
坐标均源自原始 \Lfile{pst-laboObj.tex}。

\medskip\noindent
\textbf{与 pst-labo 的主要区别：}
\begin{itemize}[nosep,leftmargin=1.5em]
  \item 使用 TikZ 而非 PSTricks（无 PostScript 依赖；
        支持 pdflatex、xelatex、lualatex、tectonic）。
  \item 线宽通过 \Lcmd{chemlabUpdateLineWidths} 随 \Lopt{scale} 自动缩放。
  \item 提供原版没有的六种预设线宽样式（\texttt{publication}、
        \texttt{draft} 等）。
  \item 火焰颜色和大小可通过
        \Lcmd{chemlabset}\Larg{flame outer color=\dots,
        flame scale=\dots} 配置。
\end{itemize}

\end{document}
