summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/korigamik/korigamik.cls
blob: 9bbe93c5e5a5e5a70b321b8a82b15817e148a70e (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
%%
%% This file is part of KorigamiK class.
%%
%% KorigamiK class is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at your option) any later version.
%%
%% KorigamiK class is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with KorigamiK class. If not, see <http://www.gnu.org/licenses/>.
%%

\ProvidesClass{korigamik}[2023/02/23 v1.0 Korigamik class]
\NeedsTeXFormat{LaTeX2e}
\LoadClass[12pt]{article}

\RequirePackage[a4paper,margin=1in,tmargin=1.5in]{geometry}

% Packages
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\RequirePackage{color,hyperref,graphicx}
\definecolor{linkcolour}{rgb}{0.286,0.286,0.286}

% Page layout
\RequirePackage{fancyhdr}
\fancypagestyle{firstpage}{%
	\fancyhf{} % clear all six fields
	\renewcommand{\headrulewidth}{0pt}
	\renewcommand{\footrulewidth}{0pt}
}
\fancypagestyle{followingpage}{%
	\fancyhf{} % clear all six fields
	\fancyhead[LO, L]{\@header}
	\fancyhead[RO]{\nouppercase\leftmark}
	\fancyhead[R]{\nouppercase\leftmark}
	\setlength{\headheight}{15pt}
	\fancyfoot{}
	\fancyfoot[L,LO]{\hfill\thepage\hfill}
}

\pagestyle{followingpage}
\AtBeginDocument{\thispagestyle{firstpage}}

\linespread{1.069}

% Font settings
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern} % modernized version of the Computer Modern font family  
\RequirePackage[sc]{mathpazo} % small caps option (sc) 
\RequirePackage{textcomp} % provides additional symbols and text companion fonts.
\RequirePackage[protrusion=true,expansion=false]{microtype} % enabling character protrusion) (disabling font expansion)

% Configurations
\newcommand*{\@rollno}{<rollno>}
\newcommand*{\rollno}[1]{
	\renewcommand*{\@rollno}{#1}
}
\newcommand*{\@subject}{<subject>}
\newcommand*{\subject}[1]{
	\renewcommand*{\@subject}{#1}
}
\newcommand*{\@keywords}{<keywords>}
\newcommand*{\keywords}[1]{
	\renewcommand*{\@keywords}{#1}
}
\newcommand*{\@logoimagepath}{}
\newcommand*{\@logoimagescale}{0.5}
\newcommand*{\@logolabel}{<Logo label>}
\newcommand*{\logoimage}[3]{
	\renewcommand*{\@logoimagepath}{#1}
	\renewcommand*{\@logoimagescale}{#2}
	\renewcommand*{\@logolabel}{#3}
}
\newcommand*{\@titlelabel}{<Something here>}
\newcommand*{\titlelabel}[1]{
	\renewcommand*{\@titlelabel}{#1}
}
\newcommand*{\@semester}{<semester>}
\newcommand*{\semester}[1]{
	\renewcommand*{\@semester}{#1}
}
\newcommand*{\@header}{<header>}
\newcommand*{\header}[1]{
	\renewcommand*{\@header}{#1}
}
\newcommand*{\@bottomnote}{<bottom note>}
\newcommand*{\bottomnote}[1]{
	\renewcommand*{\@bottomnote}{#1}
}
\newcommand*{\@course}{<course>}
\newcommand*{\course}[1]{
	\renewcommand*{\@course}{#1}
}

\newcommand{\square}{
	\begin{tikzpicture}
		\draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- (0,0);
	\end{tikzpicture}
}

\hypersetup{colorlinks,breaklinks,
linkcolor=linkcolour,citecolor=linkcolour,
filecolor=linkcolour, urlcolor=linkcolour,
pdftitle={\@title}, pdfauthor={\@author}
pdfsubject={\@subject}, pdfkeywords={\@keywords},
}

% Title page
\renewcommand{\maketitle}{%
	\newgeometry{tmargin=1in,bmargin=.5in}
	\makeatletter
	\begin{titlepage}
		\begin{center}
			\begin{flushright}
				\ifx\@logoimagepath\empty
					\square
					\\<your logo here>
				\else
					\includegraphics[scale=\@logoimagescale]{\@logoimagepath}
					\Large {\\ \textbf{\@logolabel}}
				\fi
			\end{flushright}
		\end{center}
		\vfill

		\noindent\begin{tikzpicture}
			\node[
				text width=\textwidth-2cm,
				align=left,
				font=\fontsize{30}{30}\selectfont\scshape,
				inner xsep=.5cm
			] (x) {\@title};
			\draw (x.north west) node[
				draw,
				above right=1cm and 0pt,
				font=\LARGE,
				inner sep=.2cm
			] (y) {\textsc{\@titlelabel}};
			\draw (y.south west)--($(x.south west)+(0,-1)$);
		\end{tikzpicture}

		\vspace*{2cm}
		\begin{center}
			\begin{minipage}{\textwidth}
				\begin{tabular}[h]{l  l}
					Name     & \textbf{\@author}          \\
					\ifx\@rollno\empty
					\else
					Roll No. & \textbf{\textit{\@rollno}} \\
					\fi
					\ifx\@semester\empty
					\else
					Semester & \textbf{\@semester}        \\
					\fi
					\ifx\@course\empty
					\else
					Course   & \textbf{\textit{\@course}} \\
					\fi
				\end{tabular}
			\end{minipage}
		\end{center}
		\vfill

		\begin{center}
			\textsc{\large \@bottomnote}\\[0.4cm]
			{\large \today}
		\end{center}

	\end{titlepage}
	\makeatother
	\restoregeometry
}

\renewcommand\section{\@startsection {section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\Large\raggedright}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
	{-3.25ex\@plus -1ex \@minus -.2ex}%
	{1.5ex \@plus .2ex}%
	{\normalfont\large\raggedright}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
	{-3.25ex\@plus -1ex \@minus -.2ex}%
	{1.5ex \@plus .2ex}%
	{\normalfont\normalsize\raggedright}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
	{3.25ex \@plus1ex \@minus.2ex}%
	{-1em}%
	{\normalfont\normalsize\itshape}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
	{3.25ex \@plus1ex \@minus .2ex}%
	{-1em}%
	{\normalfont\normalsize\itshape}}

\newcommand\tpj@deflogo{\@dblarg\tpj@@deflogo}

\newcommand\tpj@@deflogo[3][\@nil]{%
	\expandafter\DeclareRobustCommand\csname#2\endcsname{#3}%
	\pdfstringdefDisableCommands{%
		\expandafter\def\csname#2\endcsname{#1}}}

% Define the logos
\makeatletter
\tpj@deflogo{TeX}{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}
\tpj@deflogo{LaTeX}{L\kern-.32em\raise.37ex\hbox{\scalebox{0.76}{A}}\kern-.15em\TeX}
\tpj@deflogo{LaTeXe}{\LaTeX2$_{\textstyle\varepsilon}$}
\tpj@deflogo{BibTeX}{B{\textsc i\kern-.025em\textsc b}\kern-.08em\TeX}
\DeclareRobustCommand\logofamily{%
	\not@math@alphabet\logofamily\relax
	\fontencoding{U}\fontfamily{logo}\selectfont}
\DeclareTextFontCommand{\textlogo}{\logofamily}
\tpj@deflogo[MetaFont]{MF}{\textlogo{META}\@dischyph\textlogo{FONT}\@}
\tpj@deflogo[MetaPost]{MP}{\textlogo{META}\@dischyph\textlogo{POST}\@}
\tpj@deflogo{ConTeXt}{C\kern-.03em on\-\kern-.10em\TeX\kern-0.04em t}%
\tpj@deflogo{pdfTeX}{pdf\/\TeX}
\tpj@deflogo{pdfLaTeX}{pdf\/\LaTeX}
\makeatother

% Lists

% Save the original itemize, enumerate, and description environments
\let\originalItemize\itemize
\let\originalEndItemize\enditemize
\let\originalEnumerate\enumerate
\let\originalEndEnumerate\endenumerate
\let\originalDescription\description
\let\originalEndDescription\enddescription

% Redefine the itemize environment
\renewenvironment{itemize}
{\originalItemize\parskip=0pt}
{\originalEndItemize}

% Redefine the enumerate environment
\renewenvironment{enumerate}
{\originalEnumerate\parskip=0pt}
{\originalEndEnumerate}

% Redefine the description environment
\renewenvironment{description}
{\originalDescription\parskip=0pt\parindent=1.8em}
{\originalEndDescription}

% Define aliases for itemize and enditemize
\let\itemise\itemize
\let\enditemise\enditemize

% Redefine the label for the first level of itemize
\renewcommand\labelitemi{\normalfont\bfseries\textendash}

% Redefine the label for the second level of itemize
\renewcommand\labelitemii{\normalfont\bfseries\textperiodcentered}

% Redefine the label for the description environment
\renewcommand*\descriptionlabel[1]{\hspace\labelsep
	\normalfont\itshape #1}

% Table of Contents
\renewcommand*\contentsname{\centering \Huge Index \vskip 1cm}
\setcounter{tocdepth}{3} % Set the depth of the table of contents