emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* minted question
@ 2014-07-21 19:30 Manfred Lotz
  2014-07-21 19:53 ` Thomas S. Dye
  0 siblings, 1 reply; 8+ messages in thread
From: Manfred Lotz @ 2014-07-21 19:30 UTC (permalink / raw)
  To: emacs-orgmode

Hi there,
I have a an org file which gets exported to beamer. The following
example (although I do not know if there are errors) works fine.

Now I would like to get a frame around the perl code, and also line
numbers. How can I define this in the org file?

-- 
Thanks,
Manfred

Minimal example:

#+TITLE: My slides
#+AUTHOR: Manfred Lotz
#+EMAIL: manfred.lotz@yahoo.de
#+DATE: 2014-07-21
#+LaTeX_CLASS_options: [bigger, allowframebreaks]
#+LaTeX_HEADER: \usepackage{minted}
#+LaTeX_HEADER: \usemintedstyle{emacs}
#+OPTIONS: H:2 toc:t num:t
#+TOC: headlines [currentsection]
#+startup: beamer
#+BEAMER_THEME: CambridgeUS
#+BEAMER_COLOR_THEME: dolphin
* Introduction
** A simple slide
The following contains some perl code
- a minimal perl example
  #+BEGIN_SRC perl
  #! /usr/bin/perl
  
  use strict;
  use warnings;
  use 5.010;

  say 'hey';
  #+END_SRC
- the previous point shows the use of the minted environment

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

* Re: minted question
  2014-07-21 19:30 minted question Manfred Lotz
@ 2014-07-21 19:53 ` Thomas S. Dye
  2014-07-21 20:14   ` Manfred Lotz
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas S. Dye @ 2014-07-21 19:53 UTC (permalink / raw)
  To: Manfred Lotz; +Cc: emacs-orgmode

Aloha Manfred,

You should be able to use attr_latex (untested).

Manfred Lotz <manfred.lotz@arcor.de> writes:

#+ATTR_LATEX: :options linenos=true frame=single
>   #+BEGIN_SRC perl
>   #! /usr/bin/perl
>   
>   use strict;
>   use warnings;
>   use 5.010;
>
>   say 'hey';
>   #+END_SRC

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: minted question
  2014-07-21 19:53 ` Thomas S. Dye
@ 2014-07-21 20:14   ` Manfred Lotz
  2014-07-21 20:48     ` Thomas S. Dye
  0 siblings, 1 reply; 8+ messages in thread
From: Manfred Lotz @ 2014-07-21 20:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi Tom,

On Mon, 21 Jul 2014 09:53:41 -1000
tsd@tsdye.com (Thomas S. Dye) wrote:

> Aloha Manfred,
> 
> You should be able to use attr_latex (untested).
> 
> Manfred Lotz <manfred.lotz@arcor.de> writes:
> 
> #+ATTR_LATEX: :options linenos=true frame=single
> >   #+BEGIN_SRC perl
> >   #! /usr/bin/perl
> >   
> >   use strict;
> >   use warnings;
> >   use 5.010;
> >
> >   say 'hey';
> >   #+END_SRC
> 

Unfortunately, that doesn't work. 

I also tried 

  #+ATTR_LaTeX: :environment minted  :linenos true :frame single

which didn't do it either.


-- 
Manfred

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

* Re: minted question
  2014-07-21 20:14   ` Manfred Lotz
@ 2014-07-21 20:48     ` Thomas S. Dye
  2014-07-22  4:23       ` Manfred Lotz
  2014-07-25  6:33       ` Manfred Lotz
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas S. Dye @ 2014-07-21 20:48 UTC (permalink / raw)
  To: Manfred Lotz; +Cc: emacs-orgmode

Hi Manfred,

Manfred Lotz <manfred.lotz@arcor.de> writes:

> Hi Tom,
>
> On Mon, 21 Jul 2014 09:53:41 -1000
> tsd@tsdye.com (Thomas S. Dye) wrote:
>
>> Aloha Manfred,
>> 
>> You should be able to use attr_latex (untested).
>> 
>> Manfred Lotz <manfred.lotz@arcor.de> writes:
>> 
>> #+ATTR_LATEX: :options linenos=true frame=single
>> >   #+BEGIN_SRC perl
>> >   #! /usr/bin/perl
>> >   
>> >   use strict;
>> >   use warnings;
>> >   use 5.010;
>> >
>> >   say 'hey';
>> >   #+END_SRC
>> 
>
> Unfortunately, that doesn't work. 

Yes, when I tried a slightly modified version here I got incorrect LaTeX
output:

 \begin{minted}[,linenos=true, frame=single]{perl}
 #! /usr/bin/perl

   use strict;
   use warnings;
   use 5.010;

   say 'hey';
 \end{minted}

Note the extraneous comma in the optional argument before "linenos".

I get what looks to be correct LaTeX export if I set options in the
variable org-latex-minted-options, as shown in the emacs-lisp code block
below. 

 #+ATTR_LATEX: :options linenos=true, frame=single
 #+BEGIN_SRC perl
 #! /usr/bin/perl

   use strict;
   use warnings;
   use 5.010;

   say 'hey';
 #+END_SRC

 #+begin_src emacs-lisp
   (require 'ox-latex)
   (add-to-list 'org-latex-packages-alist '("" "minted"))
   (setq org-latex-listings 'minted)
   (setq org-latex-minted-options 
     '(("linenos" "true") ("frame" "single")))
 #+end_SEC

Are you getting an extraneous comma with the #+attr_latex line?

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: minted question
  2014-07-21 20:48     ` Thomas S. Dye
@ 2014-07-22  4:23       ` Manfred Lotz
  2014-07-22  8:10         ` Nick Dokos
  2014-07-25  6:33       ` Manfred Lotz
  1 sibling, 1 reply; 8+ messages in thread
From: Manfred Lotz @ 2014-07-22  4:23 UTC (permalink / raw)
  To: emacs-orgmode

Hi Thomas,

On Mon, 21 Jul 2014 10:48:14 -1000
tsd@tsdye.com (Thomas S. Dye) wrote:

> Hi Manfred,
> 
> Manfred Lotz <manfred.lotz@arcor.de> writes:
> 
> > Hi Tom,
> >
> > On Mon, 21 Jul 2014 09:53:41 -1000
> > tsd@tsdye.com (Thomas S. Dye) wrote:
> >
> >> Aloha Manfred,
> >> 
> >> You should be able to use attr_latex (untested).
> >> 
> >> Manfred Lotz <manfred.lotz@arcor.de> writes:
> >> 
> >> #+ATTR_LATEX: :options linenos=true frame=single
> >> >   #+BEGIN_SRC perl
> >> >   #! /usr/bin/perl
> >> >   
> >> >   use strict;
> >> >   use warnings;
> >> >   use 5.010;
> >> >
> >> >   say 'hey';
> >> >   #+END_SRC
> >> 
> >
> > Unfortunately, that doesn't work. 
> 
> Yes, when I tried a slightly modified version here I got incorrect
> LaTeX output:
> 
>  \begin{minted}[,linenos=true, frame=single]{perl}
>  #! /usr/bin/perl
> 
>    use strict;
>    use warnings;
>    use 5.010;
> 
>    say 'hey';
>  \end{minted}
> 
> Note the extraneous comma in the optional argument before "linenos".
> 
> I get what looks to be correct LaTeX export if I set options in the
> variable org-latex-minted-options, as shown in the emacs-lisp code
> block below. 
> 
>  #+ATTR_LATEX: :options linenos=true, frame=single
>  #+BEGIN_SRC perl
>  #! /usr/bin/perl
> 
>    use strict;
>    use warnings;
>    use 5.010;
> 
>    say 'hey';
>  #+END_SRC
> 
>  #+begin_src emacs-lisp
>    (require 'ox-latex)
>    (add-to-list 'org-latex-packages-alist '("" "minted"))
>    (setq org-latex-listings 'minted)
>    (setq org-latex-minted-options 
>      '(("linenos" "true") ("frame" "single")))
>  #+end_SEC
> 
> Are you getting an extraneous comma with the #+attr_latex line?
> 
> All the best,
> Tom
> 

I do not get any extraneous comma. When using the #+attr_latex line
there is just nothing in the latex output.

I'm also confused about the emacs-lisp code snippet. I only get it
working if I either put it into my .emacs or evaluate it in the scratch
buffer. The way you wrote it the lisp code shows up in my document.
I messed around with :results but to no avail.


-- 
Best, Manfred

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

* Re: minted question
  2014-07-22  4:23       ` Manfred Lotz
@ 2014-07-22  8:10         ` Nick Dokos
  2014-07-22 17:22           ` Thomas S. Dye
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2014-07-22  8:10 UTC (permalink / raw)
  To: emacs-orgmode

Manfred Lotz <manfred.lotz@arcor.de> writes:

> Hi Thomas,
>
> On Mon, 21 Jul 2014 10:48:14 -1000
> tsd@tsdye.com (Thomas S. Dye) wrote:
>
>> Hi Manfred,
>> 
>> Manfred Lotz <manfred.lotz@arcor.de> writes:
>> 
>> > Hi Tom,
>> >
>> > On Mon, 21 Jul 2014 09:53:41 -1000
>> > tsd@tsdye.com (Thomas S. Dye) wrote:
>> >
>> >> Aloha Manfred,
>> >> 
>> >> You should be able to use attr_latex (untested).
>> >> 
>> >> Manfred Lotz <manfred.lotz@arcor.de> writes:
>> >> 
>> >> #+ATTR_LATEX: :options linenos=true frame=single
>> >> >   #+BEGIN_SRC perl
>> >> >   #! /usr/bin/perl
>> >> >   
>> >> >   use strict;
>> >> >   use warnings;
>> >> >   use 5.010;
>> >> >
>> >> >   say 'hey';
>> >> >   #+END_SRC
>> >> 
>> >
>> > Unfortunately, that doesn't work. 
>> 
>> Yes, when I tried a slightly modified version here I got incorrect
>> LaTeX output:
>> 
>>  \begin{minted}[,linenos=true, frame=single]{perl}
>>  #! /usr/bin/perl
>> 
>>    use strict;
>>    use warnings;
>>    use 5.010;
>> 
>>    say 'hey';
>>  \end{minted}
>> 
>> Note the extraneous comma in the optional argument before "linenos".
>> 
>> I get what looks to be correct LaTeX export if I set options in the
>> variable org-latex-minted-options, as shown in the emacs-lisp code
>> block below. 
>> 
>>  #+ATTR_LATEX: :options linenos=true, frame=single
>>  #+BEGIN_SRC perl
>>  #! /usr/bin/perl
>> 
>>    use strict;
>>    use warnings;
>>    use 5.010;
>> 
>>    say 'hey';
>>  #+END_SRC
>> 
>>  #+begin_src emacs-lisp
>>    (require 'ox-latex)
>>    (add-to-list 'org-latex-packages-alist '("" "minted"))
>>    (setq org-latex-listings 'minted)
>>    (setq org-latex-minted-options 
>>      '(("linenos" "true") ("frame" "single")))
>>  #+end_SEC
>> 
>> Are you getting an extraneous comma with the #+attr_latex line?
>> 
>> All the best,
>> Tom
>> 
>
> I do not get any extraneous comma. When using the #+attr_latex line
> there is just nothing in the latex output.
>

Same here.

> I'm also confused about the emacs-lisp code snippet. I only get it
> working if I either put it into my .emacs or evaluate it in the scratch
> buffer. The way you wrote it the lisp code shows up in my document.
> I messed around with :results but to no avail.

Try putting it into its own :noexport: section (I also fixed the typo
below):

--8<---------------cut here---------------start------------->8---
* Setup                                       :noexport:

#+begin_src emacs-lisp
    (require 'ox-latex)
    (add-to-list 'org-latex-packages-alist '("" "minted"))
    (setq org-latex-listings 'minted)
    (setq org-latex-minted-options 
      '(("linenos" "true") ("frame" "single")))
#+end_src
--8<---------------cut here---------------end--------------->8---

Nick

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

* Re: minted question
  2014-07-22  8:10         ` Nick Dokos
@ 2014-07-22 17:22           ` Thomas S. Dye
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas S. Dye @ 2014-07-22 17:22 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

>>> Are you getting an extraneous comma with the #+attr_latex line?
>>> 
>>> All the best,
>>> Tom
>>> 
>>
>> I do not get any extraneous comma. When using the #+attr_latex line
>> there is just nothing in the latex output.
>>
>
> Same here.

Then none of us gets the result noted in the manual.

    The latter allows to specify options relative to the package used to
 highlight code in the output (e.g., ‘listings’).  This is the local
 counterpart to ‘org-latex-listings-options’ and
 ‘org-latex-minted-options’ variables, which see.

      #+ATTR_LATEX: :options commentstyle=\bfseries
      #+BEGIN_SRC emacs-lisp
        (defun Fib (n)                          ; Count rabbits.
          (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
      #+END_SRC

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: minted question
  2014-07-21 20:48     ` Thomas S. Dye
  2014-07-22  4:23       ` Manfred Lotz
@ 2014-07-25  6:33       ` Manfred Lotz
  1 sibling, 0 replies; 8+ messages in thread
From: Manfred Lotz @ 2014-07-25  6:33 UTC (permalink / raw)
  To: emacs-orgmode

Hi Tom,

On Mon, 21 Jul 2014 10:48:14 -1000
tsd@tsdye.com (Thomas S. Dye) wrote:

> Hi Manfred,
> 
> Manfred Lotz <manfred.lotz@arcor.de> writes:
> 
> > Hi Tom,
> >
> > On Mon, 21 Jul 2014 09:53:41 -1000
> > tsd@tsdye.com (Thomas S. Dye) wrote:
> >
> >> Aloha Manfred,
> >> 
> >> You should be able to use attr_latex (untested).
> >> 
> >> Manfred Lotz <manfred.lotz@arcor.de> writes:
> >> 
> >> #+ATTR_LATEX: :options linenos=true frame=single
> >> >   #+BEGIN_SRC perl
> >> >   #! /usr/bin/perl
> >> >   
> >> >   use strict;
> >> >   use warnings;
> >> >   use 5.010;
> >> >
> >> >   say 'hey';
> >> >   #+END_SRC
> >> 
> >
> > Unfortunately, that doesn't work. 
> 
> Yes, when I tried a slightly modified version here I got incorrect
> LaTeX output:
> 
>  \begin{minted}[,linenos=true, frame=single]{perl}
>  #! /usr/bin/perl
> 
>    use strict;
>    use warnings;
>    use 5.010;
> 
>    say 'hey';
>  \end{minted}
> 
> Note the extraneous comma in the optional argument before "linenos".
> 
> I get what looks to be correct LaTeX export if I set options in the
> variable org-latex-minted-options, as shown in the emacs-lisp code
> block below. 
> 
>  #+ATTR_LATEX: :options linenos=true, frame=single
>  #+BEGIN_SRC perl
>  #! /usr/bin/perl
> 
>    use strict;
>    use warnings;
>    use 5.010;
> 
>    say 'hey';
>  #+END_SRC
> 
>  #+begin_src emacs-lisp
>    (require 'ox-latex)
>    (add-to-list 'org-latex-packages-alist '("" "minted"))
>    (setq org-latex-listings 'minted)
>    (setq org-latex-minted-options 
>      '(("linenos" "true") ("frame" "single")))
>  #+end_SEC
> 

In the end I did put the code into the .emacs file which isn't too bad
as I usually like to have those minted settings globally.


-- 
Best, Manfred

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

end of thread, other threads:[~2014-07-25  6:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-21 19:30 minted question Manfred Lotz
2014-07-21 19:53 ` Thomas S. Dye
2014-07-21 20:14   ` Manfred Lotz
2014-07-21 20:48     ` Thomas S. Dye
2014-07-22  4:23       ` Manfred Lotz
2014-07-22  8:10         ` Nick Dokos
2014-07-22 17:22           ` Thomas S. Dye
2014-07-25  6:33       ` Manfred Lotz

Code repositories for project(s) associated with this 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).