From ef5f0368ec042572ee88da7f17a78366b82063fe Mon Sep 17 00:00:00 2001 From: zaikunzhang Date: Sat, 28 Sep 2024 17:04:34 +0800 Subject: [PATCH] add line numbers in the templates --- templates/README.txt | 5 +++-- templates/article/template.tex | 31 +++++++++++++++++++------------ vim/templates/article.tex | 27 +++++++++++++++++---------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/templates/README.txt b/templates/README.txt index 3cb93d3..dacd013 100644 --- a/templates/README.txt +++ b/templates/README.txt @@ -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. diff --git a/templates/article/template.tex b/templates/article/template.tex index 929a731..bf21c23 100644 --- a/templates/article/template.tex +++ b/templates/article/template.tex @@ -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} @@ -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}} @@ -353,8 +360,8 @@ \date{\DTMnow} \author{ - Zaikun Zhang\thanks{The Hong Kong Polytechnic University, Hong Kong, China. Email: - \texttt{zaikun.zhang@polyu.edu.hk}.} + Zaikun Zhang\thanks{The Hong Kong Polytechnic University, Hong Kong, China. + Email: \email{zaikunzhang@gmail.com}.} %\and %Author2 %\thanks{Information2} diff --git a/vim/templates/article.tex b/vim/templates/article.tex index 45679ca..4d5809e 100644 --- a/vim/templates/article.tex +++ b/vim/templates/article.tex @@ -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} @@ -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}}