Can I give my code fragments in minted a numbering, like with equation numbers, so they'd have a (1) etc. at the right side of them so they can be referred to? (E.g. to write something like "Combine code fragment (1) and (2) to get xyz..."). And also so that other people can reference them. I don't want to create a full floating listing, I would like to do it within the text-flow, like with equations.
Here's what I mean with some code:
Some text... blah.
\begin{minted}{cpp}
int a=0;
int b=5;
\end{minted} % => I want this code fragment to have a number on the right side, like equations do.
Now here (or later in the text), I would like to refer to above code fragment.
Like this with math:
\begin{equation}
a=0 % this will get a numbering, i.e. "(1)" on the right side
\label{myeq}
\end{equation}
As we can see in Eq. \ref{myeq}, ...blah.
So the text will look like "As we can see in Eq. 1, ...blah."
But that syntax doesn't work with minted.
I would prefer to do this in minted and not e.g. switch to listings.
minted
or would answers forlistings
or pseudo code be ok as well? You should also tell us, how you want to cite and how the citation should look like in your running text. – LaRiFaRi Jun 10 '15 at 13:28numberedblock
package. e.g., tex.stackexchange.com/questions/202966/how-can-i-show-codeboxes/… – Steven B. Segletes Jun 10 '15 at 21:12