CTeX-kit
July 9, 2026 · View on GitHub
English | 简体中文
CTeX-kit is a collection of TeX/LaTeX macro packages, scripts, and resources for Chinese typesetting. Maintained by the CTeX community, it brings together ctex, xeCJK, zhspacing, and other components to provide unified, reliable Chinese typesetting infrastructure across different TeX engines.
Core Packages
| Package | CTAN Version | Description |
|---|---|---|
| ctex | Chinese document classes and package bundle — font configuration, heading schemes, and multi-engine adaptation | |
| xeCJK | CJK font management, character spacing, and punctuation kerning for XeLaTeX |
Satellite Packages
| Package | CTAN Version | Description |
|---|---|---|
| CJKpunct | CJK punctuation kerning and spacing | |
| xCJK2uni | Legacy CJK encoding to Unicode mapping | |
| xpinyin | Automatic pinyin annotation for Chinese characters | |
| zhnumber | Chinese number and date formatting | |
| zhlineskip | Automatic line spacing adjustment for CJK–Latin mixed text | |
| zhspacing | Automatic CJK–Latin inter-character spacing (LuaTeX approach) | |
| zhmetrics | Chinese font metrics | |
| zhmetrics-uptex | Chinese font metrics for upTeX |
Quick Start
Installation
All packages are included in TeX Live and MiKTeX — no manual installation is needed. To use the development version, clone this repository directly.
Basic Usage
Using the ctexart document class:
\documentclass{ctexart}
\begin{document}
你好,\LaTeX{}!
\end{document}
Using the ctex package with a standard document class:
\documentclass{article}
\usepackage{ctex}
\begin{document}
你好,\LaTeX{}!
\end{document}
Supported engines: XeLaTeX, LuaLaTeX, pdfLaTeX (with CJK package), and upLaTeX. XeLaTeX or LuaLaTeX is recommended for the best experience.
Repository Structure
ctex-kit/
├── ctex/ # Core: Chinese document classes and packages
├── xeCJK/ # Core: XeLaTeX CJK support
├── CJKpunct/ # CJK punctuation kerning
├── xCJK2uni/ # CJK encoding conversion
├── xpinyin/ # Pinyin annotation
├── zhnumber/ # Chinese numbers
├── zhlineskip/ # Line spacing adjustment
├── zhspacing/ # CJK–Latin spacing
├── zhmetrics/ # Font metrics
├── zhmetrics-uptex/ # upTeX font metrics
├── jiazhu/ # Interlinear annotation (jiazhu)
├── gbk2uni/ # GBK→Unicode conversion tool
├── gbkmac/ # GBK encoding support (macOS)
├── zh-luatex/ # LuaTeX Chinese experimental support
├── support/ # Shared build configuration and support files
└── .github/ # CI/CD configuration
Building and Testing
This project uses l3build as its build and test framework.
# Run ctex test suite
cd ctex
l3build check
# Run xeCJK test suite
cd xeCJK
l3build check
# Build CTAN release package
l3build ctan
CI tests against the current TeX Live release on Ubuntu, macOS, and Windows, covering five test suites: ctex, xeCJK, zhnumber, CJKpunct, and zhlineskip.
Technology Stack
- Programming framework: LaTeX3 / expl3
- Literate programming: docstrip (
.dtxsource files) - Build system: l3build
- CI/CD: GitHub Actions (testing + automated releases)
Contributing
Bug reports via Issues and code contributions via Pull Requests are welcome.
Before submitting code, please ensure:
- All relevant tests pass (
l3build check) - Code follows expl3 conventions
- Changes to
.dtxfiles include\changesentries - After editing
\changes, regenerate the package'sCHANGELOG.mdwithmake changelog(orcd <pkg> && python3 ../scripts/extract-changes.py "*.dtx" all -o CHANGELOG.md) and commit it together; without a local Python, copy the expected content from the failed check-changelog CI log
Related Links
License
Packages in this project are released under the LPPL v1.3c (LaTeX Project Public License).
Copyright © 2003–2026 CTeX Community