实现代码如下:
\documentclass[10pt,twoside]{book} \usepackage[utf8]{inputenc} \usepackage{lipsum, graphicx, tabularx} \usepackage[svgnames]{xcolor} \usepackage[explicit]{titlesec} % todo modify this to display chapter name and number as shown in figure above. \titleformat{\chapter}[block] {\bfseries\Huge\sffamily} {\rlap{\hspace*{\dimexpr\linewidth+\marginparsep}% \parbox{\marginparwidth}{\centering\color{Gainsboro}\scalebox{4}{\thechapter}\\[-0.5ex]% \raisebox{-0.3\height}[0pt][0pt] \rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}\hspace{10pt}\rule{10pt}{10pt}}}} {0pt} {\color{gray!75}\begin{tabularx}{\linewidth}{@{}>{\raggedright\arraybackslash}X>{\raggedleft\arraybackslash}p{1cm}@{}} & \makebox[0pt]{\LARGE\chaptername}\\[2.5ex] #1 \end{tabularx}} [\vspace{1ex}\titlerule\vspace{16pt}] \titlespacing{\chapter}{0pt}{-5ex}{10ex} \usepackage{currfile} \usepackage{lipsum} \usepackage{shorttoc} \usepackage{tocbibind} % http://ctan.org/pkg/bookmark \usepackage{bookmark} \usepackage{listings} \usepackage{wrapfig} \usepackage{float} \begin{document} \chapter{Random Number Generators} \lipsum[1-5] \end{document}
发表评论 取消回复