0

I am using a self-defined command to create an environment for my Python code that I want to show in my document. This command has been taken from redmode's answer to the following question: here.

So, I am wondering: Is there a way to include a caption or subcaption to this code snippet then? The lstlisting environment allows for this option and I would really appreciate it.

3
  • 2
    Plesae always post code others can copy and test. If the self defined env (which you don't show) is made like in that example, then then \begin{python}[caption={text}] should work
    – daleif
    Jun 19, 2020 at 10:07
  • right. Thx a lot, daleif! ... I didn't show the code since I litterally just copied and pasted from the linked answer.
    – Luk
    Jun 19, 2020 at 11:27
  • 2
    Links can rot over time. So it is always better to show the code, perhaps mention where it is from, but always show the code.
    – daleif
    Jun 19, 2020 at 11:31

0

You must log in to answer this question.

Browse other questions tagged .