emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex listings number-lines problems with new exporter
@ 2013-03-05  9:59 Thomas Alexander Gerds
  2013-03-05 11:18 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Alexander Gerds @ 2013-03-05  9:59 UTC (permalink / raw)
  To: emacs-orgmode

Hi 

using org-mode "7.9.3f" and the new exporter I was desperately trying to
get line numbers back for exported R code blocks using the latex listing
package. first I tried

(setq org-latex-listings-options
    '(("basicstyle" "\\small")
      ("numbers" "left")))

which gives

,----
| \lstset{basicstyle=\small,numbers=left,language=R,numbers=none}      
`----

that this is possible seems sub-optimal :)

some debugging led me via org-latex-src-block to
org-element-src-block-parser which indicated adding a switch "-n" behind
to the scr-block:

,----
| #+BEGIN_SRC R -n :results output raw  :exports both  :session *R* :cache yes


this works and has a new feature (switch +n) which allows numbering to
be continued in subsequent blocks.

Now, I would like to set numbers on globally or buffer-local for all
blocks. But is it possible to set a switch globally?  I think parameters
can still be set with an appropriate #+PROPERTY: statement!?

whatever the answer, it would be nice if this feature was mentioned in
the help string of org-latex-listing-options.

regards,
Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: latex listings number-lines problems with new exporter
  2013-03-05  9:59 latex listings number-lines problems with new exporter Thomas Alexander Gerds
@ 2013-03-05 11:18 ` Nicolas Goaziou
  2013-03-05 14:03   ` Thomas Alexander Gerds
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2013-03-05 11:18 UTC (permalink / raw)
  To: Thomas Alexander Gerds; +Cc: emacs-orgmode

Hello,

Thomas Alexander Gerds <tag@biostat.ku.dk> writes:

> using org-mode "7.9.3f" and the new exporter I was desperately trying to
> get line numbers back for exported R code blocks using the latex listing
> package. first I tried
>
> (setq org-latex-listings-options
>     '(("basicstyle" "\\small")
>       ("numbers" "left")))
>
> which gives
>
> ,----
> | \lstset{basicstyle=\small,numbers=left,language=R,numbers=none}      
> `----
>
> that this is possible seems sub-optimal :)

Thanks. This should be fixed in master. If user provides "numbers"
option, "+n" and "-n" switches will be ignored from src-block.

> some debugging led me via org-latex-src-block to
> org-element-src-block-parser which indicated adding a switch "-n" behind
> to the scr-block:
>
> ,----
> | #+BEGIN_SRC R -n :results output raw  :exports both  :session *R* :cache yes
>
>
> this works and has a new feature (switch +n) which allows numbering to
> be continued in subsequent blocks.
>
> Now, I would like to set numbers on globally or buffer-local for all
> blocks. But is it possible to set a switch globally?  I think parameters
> can still be set with an appropriate #+PROPERTY: statement!?

This isn't possible. But, as noted previously, you can activate
numbering globally by adding ("numbers" "left") association to
`org-latex-listings-options'.

> whatever the answer, it would be nice if this feature was mentioned in
> the help string of org-latex-listing-options.

I don't seed the need for that. "+n" and "-n" switches are already
documented in the manual, and are not "listings" specific. They are not
even LaTeX specific.

Anyway, if you think it's still important, I will accept a patch for it
(along with one modifying `org-latex-minted-options' accordingly).


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: latex listings number-lines problems with new exporter
  2013-03-05 11:18 ` Nicolas Goaziou
@ 2013-03-05 14:03   ` Thomas Alexander Gerds
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Alexander Gerds @ 2013-03-05 14:03 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode


thanks for the fast fix. now, I agree that there is no great need to put
a link into the doc-string of org-latex-listings-options.

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Thomas Alexander Gerds <tag@biostat.ku.dk> writes:
>
>> using org-mode "7.9.3f" and the new exporter I was desperately
>> trying to get line numbers back for exported R code blocks using the
>> latex listing package. first I tried
>> (setq org-latex-listings-options '(("basicstyle" "\\small")
>> ("numbers" "left")))
>> which gives
>> ,----
>> | \lstset{basicstyle=\small,numbers=left,language=R,numbers=none}
>> `----
>> that this is possible seems sub-optimal :)
>
> Thanks. This should be fixed in master. If user provides "numbers"
> option, "+n" and "-n" switches will be ignored from src-block.
>
>> some debugging led me via org-latex-src-block to
>> org-element-src-block-parser which indicated adding a switch "-n"
>> behind to the scr-block:
>> ,----
>> | #+BEGIN_SRC R -n :results output raw :exports both :session *R*
>> | :cache yes
>>
>> this works and has a new feature (switch +n) which allows numbering
>> to be continued in subsequent blocks.
>> Now, I would like to set numbers on globally or buffer-local for all
>> blocks. But is it possible to set a switch globally?  I think
>> parameters can still be set with an appropriate #+PROPERTY:
>> statement!?
>
> This isn't possible. But, as noted previously, you can activate
> numbering globally by adding ("numbers" "left") association to
> org-latex-listings-options'.
>
>> whatever the answer, it would be nice if this feature was mentioned
>> in the help string of org-latex-listing-options.
>
> I don't seed the need for that. "+n" and "-n" switches are already
> documented in the manual, and are not "listings" specific. They are
> not even LaTeX specific.
>
> Anyway, if you think it's still important, I will accept a patch for
> it (along with one modifying `org-latex-minted-options' accordingly).
>
> Regards,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-05 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-05  9:59 latex listings number-lines problems with new exporter Thomas Alexander Gerds
2013-03-05 11:18 ` Nicolas Goaziou
2013-03-05 14:03   ` Thomas Alexander Gerds

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).