summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tiet-question-paper/tiet-question-paper.cls
blob: 6bc28c5792e71baf5bcc3449241be54500f5457f (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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
%% ----------------------------------------------------
%% Latex class ‘tiet-question-paper’
%%
%% Author: Raghav B. Venkataramaiyer
%% Email: bv.raghav -at- thapar -dot- edu
%% Email: bvraghav -at- gmail -dot- com
%% License: [MIT License](./LICENSE)
%% Version: 2024-06-22
%% ----------------------------------------------------

\NeedsTeXFormat{LaTeX2e}

\ProvidesClass%
{tiet-question-paper}%
[2024-06-22 TIET Question Paper class]

%% -----------------------------------
%% Parent Class
%% -----------------------------------
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\LoadClass[11pt,a4paper,onecolumn]{article}
%% -----------------------------------

%% -----------------------------------
%% Page Margins
%% -----------------------------------
\RequirePackage[%
  a4paper,%
  left=1in,%
  top=0.5in,%
  right=0.75in,%
  bottom=0.75in%
]{geometry}
%% -----------------------------------

%% -----------------------------------
%% Math package(s)
%% -----------------------------------
\RequirePackage{amsmath}
%% -----------------------------------

%% -----------------------------------
%% Lipsum for debugging
%% -----------------------------------
\RequirePackage{blindtext}
%% -----------------------------------

%% -----------------------------------
%% Check for empty argument
%% -----------------------------------
\RequirePackage{ifmtarg}
%% -----------------------------------

%% -----------------------------------
%% No paragraph indents
%% -----------------------------------
\RequirePackage{parskip}
%% -----------------------------------

%% -----------------------------------
%% Line spacing
%% -----------------------------------
% \RequirePackage{setspace}
% \doublespacing
%% -----------------------------------

%% -----------------------------------
%% Graphics
%% -----------------------------------
\RequirePackage{graphicx}
% \graphicspath{ {./images/} }
%% -----------------------------------

%% -----------------------------------
%% Compact Enumeration
%% -----------------------------------
\RequirePackage[inline,sizes]{enumitem}
% \setlist[enumerate]{itemsep=0in}
\setlist{nosep,leftmargin=*}
\setlist[enumerate,2]{label=\alph*)}
%% -----------------------------------

%% -----------------------------------
%% Extra font sizes
%% -----------------------------------
\RequirePackage{anyfontsize}
%% -----------------------------------

%% -----------------------------------
%% Automatic width computation
%% -----------------------------------
\RequirePackage{linegoal}
%% -----------------------------------

%% -----------------------------------
%% Tabularx
%% -----------------------------------
\RequirePackage{tabularx}
%% -----------------------------------

%% -----------------------------------
%% Box alignment within tables.
%%
%% valign keyword in includegraphics
%% -----------------------------------
\RequirePackage[export]{adjustbox}
%% -----------------------------------

%% -----------------------------------
%% {align} like columnar env.
%%
%% Remembers end of paragraph and starts there.
%% -----------------------------------
% \RequirePackage{paracol}
%% -----------------------------------

%% -----------------------------------
%% Customizing section font
%% -----------------------------------
\RequirePackage{sectsty}
\allsectionsfont{\sffamily}
\paragraphfont{\sffamily}
%% -----------------------------------

%% -----------------------------------
%% Class variable definitions
%% -----------------------------------

% Variable: institute
\def\tiet@institute{Thapar Institute of Engineering \&
  Technology}
\def\institute#1{\gdef\tiet@institute{#1}}

% Variable: abbrevinst
\def\tiet@abbrevinst{\textsc{tiet}}
\def\abbrevinst#1{\gdef\tiet@abbrevinst{#1}}

% Variable: instaddress
\def\tiet@instaddress{Patiala 147004}
\def\instaddress#1{\gdef\tiet@instaddress{#1}}

% Variable: instlogo
\let\tiet@instlogo\relax
\def\instlogo#1{\gdef\tiet@instlogo{#1}}

% Variable: schoolordepartment
\let\tiet@schoolordepartment\relax
\def\schoolordepartment#1{\def\tiet@schoolordepartment{#1}}

% Variable: examname
\let\tiet@examname\relax
\def\examname#1{\def\tiet@examname{#1}}

% Variable: cohort
\let\tiet@cohort\relax
\def\cohort#1{\def\tiet@cohort{#1}}

% Variable: coursecode
\let\tiet@coursecode\relax
\def\coursecode#1{\def\tiet@coursecode{#1}}

% Variable: coursename
\let\tiet@coursename\relax
\def\coursename#1{\def\tiet@coursename{#1}}

% Variable: timeduration
\let\tiet@timeduration\relax
\def\timeduration#1{\def\tiet@timeduration{#1}}

% Variable: maxmarks
\let\tiet@maxmarks\relax
\def\maxmarks#1{\def\tiet@maxmarks{#1}}

% Variable: faculty
\let\tiet@faculty\relax
\def\faculty#1{\gdef\tiet@faculty{#1}}

%% -----------------------------------

%% -----------------------------------
%% Questions Enum
%%
%% Ref: https://tex.stackexchange.com/a/164623
%% Update: Doesn’t help enough.
%% [TODO]
%% -----------------------------------
\DeclareRobustCommand%
% Horizontal rule after each question
\bvrhrule[1][0.4pt]{\rule{\linewidth}{#1}}

\DeclareRobustCommand%
% Skip line
\bvrskipline[1][]{\vspace{#1\baselineskip}}

% \newlist{qenum}{enumerate}{3}
% \setlist[qenum]{nosep,label=\arabic*.}
% % -----------------------------------------------------
% % We need a toggle to track whether the item is first
% % in the list or not
% \newif\ifbvrfirstq\bvrfirstqfalse
% \setlist*[qenum,1]{%
%   label=\arabic*.,%
%   % ---------------------------------------------------
%   % This saves the standard definition of \item and
%   % then redefines it to add the fill if the item is
%   % not first on the list; if it is the first item, it
%   % omits the fill but toggles the bvrfirstq switch so
%   % the next item will trigger it
%   first={% 
%     % -------------------------------------------------
%     % Save the standard definition of \item in a macro,
%     % \olditem
%     \let\olditem\item%
%     % -------------------------------------------------
%     % Set the toggle for first item in the list to true
%     \bvrfirstqtrue%
%     % -------------------------------------------------
%     % New, temporary defition of \item 
%     \def\item{\ifbvrfirstq\olditem\bvrfirstqfalse\else
%         \bvrhrule\bvrskipline\olditem\fi}%
%   },%
%   % ---------------------------------------------------
%   % This takes care of adding the fill for the final
%   % item on the list and just makes sure that \item is
%   % reset to its standard definition
%   after={
%     % -------------------------------------------------
%     % Fill for final item in list
%     \bvrhrule%
%     % -------------------------------------------------
%     % Restore standard definition of \item
%     \let\item\olditem%
%   }%
% }
% \setlist[qenum,2]{label=\alph*),before={},after={},first={}}
% %% -----------------------------------


%% -----------------------------------
%% Write Examination Details and Draw Logo
%% -----------------------------------

\DeclareRobustCommand%
% Write Examination Details
\writeexamdetails{
  \parbox[t][][t]{\linewidth}{\centering\large%
    {\bfseries \tiet@institute\par}

    \vspace*{0.2\baselineskip}
    {\tiet@schoolordepartment}

    \vspace*{0.2\baselineskip}
    {\MakeUppercase\tiet@examname}}  
}
\DeclareRobustCommand%
% Draw Logo
\drawinstlogo{
  \parbox[t][][t]{\linewidth}{\raggedright%
    \includegraphics[width=11.5mm,valign=t]
    {\tiet@instlogo}\par}
}



%% -----------------------------------
%% Title Page
%% -----------------------------------

% Make title
\renewcommand\maketitle{
  {\noindent Roll No. \rule{5cm}{0.4pt} \hfill
    \bfseries\@date\par}

  % \vspace*{0.5\baselineskip}
  {\noindent\large \textbf{\tiet@coursecode :
      \tiet@coursename} \hfill Time:
    \textbf{\tiet@timeduration} \hspace{0.3em}
    MM:\textbf{\tiet@maxmarks}}\\
  {\noindent Faculty: \tiet@faculty}


  \vspace*{\baselineskip}
  \ifx\tiet@instlogo\@empty
    \writeexamdetails
  \else
    \begin{tabularx}{\textwidth}{Xp{18mm}}
      \writeexamdetails & \drawinstlogo
    \end{tabularx}
  \fi

  \par\rule{\textwidth}{0.4pt}
  \par\vspace*{0.5\baselineskip}
}
%% -----------------------------------

%% -----------------------------------
%% Counterlessfootnote
%% -----------------------------------
\newcommand{\footnotenoless}[1]{%
  \let\svthefootnote\thefootnote
  \let\thefootnote\relax\footnote{#1}
  \addtocounter{footnote}{-1}\let\thefootnote\svthefootnote
}
%% -----------------------------------

%% -----------------------------------
%% Abbreviations
%% -----------------------------------
\RequirePackage{xspace}

% Add a period to the end of an abbreviation unless
% there's one already, then \xspace.
\makeatletter
\DeclareRobustCommand\onedot{\futurelet\@let@token\@onedot}
\def\@onedot{\ifx\@let@token.\else.\null\fi\xspace}

\def\eg{\emph{e.g}\onedot}
\def\Eg{\emph{E.g}\onedot}

\def\ie{\emph{i.e}\onedot}
\def\Ie{\emph{I.e}\onedot}

\def\cf{\emph{c.f}\onedot}
\def\Cf{\emph{C.f}\onedot}

\def\etc{\emph{etc}\onedot}

\def\vs{\emph{vs}\onedot}

\def\wrt{w.r.t\onedot}
\def\dof{d.o.f\onedot}

\def\etal{\emph{et al}\onedot}
\makeatother
%% -----------------------------------