如何将图形/列表/表格名称更改为我想要的任何内容(例如 CodeSnippet)?

如何将图形/列表/表格名称更改为我想要的任何内容(例如 CodeSnippet)?

有谁知道如何改变清单名称代码片段

列表示例

\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}

如果您知道如何解决这个问题,我将不胜感激。这是我的第一个 Latex 项目。

答案1

就像\renewcommand其他东西一样。

\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}

在此处输入图片描述

相关内容