Skip to content

Commit

Permalink
add line numbers in the templates
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Sep 28, 2024
1 parent bc8d684 commit ef5f036
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
5 changes: 3 additions & 2 deletions templates/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ https://github.com/equipez/bibliographie/blob/main/ref.bib

Usage:

- `make` or `make pdf` to get the pdf file.
- `make bib` to get the BibTeX file.
- `latexmk` or `make` or `make pdf` to get the pdf file.
- `make bib` to get the BibTeX file; make sure to set the document to the draft mode, i.e., \documentclass[draft]{article}
- `make all` to compile everything and get the BibTeX file.
- `make clean` to clean up the directory.
31 changes: 19 additions & 12 deletions templates/article/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@
\newcommand{\bibfile}{\jobname.bib} % Name of the BibTeX file.
% ref.bib should be a symbolic link to the universal BibTeX file, which should be a local copy of
% https://github.com/equipez/bibliographie/blob/main/ref.bib
% When the paper is finished, run `getbib` in the current directory to get the BibTeX file
% containing only the cited references. The name will be xyz.bib if this TeX file is xyz.tex.
% Run `getbib` in the current directory under the draft mode to get the BibTeX file containing only
% the cited references. The name will be xyz.bib if this TeX file is xyz.tex.
\newcommand{\universalbib}{ref.bib}
\ifdraft{\IfFileExists{\universalbib}{\renewcommand{\bibfile}{\universalbib}}{}}{}
% 20221018: \iscite does not work as intended.
% The counter `cite' is used to count the number of citations.
\newcounter{cite}
\pretocmd{\cite}{\stepcounter{cite}}{}{}


%% Add line numbers in draft mode
\RequirePackage[mathlines]{lineno}
\ifdraft{\linenumbers}{}
\renewcommand{\linenumberfont}{\normalfont\scriptsize\sffamily\color{gray}}
\setlength{\linenumbersep}{\marginparsep}


%% Geometry
\voffset=-1.5cm \hoffset=-1.4cm \textwidth=16cm \textheight=22.0cm % Luis' setting
%\usepackage[a4paper, textwidth=16.0cm, textheight=22.0cm]{geometry}
%\voffset=-1.5cm \hoffset=-1.4cm \textwidth=16cm \textheight=22.0cm % Luis' setting
\usepackage[a4paper, textwidth=16.0cm, textheight=22.0cm]{geometry}
\renewcommand{\baselinestretch}{1.2}


Expand Down Expand Up @@ -257,11 +263,12 @@
\newcommand{\tg}{{\textnormal{g}}}
\newcommand{\ts}{{\textnormal{s}}}
\newcommand{\st}{\textnormal{s.t.}}
\newcommand{\etc}{{etc.}}
\newcommand{\ie}{{i.e.}}
\newcommand{\eg}{{e.g.}}
\newcommand{\etal}{{et al.}}
\newcommand{\iid}{\text{i.i.d.}}
\newcommand{\etc}{{etc.}\xspace}
\newcommand{\ie}{{i.e.}\xspace}
\newcommand{\eg}{{e.g.}\xspace}
\newcommand{\etal}{{et al.}\xspace}
\newcommand{\iid}{\text{i.i.d.}\xspace}
\newcommand{\as}{\text{a.s.}\xspace}

\newcommand{\me}{\mathrm{e}}
\newcommand{\md}{\mathrm{d}}
Expand Down Expand Up @@ -353,8 +360,8 @@
\date{\DTMnow}

\author{
Zaikun Zhang\thanks{The Hong Kong Polytechnic University, Hong Kong, China. Email:
\texttt{[email protected]}.}
Zaikun Zhang\thanks{The Hong Kong Polytechnic University, Hong Kong, China.
Email: \email{[email protected]}.}
%\and
%Author2
%\thanks{Information2}
Expand Down
27 changes: 17 additions & 10 deletions vim/templates/article.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@
\newcommand{\bibfile}{\jobname.bib} % Name of the BibTeX file.
% ref.bib should be a symbolic link to the universal BibTeX file, which should be a local copy of
% https://github.com/equipez/bibliographie/blob/main/ref.bib
% When the paper is finished, run `getbib` in the current directory to get the BibTeX file
% containing only the cited references. The name will be xyz.bib if this TeX file is xyz.tex.
% Run `getbib` in the current directory under the draft mode to get the BibTeX file containing only
% the cited references. The name will be xyz.bib if this TeX file is xyz.tex.
\newcommand{\universalbib}{ref.bib}
\ifdraft{\IfFileExists{\universalbib}{\renewcommand{\bibfile}{\universalbib}}{}}{}
% 20221018: \iscite does not work as intended.
% The counter `cite' is used to count the number of citations.
\newcounter{cite}
\pretocmd{\cite}{\stepcounter{cite}}{}{}


%% Add line numbers in draft mode
\RequirePackage[mathlines]{lineno}
\ifdraft{\linenumbers}{}
\renewcommand{\linenumberfont}{\normalfont\scriptsize\sffamily\color{gray}}
\setlength{\linenumbersep}{\marginparsep}


%% Geometry
\voffset=-1.5cm \hoffset=-1.4cm \textwidth=16cm \textheight=22.0cm % Luis' setting
%\usepackage[a4paper, textwidth=16.0cm, textheight=22.0cm]{geometry}
%\voffset=-1.5cm \hoffset=-1.4cm \textwidth=16cm \textheight=22.0cm % Luis' setting
\usepackage[a4paper, textwidth=16.0cm, textheight=22.0cm]{geometry}
\renewcommand{\baselinestretch}{1.2}


Expand Down Expand Up @@ -258,11 +264,12 @@
\newcommand{\tg}{{\textnormal{g}}}
\newcommand{\ts}{{\textnormal{s}}}
\newcommand{\st}{\textnormal{s.t.}}
\newcommand{\etc}{{etc.}}
\newcommand{\ie}{{i.e.}}
\newcommand{\eg}{{e.g.}}
\newcommand{\etal}{{et al.}}
\newcommand{\iid}{\text{i.i.d.}}
\newcommand{\etc}{{etc.}\xspace}
\newcommand{\ie}{{i.e.}\xspace}
\newcommand{\eg}{{e.g.}\xspace}
\newcommand{\etal}{{et al.}\xspace}
\newcommand{\iid}{\text{i.i.d.}\xspace}
\newcommand{\as}{\text{a.s.}\xspace}

\newcommand{\me}{\mathrm{e}}
\newcommand{\md}{\mathrm{d}}
Expand Down

0 comments on commit ef5f036

Please sign in to comment.