On 2012-01-18, Nikolaj wrote:
> Hello group,

> Sorry if I bring this subject back but I couldn't find any
> satisfactory answer on the net.

> I'm using Sphinx v1.1.2 with Pygments 1.4 under Ubuntu 11.04 64 bits.

Which Docutils version (try, e.g., ``rst2html --version``)?

> I could not find how to start the numbering of code (C++) lines with
> any number.

> For example, the rst-directive "literalinclude" doesn't have (AFAIK)
> an option to specify a starting number.

> I would like to have

> 56     first line of code
> 57     second line of code

> in my documentation.

> What is the easiest/best way to do this?


With Docutils 0.9 

(currently only available as developer version from SVN__):

Are the code lines in a separate file?

  No: use the "code" directive
      http://docutils.sourceforge.net/docs/ref/rst/directives.html#code

  Yes: use the "include" directive with the :code: option
       and eventually the :start-line: and :end-line: options.
       
http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment

For line numbers, use the option

  number-lines : [start line number]
    Precede every line with a line number. 
    The optional argument is the number of the first line (defaut 1). 

Example::

  .. include::  myfile.cc
     :code: C++
     :start-line: 57
     :end-line:   58
     :number-lines: 56
     

   
Günter

__ 
http://docutils.sourceforge.net/docs/dev/repository.html#accessing-the-repository

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to