emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [export] Beamer frames containing lstlisting are no longer made fragile
@ 2013-09-13 12:21 Christoph LANGE
  2013-09-16  7:51 ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph LANGE @ 2013-09-13 12:21 UTC (permalink / raw)
  To: Orgmode Mailing List

Dear all,

having created a number of Beamer presentations with the old exporter
(Org version 7), I'm now working on the first Beamer presentation with
the new exporter.

Frames that contain an lstlisting environment are no longer made fragile
automatically.  (Thus I'm not sure the documentation in manual section
12.5 "Beamer export" is still correct, which says "`fragile' option is
added automatically if it contains source code that uses any verbatim
environment".)

My intuition after browsing the Org source code and documentation is
that I should now use #+BEGIN_SRC and that then everything will be
handled automatically.  However the language of my listings is a
non-standard one, which requires a lot of custom options to the
lstlisting environment.

Could anyone kindly point me to an example?

Cheers, and thanks in advance,

Christoph

-- 
Christoph Lange-Bever, http://www.facebook.com/ch.lange, Skype duke4701

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

* [export] Beamer frames containing lstlisting are no longer made fragile
@ 2013-09-13 12:53 Christoph LANGE
  2013-09-13 15:32 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph LANGE @ 2013-09-13 12:53 UTC (permalink / raw)
  To: Orgmode Mailing List

Dear all,

having created a number of Beamer presentations with the old exporter
(Org version 7), I'm now working on the first Beamer presentation with
the new exporter.

Frames that contain an lstlisting environment are no longer made fragile
automatically.  (Thus I'm not sure the documentation in manual section
12.5 "Beamer export" is still correct, which says "`fragile' option is
added automatically if it contains source code that uses any verbatim
environment".)

My intuition after browsing the Org source code and documentation is
that I should now use #+BEGIN_SRC and that then everything will be
handled automatically.  However the language of my listings is a
non-standard one, which requires a lot of custom options to the
lstlisting environment.

Could anyone kindly point me to an example?

Cheers, and thanks in advance,

Christoph

-- 
Christoph Lange, School of Computer Science, University of Birmingham
http://cs.bham.ac.uk/~langec/, Skype duke4701

→ Mathematics in Computer Science Special Issue on “Enabling Domain
  Experts to use Formalised Reasoning”; submission until 31 October.
  http://cs.bham.ac.uk/research/projects/formare/pubs/mcs-doform/

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

* Re: [export] Beamer frames containing lstlisting are no longer made fragile
  2013-09-13 12:53 Christoph LANGE
@ 2013-09-13 15:32 ` Nicolas Goaziou
  2013-09-14 14:14   ` Christoph LANGE
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2013-09-13 15:32 UTC (permalink / raw)
  To: Christoph LANGE; +Cc: Orgmode Mailing List

Hello,

Christoph LANGE <math.semantic.web@gmail.com> writes:

> Frames that contain an lstlisting environment are no longer made fragile
> automatically.  (Thus I'm not sure the documentation in manual section
> 12.5 "Beamer export" is still correct, which says "`fragile' option is
> added automatically if it contains source code that uses any verbatim
> environment".)

If you're inserting the environment manually, Beamer export back-end
will not be able to detect that a "fragile" option is required. In that
case, you can also insert that option manually, by setting BEAMER_OPT
property to fragile in the headline representing your frame:

* My frame
  :PROPERTIES:
  :BEAMER_OPT: fragile
  :END:


Regards,

-- 
Nicolas Goaziou

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

* Re: [export] Beamer frames containing lstlisting are no longer made fragile
  2013-09-13 15:32 ` Nicolas Goaziou
@ 2013-09-14 14:14   ` Christoph LANGE
  2013-09-14 14:33     ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph LANGE @ 2013-09-14 14:14 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Orgmode Mailing List

Hi Nicolas,

2013-09-13 17:32 Nicolas Goaziou:
> If you're inserting the environment manually, Beamer export back-end
> will not be able to detect that a "fragile" option is required. In that
> case, you can also insert that option manually, by setting BEAMER_OPT
> property to fragile in the headline representing your frame:
>
> * My frame
>   :PROPERTIES:
>   :BEAMER_OPT: fragile
>   :END:

Thanks, that works – indeed I should have tried this first, as the
documentation actually mentions it.

Still I think the following sentence in the documentation (section 12.5)
is easy to misunderstand:

"`fragile' option is added automatically if it contains source code that
uses any verbatim environment".

I think it means that when I use a proper "source block" using
#+BEGIN_SRC, the exporter automatically sets the [fragile] option as
needed.  However the sentence could also be interpreted as reflecting
the behaviour of the old exporter, which indeed scanned the full _LaTeX_
source code (e.g. in #+BEGIN_LaTeX) for certain environments and then
set the [fragile] option.

Anyway, you told me how to make my legacy {lstlisting} environments
work.  Is this approach, of manually setting "BEAMER_OPT: fragile" the
preferred way whenever you have a listing in a non-standard language,
where the {lstlisting} environment requires special arguments (e.g.
"morekeywords")?  Or is there some way of passing extra arguments into
the {lstlisting} environment that is created from #+BEGIN_SRC?

Cheers, and thanks in advance,

Christoph

-- 
Christoph Lange, School of Computer Science, University of Birmingham
http://cs.bham.ac.uk/~langec/, Skype duke4701

→ Mathematics in Computer Science Special Issue on “Enabling Domain
  Experts to use Formalised Reasoning”; submission until 31 October.
  http://cs.bham.ac.uk/research/projects/formare/pubs/mcs-doform/

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

* Re: [export] Beamer frames containing lstlisting are no longer made fragile
  2013-09-14 14:14   ` Christoph LANGE
@ 2013-09-14 14:33     ` Nicolas Goaziou
  2013-10-05 14:20       ` Christoph LANGE
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2013-09-14 14:33 UTC (permalink / raw)
  To: Christoph LANGE; +Cc: Orgmode Mailing List

Hello,

Christoph LANGE <math.semantic.web@gmail.com> writes:

> Still I think the following sentence in the documentation (section 12.5)
> is easy to misunderstand:
>
> "`fragile' option is added automatically if it contains source code that
> uses any verbatim environment".

What would you suggest instead?

> I think it means that when I use a proper "source block" using
> #+BEGIN_SRC, the exporter automatically sets the [fragile] option as
> needed.

It isn't just about source blocks, see `org-beamer-verbatim-elements'.

> Anyway, you told me how to make my legacy {lstlisting} environments
> work.  Is this approach, of manually setting "BEAMER_OPT: fragile" the
> preferred way whenever you have a listing in a non-standard language,
> where the {lstlisting} environment requires special arguments (e.g.
> "morekeywords")?  Or is there some way of passing extra arguments into
> the {lstlisting} environment that is created from #+BEGIN_SRC?

At the moment, the only way to pass extra arguments to lstlisting is
using `org-latex-listings-options'. IOW, it isn't possible to set
specific options for a given block.

Though, it should be fairly easy to implement an :extra attribute for
source blocks. E.g.,

  #+attr_latex: :extra key1=val1,key2=val2
  #+begin_src
  ...
  #+end_src


Regards,

-- 
Nicolas Goaziou

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

* Re: [export] Beamer frames containing lstlisting are no longer made fragile
  2013-09-13 12:21 [export] Beamer frames containing lstlisting are no longer made fragile Christoph LANGE
@ 2013-09-16  7:51 ` Eric S Fraga
  2013-10-05 14:25   ` Christoph LANGE
  0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2013-09-16  7:51 UTC (permalink / raw)
  To: Christoph LANGE; +Cc: Orgmode Mailing List

Christoph LANGE <allegristas@gmail.com> writes:

> Dear all,
>
> having created a number of Beamer presentations with the old exporter
> (Org version 7), I'm now working on the first Beamer presentation with
> the new exporter.
>
> Frames that contain an lstlisting environment are no longer made fragile
> automatically.  (Thus I'm not sure the documentation in manual section
> 12.5 "Beamer export" is still correct, which says "`fragile' option is
> added automatically if it contains source code that uses any verbatim
> environment".)
>
> My intuition after browsing the Org source code and documentation is
> that I should now use #+BEGIN_SRC and that then everything will be
> handled automatically.  However the language of my listings is a
> non-standard one, which requires a lot of custom options to the
> lstlisting environment.
>
> Could anyone kindly point me to an example?

I am not sure what it is you want an example of?  If it's how to
configure lstlisting for a new language, here are two examples:

#+latex_header: \lstdefinelanguage{gams}{
#+latex_header: keywords={all, positive, variable, variables, equation, equations, model,%
#+latex_header: minimizing, parameter, parameters, display, solve, using, /},
#+latex_header: sensitive=false,
#+latex_header: morecomment=[f]*,%
#+latex_header: morecomment=[s]{$ontext}{$offtext},
#+latex_header: morestring=[b]",
#+latex_header: morestring=[b]'
#+latex_header: }

#+latex_header: \lstdefinelanguage{Maxima}{
#+latex_header: keywords={addrow,addcol,zeromatrix,ident,augcoefmatrix,ratsubst,diff,ev,tex,%
#+latex_header: with_stdout,nouns,express,depends,load,submatrix,div,grad,curl,%
#+latex_header: rootscontract,solve,part,assume,sqrt,integrate,abs,inf,exp},
#+latex_header: sensitive=true,
#+latex_header: comment=[n]{/*}{*/}
#+latex_header: }

HTH,
eric
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5

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

* Re: [export] Beamer frames containing lstlisting are no longer made fragile
  2013-09-14 14:33     ` Nicolas Goaziou
@ 2013-10-05 14:20       ` Christoph LANGE
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph LANGE @ 2013-10-05 14:20 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Orgmode Mailing List

Hi Nicolas,

I'm sorry I hadn't got back to this email – didn't notice it because of
a filtering mistake on my side.

2013-09-14 15:33 Nicolas Goaziou:
> Christoph LANGE <math.semantic.web@gmail.com> writes:
>> Still I think the following sentence in the documentation (section 12.5)
>> is easy to misunderstand:
>>
>> "`fragile' option is added automatically if it contains source code that
>> uses any verbatim environment".
>
> What would you suggest instead?

Let me see; I'd first have to understand how this mechanism works.  I do
not think it works in the same was as the old exporter worked.  I.e. I
think the new mechanism does not automatically add [fragile] on, e.g.,
encountering the following:

#+LATEX: \begin{lstlisting}
#+LATEX: ...
#+LATEX: \end{lstlisting}

>> I think it means that when I use a proper "source block" using
>> #+BEGIN_SRC, the exporter automatically sets the [fragile] option as
>> needed.
>
> It isn't just about source blocks, see `org-beamer-verbatim-elements'.

OK, I had checked this variable before, but I don't understand it.  The
documentation says "List of element or object types producing verbatim
text".  I presume "elements" and "objects" refer to things in Org-mode,
from which LaTeX is only generated later in the export process.  And as
the only thing ("element" or "object"?) on the Org-mode side that
generates {lstlisting} environments is a SRC-BLOCK, there is probably no
way of teaching the exporter the pre-Org-8.0 behaviour explained above,
i.e. enabling [fragile] on encountering \begin{lstlisting}.

>> Anyway, you told me how to make my legacy {lstlisting} environments
>> work.  Is this approach, of manually setting "BEAMER_OPT: fragile" the
>> preferred way whenever you have a listing in a non-standard language,
>> where the {lstlisting} environment requires special arguments (e.g.
>> "morekeywords")?  Or is there some way of passing extra arguments into
>> the {lstlisting} environment that is created from #+BEGIN_SRC?
>
> At the moment, the only way to pass extra arguments to lstlisting is
> using `org-latex-listings-options'. IOW, it isn't possible to set
> specific options for a given block.
>
> Though, it should be fairly easy to implement an :extra attribute for
> source blocks. E.g.,
>
>   #+attr_latex: :extra key1=val1,key2=val2
>   #+begin_src
>   ...
>   #+end_src

Such a feature would of course be nice to have.  But it doesn't have the
highest priority for me, as I managed to reuse my existing

#+LATEX: \begin{lstlisting}

code, and as I'm not currently planning to export these Org files to
anything else but LaTeX-Beamer.

Cheers,

Christoph

-- 
Christoph Lange, School of Computer Science, University of Birmingham
http://cs.bham.ac.uk/~langec/, Skype duke4701

→ Mathematics in Computer Science Special Issue on “Enabling Domain
  Experts to use Formalised Reasoning”; submission until 31 October.
  http://cs.bham.ac.uk/research/projects/formare/pubs/mcs-doform/

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

* Re: [export] Beamer frames containing lstlisting are no longer made fragile
  2013-09-16  7:51 ` Eric S Fraga
@ 2013-10-05 14:25   ` Christoph LANGE
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph LANGE @ 2013-10-05 14:25 UTC (permalink / raw)
  To: Orgmode Mailing List

Hi Eric,

I'm sorry I hadn't got back to this email – didn't notice it because of
a filtering mistake on my side.

2013-09-16 08:51 Eric S Fraga:
>> My intuition after browsing the Org source code and documentation is
>> that I should now use #+BEGIN_SRC and that then everything will be
>> handled automatically.  However the language of my listings is a
>> non-standard one, which requires a lot of custom options to the
>> lstlisting environment.
>>
>> Could anyone kindly point me to an example?
>
> I am not sure what it is you want an example of?

I was interested in an example of defining a new language, including
keywords and comment and string syntaxes etc., so that one can use it
with #+BEGIN_SRC and that the exporter (case 4 of (defun
org-latex-src-block) in ox-latex.el) will create the right
\lstset{...}\begin{lstlisting}...\end{lstlisting} output.  I presume it
boils down to adding a custom language to Babel, but that's something I
haven't done before.

> If it's how to
> configure lstlisting for a new language, here are two examples:

Thanks!  With this way I'm familiar.  In case it may be of interest to
anyone, I recently made public a LaTeX package with \lstdefinelanguage
settings for a lot of languages I am interested in (mainly from the
Semantic Web): https://github.com/clange/latex/blob/master/lstsemantic.sty.

Cheers,

Christoph

-- 
Christoph Lange, School of Computer Science, University of Birmingham
http://cs.bham.ac.uk/~langec/, Skype duke4701

→ Mathematics in Computer Science Special Issue on “Enabling Domain
  Experts to use Formalised Reasoning”; submission until 31 October.
  http://cs.bham.ac.uk/research/projects/formare/pubs/mcs-doform/

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-13 12:21 [export] Beamer frames containing lstlisting are no longer made fragile Christoph LANGE
2013-09-16  7:51 ` Eric S Fraga
2013-10-05 14:25   ` Christoph LANGE
  -- strict thread matches above, loose matches on Subject: below --
2013-09-13 12:53 Christoph LANGE
2013-09-13 15:32 ` Nicolas Goaziou
2013-09-14 14:14   ` Christoph LANGE
2013-09-14 14:33     ` Nicolas Goaziou
2013-10-05 14:20       ` Christoph LANGE

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).