Skip to content

Instantly share code, notes, and snippets.

@Liam0205
Last active April 23, 2020 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Liam0205/803a512eb91e4d2b179c46bfb17d783f to your computer and use it in GitHub Desktop.
Save Liam0205/803a512eb91e4d2b179c46bfb17d783f to your computer and use it in GitHub Desktop.
\documentclass{ctexbook}
\usepackage{calc}
% \usepackage{geometry}
% \geometry{showframe}
\usepackage{colortbl}
\definecolor{titlecolor}{rgb}{0.503906,0.503906,0.734375}
\ctexset {
chapter = {
beforeskip = 0pt,
fixskip = true,
nameformat = \chapternamebox,
titleformat = \chaptertitlebox,
number = \arabic{chapter},
}
}
\newcommand{\chapternamebox}[1]{\relax}
\makeatletter
\newcommand{\chaptertitlebox}[1]{%
\setlength{\arrayrulewidth}{0pt}%
\begin{tabular}{p{0.05\textwidth-2\tabcolsep}p{0.95\textwidth-2\tabcolsep}}
\cellcolor{black} & \cellcolor{titlecolor}\textcolor{white}%
{\bfseries\LARGE{\CTEXifname{\CTEXthechapter\CTEX@chapter@aftername}{}}#1}%
\end{tabular}%
}
\makeatother
\begin{document}
\tableofcontents
\chapter{熟悉 \LaTeX{}}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment