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 Jan 15 '14 at 3:10

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 Apr 24 '14 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.