Added commands to add authors and affiliations (#1)

* Added commands to automatically insert authors regardless of style

* Updated README and automated adding authors
This commit is contained in:
Ali Hariri authored and GitHub committed 2023-01-18 22:12:51 +01:00
1 parent 40b8a8b308
commit 3b47b09b27
17 files changed
+311 -304

No files matched your search

+41 -34
View File
@@ -1,39 +1,46 @@
# ResearchPaperTemplate
# LaTeX Template for Computer Science Research Papers
### A Latex template that minimises the repetitve work of styling and eleminate writing style-specific tex code.
###### The template supports IEEEtran and acmart styles only. However, I am planning to add support for more styles later.
### A style-agnostic LaTeX template that eliminates the need to write style-specific code and eases switching between the typical document classes of computer science research papers.
###### The template supports *IEEEtran*, *llncs* and *acmart* styles only. Feel free to contribute and support more styles.
---
To write a paper, you only need to your content in tex files under the *sections* directory.
It is recommended to write each section in separate tex file, but the template works pefectly fine if you write all content in one file.
Use the *variables.tex* file to define the title, abstract, keywords, document class (i.e. style), as well as the files in the *sections* directory that you would like them to be included.
Note that the files must be added in the same order you want them to appear.
Example of *variables.tex*:
\def \varTitle{insert title here}
\def \varAbstract{
insert abstract here
}
\def \varKeywords{
insert, comma-separated, keywords, here
}
\def \varDocClass{IEEEtran}
\def \varKeyvals{conference}
\def \varSections{introduction,section1,section2,conclusion}
Note that you only need to insert/modify the arguments of the above commands. Check *variables.tex*
In addition to the above, you need to define the authors in files specific to each style (e.g., *preamble/authorsIEEE.tex*).
This is the only place where you need to write style-specific tex code.
I need to find to way to allow author style to be configured dynamically such that users only define the authors and affiliations in the *variables.tex* file.
Feel free to contribute if you can help with this!
You can also use the *preamble/packages.tex* and *preamble/configUser.tex* to add packages and user-define preabmle code such as listings, filecontents, etc.
Finally, use *references.bib* for your bibliography.
### Template Structure
* [main.tex](main.tex): the root document of the template. This file *must not* be modified.
* [bibliography](bibliography/): contains bibliography styles and references file. Only the references file shall be modified.
* [config](config/]: contains style-specific code and configurations. The contents of this directory *must not* be modified.
* [sections](sections/): directory to add paper sections and text.
* [user](user/): contains user-defined variables and configurations such as paper title, abstract, athors, and packages.
---
Feel free to contribute by completing any of the **TODO** comments or by adding support for other styles.
### Usage
To write a paper, you only need to add your content in tex files under the [*sections*](sections) directory.
It is recommended to write each section in separate tex file, but the template works perfectly fine if you write all content in one file only.
Specify template settings in [*settings.tex*](user/settings.tex). Set the style to be used (i.e., acm, ieee or llncs) as well as the sections to be included from the [sections](sections) directory. Note that the sections must be added in the same order you want them to appear.
Example:
\def \varStyle{llncs}
\def \varSections{introduction,conclusion}
Use the [*topmatter.tex*](user/topmatter.tex) file to define the title, authors, abstract, and keywords.
Example:
\addTitle{insert title here}
\addAuthor{Author}{1}
\addInstitution{Department, Institution}{City}{Country}{{name.surname}@example.com}
\addAbstract{insert abstract here}
\addKeywords{insert, comma-separated, keywords, here}
Note that you only need to insert/modify the arguments of the above commands.
Use [*user/packages.tex*](user/packages.tex) and [*user/preamble.tex*](user/preamble.tex) to add packages and user-defined preabmle code (e.g., listings, acronyms) respectively.
Finally, use [*references.bib*](bibliography/references.bib) for your bibliography.
---
-32
View File
@@ -1,32 +0,0 @@
% TODO: Find a way to define authors and affiliations as variables and configure them automatically according to the document class.
\author{Author A}
\orcid{0000-1111-2222-3333}
\affiliation{
\institution{Department, Institution1}
\city{City1}
\country{Country1}
}
\email{A.surname@domain1.com}
\affiliation{
\institution{Department, Institution2}
\city{City2}
\country{Country2}
}
\email{A.surname@domain2.com}
\author{Author B}
\affiliation{
\institution{Department, Institution1}
\city{City1}
\country{Country1}
}
\email{B.surname@domain1.com}
\author{Author C}
\affiliation{
\institution{Department, Institution2}
\city{City2}
\country{Country2}
}
\email{C.surname@domain1.com}
-55
View File
@@ -1,55 +0,0 @@
% DO NOT MODIFY THIS FILE
\def\varStyleId{1}
\ifx\varDocClass\undefined
\def \varDocClass{acmart}
\fi
\ifx\varKeyvals\undefined
\def \varKeyvals{sigconf}
\fi
\newcommand{\cmdAuthors}{
\input{acm/authors}
}
%\newcommand{\cmdKeywords}{
% \keywords{\varKeywords}
% \maketitle
%}
\newcommand{\cmdAbstract}{
\begin{abstract}
\varAbstract
\end{abstract}
\keywords{\varKeywords}
\maketitle
}
\newcommand{\cmdBibStyle}{
\bibliographystyle{bibliography/ACM-Reference-Format}
}
%% \BibTeX command to typeset BibTeX logo in the docs
\AtBeginDocument{%
\providecommand\BibTeX{{%
\normalfont B\kern-0.5em{\scshape i\kern-0.25em b}\kern-0.8em\TeX}}}
%% Rights management information. This information is sent to you
%% when you complete the rights form. These commands have SAMPLE
%% values in them; it is your responsibility as an author to replace
%% the commands and values with those provided to you when you
%% complete the rights form.
%\setcopyright{acmcopyright}
%\copyrightyear{2018}
%\acmYear{2018}
%\acmDOI{10.1145/1122445.1122456}
%% These commands are for a PROCEEDINGS abstract or paper.
%\acmConference[Woodstock '18]{Woodstock '18: ACM Symposium on Neural
% Gaze Detection}{June 03--05, 2018}{Woodstock, NY}
%\acmBooktitle{Woodstock '18: ACM Symposium on Neural Gaze Detection,
% June 03--05, 2018, Woodstock, NY}
%\acmPrice{15.00}
%\acmISBN{978-1-4503-XXXX-X/18/06}
+83
View File
@@ -0,0 +1,83 @@
%=============================%
% DO NOT MODIFY THIS FILE %
%=============================%
\ifx\varDocClass\undefined
\def \varDocClass{acmart}
\fi
\ifx\varKeyvals\undefined
\def \varKeyvals{sigconf}
\fi
\def\insertAuthors{}
\makeatletter
\newcommand{\addAuthor}[2]{
\g@addto@macro\insertAuthors{\author{#1}}
\@for\varRef:={#2}\do{
\expandafter\g@addto@macro\expandafter\insertAuthors\expandafter{\expandafter\getInst\expandafter{\varRef}}
}
\g@addto@macro\insertAuthors{ }
}
\newcommand{\addInst}[2]{\expandafter\gdef\csname my@inst@#1\endcsname{#2}}
\newcommand{\getInst}[1]{\csname my@inst@#1\endcsname}
\newcounter{instId}
\newcommand{\addInstitution}[4]{
\stepcounter{instId}
\addInst{\theinstId}{
\affiliation{
\institution{#1}
\city{#2}
\country{#3}
}
\email{#4}
}
}
\makeatother
\newcommand{\addAbstract}[1]{\def\varAbstract{#1}}
\newcommand{\addTitle}[1]{\def\varTitle{#1}}
\newcommand{\addKeywords}[1]{\def\varKeywords{#1}}
\def\insertRunningHeads{}
\newcommand{\setRunningHeads}[1]{
\def\insertRunningHeads{\renewcommand{\shortauthors}{#1}}
}
\newcommand{\insertTopmatter}{
\title{\varTitle}
\insertAuthors
\insertRunningHeads
\begin{abstract}
\varAbstract
\end{abstract}
\keywords{\varKeywords}
\maketitle
}
\newcommand{\setBibStyle}{\bibliographystyle{bibliography/ACM-Reference-Format}}
%% \BibTeX command to typeset BibTeX logo in the docs
\AtBeginDocument{%
\providecommand\BibTeX{{%
\normalfont B\kern-0.5em{\scshape i\kern-0.25em b}\kern-0.8em\TeX}}}
%% Rights management information. This information is sent to you
%% when you complete the rights form. These commands have SAMPLE
%% values in them; it is your responsibility as an author to replace
%% the commands and values with those provided to you when you
%% complete the rights form.
%\setcopyright{acmcopyright}
%\copyrightyear{2018}
%\acmYear{2018}
%\acmDOI{10.1145/1122445.1122456}
%% These commands are for a PROCEEDINGS abstract or paper.
%\acmConference[Woodstock '18]{Woodstock '18: ACM Symposium on Neural
% Gaze Detection}{June 03--05, 2018}{Woodstock, NY}
%\acmBooktitle{Woodstock '18: ACM Symposium on Neural Gaze Detection,
% June 03--05, 2018, Woodstock, NY}
%\acmPrice{15.00}
%\acmISBN{978-1-4503-XXXX-X/18/06}
+56
View File
@@ -0,0 +1,56 @@
%=============================%
% DO NOT MODIFY THIS FILE %
%=============================%
\ifx\varDocClass\undefined
\def \varDocClass{IEEEtran}
\fi
\ifx\varKeyvals\undefined
\def \varKeyvals{conference}
\fi
\def\varAuthors{}
\def\varInstitutions{}
\makeatletter
\newcommand{\addAuthor}[2]{
\g@addto@macro\varAuthors{#1}
\@for\varRef:={#2}\do{
\expandafter\g@addto@macro\expandafter\varAuthors\expandafter{\expandafter\IEEEauthorrefmark\expandafter{\varRef}}
}
\g@addto@macro\varAuthors{ }
}
\newcommand{\addInst}[2]{%
\g@addto@macro\varInstitutions{ %
\IEEEauthorblockA{\IEEEauthorrefmark{#1}#2}
}
}
\newcounter{affId}
\newcommand{\addInstitution}[4]{%
\stepcounter{affId}
\edef\myval{\theaffId}
\expandafter\addInst\expandafter{\myval}{#1, #2, #3\\#4}
}
\makeatother
\newcommand{\addAbstract}[1]{\def\varAbstract{#1}}
\newcommand{\addTitle}[1]{\def\varTitle{#1}}
\newcommand{\addKeywords}[1]{\def\varKeywords{#1}}
\newcommand{\setRunningHeads}[1]{}
\newcommand{\insertTopmatter}{
\title{\varTitle}
\author{\IEEEauthorblockN{\varAuthors}\varInstitutions}
\maketitle
\begin{abstract}
\varAbstract
\end{abstract}
\begin{IEEEkeywords}
\varKeywords
\end{IEEEkeywords}
}
\newcommand{\setBibStyle}{\bibliographystyle{bibliography/IEEEtran}}
%\IEEEoverridecommandlockouts
+63
View File
@@ -0,0 +1,63 @@
%=============================%
% DO NOT MODIFY THIS FILE %
%=============================%
\ifx\varDocClass\undefined
\def \varDocClass{llncs}
\fi
\ifx\varKeyvals\undefined
\def \varKeyvals{runningheads}
\fi
\def\varAuthors{}
\def\varInstitutions{}
\makeatletter
\newcommand{\addAuthor}[2]{
\ifx\varAuthors\empty
\else
\g@addto@macro\varAuthors{ \and }
\fi
\g@addto@macro\varAuthors{#1\inst{#2}}
}
\newcommand{\addInstitution}[4]{
\ifx\varInstitutions\empty
\else
\g@addto@macro\varInstitutions{ \and }
\fi
\g@addto@macro\varInstitutions{#1, #2, #3 \\ \email{\detokenize{#4}}}
}
\newcommand{\addAbstract}[1]{\def\varAbstract{#1}}
\newcommand{\addTitle}[1]{\def\varTitle{#1}}
\newcommand{\addKeywords}[1]{
\def\varKeywords{}
\@for\varKeyword:={#1}\do{
\ifx\varKeywords\empty
\else
\g@addto@macro\varKeywords{ \and}
\fi
\expandafter\g@addto@macro\expandafter\varKeywords\expandafter{\varKeyword}
}
}
\makeatother
\def\insertRunningHeads{}
\newcommand{\setRunningHeads}[1]{\def\insertRunningHeads{\authorrunning{#1}}}
\newcommand{\insertTopmatter}{
\title{\varTitle}
\author{\varAuthors}
\institute{\varInstitutions}
\insertRunningHeads
\maketitle
\begin{abstract}
\varAbstract
\keywords{\varKeywords}
\end{abstract}
}
\newcommand{\setBibStyle}{\bibliographystyle{bibliography/splncs04}}
-19
View File
@@ -1,19 +0,0 @@
% TODO: Find a way to define authors and affiliations as variables and configure them automatically according to the document class.
\author{
\IEEEauthorblockN{
Author A\IEEEauthorrefmark{1}\IEEEauthorrefmark{2}
Author B\IEEEauthorrefmark{1}
Author C\IEEEauthorrefmark{2}
}
\IEEEauthorblockA{
\IEEEauthorrefmark{1}
Department, Institution1, City1, Country1\\
\{name.surname\}@domain1.com
}
\IEEEauthorblockA{
\IEEEauthorrefmark{2}
Department, Institution2, City2, Country2\\
\{name.surname\}@domain2.com
}
}
-37
View File
@@ -1,37 +0,0 @@
% DO NOT MODIFY THIS FILE
\def\varStyleId{2}
\ifx\varDocClass\undefined
\def \varDocClass{IEEEtran}
\fi
\ifx\varKeyvals\undefined
\def \varKeyvals{conference}
\fi
\newcommand{\cmdAuthors}{
\input{ieee/authors}
\maketitle
}
%\newcommand{\cmdKeywords}{
% \begin{IEEEkeywords}
% \varKeywords
% \end{IEEEkeywords}
%}
\newcommand{\cmdAbstract}{
\begin{abstract}
\varAbstract
\end{abstract}
\begin{IEEEkeywords}
\varKeywords
\end{IEEEkeywords}
}
\newcommand{\cmdBibStyle}{
\bibliographystyle{bibliography/IEEEtran}
}
%\IEEEoverridecommandlockouts
-16
View File
@@ -1,16 +0,0 @@
% TODO: Find a way to define authors and affiliations as variables and configure them automatically according to the document class.
\author{Author A\inst{1,2}\orcidID{0000-1111-2222-3333}
\and
Author B\inst{1}
\and
Author C\inst{2}
}
\authorrunning{Author A et al.}
\institute{Department, Institution1, City1, Country1, %\\
\email{\{name.surname\}@domain1.com}
\and
Department, Institution2, City2, Country2%\\
\email{\{name.surname\}@domain2.it}
}
-51
View File
@@ -1,51 +0,0 @@
% DO NOT MODIFY THIS FILE
\def\varStyleId{3}
\ifx\varDocClass\undefined
\def \varDocClass{llncs}
\fi
\ifx\varKeyvals\undefined
\def \varKeyvals{runningheads}
\fi
\newcommand{\cmdAuthors}{
\input{llncs/authors}
\maketitle
}
%\makeatletter
%\newcommand{\cmdKeywords}{
% \def\lncsKeywords{}
% \@for\varKeyword:={\varKeywords}\do{
% \ifx\lncsKeywords\empty
% \else
% \g@addto@macro\lncsKeywords{ \and}
% \fi
% \expandafter\g@addto@macro\expandafter\lncsKeywords\expandafter{\varKeyword}
% }
% \keywords{\lncsKeywords}
%}
%\makeatother
\makeatletter
\newcommand{\cmdAbstract}{
\begin{abstract}
\varAbstract
\def\lncsKeywords{}
\@for\varKeyword:={\varKeywords}\do{
\ifx\lncsKeywords\empty
\else
\g@addto@macro\lncsKeywords{ \and}
\fi
\expandafter\g@addto@macro\expandafter\lncsKeywords\expandafter{\varKeyword}
}
\keywords{\lncsKeywords}
\end{abstract}
}
\makeatother
\newcommand{\cmdBibStyle}{
\bibliographystyle{bibliography/splncs04}
}
+20 -23
View File
@@ -1,36 +1,33 @@
% DO NOT MODIFY THIS FILE
%=============================%
% DO NOT MODIFY THIS FILE %
%=============================%
% The only files to be modified are:
% acm/authors.tex
% ieee/authors.tex
% llncs/authors.tex
% preamble/variables.tex
% preamble/config.tex
% preamble/packages.tex
% bibliography/references.tex
% sections/*.tex
%
% Add your text in tex files in the 'sections' directory.
% Update variables.tex to determine which files to include
% from 'sections' directory
% % The only files to be modified are:
% % user/*.tex
% % sections/*.tex
% % bibliography/references.bib
\input{preamble/variables}
\input{\varStyle/config}
% % Add your text in tex files in the 'sections' directory.
% % Update settings.tex to determine which files to include from 'sections' directory
\input{user/settings}
\input{config/\varStyle}
\input{user/topmatter}
\documentclass[\varKeyvals]{\varDocClass}
\input{preamble/packages}
\input{preamble/config}
\input{user/packages}
\input{user/preamble}
\begin{document}
\title{\varTitle}
\cmdAuthors
\cmdAbstract
\insertTopmatter
\makeatletter
\@for\varSection:={\varSections}\do{\input{sections/\varSection}}
\makeatother
\cmdBibStyle{}
\setBibStyle
\bibliography{bibliography/references.bib}
\end{document}
\end{document}
% % Template available on GitHub: https://github.com/HaririAli/cs-paper-template
-1
View File
@@ -1 +0,0 @@
% Add packages here
-34
View File
@@ -1,34 +0,0 @@
% Define style
% This must be one of the following 3 values: acm, ieee, llncs
\def \varStyle{llncs}
% If style is set to acm,
% then document class will be set to acmart and keyvals will be set to sigconf
% If style is set to ieee,
% then document class will be set to IEEEtran and keyvals will be set to conference
% If style is set to llncs,
% then document class will be set to llncs and keyvals will be set to runningheads
% These settings can be overriden in the following blocks
% This is what goes between the curly brackets in \documentclass[keyvals]{class}
% Uncomment the following line to override the document class.
%\def \varDocClass{acmart}
% This is what goes between the square brackets in \documentclass[keyvals]{class}
% Uncomment the following line to override the keyvals
%\def \varKeyvals{sigconf}
% Define the title of the paper
\def \varTitle{insert title here}
% Define the abstract
\def \varAbstract{
insert abstract here
}
% Define keywords
\def \varKeywords{insert, comma-separated, keywords, here}
% Define the sections of the paper as a comma-separated list without spaces.
% Each item in the list must refer to a tex file in the sections directory.
% Add the filename only without the extension.
\def \varSections{introduction,conclusion}
+1
View File
@@ -0,0 +1 @@
% % Add packages here
+2 -2
View File
@@ -1,5 +1,5 @@
% Add user-defined configurations here.
% Example: listing style
% % Add user-defined preamble here.
% % Example: listing style or acronyms
%\lstdefinestyle{numbers}{
% numbers=right,
+20
View File
@@ -0,0 +1,20 @@
% % Define style
% % This must be one of the following 3 values: acm, ieee, llncs
\def \varStyle{ieee}
% % If style is set to acm,
% % then document class will be set to acmart and keyvals will be set to sigconf
% % If style is set to ieee,
% % then document class will be set to IEEEtran and keyvals will be set to conference
% % If style is set to llncs,
% % then document class will be set to llncs and keyvals will be set to runningheads
% % The keyvals settings can be overridden in the following block
% % This is the optional argument (what goes between the square brackets) in
% % \documentclass[keyvals]{class} Uncomment the following line to override
% % the keyvals
%\def \varKeyvals{sigconf}
% % Define the sections of the paper as a comma-separated list without spaces.
% % Each item in the list must refer to a tex file in the sections directory.
% % Add the filename only without the extension.
\def \varSections{introduction,conclusion}
+25
View File
@@ -0,0 +1,25 @@
% % Add top matter (i.e., title, abstract, authors, and keywords)
% % of the paper in this file
% % Set the title here
\addTitle{insert title here}
% % Set the authors and their affiliations here
% % Author affiliations are passed in the second argument as numbers
% % referring to the positions of institutions as defined below.
\addAuthor{Author One}{1,2}
\addAuthor{Author Two}{1}
\addAuthor{Author Three}{2}
\addInstitution{Department, Institution1}{City1}{Country1}{{name.surname}@domain1.com}
\addInstitution{Institution2}{City2}{Country2}{{n.surname}@domain2.com}
% % Set running heads here (i.e., authors' names to appear on page headers)
% \setRunningHeads{Author One et al.}
% % Write the abstract here
\addAbstract{
insert abstract here
}
% % Set the keywords here
\addKeywords{insert, comma-separated, keywords, here}