chapter style
Eureka
latex
a year ago
5.1 kB
25
Indexable
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{graphicx}
\usepackage{xcolor}
\definecolor{zchapColor}{HTML}{7f8184}
\usepackage{tikz}
\usetikzlibrary{calc}
%%%%%%%% font family setup %%%%%%%%
\def\Cinzel{\relax}
\ExplSyntaxOn
% find number suffix: 1 -> st, 2 -> nd, ...
\tl_const:Nn \c_numSufix_i {st}
\tl_const:Nn \c_numSufix_ii {nd}
\tl_const:Nn \c_numSufix_iii {rd}
\tl_const:Nn \c_numSufix_ {th}
\clist_const:Nn \c_numSpecialSufix_clist {11, 12, 13}
\NewDocumentCommand\Suffixnum{m}{
\clist_if_in:NnTF \c_numSpecialSufix_clist {#1}
{th}{
\int_compare:nNnTF {\int_mod:nn {#1}{10}}{>}{3}
{th}
{\tl_use:c {c_numSufix_\int_to_roman:n {\int_mod:nn {#1}{10}}}}
}
}
% numbered chapter format
\makeatletter
\titleformat{\chapter}[display]
{\normalfont\huge\sffamily}{}
{20pt}{
\begin{tikzpicture}[overlay, remember~ picture]%
% mark nodes (need 'calc' library)
\coordinate (A) at ($(current~ page.north~ west)+(.125\paperwidth, 0pt)$);
\coordinate (stripES) at ($(A)+(3em, -.25\paperheight)$);
% chapter head
\fill[zchapColor] (A) rectangle (stripES);
\draw[draw=zchapColor] (stripES)++(.25em, 4em) -- ++(.75\paperwidth-3.25em, 0pt);
\draw[draw=zchapColor] (stripES)++(.25em, 1.5pt) -- ++(.75\paperwidth-3.25em, 0pt);
\draw[draw=zchapColor] (stripES)++(.25em, 0em) -- ++(.75\paperwidth-3.25em, 0pt);
% chapter title and index
\node[anchor=south, color=white] at ($(stripES)+(-1.5em, 0em)$)
{\normalfont\normalsize\scalebox{4}{\thechapter}\Suffixnum{\thechapter}};
\node[anchor=south~ west, inner~ sep=0pt,
yshift=4.25em, xshift=.25em,
font=\Large\bfseries, color=zchapColor
] at (stripES) {\z@subtitle};
\node[anchor=south~ west, inner~ sep=0pt,
yshift=1.5em, xshift=.25em,
font=\Cinzel\Huge\bfseries, color=zchapColor
] at (stripES) {#1};
% parbox insert
\node[anchor=north~ west, inner~ sep=0pt] at ($(stripES)+(-3em, -1em)$){
\parbox[t]{.3\paperwidth}{\normalfont\fontsize{10pt}{15pt}
\selectfont\Cinzel\itshape\z@leftContent}
};
\node[anchor=north~ west, inner~ sep=0pt] at ($(stripES)+(-3em+.45em+.3\paperwidth, -1em)$){
\parbox[t]{\dimeval{.45\paperwidth-.45em}}{
\normalfont\fontsize{10pt}{15pt}\selectfont\z@rightContent}
};
% saying block
\coordinate (sayingWN) at ($(current~ page.south~ west)+(0, .3\paperheight)$);
\shade[top~ color=white, bottom~ color=zchapColor!25] (sayingWN)
rectangle ++(1\paperwidth, 5pt);
\shade[top~ color=zchapColor!25, bottom~ color=white] ($(sayingWN)+(0em, -.15\paperheight)$)
rectangle ++(1\paperwidth, -5pt);
\node at ($(sayingWN)+(.5\paperwidth, -0.075\paperheight)$) {
\parbox[t][][r]{.75\paperwidth}{\normalfont\fontsize{15pt}{22.5pt}\selectfont
\MakeUppercase{\Cinzel\z@saying\\\hspace*{\fill}{\itshape\normalsize\z@sayauthor}}}
};
\end{tikzpicture}}[\thispagestyle{empty}\clearpage]
\makeatother
% fancy chapter default material
\ExplSyntaxOff
\makeatletter
% default settings
\newcommand{\z@subtitle}{An Introduction to Mathematical Logic}
\newcommand{\z@saying}{Mathematical logic has always been closely connected with the philosophy of mathematics.}
\newcommand{\z@sayauthor}{-- Joseph R. Shoenfield}
\newcommand{\z@leftContent}{
\includegraphics[width=1\linewidth]{example-image-duck}\\[.5em]
We add two words of caution. First, if two different syntactical variables
occur in the same context, they do not necessarily represent different expressions.
}
\newcommand{\z@rightContent}{
Logic is the study of reasoning; and mathematical logic is the study of the
type of reasoning done by mathematicians. To discover the proper approach to
mathematical logic, we must therefore examine the methods of the mathematician.\\
The conspicuous feature of mathematics, as opposed to other sciences, is
the use of proofs instead of observations. A physicist may prove physical laws
from other physical laws; but he usually regards agreement with observation as
the ultimate test of a physical law. A mathematician may, on occasions, use
observation; for example, he may measure the angles of many triangles and
conclude that the sum of the angles is always 180$^\circ$. However, he will
accept this as a law of mathematics only when it has been proved.
}
% users' interface
\NewDocumentCommand{\zsubtitle}{m}{
\renewcommand\z@subtitle{#1}
}
\NewDocumentCommand{\zchapterSaying}{O{}m}{
\renewcommand\z@saying{#2}
\renewcommand\z@sayauthor{#1}
}
\NewDocumentCommand{\zchapterLContent}{m}{
\renewcommand\z@leftContent{#1}
}
\NewDocumentCommand{\zchapterRContent}{m}{
\renewcommand\z@rightContent{#1}
}
\makeatother
\begin{document}
\setcounter{chapter}{98}
\chapter{MATHEMATICAL LOGIC}
\section{SSE I}
\section{SSE II}
Hello \newpage
world
\zsubtitle{Step into Structure of English Stentences}
\setcounter{chapter}{0}
\chapter{English Learning}
\section{SSE I}
\section{SSE II}
hello world
\[
\alpha + \beta = \gamma
\]
\end{document}Editor is loading...
Leave a Comment