0

Anyone knows how to change the Listing name to Code Snippet?

lstlisting example

\documentclass[bsc]{bangorcsthesis}
\title{Mirror, mirror on the Web}
\author{Loizos Vasileiou}
\date{\today}
\degreeScheme{BSc Creative Technologies}
\supervisor{Prof. Kuncheva L.}

\bibliographySetup[compressed]
\addbibresource{references.bib}

\usepackage{soul}
\newcommand{\lk}[1]{\textcolor{red}{#1}}
\newcommand{\mk}[1]{\textcolor{green}{#1}}
\usepackage{listings}
\usepackage{color}
\definecolor{lightgray}{rgb}{.9,.9,.9}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}

\lstdefinelanguage{JavaScript}{
  keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
  keywordstyle=\color{blue}\bfseries,
  ndkeywords={class, export, boolean, throw, implements, import, this, image, createCapture},
  ndkeywordstyle=\color{darkgray}\bfseries,
  identifierstyle=\color{black},
  sensitive=false,
  comment=[l]{//},
  morecomment=[s]{/*}{*/},
  commentstyle=\color{purple}\ttfamily,
  stringstyle=\color{red}\ttfamily,
  morestring=[b]',
  morestring=[b]"
}

\lstset{
   language=JavaScript,
   backgroundcolor=\color{lightgray},
   extendedchars=true,
   basicstyle=\footnotesize\ttfamily,
   showstringspaces=false,
   showspaces=false,
   numbers=left,
   numberstyle=\footnotesize,
   numbersep=9pt,
   tabsize=2,
   breaklines=true,
   showtabs=false,
   captionpos=b
}
\begin{document}

Some text explaining what Listing~\ref{myLabel}.


\begin{lstlisting}[caption=My Javascript Example, label=myLabel]
var videoElement = createCapture(VIDEO);
\end{lstlisting}
\end{document}

Please if you know how to solve this it would be really appreciated. this is my first Latex Project.

1

Just have a \renewcommand as anything else.

\documentclass[bsc]{bangorcsthesis}
\title{Mirror, mirror on the Web}
\author{Loizos Vasileiou}
\date{\today}
\degreeScheme{BSc Creative Technologies}
\supervisor{Prof. Kuncheva L.}

\bibliographySetup[compressed]
\addbibresource{references.bib}

\usepackage{soul}
\newcommand{\lk}[1]{\textcolor{red}{#1}}
\newcommand{\mk}[1]{\textcolor{green}{#1}}
\usepackage{listings}
\usepackage{color}
\definecolor{lightgray}{rgb}{.9,.9,.9}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}

\lstdefinelanguage{JavaScript}{
  keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
  keywordstyle=\color{blue}\bfseries,
  ndkeywords={class, export, boolean, throw, implements, import, this, image, createCapture},
  ndkeywordstyle=\color{darkgray}\bfseries,
  identifierstyle=\color{black},
  sensitive=false,
  comment=[l]{//},
  morecomment=[s]{/*}{*/},
  commentstyle=\color{purple}\ttfamily,
  stringstyle=\color{red}\ttfamily,
  morestring=[b]',
  morestring=[b]"
}

\lstset{
   language=JavaScript,
   backgroundcolor=\color{lightgray},
   extendedchars=true,
   basicstyle=\footnotesize\ttfamily,
   showstringspaces=false,
   showspaces=false,
   numbers=left,
   numberstyle=\footnotesize,
   numbersep=9pt,
   tabsize=2,
   breaklines=true,
   showtabs=false,
   captionpos=b
}
\renewcommand\lstlistingname{Code snippet}
\begin{document}

   Some text explaining what Listing~\ref{myLabel}.


    \begin{lstlisting}[caption=My Javascript Example, label=myLabel]
var videoElement = createCapture(VIDEO);
    \end{lstlisting}
    \end{document}

enter image description here

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.