% --------------------------------------------------------------------------
% the CNLTX bundle
%
%   LaTeX source code and output
%
% --------------------------------------------------------------------------
% Clemens Niederberger
% Web:    https://github.com/cgnieder/cnltx/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
% Copyright 2013-2014 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
\RequirePackage{cnltx-base}
\ProvidesPackage{cnltx-listings}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info]

\cnltx@create@bundle@message{listings}{Error}
\cnltx@create@bundle@message{listings}{Warning}
\cnltx@create@bundle@message{listings}{WarningNoLine}
\cnltx@create@bundle@message{listings}{Info}

\RequirePackage{listings}

% --------------------------------------------------------------------------
% a listings language BibTeX:
\lstdefinelanguage{BibTeX}{
  % entry types:
  morekeywords = {
    % regular types:
    @article,
    @book,@mvbook,@inbook,@bookinbook,@suppbook,@booklet,
    @collection,@mvcollection,@incollection,@suppcollection,
    @manual,
    @misc,
    @online,
    @patent,
    @periodical,
    @suppperiodical,
    @proceedings,@mvproceedings,@inproceedings,
    @reference,@mvreference,@inreference,
    @report,
    @set,
    @thesis,
    @unpublished,
    @xdata,
    @customa,@customb,@customc,@customd,@custome,@customf,
    % type aliases:
    @conference,
    @electronic,
    @mastersthesis,
    @phdthesis,
    @techreport,
    @www,
    % unsupported types:
    @artwork,
    @audiobibnote,
    @commentary,
    @image,
    @jurisdiction,
    @legislation,
    @legal,
    @letter,
    @movie,
    @music
    @performance,
    @review,
    @software,
    @standard,
    @video,
    % cnltx types:
    @bundle,
    @class,
    @package,
  } ,
  % entry fields:
  morekeywords = [2]{
    % data fields:
    abstract,
    addendum,
    afterword,
    annotation,
    annotator,
    author,
    authortype,
    bookauthor,
    bookpagination,
    booksubtitle,
    booktitle,
    booktitleaddon,
    chapter,
    commentator,
    date,
    doi,
    edition,
    editor,editora,editorb,editorc,
    editortype,
    editoratype,editorbtype,editorctype,
    eid,
    entrysubtype,
    eprint,
    eprintclass,
    eprinttype,
    eventdate,
    eventtitle,
    eventtitleaddon,
    file,
    foreword,
    holder,
    howpublished,
    indextitle,
    institution,
    introduction,
    isan,
    isbn,
    ismn,
    isrn,
    issn,
    issue,
    issuesubtitle,
    issuetitle,
    iswc,
    journalsubtitle,
    journaltitle,
    label,
    language,
    library,
    location,
    mainsubtitle,
    maintitle,
    maintitleaddon,
    month,
    nameaddon,
    note,
    number,
    organization,
    origdate,
    origlanguage,
    origlocation,
    origpublisher,
    origtitle,
    pages,
    pagetotal,
    pagination,
    part,
    publisher,
    pubstate,
    reprinttitle,
    series,
    shortauthor,
    shorteditor,
    shorthand,
    shorthandintro,
    shortjournal,
    shortseries,
    shorttitle,
    subtitle,
    title,
    titleaddon,
    translator,
    type,
    url,
    urldate,
    venue,
    version,
    volume,
    volumes,
    year,
    % special fields:
    crossref,
    entryset,
    execute,
    gender,
    hyphenation,
    ids,
    indexsorttitle,
    keywords,
    options,
    presort,
    related,
    relatedoptions,
    relatedtype,
    relatedstring,
    sortkey,
    sortname,
    sortshorthand,
    sorttitle,
    sortyear,
    xdata,
    xref,
    % custom fields:
    namea,nameb,namec,
    nameatype,namebtype,namectype,
    lista,listb,listc,listd,liste.listf,
    usera,userb,userc,userd,usere,userf,
    verba,verbb,verbc,
    % field aliases:
    address,
    annote,
    archiveprefix,
    journal,
    key,
    pdf,
    primaryclass,
    school,
    % cnltx fields:
    maintainer
  } ,
  morestring = [b]{"} ,
  morecomment = [l]{\%} ,
  sensitive = false
}

\lstdefinelanguage{makeindex}{
  morekeywords = {
    actual,           % @
    arg_open,         % {
    arg_close,        % }
    encap,            % |
    escape,           % \\
    keyword,          % \\indexentry
    level,            % !
    page_compositor,  % -
    quote,            % "
    range_open,       % (
    range_close,      % )
    preamble,         % \\begin{theindex} \n
    postamble,        % \n\n \end{theindex} \n
    setpage_prefix,   % \n \\setcounter{page}{
    setpage_suffix,   % } \n
    group_skip,       % \n\n \\indexspace \n
    headings_flag,    % 0
    heading_prefix,   %
    heading_suffix,   %
    symhead_positive, % Symbols
    symhead_negative, % symbols
    numhead_positive, % Numbers
    numhead_negative, % numbers
    item_0,           % \n \\item
    item_1,           % \n \\subitem
    item_2,           % \n \\subsubitem
    item_01,          % \n \\subitem
    item_x1,          % \n \\subitem
    item_12,          % \n \\subsubitem
    item_x2,          % \n \\subsubitem
    delim_0,          % , 
    delim_1,          % , 
    delim_2,          % , 
    delim_n,          % , 
    delim_r,          % --
    delim_t,          %
    suffix_2p,        %
    suffix_3p,        %
    suffix_mp,        %
    encap_prefix,     % \\
    encap_infix,      % {
    encap-suffix,     % }
    line_max,         % 72
    indent_space,     % \t\t
    indent_length     % 16
  } ,
  morestring = [b]{"} ,
  morecomment = [l]{\%} ,
  sensitive = true
}

% --------------------------------------------------------------------------
% command names `moretexcs' that are used as not-indexed texcs for the
% listings style `cnltx':
\def\cnltx@predefined@control@sequences{%
  % symbols:
  -,@,
  % csnames beginning with @:
  @alph,@Alph,@arabic,
  @car,@cdr,@ctrerr,
  @empty,
  @firstofone,@firstoftwo,
  @gobble,
  @ifclassloaded,
  @ifnextchar,
  @ifpackageloaded,
  @ifstar,
  @makefnmark,
  @nil,
  @roman,@Roman,
  @secondoftwo,
  @slowromancap,
  @textsuperscript,
  @thefnmark,
  % A:
  a,AA,aa,
  above,
  abovedisplayshortskip,
  abovedisplayskip,
  abovewithdelims,
  accent,
  active,
  acute,
  addbibresource,
  addcontentsline,
  addpenalty,
  addtocontents,
  addtocounter,
  addtolength,
  addtokomafont,
  addtoversion,
  addvspace,
  adjdemerits,
  advance,
  advancepageno,
  ae,AE,
  afterassignment,
  AfterEndPreamble,
  AfterEndDocument,
  AfterEndEnvironment,
  aftergroup,
  AfterPreamble,
  aleph,
  allocationnumber,
  allowbreak,
  alph,Alph,
  alpha,
  amalg,
  and,
  angle,
  approx,
  appto,
  apptocmd,
  arabic,
  arccos,
  arcsin,
  arctan,
  arg,
  arraycolsep,
  arrayrulewidth,
  arraystretch,
  arrowvert,
  Arrowvert,
  ast,
  asymp,
  AtBeginDocument,
  AtBeginDvi,
  AtBeginEnvironment,
  AtEndDocument,
  AtEndEnvironment,
  AtEndOfClass,
  AtEndOfPackage,
  AtEndPreamble,
  atop,
  atopwithdelims,
  author,
  author,
  autodot,
  % B
  b,
  backslash,
  badness,
  bar,
  baselineskip,
  baselinestretch,
  batchmode,
  BeforeBeginEnvironment,
  begingroup,
  beginsection,
  belowdisplayshortskip,
  belowdisplayskip,
  beta,
  bezier,
  bf,
  bffam,
  bfseries,
  bgroup,
  bibcite,
  bibdata,
  bibitem,
  bibliography,
  bibliographystyle,
  bibstyle,
  big,
  Big,
  bigbreak,
  bigcap,
  bigcirc,
  bigcup,
  bigg,
  Bigg,
  biggl,
  Biggl,
  biggm,
  Biggm,
  biggr,
  Biggr,
  bigl,
  Bigl,
  bigm,
  Bigm,
  bigodot,
  bigoplus,
  bigotimes,
  bigr,
  Bigr,
  bigskip,
  bigskipamount,
  bigsqcup,
  bigtriangledown,
  bigtriangleup,
  biguplus,
  bigvee,
  bigwedge,
  binoppenalty,
  bmod,
  boldmath,
  boolfalse,booltrue,
  bordermatrix,
  bot,
  botfigrule,
  botmark,
  bottomfraction,
  bowtie,
  Box,
  box,
  boxmaxdepth,
  brace,
  braceld,
  bracelu,
  bracerd,
  braceru,
  bracevert,
  brack,
  break,
  breve,
  brokenpenalty,
  buildrel,
  bullet,
  bye,
  % C
  c,
  cal,
  cap,
  caption,
  cases,
  catcode,
  cb,
  cdot,
  cdotp,
  cdots,
  centering,
  centerline,
  chapter,
  char,
  chardef,
  check,
  CheckCommand,
  chi,
  choose,
  circ,
  circle,
  citation,
  cite,
  ClassError,
  ClassInfo,
  ClassWarning,
  ClassWarningNoLine,
  cleaders,
  cleardoublepage,
  clearpage,
  cleartabs,
  cline,
  closein,
  closeout,
  clubpenalty,
  clubsuit,
  colon,
  color,
  columns,
  columnsep,
  columnseprule,
  columnwidth,
  cong,
  contentsline,
  coprod,
  copy,
  copyright,
  cos,
  cosh,
  cot,
  coth,
  count,
  countdef,
  cr,
  crcr,
  cref,
  csappto,cseappto,csgappto,csxappto,
  csc,
  csdef,csedef,csgdef,csxdef,
  csdimdef,csdimgdef,
  csexpandonce,
  csgluedef,csgluegdef,
  cslet,csletcs,
  csmudef,csmugdef,
  csname,
  csnumdef,csnumgdef,
  cspreto,csepreto,csgpreto,csxpreto,
  csshow,
  csundef,
  csuse,
  cup,
  CurrentOption,
  % D
  d,
  dag,
  dagger,
  dashbox,
  dashv,
  date,
  day,
  dblfigrule,
  dblfloatpagefraction,
  dblfloatsep,
  dbltextfloatsep,
  dbltopfraction,
  ddag,
  ddagger,
  ddot,
  ddots,
  deadcycles,
  DeclareCharacterInheritance,
  DeclareDictTranslation,
  DeclareErrorFont,
  DeclareFixedFont,
  DeclareFontEncoding,
  DeclareFontEncodingDefaults,
  DeclareFontFamily,
  DeclareFontShape,
  DeclareFontSubstitution,
  DeclareLanguage,
  DeclareLanguageAlias,
  DeclareLanguageDialect,
  DeclareListParser,
  DeclareMathAccent,
  DeclareMathAlphabet,
  DeclareMathAlphabet,
  DeclareMathDelimiter,
  DeclareMathRadical,
  DeclareMathSizes,
  DeclareMathSymbol,
  DeclareMathVersion,
  DeclareMicrotypeAlias,
  DeclareMicrotypeBabelHook,
  DeclareMicrotypeSet,
  DeclareMicrotypeSetDefault,
  DeclareMicrotypeVariants,
  DeclareOldFontCommand,
  DeclareOption,
  DeclarePreloadSizes,
  DeclareRobustCommand,
  DeclareSizeFunction,
  DeclareSymbolFont,
  DeclareSymbolFontAlphabet,
  DeclareTextAccent,
  DeclareTextAccentDefault,
  DeclareTextCommand,
  DeclareTextCommandDefault,
  DeclareTextComposite,
  DeclareTextCompositeCommand,
  DeclareTextFontCommand,
  DeclareTextSymbol,
  DeclareTextSymbolDefault,
  DeclareTranslation,
  DeclareTranslationFallback,
  def,
  defaulthyphenchar,
  defaultscriptratio,
  defaultscriptscriptratio,
  defaultskewchar,
  defcounter,
  deffootnote,deffootnotemark,
  definecolor,
  deflength,
  deg,
  delcode,
  delimiter,
  delimiterfactor,
  delimitershortfall,
  delta,
  Delta,
  depth,
  descriptionlabel,
  det,
  dh,DH,
  Diamond,
  diamond,
  diamondsuit,
  dim,
  dimdef,dimgdef,
  dimen,
  dimendef,
  dimexpr,
  DisableLigatures,
  discretionary,
  displayindent,
  displaylimits,
  displaylines,
  displaystyle,
  displaywidowpenalty,
  displaywidth,
  div,
  divide,
  dj,DJ,
  do,
  documentclass,
  documentstyle,
  dospecials,
  dosupereject,
  dot,
  doteq,
  dotfill,
  dots,
  doublehyphendemerits,
  doublerulesep,
  downarrow,
  Downarrow,
  downbracefill,
  dp,
  % E
  eappto,
  edef,
  egroup,
  eject,
  ell,
  else,
  em,
  emergencystretch,
  emph,
  empty,
  emptyset,
  endcsname,
  endgraf,
  endgroup,
  endinput,
  endinsert,
  enditemize,
  endline,
  endlinechar,
  endlist,
  endlrbox,
  endmath,
  endminipage,
  endnote,
  endpicture,
  endsloppypar,
  endtabbing,
  endtabular,
  endtrivlist,
  endverbatim,
  enlargethispage,
  enskip,
  enspace,
  ensuremath,
  epreto,
  epsilon,
  eqalign,
  eqalignno,
  eqno,
  equiv,
  errhelp,
  errmessage,
  errorcontextlines,
  errorstopmode,
  escapechar,
  eta,
  evensidemargin,
  everycr,
  everydisplay,
  everyhbox,
  everyjob,
  everymath,
  everypar,
  everyvbox,
  ExecuteOptions,
  exhyphenpenalty,
  exists,
  exp,
  expandafter,
  expandonce,
  extracolsep,
  % F
  fam,
  fbox,
  fboxrule,
  fboxsep,
  fi,
  filbreak,
  filecontents,
  fill,
  finalhypendemerits,
  firstmark,
  fiverm,
  fivebf,
  fivei,
  fivesy,
  flat,
  floatingpenalty,
  floatpagefraction,
  floatsep,
  flushbottom,
  fmtname,
  fmtversion,
  fnsymbol,
  folio,
  font,
  fontdimen,
  fontencoding,
  fontfamily,
  fontname,
  fontseries,
  fontshape,
  fontsize,
  fontspec,
  fontsubfuzz,
  footins,
  footline,
  footnote,
  footnotemark,
  footnoterule,
  footnotesep,
  footnotesize,
  footnotetext,
  footskip,
  forall,
  forlistloop,
  foreignlanguage,
  frac,
  frame,
  framebox,
  frenchspacing,
  frown,
  fussy,
  futurelet,
  % G
  gamma,
  Gamma,
  gappto,
  gcd,
  ge,
  GenericError,
  GenericInfo,
  GenericWarning,
  geq,
  gets,
  GetTranslation,
  GetTranslationFor,
  gdef,
  gg,
  global,
  globaldefs,
  glossary,
  gluedef,gluegdef,
  goodbreak,
  gpreto,
  grave,
  % H
  H,
  halign,
  hang,
  hangafter,
  hangindent,
  hat,
  hbadness,
  hbar,
  hbox,
  headheight,
  headline,
  headsep,
  heartsuit,
  height,
  hfil,
  hfill,
  hfilneg,
  hfuzz,
  hglue,
  hideskip,
  hidewidth,
  hline,
  hoffset,
  holdinginserts,
  hom,
  hookleftarrow,
  hookrightarrow,
  hphantom,
  hrule,
  hrulefill,
  hsize,
  hskip,
  hskip,
  hspace,
  hss,
  ht,
  huge,
  Huge,
  hypersetup,
  hyphenation,
  hyphenchar,
  hyphenpenalty,
  % I
  i,I,
  ialign,
  if,
  ifblank,
  ifbool,ifboolexpe,ifboolexpr,
  ifcase,
  ifcat,
  ifcsdef,
  ifcsname,
  ifdim,
  ifdef,
  ifeof,
  iff,
  iffalse,
  IfFileExists,
  ifhbox,
  ifhmode,
  ifinlist,
  ifinner,
  ifmmode,
  ifnum,
  ifodd,
  ifpatchable,
  ifstr,
  ifstrempty,
  ifstrequal,
  iftoggle,
  iftrue,
  ifvbox,
  ifvmode,
  ifvoid,
  ifx,
  ignorespaces,
  ignorespacesafterend,
  Im,
  imath,
  immediate,
  in,
  include,
  includeonly,
  indent,
  inf,
  infty,
  indent,
  index,
  input,
  InputIfFileExists,
  inputlineno,
  insert,
  insertpenalties,
  int,
  interdisplaylinepenalty,
  interfootnotelinepenalty,
  interlinepenalty,
  intextsep,
  intop,
  iota,
  it,
  item.
  itemindent,
  itemitem,
  itemize,
  itemsep,
  iterate,
  itfam,
  itshape,
  % J
  j,
  jmath,
  jobname,
  Join,
  joinrel,
  jot,
  % K
  k,
  kappa,
  ker,
  kern,
  kill,
  KOMAoption,
  KOMAoptions,
  % L
  l,L,
  label,
  labelsep,
  labelwidth,
  labelenumi,
  labelenumii,
  labelenumiii,
  labelenumiv,
  labelitemi,
  labelitemii,
  labelitemiii,
  labelitemiv,
  lambda,
  Lambda,
  land,
  langle,
  language,
  large,
  Large,
  LARGE,
  lastbox,
  lastkern,
  lastpenalty,
  lastskip,
  LaTeX,
  LaTeXe,
  lbrace,
  lbrack,
  lccode,
  lceil,
  ldotp,
  ldots,
  le,
  leaders,
  leadsto,
  leavevmode,
  left,
  leftarrow,
  Leftarrow,
  leftarrowfill,
  lefteqn,
  leftharpoondown,
  leftharpoonup,
  lefthyphenmin,
  leftline,
  leftmargin,
  leftmargini,
  leftmarginii,
  leftmarginiii,
  leftmarginiv,
  leftmarginv,
  leftmarginvi,
  leftmark,
  leftskip,
  leftrightarrow,
  Leftrightarrow,
  leq,
  leqalignno,
  leqno,
  let,letcs,
  lfloor,
  limits,
  linepenalty,
  lineskip,
  lineskiplimits,
  lg,
  lgroup,
  lhd,
  lhook,
  lim,
  liminf,
  limsup,
  line,
  linebreak,
  linespread,
  linethickness,
  linewidth,
  list,
  listadd,
  listfiles,
  listfiles,
  listparindent,
  ll,
  llap,
  lmoustache,
  ln,
  lnot,
  LoadClassWithOptions,
  LoadClass,
  LoadDictionary,
  LoadDictionaryFor,
  LoadMicrotypeFile,
  log,
  long,
  longleftarrow,
  Longleftarrow,
  longleftrightarrow,
  Longleftrightarrow,
  longmapsto,
  longrightarrow,
  loop,
  looseness,
  lor,
  lower,
  lowercase,
  lq,
  lslig,
  lsstyle,
  lstinline,
  lstinputlisting,
  lrbox,
  ltx@ifnextchar,
  LuaLaTeX,LuaTeX,
  % M
  mag,
  magnification,
  magstep,
  magstephalf,
  makeatletter,
  makeatother,
  makebox,
  makefootline,
  makeglossary,
  makeheadline,
  makeindex,
  makelabel,
  MakeLowercase,
  maketitle,
  MakeUppercase,
  mapsto,
  mapstochar,
  marginpar,
  marginparpush,
  marginparsep,
  marginparwidth,
  mark,
  markboth,
  markright,
  math,
  mathaccent,
  mathbf,
  mathbin,
  mathchar,
  mathchardef,
  mathchoice,
  mathclose,
  mathcode,
  mathellipsis,
  mathgroup,
  mathhexbox,
  mathinner,
  mathit,
  mathop,
  mathopen,
  mathord,
  mathpalette,
  mathparagraph,
  mathpunct,
  mathrel,
  mathrm,
  mathsection,
  mathsf,
  mathsterling,
  mathstrut,
  mathsurround,
  mathtt,
  mathunderscore,
  mathversion,
  matrix,
  max,
  maxdeadcycles,
  maxdepth,
  maxdimen,
  mbox,
  mdseries,
  meaning,
  medbreak,
  medmuskip,
  medskip,
  medskipamount,
  message,
  MessageBreak,
  mho,
  microtypecontext,
  microtypesetup,
  mid,
  midinsert,
  min,
  minipage,
  mit,
  mkern,
  models,
  month,
  moveleft,
  moveright,
  mp,
  mscount,
  mskip,
  mu,
  mudef,mugdef,
  multicolumn,
  multiply,
  multiput,
  multispan,
  muskip,
  muskipdef,
  % N
  nabla,
  narrower,
  natural,
  ne,
  nearrow,
  NeedsTeXFormat,
  neg,
  negthinspace,
  neq,
  newbox,
  newbool,
  newcommand,
  newcount,
  newcounter,
  newdimen,
  newenvironment,
  newfam,
  newfont,
  newfontfamily,
  newhelp,
  newif,
  newinsert,
  newlabel,
  newlanguage,
  newlength,
  newline,
  newlinechar,
  newmathalphabet,
  newmuskip,
  newpage,
  newread,
  newrobustcmd,
  newsavebox,
  newskip,
  newtheorem,
  newtoggle,
  newtoks,
  NewTranslation,
  newwrite,
  next,
  ng,NG,
  ni,
  noalign,
  noboundary,
  nobreak,
  nobreakspace,
  nocite,
  nocorr,
  nocorrlist,
  node,
  noexpand,
  nofiles,
  noindent,
  nointerlineskip,
  nolimits,
  nolinebreak,
  nonfrenchspacing,
  nonscript,
  nonstopmode,
  nonumber,
  nopagebreak,
  nopagenumbers,
  normalbaselines,
  normalbaselineskip,
  normalbottom,
  normalcolor,
  normalfont,
  normalmarginpar,
  normallineskip,
  normallineskiplimit,
  normalsize,
  notblank,
  notbool,
  nottoggle,
  nopagebreak,
  not,
  notin,
  nu,
  null,
  nulldelimiterspace,
  nullfont,
  number,
  numberline,
  numdef,numgdef,
  numexpr,
  nwarrow,
  % O
  o,O,
  oalign,
  obeycr,
  obeylines,
  obeyspaces,
  oddsidemargin,
  odot,
  oe,OE,
  of,
  offinterlineskip,
  oint,
  ointop,
  oldstyle,
  oldstylenums,
  omega,
  Omega,
  ominus,
  omit,
  onecolumn,
  ooalign,
  openin,
  openout,
  openup,
  oplus,
  OptionNotUsed,
  or,
  oslash,
  otimes,
  othersectionlevelsformat,
  outer,
  output,
  outputpenalty,
  oval,
  over,
  overbrace,
  overfullrule,
  overleftarrow,
  overline,
  overrightarrow,
  overwithdelims,
  owns,
  % P
  P,
  PackageError,
  PackageInfo,
  PackageWarning,
  PackageWarningNoLine,
  pagebody,
  pagebreak,
  pagecontents,
  pagedepth,
  pagefilllstretch,
  pagefillstretch,
  pagefilstretch,
  pagegoal,
  pageinsert,
  pageno,
  pagenumbering,
  pageref,
  pageshrink,
  pagestretch,
  pagestyle,
  pagetotal,
  paperheight,
  paperwidth,
  par,
  paragraph,
  paragraphmark,
  parallel,
  parbox,
  parfillskip,
  parindent,
  parsep,
  parshape,
  parskip,
  part,
  partformat,
  partial,
  partname,
  partopsep,
  PassOptionsToClass,PassOptionsToPackage,
  patchcmd,
  patterns,
  pausing,
  pdfLaTeX,
  pdfstringdefDisableCommands,
  pdfTeX,
  penalty,
  perp,
  pgfkeys,
  phantom,
  phi,
  Phi,
  pi,
  Pi,
  picture,
  plainoutput,
  pm,
  pmatrix,
  pmod,
  poptabs,
  postdisplaypenalty,
  pounds,
  Pr,
  prec,
  preceq,
  predisplaypenalty,
  predisplaysize,
  preloaded,
  preto,
  pretocmd,
  pretolerance,
  prevdepth,
  prevgraf,
  prime,
  printacronyms,
  printbibliography,
  printendnotes,
  printindex,
  ProcessPgfOptions,
  ProcessOptions,
  proclaim,
  prod,
  propto,
  protect,
  protected,
  protected@eappto,protected@xappto,
  protected@edef.protected@xdef,
  protected@epreto,protected@xpreto,
  protected@cseappto,protected@csxappto,
  protected@csedef,protected@csxdef,
  protected@csepreto,protected@csxpreto,
  protecting,
  providebool,
  providecommand,providerobustcmd,
  ProvidesClass,
  ProvideDictionaryFor,
  ProvidesFile,
  ProvidesPackage,
  ProvideTextCommand,
  providetoggle,
  psi,
  Psi,
  pushtabs,
  put,
  % Q
  qbezier,
  qbeziermax,
  qquad,
  quad,
  % R
  r,
  radical,
  raggedbottom,
  raggedleft,
  RaggedLeft,
  raggedright,
  RaggedRight,
  raise,
  raisebox,
  rangle,
  rbrace,
  rbrack,
  rceil,
  Re,
  read,
  recalctypearea,
  ref,
  refstepcounter,
  relax,
  relbar,
  Relbar,
  relpenalty,
  removelastskip,
  renewcommand,
  renewenvironment,
  renewrobustcmd,
  RenewTranslation,
  repeat,
  RequirePackage,
  RequirePackageWithOptions,
  restorecr,
  reversemarginpar,
  rfloor,
  rgroup,
  rhd,
  rho,
  rhook,
  right,
  rightarrow,
  Rightarrow,
  rightarrowfill,
  rightharpoondown,
  rightharpoonup,
  righthyphenmin,
  rightleftharpoons,
  rightline,
  rightmargin,
  rightmark,
  rightskip,
  rlap,
  rm,
  rmfamily,
  rmoustache,
  robustify,
  roman,
  Roman,
  romannumeral,
  root,
  rootbox,
  rq,
  rule,
  % S
  S,
  samepage,
  SaveTranslation,
  SaveTranslationFor,
  sb,
  sbox,
  scriptfont,
  scriptscriptfont,
  scriptscriptstyle,
  scriptsize,
  scriptspace,
  scriptstyle,
  scrollmode,
  scshape,
  searrow,
  sec,
  secdef,
  section,
  sectionmark,
  selectfont,
  selectlanguage,
  setbool,
  setbox,
  setcapindent,
  setcounter,
  SetExpansion,
  SetExtraKerning,
  SetExtraSpacing,
  setfnpct,
  setkomafont,
  setlanguage,
  setlength,
  setmainfont,
  setmainlanguage,
  SetMathAlphabet,
  setminus,
  setmonofont,
  setotherlanguage,
  setotherlanguages,
  SetProtrusion,
  setsansfont,
  SetSymbolFont,
  settabs,
  settodepth,
  settoggle,
  settoheight,
  settowidth,
  SetTracking,
  sevenbf,
  seveni,
  sevensy,
  sevenrm,
  sfcode,
  sffamily,
  sharp,
  shipout,
  shorthandoff,
  shorthandon,
  shortstack,
  show,
  showbox,
  showboxbreadth,
  showboxdepth,
  showhyphens,
  showlists,
  showoutput,
  showoverfull,
  showthe,
  sidenote,
  sigma,
  Sigma,
  sim,
  simeq,
  sin,
  sinh,
  skew,
  skewchar,
  skip,
  skipdef,
  sl,
  slash,
  slfam,
  sloppy,
  sloppypar,
  slshape,
  small,
  smallbreak,
  smallint,
  smallskip,
  smallskipamount,
  smash,
  smile,
  sp,
  space,
  spacefactor,
  spaceskip,
  spadesuit,
  span,
  special,
  splitbotmark,
  splitfirstmark,
  splitmaxdepth,
  splittopskip,
  sqcap,
  sqcup,
  sqrt,
  sqsubset,
  sqsubseteq,
  sqsupset,
  sqsupseteq,
  ss,
  SS,
  stackrel,
  star,
  stepcounter,
  stop,
  stretch,
  string,
  strut,
  strutbox,
  subparagraph,
  subparagraphmark,
  subsection,
  subsectionmark,
  subset,
  subseteq,
  subsubsection,
  subsubsectionmark,
  succ,
  succeq,
  sum,
  sup,
  supereject,
  suppressfloats,
  supset,
  supseteq,
  surd,
  swarrow,
  symbol,
  % T
  t,
  tabalign,
  tabbing,
  tabbingsep,
  tabcolsep,
  tableofcontents,
  tabskip,
  tabular,
  tabularnewline,
  tabs,
  tabsdone,
  tabsyet,
  tan,
  tanh,
  tau,
  tenbf,
  tenex,
  teni,
  tenit,
  tenrm,
  tensl,
  tensy,
  tentt,
  TeX,
  test,
  textasciicircum,
  textasciitilde,
  textasteriskcentered,
  textbackslash,
  textbar,
  textbf,
  textbraceleft,
  textbraceright,
  textbullet,
  textcircled,
  textcompwordmark,
  textcolor,
  textdagger,
  textdaggerdbl,
  textdollar,
  textellipsis,
  textemdash,
  textemdash,
  textenglish,
  textexclamdown,
  textexclamdown,
  textfloatsep,
  textfont,
  textfraction,
  textgreater,
  textindent,
  textit,
  textheight,
  textless,
  textls,
  textmicrotypecontext,
  textmd,
  textnormal,
  textogonekcentered,
  textparagraph,
  textperiodcentered,
  textquestiondown,
  textquotedbl,
  textquotedblleft,
  textquotedblright,
  textquoteleft,
  textquoteright,
  textregistered,
  textrm,
  textsc,
  textsection,
  textsf,
  textsl,
  textsterling,
  textstyle,
  textsuperscript,
  textsection,
  textsubscript,
  textsuperscript,
  textsterling,
  TextSymbolUnavailable,
  texttt,
  texttrademark,
  textunderscore,
  textup,
  textvisiblespace,
  textwidth,
  th,TH,
  thanks,
  the,
  theendnotes,
  theenumi,theenumii,theenumiii,theenumiv,
  thefootnote,
  thefootnotemark,
  thempfn,
  thempfn,
  thempfootnote,
  thepage,
  thepart,
  theta,
  Theta,
  thicklines,
  thickmuskip,
  thinlines,
  thinmuskip,
  thinspace,
  thispagestyle,
  tikz,
  tilde,
  time,
  times,
  tiny,
  title,
  to,
  today
  togglefalse,toggletrue,
  toks,
  toksdef,
  tolerance,,
  top,
  topfigrule,
  topfraction,
  topglue,
  topins,
  topinsert,
  topmargin,
  topmark,
  topsep,
  topskip,
  totalheight,
  tracingall,
  tracingcommands,
  tracingfonts,
  tracinglostchars,
  tracingmacros,
  tracingonline,
  tracingoutput,
  tracingpages,
  tracingparagraphs,
  tracingpatches,
  tracingrestores,
  tracingstats,
  triangle,
  triangleleft,
  triangleright,
  trivlist,
  tt,
  ttfam,
  ttfamily,
  ttraggedright,
  two@digits,
  twocolumn,
  typein,
  typeout,
  % U
  u,
  uccode,
  uchyph,
  unboldmath,
  undef,
  underbar,
  underbrace,
  underline,
  unhbox,
  unhcopy,
  unitlength,
  unkern,
  unlhd,
  unpenalty,
  unrhd,
  unskip,
  unvbox,
  unvcopy,
  uparrow,
  Uparrow,
  upbracefill,
  updownarrow,
  Updownarrow,
  uplus,
  uppercase,
  upsilon,
  Upsilon,
  upshape,
  usebox,
  usecounter,
  usefont,
  UseMicrotypeSet,
  usepackage,
  UseTextAccent,UseTextSymbol,
  upshape,
  % V
  v,
  vadjust,
  valign,
  value,
  varepsilon,
  varphi,
  varpi,
  varrho,
  varsigma,
  vartheta,
  vbadness,
  vbox,
  vcenter,
  vdash,
  vdots,
  vec,
  vector,
  vee,
  verb,
  verbatim,
  vert,
  Vert,
  vfil,
  vfill,
  vfilneg,
  vfootnote,
  vfuzz,
  vglue,
  vline,
  voffset,
  vphantom,
  vrule,
  vsize,
  vskip,
  vspace,
  vsplit,
  vss,
  vtop,
  % W
  wd,
  wedge,
  widehat,
  widetilde,
  widowpenalty,
  width,
  wlog,
  wp,
  wr,
  write,
  % X
  xappto,
  xdef,
  xdefinecolor,
  XeLaTeX,
  XeTeX,
  xi,
  Xi,
  xleaders,
  xpreto,
  xspaceskip,
  % Y
  year,
  % Z
  zeta
}

% --------------------------------------------------------------------------
% command names `morekeywords' that are used as not-indexed texcs for the
% listings style `cnltx':
\def\cnltx@predefined@environments{%
  array,
  center,
  description,
  displaymath,
  document,
  enumerate,
  eqnarray,
  equation,
  figure,
  flushleft,
  flushright,
  itemize,
  labeling,
  list,
  longtable,
  lrbox,
  math,
  minipage,
  otherlanguage,
  picture,
  quote,quoting,
  sloppypar,
  tabbing,
  table,
  tabu,
  tabular,
  tabularx,
  tabulary,
  trivlist,
  verbatim
}

% --------------------------------------------------------------------------
% helper commands that print the list of additionally defined keywords and
% texcs:
\def\cnltx@print@list@sep{, }

\pgfkeys{
  cnltx/.cd,
    list-sep/.code = \def\cnltx@print@list@sep{#1}
}

\newrobustcmd*\cnltx@write@list@entry[2]{%
  #1*{#2}\def\cnltx@write@list@entry##1##2{\cnltx@print@list@sep ##1*{##2}}%
}

\newrobustcmd*\cnltx@write@list[2]{%
  \cnltx@fullexpand@twoargs
    \forcsvlist
    {\noexpand\cnltx@write@list@entry\noexpand#2}
    {\expandonce#1}%
}

\newrobustcmd*\listsilentcmds{%
  \begingroup
    \cnltx@write@list\cnltx@predefined@control@sequences\cs
  \endgroup
}
\newrobustcmd*\listsilentenvs{%
  \begingroup
    \cnltx@write@list\cnltx@predefined@environments\env
  \endgroup
}


% --------------------------------------------------------------------------
% read bibfiles and get name and type of entries:
\RequirePackage{catchfile}
\DeclareListParser*{\cnltx@parse@bibfile}{@}

\def\cnltx@bibfile@entries{}

\long\def\cnltx@get@bibfile@entry#1{\ifblank{#1}{}{\cnltx@parse@bibfile@entry#1}}

\long\def\cnltx@parse@bibfile@entry#1#{%
  \cnltx@parse@bibfile@entry@aux{#1}%
}

\def\cnltx@parse@bibfile@entry@aux#1#2{%
  \ifblank{#2}{}{%
    \cnltx@parse@bibfile@entry@aux@i{#1}#2\q@stop
  }%
}
\long\def\cnltx@parse@bibfile@entry@aux@i#1#2,#3\q@stop{%
  \cnltx@ifinlist{{#1}{#2}}\cnltx@bibfile@entries{}
    {\listadd\cnltx@bibfile@entries{{#1}{#2}}}%
}

\def\cnltx@read@bibfile@entry#1#2#3{#1#2#3}

\def\cnltx@bibentry@key#1#2#3{%
  #1{#3}\def\cnltx@bibentry@key##1##2##3{\cnltx@print@list@sep##1{##3}}}

\def\cnltx@bibentry@type#1#2#3{%
  #1{@#2}\def\cnltx@bibentry@type##1##2##3{\cnltx@print@list@sep##1{@##2}}}

\def\cnltx@bibentry#1#2#3{%
  #1{#3} (#1{@#2})%
  \def\cnltx@bibentry##1##2##3{\cnltx@print@list@sep##1{##3} (##1{@##2})}%
}

% #1: cs with three args: first formats, second is the type of the entry, the
% third is the name
% #2: cs with one arg that formats whatever #1 prints, passed to #1
% #3: filename
\def\cnltx@read@bibfile#1#2#3{%
  \def\cnltx@bibfile@entries{}%
  \CatchFileDef\cnltx@tmpa{#3}{}%
  \expandafter\cnltx@parse@bibfile
  \expandafter\cnltx@get@bibfile@entry
  \expandafter{\cnltx@tmpa}%
  \forlistloop{\cnltx@read@bibfile@entry#1#2}\cnltx@bibfile@entries
}

\newrobustcmd*\listbibfilekeys[1]{%
  \begingroup
    \makeatletter
    \cnltx@read@bibfile\cnltx@bibentry@key\code{#1}%
  \endgroup
}

\newrobustcmd*\listbibfiletypes[1]{%
  \begingroup
    \makeatletter
    \cnltx@read@bibfile\cnltx@bibentry@type\code{#1}%
  \endgroup
}

\newrobustcmd*\listbibfileentries[1]{%
  \begingroup
    \makeatletter
    \cnltx@read@bibfile\cnltx@bibentry\code{#1}%
  \endgroup
}

\endinput

% --------------------------------------------------------------------------
HISTORY:

2013/09/15 v0.4  - first published version
2013/09/20 v0.5  - merged with `cnltx-csnames', added a number of command names
2013/09/21 v0.6  - added loads of command names
2013/09/30 v0.7  - added \listbibfilekeys, \listbibfiletypes and
                   \listbibfileentries
                 - added listings language `makeindex'
2013/10/04 v0.7a - the \listbib... commands remove duplicate entries from the
                   list if they're equal both in entry type and cite key
                 - added drivers `@class' and `@bundle'
2013/10/21 v0.8  - added missing comma in list of commands
2013/10/21 v0.9  - added internal LaTeX commands and a number of `etoolbox'
                   macros

