![如何将图形/列表/表格名称更改为我想要的任何内容(例如 CodeSnippet)?](https://linux22.com/image/393809/%E5%A6%82%E4%BD%95%E5%B0%86%E5%9B%BE%E5%BD%A2%2F%E5%88%97%E8%A1%A8%2F%E8%A1%A8%E6%A0%BC%E5%90%8D%E7%A7%B0%E6%9B%B4%E6%94%B9%E4%B8%BA%E6%88%91%E6%83%B3%E8%A6%81%E7%9A%84%E4%BB%BB%E4%BD%95%E5%86%85%E5%AE%B9%EF%BC%88%E4%BE%8B%E5%A6%82%20CodeSnippet%EF%BC%89%EF%BC%9F.png)
有谁知道如何改变清单名称代码片段?
\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}