-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreamble_style.sty
82 lines (70 loc) · 3.95 KB
/
preamble_style.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
% \usepackage[utf8]{inputenc}
\usepackage[a4paper, headheight=14pt, left=1.5cm, right=1.5cm, top=2cm, bottom=2cm]{geometry}
\usepackage{fancyhdr} % for customizing page-style (mainly headings).
\usepackage{titlesec} % for changing style of chapters, section... (with title format).
\usepackage{bookmark} % solve some warnings such as writing a section just below a part (i.e. without a chapter between them).
\usepackage[es-ES]{datetime2} % for writing the current date when compiling.
\usepackage{subfiles} % for creating subfiles .tex and compiling them separately to main.tex.
\usepackage{lmodern} % modern latin font. Also for avoiding (and correcting) some warnings.
\usepackage{titlecaps}
%%%%%%%% Index %%%%%%%%%
\usepackage{makeidx} % note the use of \makeindex in the preamble_style.sty
% \indexsetup{headers={\indexname}{\indexname}}
% \let\emph\relax % there's no \RedeclareTextFontCommand
% \DeclareTextFontCommand{\emph}{\bfseries\em}
% \newcommand\capmystring[1]{\capmystringaux#1\relax}
% \def\capmystringaux#1#2\relax{\uppercase{#1}#2} % only uppercase the text, ignore math
% % \renewcommand{\emph}[1]{{\em#1\index{\capmystring{#1}}}}
% % \usepackage{textcase} % in order to use \MakeUppercase
% % \newcommand{\ucfirst}[1]{\MakeUppercase{\f@rtocap{#1}}} % only capitalize the first letter
% % \def\f@rtocap#1\@nil{\uppercase{#1}\@nil}
% \usepackage{mfirstuc}
\renewcommand{\emph}[1]{{\em#1\index{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%% For cross-refering among documents %%%%%%
% \usepackage{xr}
% \externaldocument{Mathematics/1st/Fundamentals_of_mathematics/Fundamentals_of_mathematics}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% Title format and page style %%%%%%
\titleformat{\chapter}[hang]{\normalfont\Huge\bfseries}{\thechapter.}{20pt}{}
\titleformat{\section}[block]
{{\color{\col}\titlerule[1.5pt]}\addvspace{4pt}\normalfont\fontsize{19}{21}\bfseries}
{\thesection.} % label
{1em} % separation between label and body
{} % code before title body
[\vspace{2pt}{\color{\col}\titlerule[1.5pt]}] % code after title body
\titleformat{\subsection}[hang]{\normalfont\fontsize{13}{15}\bfseries}{\thesubsection.\hspace{6pt}$\textcolor{\col}{\vf{|}}$\hspace{-6pt}}{1em}{}
\titleformat{\subsubsection}[hang]{\normalfont\fontsize{11}{13}\bfseries}{}{0pt}{}
% For well cross reference in the table of contents
\renewcommand*{\theHchapter}{\the\value{part}.\the\value{chapter}}
\renewcommand*{\theHsection}{\the\value{part}.\the\value{chapter}.\the\value{section}}
\renewcommand*{\theHsubsection}{\the\value{part}.\the\value{chapter}.\the\value{section}.\the\value{subsection}}
\ifSubfilesClassLoaded{% show only when the single subfile is compiled
\titleformat{\section}[block]
{{\color{\col}\titlerule[1.5pt]}\addvspace{4pt}\normalfont\fontsize{19}{22}\bfseries}
{} % label
{0pt} % separation between label and body
{} % code before title body
[\vspace{2pt}{\color{\col}\titlerule[1.5pt]}] % code after title body
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
% For numbering by default level-3 headings (i.e. subsubsections). It is not by default because we are in a report class document.
\setcounter{secnumdepth}{3}
% For creating references in the .pdf file.
\setcounter{tocdepth}{3}
\titlelabel{\thesubsubsection} % removing space between number and text (i.e. "1. Probability" -----> "1.Probability").
\renewcommand{\thesubsubsection}{} % removing the label of the subsubsection.
}{% show only when the main file is compiled
\numberwithin{theorem}{section}
\numberwithin{equation}{section} % resets equation numbering when starting a new section.
%%% Page-style (heading) %%%
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\nouppercase{\leftmark}}
\fancyhead[R]{\nouppercase{\rightmark}}
\fancyfoot[C]{\thepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeindex
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%