summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chet/chet.sty
blob: 679441b4054c00bdc6ecfdb14da9c4e3057448a6 (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
% chet.sty (version 2.2)
% Copyright 2017 Andreas Stergiou
%
% This package is supposed to streamline latex typesetting and give the
% look and feel of harvmac to a paper, with the use of LaTex2e.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{chet}

\RequirePackage{kvoptions}

\SetupKeyvalOptions{%
  family=Chet,
  prefix=Chet@}

\DeclareBoolOption{macrosonly}

\ProcessKeyvalOptions*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifChet@macrosonly

\usepackage{xparse}
\usepackage{xspace}

% Numbered equation with optional label
\NewDocumentCommand\eqn{mo}{%
  \IfNoValueTF{#2}
     {\[ #1 \]}
     {\begin{equation}\label{#2} #1 \end{equation} \expandafter\newcommand\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces}
}

% Numbered aligned equation with optional label in the vertical middle
\NewDocumentCommand\eqna{mo}{%
  \IfNoValueTF{#2}
    {\begin{align*} #1 \end{align*}}
    {\begin{equation}\label{#2}\begin{split} #1 \end{split}\end{equation} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces}
}

% Numbered subequations
% Two subequations
\NewDocumentCommand\twoseqn{momoo}{%
    \IfNoValueTF{#5}
       {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4}  \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces}
       {\begin{subequations}\label{#5}\begin{align} #1\label{#2} \\ #3 \label{#4}  \end{align}\end{subequations} \expandafter\def\csname #5\endcsname{\eqref{#5}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces}
}
% Three subequations
\NewDocumentCommand\threeseqn{momomoo}{%
   \IfNoValueTF{#7}
     {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces}
     {\begin{subequations}\label{#7}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \end{align}\end{subequations} \expandafter\def\csname #7\endcsname{\eqref{#7}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces}
}

% Four subequations
\NewDocumentCommand\fourseqn{momomomoo}{%
   \IfNoValueTF{#9}
     {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \\ #7\label{#8} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces \expandafter\def\csname #8\endcsname{\eqref{#8}\xspace}\ignorespaces}
     {\begin{subequations}\label{#9}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \\ #7\label{#8} \end{align}\end{subequations} \expandafter\def\csname #9\endcsname{\eqref{#9}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces \expandafter\def\csname #8\endcsname{\eqref{#8}\xspace}\ignorespaces}
}

\newcommand{\rcite}{\cite}
\newcommand{\draftmode}{\usepackage[notref,notcite]{showkeys}}
\providecommand*\showkeyslabelformat[1]{\normalfont\sffamily\footnotesize#1}
\newcommand{\foot}{\footnote}

% Sections and subsections
\NewDocumentCommand\newsec{mo}{%
  \IfNoValueTF{#2}
     {\section{#1}}
     {\section{#1}\label{#2} \expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces}
}
\NewDocumentCommand\subsec{mo}{%
  \IfNoValueTF{#2}
     {\subsection{#1}}
     {\subsection{#1}\label{#2}\expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces}
}
\NewDocumentCommand\subsubsec{mo}{%
  \IfNoValueTF{#2}
     {\subsubsection{#1}}
     {\subsubsection{#1}\label{#2}\expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces}
}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}% 
{-6ex \@plus -1ex \@minus -.2ex}% 
{2.3ex \@plus.2ex}% 
{\bfseries}}
\makeatother
\makeatletter
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\itshape}}
\makeatother
\makeatletter
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\itshape}}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\else

\usepackage{xparse}
\usepackage{xspace}
\usepackage{datetime}
\usepackage{amsmath}
\usepackage[labelsep=colon,labelfont=bf]{caption}
\usepackage{tocloft}
\usepackage{cite}
\usepackage[parsep]{collref}
\usepackage{color}
\usepackage{microtype}
\usepackage[para]{manyfoot}
\usepackage[bottom]{footmisc}
\usepackage{filecontents}
\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=3cm]{geometry}
\usepackage[linktocpage]{hyperref}

\numberwithin{equation}{section}

\newcommand{\rcite}{\cite}
\newcommand{\rcitedraft}[1]{\cite{#1}$^{\normalfont\text{\textsf{#1}}}$}
\newcommand{\draftmode}{\usepackage[notref,notcite]{showkeys}\renewcommand{\rcite}{\rcitedraft}\overfullrule=8pt}
\providecommand*\showkeyslabelformat[1]{\normalfont\sffamily\footnotesize#1}

% Table of contents formatting
\setcounter{tocdepth}{3}
\renewcommand{\cfttoctitlefont}{\bfseries}
\renewcommand{\cftsecaftersnum}{.}
\renewcommand{\cftsubsecaftersnum}{.}
\renewcommand{\cftsubsubsecaftersnum}{.}
\renewcommand{\cftdotsep}{8}
\newcommand{\toc}{\tableofcontents}
\renewcommand\contentsname{\centerline{Contents}}

% Numbered equation with optional label
\NewDocumentCommand\eqn{mo}{%
  \IfNoValueTF{#2}
     {\[ #1 \]}
     {\begin{equation}\label{#2} #1 \end{equation} \expandafter\newcommand\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces}
}
% Numbered aligned equation with optional label in the vertical middle
\NewDocumentCommand\eqna{mo}{%
  \IfNoValueTF{#2}
    {\begin{align*} #1 \end{align*}}
    {\begin{equation}\label{#2}\begin{split} #1 \end{split}\end{equation} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces}
}

% Numbered subequations
% Two subequations
\NewDocumentCommand\twoseqn{momoo}{%
    \IfNoValueTF{#5}
       {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4}  \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces}
       {\begin{subequations}\label{#5}\begin{align} #1\label{#2} \\ #3 \label{#4}  \end{align}\end{subequations} \expandafter\def\csname #5\endcsname{\eqref{#5}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces}
}
% Three subequations
\NewDocumentCommand\threeseqn{momomoo}{%
   \IfNoValueTF{#7}
     {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces}
     {\begin{subequations}\label{#7}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \end{align}\end{subequations} \expandafter\def\csname #7\endcsname{\eqref{#7}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces}
}
% Four subequations
\NewDocumentCommand\fourseqn{momomomoo}{%
   \IfNoValueTF{#9}
     {\begin{subequations}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \\ #7\label{#8} \end{align}\end{subequations} \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces \expandafter\def\csname #8\endcsname{\eqref{#8}\xspace}\ignorespaces}
     {\begin{subequations}\label{#9}\begin{align} #1\label{#2} \\ #3 \label{#4} \\ #5 \label{#6} \\ #7\label{#8} \end{align}\end{subequations} \expandafter\def\csname #9\endcsname{\eqref{#9}\xspace}\ignorespaces \expandafter\def\csname #2\endcsname{\eqref{#2}\xspace}\ignorespaces \expandafter\def\csname #4\endcsname{\eqref{#4}\xspace}\ignorespaces \expandafter\def\csname #6\endcsname{\eqref{#6}\xspace}\ignorespaces \expandafter\def\csname #8\endcsname{\eqref{#8}\xspace}\ignorespaces}
}


% Sections and subsections
\NewDocumentCommand\newsec{mo}{%
  \IfNoValueTF{#2}
     {\section{#1}}
     {\section{#1}\label{#2} \expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces}
}
\NewDocumentCommand\subsec{mo}{%
  \IfNoValueTF{#2}
     {\subsection{#1}}
     {\subsection{#1}\label{#2}\expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces}
}
\NewDocumentCommand\subsubsec{mo}{%
  \IfNoValueTF{#2}
     {\subsubsection{#1}}
     {\subsubsection{#1}\label{#2}\expandafter\gdef\csname #2\endcsname{\ref{#2}\xspace}\ignorespaces}
}

\renewcommand\section{\@startsection {section}{1}{\z@}%
{-6ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\itshape}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\itshape}}
% Dot after section number
\def\@seccntformat#1{\csname the#1\endcsname.\hspace{4.6pt}}


% Acknowledgments
\newenvironment{acknowledgments}{\vspace{12pt}\begin{center}\textbf{Acknowledgments}\end{center}\vspace{-12pt}}{}
\newcommand{\ack}[1]{\begin{samepage}\begin{acknowledgments} {#1} \end{acknowledgments}\end{samepage}}

% References
\renewcommand\refname{\bfseries\normalsize\centering References\\ \vspace{-0.4cm}
\addcontentsline{toc}{section}{References}}
\bibliographystyle{chetref}
% Separator between references in single cite number
\collectsep[.]{;\\}


% Footnotes
%\renewcommand{\footnotesize}{\normalsize}
\newcommand{\foot}{\footnote}
\setlength{\skip\footins}{0.5cm} % Vertical spacing between text body and footnotes
\setlength{\footnotesep}{0.4cm} % Vertical separation of footnotes


% Horizontal spacing between words
\fontdimen2\font=1.2\fontdimen2\font


% Vertical spacing between lines
\linespread{1.25}


% Vertical spacing in multiline equations (align, gather, ...)
\setlength{\jot}{5pt}


% Figure name
\renewcommand{\figurename}{Fig.\!}


% Format of date in bottom left of title page
\newdateformat{mydate}{\monthname[\THEMONTH] \THEYEAR} %Needs package datetime
\mydate{}


% Appendices
\newcommand\appendix@section[1]{%
  \refstepcounter{section}%
  \orig@section*{Appendix~\@Alph\c@section.~#1}%
  \addcontentsline{toc}{section}{Appendix~\@Alph\c@section.~#1}}
\let\orig@section\section
\g@addto@macro\appendix{\let\section\appendix@section}
\newcommand{\appendices}{\appendix}


% Footnotes for emails in titlepage
% Horizontal emails
\SetFootnoteHook{\noindent\hspace{-5pt}}
\DeclareNewFootnote[para]{E}[roman]
\newcommand{\email}[1]{\footnoteE{\href{mailto:#1}{\texttt{#1}}}}
% Vertical emails
\SetFootnoteHook{\noindent\hspace{-10pt}}
\DeclareNewFootnote{EE}[roman]
\newcommand{\emailV}[1]{\footnoteEE{\href{mailto:#1}{\texttt{#1}}}}
% All emails together
\SetFootnoteHook{\noindent}
\DeclareNewFootnote[para]{EEE}[roman]
\newcommand{\emails}[1]{\footnotetextEEE{\texttt{#1}}}


%Titlepage
\renewcommand{\abstract}[1]{\def\@abstract {#1}}
\newcommand{\affiliation}[1]{\def\@affiliation {#1}}
\newcommand{\preprint}[1]{\def\@preprint {#1}}
\abstract{}
\affiliation{}
\preprint{}


% Title font (scaled cmr10)
\DeclareFontShape{OT1}{cmr}{mx}{n}%
    {<->cmr10}{}
\newcommand{\mytitlefont}{\fontseries{mx}\selectfont}
% Command for use with math in title $\titlemath{...}$
\DeclareMathAlphabet{\titlemath}{OT1}{cmr}{mx}{n}


\def\maketitle{%
    \begin{titlepage}
        \begin{flushright}
            \@preprint
        \end{flushright}
        \vspace{2cm}
		\begin{center}
            {\huge\mytitlefont\@title}

            \bigskip\bigskip\bigskip
            
            \@author
            
            \bigskip
			
            {\emph\@affiliation}
        \end{center}
		\bigskip\bigskip
        \noindent\@abstract
		\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill
		\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill\vfill
		\noindent\@date
    \end{titlepage}
}
\fi


\endinput
%