2012-05-29 91 views
2

使用:自定义标题前缀

\begin{listing} 
... 
\caption{foo} 
\end{listing} 

的标题会说:Listing x: foo。我如何将Listing这个词替换成别的东西?

回答

2

你可能想阅读手册

http://mirror.switch.ch/ftp/mirror/tex/macros/latex/contrib/listings/listings.pdf

页32

\begin{listing}[caption=Some fancy listing] 

,或者尝试

\begin{listing}[title=Some fancy listing] 

,或者尝试

\renewcommand{\lstlistingname}{A funny listing} 
为我的作品

小例子:

\documentclass{article} 

\usepackage{listings} 
\renewcommand{\lstlistingname}{Something} 

\begin{document} 
Some text. 
\begin{lstlisting}[caption=wwww] 
xxxx 
\end{lstlisting} 
Some more text. 
\end{document} 
+0

最后一个似乎成为我所需要的。我试过了,但它不起作用。我把它粘贴在'\ usepackage {listing}'的下面。任何想法如何调试? – user1367401

+0

一些其他信息会有帮助。你使用哪个软件包?我没有在包列表中找到“列表”环境,也没有给我一个标题。 – JohnB

2

如果您使用的是铸造(我和我的源代码看起来像你的),你可能会想尝试

\renewcommand{\listingscaption}{Some fancy listing}