This question is mainly related to Multiple listings styles. If I have \usepackage{caption} definition in the head of file, list of custom listings disappear. How to make it work?
\documentclass{article}
\usepackage{regexpatch}% http://ctan.org/pkg/regexpatch
\usepackage{listings}% http://ctan.org/pkg/listings
\usepackage{caption}
\makeatletter
% --------------------------------------- C++
\newcommand{\lstlistcplusplusname}{List of C++}
\lst@UserCommand\lstlistofcplusplus{\bgroup
\let\contentsname\lstlistcplusplusname
\let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{loc}}%
\tableofcontents \egroup}
\lstnewenvironment{cplusplus}[1][]{%
\renewcommand{\lstlistingname}{C++ Code}%
\xpatchcmd*{\lst@MakeCaption}{lol}{loc}{}{}%
\lstset{language=C++,#1}}
{}
% --------------------------------------- R
\newcommand{\lstlistrcodename}{List of R}
\lst@UserCommand\lstlistofrcode{\bgroup
\let\contentsname\lstlistrcodename
\let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lor}}%
\tableofcontents \egroup}
\lstnewenvironment{rcode}[1][]{%
\renewcommand{\lstlistingname}{R Code}%
\xpatchcmd*{\lst@MakeCaption}{lol}{lor}{}{}%
\lstset{language=R,#1}}
{}
% --------------------------------------- Pseudocode
\newcommand{\lstlistpseudocodename}{List of Pseudocode}
\lst@UserCommand\lstlistofpseudocode{\bgroup
\let\contentsname\lstlistpseudocodename
\let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lop}}%
\tableofcontents \egroup}
\lstnewenvironment{pseudocode}[1][]{%
\renewcommand{\lstlistingname}{Pseudocode}%
\xpatchcmd*{\lst@MakeCaption}{lol}{lop}{}{}%
\lstset{basicstyle=\ttfamily,#1}}
{}
\makeatother
\begin{document}
\lstlistofcplusplus
\lstlistofrcode
\lstlistofpseudocode
\begin{cplusplus}[caption={Hello world}]
// 'Hello World!' program
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
return 0;
}
\end{cplusplus}
\begin{rcode}[caption={Hello world}]
cat('Hello, world!\n')
\end{rcode}
\begin{pseudocode}[caption={Hello world}]
print "Hello world"
\end{pseudocode}
\end{document}

articlewithbeamerthe document will still compile fine. The lists are missing, the reason for this is thatbeamersimply does not support lists. – Apr 10 '19 at 06:38