| Deutsch English Français Italiano |
|
<vqn2uh$1e9r7$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Jinsong Zhao <jszhao@yeah.net>
Newsgroups: comp.text.tex
Subject: Re: label on the left side of minted or listings
Date: Tue, 11 Mar 2025 00:10:48 +0800
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <vqn2uh$1e9r7$1@dont-email.me>
References: <vq39ln$16c4b$1@dont-email.me> <m2mm7sF6iifU2@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 10 Mar 2025 17:10:58 +0100 (CET)
Injection-Info: dont-email.me; posting-host="6cb4d6729130ccae8c7684d5ebe7458b";
logging-data="1517415"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dfA1magfDPI5keEMvjrnS"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ZunuX+bSZ7TX9n/8MTBg9fb/HYs=
Content-Language: en-US
In-Reply-To: <m2mm7sF6iifU2@mid.individual.net>
Bytes: 2221
On 2025/3/4 5:45, Peter Flynn wrote:
> 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
Thank you very much. The code in your reply is exactly what I need. It
is simple and robust (I think).
I'm just getting back to you because my last test (for some reason)
didn't work, but today it did. It's really weird.
Best,
Jinsong