[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] line numbers in org src blocks?
From: |
John Kitchin |
Subject: |
Re: [O] line numbers in org src blocks? |
Date: |
Tue, 13 Oct 2015 09:10:10 -0400 |
User-agent: |
mu4e 0.9.13; emacs 25.0.50.1 |
I meant in the org-file buffer. The numbers in export are pretty
straightforward.
I made a partial solution here:
http://kitchingroup.cheme.cmu.edu/blog/2015/10/13/Line-numbers-in-org-mode-code-blocks/
It works pretty well I think.
Nick Dokos writes:
> John Kitchin <jkitchin <at> andrew.cmu.edu> writes:
>
>>
>> Does anyone know if it is possible to get line numbering only in code
>> blocks in an org-file?
>>
>
> When exporting? Or in the buffer? If the latter, I don't know. If the
> former, -n does that but it is position-sensitive I think:
>
> --8<---------------cut here---------------start------------->8---
>
> * A code block for exporting with line number
>
> #+BEGIN_SRC python -n :exports code
> import sys
>
> sys.exit(0)
>
> #+END_SRC
>
> #+BEGIN_EXAMPLE -n
> import sys
>
> sys.exit(0)
> #+END_EXAMPLE
> --8<---------------cut here---------------end--------------->8---
>
> works, but putting it at the end of the BEGIN_SRC line does not.
>
> See
>
> (info "(org) Literal examples")
>
> for more.
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu