Skip to content

Instantly share code, notes, and snippets.

@majkrzak
Last active November 4, 2023 21:38
Show Gist options
  • Save majkrzak/e077740e14b930b2747632052052731b to your computer and use it in GitHub Desktop.
Save majkrzak/e077740e14b930b2747632052052731b to your computer and use it in GitHub Desktop.
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{paper}
\LoadClass[
10pt,
a4paper,
twocolumn,
twoside
]{article}
\RequirePackage[
includefoot,
margin=1cm
]{geometry}
\RequirePackage{biblatex}
\setcounter{biburlnumpenalty}{1000}
\setcounter{biburlucpenalty}{1000}
\setcounter{biburllcpenalty}{3000}
\setcounter{biburlbigbreakpenalty}{1000}
\setcounter{biburlbreakpenalty}{2000}
\nocite{*}
\RequirePackage[
hidelinks
]{hyperref}
\RequirePackage{verbatim}
\RequirePackage{float}
\floatstyle{ruled}
\newfloat{listing}{tbph}{lst}
\floatname{listing}{Listing}
\newfloat{figure}{tbph}{fig}
\floatname{figure}{Figure}
\newfloat{table}{tbph}{tbl}
\floatname{table}{Table}
\RequirePackage{titlesec}
\titleformat\section{\rmfamily\bfseries\large}{\thesection}{1em}{}
\titlespacing*\section{0pt}{4pt plus 2pt minus 2pt}{2pt plus 1pt minus 0pt}
\titleformat\subsection{\rmfamily\bfseries\large}{\thesubsection}{1em}{}
\titlespacing*\subsection{0pt}{4pt plus 2pt minus 2pt}{2pt plus 1pt minus 0pt}
\titleformat\subsubsection{\rmfamily\bfseries}{\thesubsubsection}{1em}{}
\titlespacing*\subsubsection{0pt}{4pt plus 2pt minus 2pt}{2pt plus 1pt minus 0pt}
\RequirePackage{etoolbox}
\preto{\@verbatim}{\topsep=0pt\partopsep=0pt}
\renewcommand{\arraystretch}{1.25}
\RequirePackage{nopageno}
% https://arxiv.org/pdf/2107.02270.pdf
\RequirePackage{xcolor}
\definecolor{p0}{RGB}{63,144,218} % blue
\definecolor{p1}{RGB}{255,169,14} % orange
\definecolor{p2}{RGB}{189,31,1} % red
\definecolor{p3}{RGB}{148,164,162} % gray
\definecolor{p4}{RGB}{131,45,182} % purple
\definecolor{p5}{RGB}{169,107,89} % brown
\definecolor{p6}{RGB}{231,99,0} % dark orange
\definecolor{p7}{RGB}{185,172,112} % tan
\definecolor{p8}{RGB}{113,117,129} % dark gray
\definecolor{p9}{RGB}{146,218,221} % light blue
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\RequirePackage[hang]{footmisc}
\setlength\footnotemargin{0em}
\RequirePackage{varwidth}
\def\title#1{\def\@title{#1}}
\def\author[#1]#2{\expandafter\def\csname @author#1\endcsname{#2}}
\def\email[#1]#2{\expandafter\def\csname @email#1\endcsname{#2}}
\def\homepage[#1]#2{\expandafter\def\csname @homepage#1\endcsname{#2}}
\def\abstract#1{\def\@abstract{#1}}
\def\keywords#1{\def\@keywords{#1}}
\def\doi#1{\def\@doi{#1}}
\def\arxiv#1{\def\@arxiv{#1}}
\def\uri#1{\def\@uri{#1}}
\AtBeginDocument{
\newcounter{@n}
\loop
\stepcounter{@n}
\ifcsname @author\the@n \endcsname
\ifnum \value{@n}=1
\edef\@authors{\@nameuse{@author\the@n}}
\else
\edef\@authors{\@authors, \@nameuse{@author\the@n}}
\fi
\fi
\ifnum\value{@n}<4\repeat
\let\c@@n\undefined
\hypersetup{
pdftitle=\@title,
pdfauthor=\@authors,
pdfsubject=\@abstract,
pdfkeywords=\@keywords
}
}
\def\@maketitle{
\hrule
\vspace{1em}
{
\sffamily
\bfseries
\LARGE
\@title
\par
}
\vspace{.5em}
\newcounter{@n}
\loop
\stepcounter{@n}
\begin{varwidth}[t]{\linewidth}
{
\ifcsname @author\the@n \endcsname
\sffamily
\Large
\@nameuse{@author\the@n}
\par
\fi
}
{
\ifcsname @email\the@n \endcsname
\sffamily
\small
\href{mailto:\@nameuse{@email\the@n}}{\@nameuse{@email\the@n}}
\par
\fi
}
{
\ifcsname @homepage\the@n \endcsname
\sffamily
\small
\href{https://\@nameuse{@homepage\the@n}}{\@nameuse{@homepage\the@n}}
\par
\fi
}
\end{varwidth}
\ifnum\value{@n}<4\repeat
\let\c@@n\undefined
\vspace{.5em}
\hrule
\vspace{.5em}
{
\textbf{Abstract:}
\@abstract
\par
}
{
\textbf{Keywords:}
\textsc{\@keywords}
\par
}
{
\ifdefined\@doi
\textbf{doi:}
\href{https://doi.org/\@doi}{\@doi}
\fi
}
{
\ifdefined\@arxiv
\textbf{arXiv:}
\href{https://arxiv.org/abs/\@arxiv}{\@arxiv}
\fi
}
{
\ifdefined\@uri
\href{https://\@uri}{\texttt{\@uri}}
\fi
}
\hrule
\vspace{.5em}
\thispagestyle{empty}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment