-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtechreport.sty
105 lines (93 loc) · 4.23 KB
/
techreport.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
% Load packages
\RequirePackage{fancyhdr} % Make nice headers
\RequirePackage{graphicx} % Import figures
\RequirePackage{booktabs} % Nicer table formatting
\RequirePackage{textcomp} % Prevents two warnings in gensymb
\RequirePackage{gensymb} % Symbols for math and text
\RequirePackage{lineno} % Number lines (editing)
\RequirePackage{longtable} % Long tables (multi-page)
\RequirePackage{amsmath} % Math facilities
\RequirePackage{microtype} % Better type handling
\RequirePackage{url} % Format website addresses
\RequirePackage{setspace} % Extra space between lines (editing)
\RequirePackage{lastpage} % Count total number of pages
\RequirePackage[nottoc, notbib]{tocbibind} % Add index to TOC
\RequirePackage{hanging} % Hanging paragraphs (i.e., citations)
\RequirePackage{placeins} % Better float placement
\RequirePackage{flafter} % Floats after cross-references
\RequirePackage{sectsty} % Change section formatting
\RequirePackage[english]{babel} % Typographics and hyphenation
\RequirePackage{titlecaps} % Case options for title
\RequirePackage{textcase} % More case options for title
\RequirePackage[labelsep=period]{caption} % Dots in captions
\RequirePackage{lmodern} % Nicer (c) symbol
\RequirePackage{calc} % Text length calculations
\RequirePackage[authoryear]{natbib} % Citations
\RequirePackage[hidelinks]{hyperref} % Better cross references
\RequirePackage{letltxmacro} % Enable/disable footnotes
% General layout parameters for all pages:
\renewcommand{\topfraction}{0.9} % Max fraction of floats at top
\renewcommand{\bottomfraction}{0.8} % Max fraction of floats at bottom
% Parameters for text pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4} % 2 may work better
\setcounter{dbltopnumber}{2} % for 2-column pages
\renewcommand{\dbltopfraction}{0.9} % Fit big float above 2-col. text
\renewcommand{\textfraction}{0.07} % Allow minimal text w. figs
% Parameters for float pages (not text pages):
\renewcommand{\floatpagefraction}{0.85} % Require fuller float pages
\renewcommand{\dblfloatpagefraction}{0.7} % Require fuller float pages
% Line numbers don't like equations: this is a fix
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}}%
\AtBeginDocument{%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
}
% Update definitions
\renewcommand{\headrulewidth}{0pt} % No header line
\setlength{\headheight}{14.5pt}
\bibpunct{(}{)}{;}{a}{}{,} % Punctuation for citations
\fancyhead{} % No header
\sloppy % No text in margins (line length)
\setlength\parindent{1em} % Paragraph indent
\sectionfont{\normalsize\centering\noindent} % Section formatting
\subsectionfont{\normalsize\raggedright\noindent} % Subsection formatting
% Ensure auto-generated sections are uppercase
\addto\captionsenglish{\renewcommand{\contentsname}{CONTENTS}}
\addto\captionsenglish{\renewcommand{\refname}{REFERENCES}}
\addto\captionsenglish{\renewcommand{\indexname}{INDEX}}
% Words that stay lowercase (for title case)
\Addlcwords{a and as but etc for if in is of on the to with}
% Better treatment of input (no extra trailing space)
\newcommand{\inputsp}[1]{\input{#1}\unskip}
% Allow wide tables to spill into both margins equally: \centerfloat
\makeatletter
\newcommand*{\centerfloat}{%
\parindent \z@
\leftskip \z@ \@plus 1fil \@minus \textwidth
\rightskip\leftskip
\parfillskip \z@skip}
\makeatother
% Footnote fun
\LetLtxMacro\Oldfootnote\footnote
% Enable footnotes
\newcommand{\EnableFootNotes}{%
\LetLtxMacro\footnote\Oldfootnote%
}
% Disable footnotes (on the cover page)
\newcommand{\DisableFootNotes}{%
\renewcommand{\footnote}[2][]{\relax}
}