I use minted for listing Objective-C code and I need to replace the label text from Listing 1. to Source Code #chapter_number#.#subsection_number#.#subsubsection_number#.#label_number# like "Source Code Starting the accelerometer". Also, I need to refer this like "Source Code".

How can I accomplish this?

I tried:

    \renewcommand\listingscaption{Source Code \thesubsection -}

But it isn't working when I try to use \cref or \ref or \autoref I got "listing 1 1".

Thanks for your time and help!

  • 1
    Welcome to TeX.SX! Shouldn't caption_number be chapter_number? – egreg Jun 17 '14 at 9:10

This seems to be what you want:



\renewcommand{\listingscaption}{Source code}
\crefname{listing}{source code}{source codes}



References: \cref{list}, \ref{list}


enter image description here

  • Thank you very much. That works as I imagined :). Thanks for your help. – flatronka Jun 17 '14 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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