| Deutsch English Français Italiano |
|
<m2mm7sF6iifU2@mid.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Peter Flynn <peter@silmaril.ie>
Newsgroups: comp.text.tex
Subject: Re: label on the left side of minted or listings
Date: Mon, 3 Mar 2025 21:45:32 +0000
Organization: Usenet Labs Bozon Detector Facility
Lines: 30
Message-ID: <m2mm7sF6iifU2@mid.individual.net>
References: <vq39ln$16c4b$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net /BoG2gZ60Ak4R7FTuDI4EQ4vB3oZfjeG+lzhM+qvefECXgi/z5
Cancel-Lock: sha1:XdE//rf+EGx04ozCdnAjkmUkhfg= sha256:uN3jgK0Jk/PJGCIr7OyJtWYKi8AmrKa2rGlzVFH50WU=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <vq39ln$16c4b$1@dont-email.me>
Bytes: 1648
On 03/03/2025 04:03, Jinsong Zhao wrote:
> Hi there,
>
> Hi there,
>
> I am typesetting code using minted or listings package. It works fine.
> Now I am hoping to add a label, similar to equation label, on the left
> side of the code block, looks like following. (%o1) is the label.
>
> (%o1) code here here here
> code here here
> code here
> code
>
> However, I can't find a way to do this. Any hint will be appreciated.
I would think the simplest is to put the code listing in a list item, eg
\usepackage{enumitem,listings}
....
\begin{enumerate}[label={(\%ol)}]
\item \begin{lstlisting}
foo
bar
\end{lstlisting}
\end{enumerate}
That way (enumitem) you have good control over the label and the spacing.
Peter