├── .gitignore ├── README.md ├── chapter.png └── main.tex /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | *.aux 3 | *.log -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## LaTeX Chapter Style 2 | 3 | ![Chapter Style](./chapter.png) 4 | -------------------------------------------------------------------------------- /chapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skyme5/tex-template-chapter/master/chapter.png -------------------------------------------------------------------------------- /main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,12pt]{book} 2 | \usepackage[utf8]{inputenc} 3 | \usepackage{graphicx} 4 | \usepackage{lipsum} 5 | 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | % title format for chapter 8 | % 9 | \usepackage{tikzpagenodes} 10 | \usepackage[explicit]{titlesec} 11 | \usepackage{xcolor} 12 | \usepackage{microtype} 13 | \definecolor{blueBack}{RGB}{0,82,155} 14 | 15 | % For Chapters 16 | %\titleformat{command} 17 | %[shape] 18 | %{format} 19 | %{label} 20 | %{sep} 21 | %{before-code} 22 | %[after-code] 23 | 24 | \titleformat{\chapter} 25 | [display] %shape 26 | {} %format 27 | {}{0cm} %sep 28 | { %before 29 | \begin{tikzpicture}[background rectangle/.style={fill=olive!45} remember picture,overlay] 30 | \node[shape=rectangle, fill=gray!20, minimum height=12cm, minimum width=1.0\paperwidth] at (7.61, 5.5cm) {}; 31 | \node[shape=rectangle, minimum height=4cm, minimum width=4cm, absolute] 32 | at (1.54, 3.54) { 33 | \rotatebox[origin=c]{90}{% 34 | \normalfont\color{black}\Large% 35 | \textls[180]{\textsc{\fontsize{16}{20}\selectfont\chaptertitlename}}% 36 | }\hspace{0pt} 37 | {\setlength\fboxsep{0pt}% 38 | \colorbox{blueBack}{ 39 | \parbox[c][3.5cm][c]{3.5cm}{% 40 | \centering\color{white}{\Huge \thechapter}}% 41 | }} 42 | }; 43 | \node[shape=rectangle, minimum height=4cm, minimum width=11cm, text width=11cm, align=right, font=\huge] 44 | at (10, 3.54) { 45 | \textbf{#1} 46 | }; 47 | \end{tikzpicture} 48 | } 49 | [\enlargethispage{-\parskip}\vspace{1cm}] 50 | 51 | \titleformat{name=\chapter,numberless} 52 | [display] %shape 53 | {} %format 54 | {}{0cm} %sep 55 | { %before 56 | \begin{tikzpicture}[background rectangle/.style={fill=olive!45} remember picture,overlay] 57 | \node[shape=rectangle, fill=gray!20, minimum height=12cm, minimum width=1.0\paperwidth] at (7.61, 5.5cm) {}; 58 | \node[shape=rectangle, minimum height=4cm, minimum width=11cm, text width=11cm, align=right, font=\huge] 59 | at (10, 3.54) { 60 | \textbf{#1} 61 | }; 62 | \end{tikzpicture} 63 | } 64 | [\enlargethispage{-\parskip}\vspace{1cm}] 65 | 66 | \begin{document} 67 | 68 | \author{TeXstudio Team} 69 | \title{Simple Book Example} 70 | \date{January 2013} 71 | 72 | %\frontmatter 73 | %\maketitle 74 | %\tableofcontents 75 | 76 | \mainmatter 77 | \chapter[Short title]{This is a demonstration text for showing how line breaking works.} 78 | \lipsum 79 | 80 | \backmatter 81 | % bibliography, glossary and index would go here. 82 | 83 | \end{document} --------------------------------------------------------------------------------