emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Confused about src vs example and LaTeX export
@ 2020-01-05 10:53 Norman Walsh
  2020-01-06  7:10 ` Fraga, Eric
  0 siblings, 1 reply; 4+ messages in thread
From: Norman Walsh @ 2020-01-05 10:53 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

Hello again,

I’m confused about the distinction between BEGIN_EXAMPLE and BEGIN_SRC
and LaTeX export. I tend to use BEGIN_SRC more often because I’m
taking advantage of Babel output.

Consider this file:

#+TITLE: Test Org File

This is an example.

* Simple environments

#+BEGIN_EXAMPLE emacs-lisp
(+ 3 4)
#+END_EXAMPLE

#+BEGIN_SRC emacs-lisp
(+ 3 4)
#+END_SRC

* LaTeX attributes

#+ATTR_LATEX: :environment lstlisting
#+BEGIN_EXAMPLE emacs-lisp
(+ 3 4)
#+END_EXAMPLE

#+ATTR_LATEX: :environment lstlisting
#+BEGIN_SRC emacs-lisp
(+ 3 4)
#+END_SRC

In the simple case, both EXAMPLE and SRC export as {verbatim}
environments; that’s fine as a default. In the second case, the
ATTR_LATEX request for the {lstlisting} environment works on EXAMPLE
but appears to be ignored on SRC.

To confound me further, setting org-latex-custom-lang-environments
doesn’t seem to have any effect in either case.

  (setq org-latex-custom-lang-environments
     '((emacs-lisp "lstlisting")))

I’m not sure what I’m overlooking.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | There has never been a perfect
http://nwalsh.com/            | government, because men have passions;
                              | and if they did not have passions,
                              | there would be no need for
                              | government.--Voltaire

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Confused about src vs example and LaTeX export
  2020-01-05 10:53 Confused about src vs example and LaTeX export Norman Walsh
@ 2020-01-06  7:10 ` Fraga, Eric
  2020-01-06  9:43   ` Norman Walsh
  0 siblings, 1 reply; 4+ messages in thread
From: Fraga, Eric @ 2020-01-06  7:10 UTC (permalink / raw)
  To: Norman Walsh; +Cc: emacs-orgmode@gnu.org

On Sunday,  5 Jan 2020 at 10:53, Norman Walsh wrote:
> In the simple case, both EXAMPLE and SRC export as {verbatim}
> environments; that’s fine as a default. In the second case, the
> ATTR_LATEX request for the {lstlisting} environment works on EXAMPLE
> but appears to be ignored on SRC.

Not for me.  I have lstlisting for both cases.

I would use example blocks for content that should not be parsed and src
blocks for actual code (whether LaTeX, lisp, or anything else).

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c

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

* Re: Confused about src vs example and LaTeX export
  2020-01-06  7:10 ` Fraga, Eric
@ 2020-01-06  9:43   ` Norman Walsh
  2020-01-06 14:16     ` Fraga, Eric
  0 siblings, 1 reply; 4+ messages in thread
From: Norman Walsh @ 2020-01-06  9:43 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> On Sunday,  5 Jan 2020 at 10:53, Norman Walsh wrote:
>> In the simple case, both EXAMPLE and SRC export as {verbatim}
>> environments; that’s fine as a default. In the second case, the
>> ATTR_LATEX request for the {lstlisting} environment works on EXAMPLE
>> but appears to be ignored on SRC.
>
> Not for me.  I have lstlisting for both cases.

The trick turned out to be

  (setq org-latex-listings t)

I’ve written up a few more remarks here:

https://so.nwalsh.com/2020/01/05-latex

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | People tend to feel strongest about
http://nwalsh.com/            | those things they understand the least.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Confused about src vs example and LaTeX export
  2020-01-06  9:43   ` Norman Walsh
@ 2020-01-06 14:16     ` Fraga, Eric
  0 siblings, 0 replies; 4+ messages in thread
From: Fraga, Eric @ 2020-01-06 14:16 UTC (permalink / raw)
  To: Norman Walsh; +Cc: emacs-orgmode@gnu.org

On Monday,  6 Jan 2020 at 09:43, Norman Walsh wrote:
> The trick turned out to be
>
>   (setq org-latex-listings t)

Ah, yes, that needs to be set.  I changed the default so long ago
now...  Anyway, glad you figured it out.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-379-gff2bf2

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

end of thread, other threads:[~2020-01-06 14:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-05 10:53 Confused about src vs example and LaTeX export Norman Walsh
2020-01-06  7:10 ` Fraga, Eric
2020-01-06  9:43   ` Norman Walsh
2020-01-06 14:16     ` Fraga, Eric

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