1

I'm new with LaTeX and now I have a problem with a reference of the C++ code.

I have this code:

\begin{lstlisting}[label={code:enumtx}, caption={Porzione di codice che riporta il tipo enumerazione nel file standard.h di bitcoin core.}]
enum txnouttype
{
    TX_NONSTANDARD,
    TX_PUBKEY,
    TX_PUBKEYHASH,
    TX_SCRIPTHASH,
    TX_MULTISIG,
    TX_NULL_DATA, //!< unspendable OP_RETURN script that carries data
    TX_WITNESS_V0_SCRIPTHASH,
    TX_WITNESS_V0_KEYHASH,
    TX_WITNESS_UNKNOWN, //!< Only for Witness versions not already defined above
};
\end{lstlisting}

and this result

enter image description here

My question is:

How can I change the caption title from Listing 2.1 to Code 2.1? Is this possible?

This is a minimal example:

\documentclass[12pt]{toptesi}

\usepackage[utf8]{inputenc} %utf8
\usepackage[italian]{babel}
\usepackage{listings}


\lstset{%
    captionpos=b,
    language=C++,
    basicstyle =\small\ttfamily,
    keywordstyle=\color{red}\bfseries,
    breaklines=true,
    breakatwhitespace=true,
    frame=lines,
    numbers=left,
    numberstyle=\footnotesize,
}

\begin{document}

\begin{lstlisting}[label={code:enumtx}, caption={Porzione di codice che riporta il tipo enumerazione nel file standard.h di bitcoin core.}]

enum txnouttype
{
    TX_NONSTANDARD,
    TX_PUBKEY,
    TX_PUBKEYHASH,
    TX_SCRIPTHASH,
    TX_MULTISIG,
    TX_NULL_DATA, //!< unspendable OP_RETURN script that carries data
    TX_WITNESS_V0_SCRIPTHASH,
    TX_WITNESS_V0_KEYHASH,
    TX_WITNESS_UNKNOWN, //!< Only for Witness versions not already defined above
};
\end{lstlisting}

\end{document}
cgnieder
  • 66,645

0 Answers0