forked from rameshgovindan/gdoc_latex_sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.tex
70 lines (58 loc) · 2.33 KB
/
macros.tex
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
%%% Macros for convenience
%% References
\newcommand{\secref}[1]{\S\ref{sec:#1}}
\newcommand{\figref}[1]{Figure~\ref{fig:#1}}
\newcommand{\tabref}[1]{Table~\ref{tab:#1}}
%% Common latin terms
\newcommand{\etc}{\emph{etc.}\xspace}
\newcommand{\ie}{\emph{i.e.,}\xspace}
\newcommand{\eg}{\emph{e.g.,}\xspace}
\newcommand{\etal}{\emph{et al.}\xspace}
%%%%% Squeezing space before sections, subsections, and re-defining
%%%%% paragraphs
\makeatletter
\let\origsection\section
\let\origsubsection\subsection
\let\origparagraph\paragraph
\renewcommand\section{\@ifstar{\starsection}{\nostarsection}}
\renewcommand\subsection{\@ifstar{\starsubsection}{\nostarsubsection}}
\renewcommand\paragraph{\@ifstar{\starpara}{\nostarpara}}
%% Change these
\newcommand\sectionprelude{\vspace{0em}}
\newcommand\sectionpostlude{\vspace{0em}}
\newcommand\subsectionprelude{\vspace{0em}}
\newcommand\subsectionpostlude{\vspace{0em}}
\newcommand\paraspace{\vspace*{0ex}}
\newcommand\nostarsection[1]{\sectionprelude\origsection{#1}\sectionpostlude}
\newcommand\starsection[1]{\sectionprelude\origsection*{#1}\sectionpostlude}
\newcommand\nostarsubsection[1]{\subsectionprelude\origsubsection{#1}\subsectionpostlude}
\newcommand\starssubection[1]{\subsectionprelude\origsubsection*{#1}\subsectionpostlude}
\newcommand\starpara[1]{\paraspace\noindent\origparagraph*{\textbf{#1}}}
\newcommand\nostarpara[1]{\paraspace\noindent\origparagraph*{\textbf{#1}}}
\providecommand\subparagraph[1]{\paraspace\noindent\origparagraph*{\textit{#1}}}
\makeatother
%%% Backref magic
\DefineBibliographyStrings{english}{%
backrefpage = {Cited on page},
backrefpages = {Cited on pages},
}
\renewbibmacro{pageref}{%
\iflistundef{pageref}
{\printtext[parens]{Not Cited}}
{%
\printtext[parens]{\ifnumgreater{\value{pageref}}{1}
{\bibstring{backrefpages}}
{\bibstring{backrefpage}}
\printlist [pageref][-\value{listtotal}]{pageref}}}}
\DeclareListFormat{pageref}{%
% == 2 references
\ifthenelse{\value{liststop} < 3}{\ifthenelse{\value{listcount}<\value{liststop}}{\hyperpage{#1} and }{\hyperpage{#1}}} %
{ % > 2 references
\ifthenelse{\value{listcount}<\value{liststop}}
{\hyperpage{#1}\addcomma\addspace}
{\ifnumequal{\value{listcount}}{\value{liststop}}
{and \hyperpage{#1}}
{}%
}%
}%
}