Skip to content

Instantly share code, notes, and snippets.

@nouredd2
Created April 26, 2019 00:21
Show Gist options
  • Save nouredd2/ca87554ff2dc6226c4b90b526f70a42b to your computer and use it in GitHub Desktop.
Save nouredd2/ca87554ff2dc6226c4b90b526f70a42b to your computer and use it in GitHub Desktop.
General purpose macro definitions for my papers
\newcommand{\Sys}{\textsc{P4aig}\xspace}
\newcommand{\Fix}[1]{\textcolor{red}{[#1]}}
\newcommand{\pfour}{\texttt{P4}\xspace}
\newcommand{\CodeIn}[1]{{\small \texttt{#1}}}
\newcommand{\PP}[1]{\noindent {\bf #1}}
\newcommand{\ie}{i.e.,\xspace}
% for drawing the colored circles to mention the figure
%% Ported from Wajih's code
\newcommand*\BC[1]{%
\begin{tikzpicture}[baseline=(C.base)]
\node[draw,circle,fill=yyellow,inner sep=0.2pt](C) {\textcolor{black}{#1}};
\end{tikzpicture}
}
%% lstlisting config
% ----------
% THIS BELOW COPIED FROM vkuncak/doc/vmcai09/defs.tex
\definecolor{gray}{RGB}{211,211,211}
\definecolor{yyellow}{HTML}{FFFF99}
\newcommand{\jbasicstyle}{\scriptsize\sffamily}
\newcommand{\jnumberstyle}{\tiny}
\newcommand{\Hilight}{\makebox[0pt][l]{\color{gray}\rule[-3pt]{0.80\linewidth}{9pt}}}
\lstdefinelanguage{pseudo}{
morekeywords={if,else,return,map},
keywordstyle=\bfseries,
lineskip=-0.1em,
numbers=none,
numberstyle=\jnumberstyle,
numbersep=4pt,
basicstyle=\scriptsize,
basicstyle=\jbasicstyle,
breaklines=true,
breakautoindent=true,
commentstyle=\color{dkgreen},
tabsize=2,
columns=fullflexible,
morecomment=*[l][\textsl]{//},
mathescape=true,
}
\lstdefinelanguage{p4}{
morekeywords={state, parser, packet_in, out, inout, metadata, standard_metadata_t,
transition, select, default},
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
}
\definecolor{dkgreen}{rgb}{0,.4,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{light-gray}{gray}{0.95} %the shade of grey that stack exchange uses
\newcommand{\cbasicstyle}{\scriptsize\sffamily}
\newcommand{\cnumberstyle}{\tiny}
\lstset{frame=tb,
language=C,
backgroundcolor=\color{light-gray},
aboveskip=0mm,
belowskip=0mm,
% showstringspaces=false,
% columns=flexible,
numberstyle=\jnumberstyle,
basicstyle=\scriptsize,
basicstyle=\jbasicstyle,
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\bfseries\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment