Is it possible to define custom numbers to each source code line, like:

1 string title = "This is a Unicode π in the sky"
22 /*
23 Defined as $\pi=\lim_{n\to\infty}\frac{P_n}{d}$ where $P$ is the perimeter
24 of an $n$-sided regular polygon circumscribing a
25 circle of diameter $d$.
26 */
30-40 ...
162 const double pi = 3.1415926535
  • There isn't a built-in way to do this. But if you work with fancyvrb, which is what minted uses internally, you can probably figure out a way to do this. You would want to look at the counter FancyVerbLine (line number) and maybe the macro \theFancyVerbLine (typesetting style).
    – G. Poore
    Commented Jan 15, 2014 at 3:10

1 Answer 1


A nice workaround is the use of minted's texcomments option:


In your code, just add a comment:

# \setcounter{FancyVerbLine}{20}
  • A nice workaround!
    – m0nhawk
    Commented Apr 24, 2014 at 12:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .