%Purpose: Level-1 macro for initiating an object, i.e., it defines the object's standalone (\Declare<ObjectName>) and batch (\Batch<ObjectName>) macros
%E.g.: \InitiateObject{set}{s}{\mathcal}, which allows defining `set' macros of the form \s* (e.g., \sH in the MWE below) using \Declareset command below.
%Purpose: Level-1 macro for batch-initiating objects; works by repeatedly calling \InitiateObject
%Syntax: \InitiateObjects{<Objects'Description>}, where <Objects'Description> is a CSV list, with each entry in the list being the description of the object as {<ObjectName>}{<Prefix>}{<TextType>}
%E.g.: \InitiateObjects{{set}{s}{\mathcal},{function}{f}{}} defines a set object and a function object with prefixes s and f respectively.
%%Declare objects required for your paper as a CSV list, with each object of the form {<ObjectName>}{<Prefix>}{<TextType>}.
%It is recommended to use not-too-short prefixes so that existing commands are not overwritten.
\InitiateObjects{
%Discrete math
{set}{s}{\mathcal},%Sets in calligraphic font, \s*
{function}{f}{},%Functions, \f*
{polynomial}{p}{},%Polynomials, \p*
{vector}{v}{\boldsymbol},%Vectors, \V*
%Probability
{Event}{E}{},%Events, \E*
{Distribution}{D}{},%\Distributions, \D*
%TCS
{Algorithm}{A}{\mathsf},%Algorithms, \A*
{circuit}{c}{\mathsf},%Circuits, \c*
{Class}{C}{\mathbf},%Complexity classes, \C*
{Problem}{P}{\textsc}%Search problems, \P*
}
%Declare instances of objects required for your paper.
%Discrete math
\Batchset{H,I}%Instances of sets: \sH and \sI
\Batchvector{v,m}%Instances of vectors: \vv and \vm
\Batchpolynomial{p}%...\pp
\Batchfunction{trace}%
%Probability objects
\BatchEvent{bad}%\Ebad
\BatchDistribution{X}%\DX
%CS objects
\BatchAlgorithm{A,PP}% \AS and \APP
\Batchcircuit{C}%\cC
\BatchClass{P,NP}%\CP and \CNP
\BatchProblem{Factoring,SVL}%PFactoring and \PSVL
\title{Batching for TCS Papers\footnote{Version 1.2}}
\author{Chethan Kamath}
\date{\today}
\begin{document}
\maketitle
Often times when writing TCS papers, we need to define multiple instances of the same object, e.g., sets.
Instead of defining each instance separately, it is desirable to batch-define them so that there is minimal amount of \LaTeX\ code.
This note serves a minimal-working example of the \TeX\ code that I ended up converging to, thanks to \cite{TeXSE:egreg11a,TeXSE:egreg11b,TeXSE:egreg13,Manual:Feuersaenger20,Manual:Knuth86} -- an explanation of the code can be found as comments in the \verb|.tex| file.
To demonstrate the code, some of the notation from my thesis \cite{Thesis:Kamath20} has been ported to the new macros:
\begin{itemize}
\item We use straight font to denote algorithms, circuits and protocols (e.g., $\AA, \cC, \APP$), calligraphic font to denote sets (e.g., $\sI,\sH$), bold face to denote complexity classes (e.g., $\CP, \CNP$) or vectors (e.g., $\vv, \vm$), small caps to denote problems or languages (e.g., $\PFactoring, \PSVL$). Polynomials, func-tions and events are in normal math mode (e.g., $\pp(n), \ftrace, \Ebad$).
\end{itemize}
\begin{thebibliography}{1}
\bibitem{TeXSE:egreg11a}
{\sc egreg},
\newblock{\em What exactly do \verb|\csname| and \verb|\endcsname| do?}.
% This template uses the scontents package, which is only available on relatively recent TeX distributions. In case it is not available on your system, use the legacy_template.tex
%Purpose: Level-1 macro for initiating an object, i.e., it defines the object's standalone (\Declare<ObjectName>) and batch (\Batch<ObjectName>) macros
%E.g.: \InitiateObject{set}{s}{\mathcal}, which allows defining `set' macros of the form \s* (e.g., \sH in the MWE below) using \Declareset command below.
%Purpose: Level-1 macro for batch-initiating objects; works by repeatedly calling \InitiateObject
%Syntax: \InitiateObjects{<Objects'Description>}, where <Objects'Description> is a CSV list, with each entry in the list being the description of the object as {<ObjectName>}{<Prefix>}{<TextType>}
%E.g.: \InitiateObjects{{set}{s}{\mathcal},{function}{f}{}} defines a set object and a function object with prefixes s and f respectively.
\@for\@Object:=#1\do{
\expandafter\InitiateObject\@Object
}
}
\makeatother
%%END
%%Declare objects required for your paper as a CSV list, with each object of the form {<ObjectName>}{<Prefix>}{<TextType>}.
%It is recommended to use not-too-short prefixes so that existing commands are not overwritten.
\InitiateObjects{
%Discrete math
{set}{s}{\mathcal},%Sets in calligraphic font, \s*