## Cisco Language for LaTeX Listings Package

Recently I have been working on documenting Cisco code in LaTeX and could not find a language definition for Cisco configurations in the Listings package. Of course I ended up defining my own and figured I would share it here for others looking for the same information.

This is the simple LaTeX definition for the code highlighting.

% This defines the cisco language and highlights
\usepackage{listings}
\lstdefinelanguage{cisco}{
alsoletter={-},
%keyword1&2&6
morekeywords = [1]{router,router-id,ospf,ospfv3,area,nssa,stub,stubby,eigrp,bgp,rip,dmvpn,no,redis,redist,redistribute},
%keyword3
morekeywords = [2]{int,line,serial,range,passive,pass},
%keyword4
%keyword5
morekeywords = [4]{mpls,ldp,router-id,route-target,rd,route-map,vrf,for,forward},
%function1
morekeywords = [6]{Verification},
keywordstyle = [1]\color{darkblue},
keywordstyle = [2]\color{purple},
keywordstyle = [3]\color{magenta},
keywordstyle = [4]\color{orange},
keywordstyle = [5]\color{darkgreen},
keywordstyle = [6]\color{red},
sensitive = false,
morecomment = [l]{!},
morecomment = [s]{/*}{*/},
morecomment = [s]{/**}{*/},
morestring = [b]",
morestring = [b]',
stringstyle = \color{purple}
}
\lstset{
language={cisco},
backgroundcolor=\color{lightgray},
frame={trbl},
xleftmargin=10pt,
breaklines=true,
columns=[l]{fullflexible},
numbers=left,
numberstyle={\scriptsize},
stepnumber=1
}


Here is a link to a sample pdf output.

This entry was posted in Code. Bookmark the permalink.