emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Custom column environment in beamer export
@ 2015-06-15 22:00 Suvayu Ali
  2015-06-15 22:30 ` Rasmus
  0 siblings, 1 reply; 8+ messages in thread
From: Suvayu Ali @ 2015-06-15 22:00 UTC (permalink / raw)
  To: Emacs Org mode

Hi,

Is it possible to define a custom column like environment?  At the
moment I'm hacking around the need with this:

(add-to-list 'org-beamer-environments-extra
	     '("minipage" "m" "\\begin{minipage}%H" "\\end{minipage}%"))

With the above I can export the following

* 0.1\linewidth						 :B_minipage:
  :PROPERTIES:
  :BEAMER_env: minipage
  :END:
+/cFit/+

to

\begin{minipage}{0.1\linewidth}
\structure{\emph{cFit}}
\end{minipage}%

However within Org, not being able to specify a descriptive headline
sacrifices readability.  It would be great if I could write something
like this:

* Fitting technique					 :B_minipage:
  :PROPERTIES:
  :BEAMER_env: minipage
  :BEAMER_arg: 0.1\linewidth
  :END:
+/cFit/+

I seem to recall this was possible in the past.  Is there any chance to
get something like this going?

Thanks for any thoughts.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Custom column environment in beamer export
  2015-06-15 22:00 Custom column environment in beamer export Suvayu Ali
@ 2015-06-15 22:30 ` Rasmus
  2015-06-16  9:42   ` Suvayu Ali
  2015-06-16 11:57   ` Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: Rasmus @ 2015-06-15 22:30 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> * Fitting technique					 :B_minipage:
>   :PROPERTIES:
>   :BEAMER_env: minipage
>   :BEAMER_arg: 0.1\linewidth
>   :END:
> +/cFit/+

The closest would probably be something like

(add-to-list 'org-beamer-environments-extra
             '("minipage"
               "m"
               "\\begin{minipage}%o%a\n\\structure{%h}"
               "\\end{minipage}"))

Which would afford you something like

* slide
** Fitting technique                                            :B_minipage:
  :PROPERTIES:
  :BEAMER_env: minipage
  :BEAMER_OPT: [t]{0.1\linewidth}
  :BEAMER_ACT: <5>
  :END:
  /cFit/

Unfortunately, BEAMER_OPTs are wrapped in square brackets thanks to
org-beamer--normalize-argument, so the above won't actually work (see
org-beamer--format-block).  From the looks of it I'd be willing to call it
a bug, but Nicolas may have had something in mind.

Perhaps these days it would be nice to allow the third element of
org-beamer-environments-extra to be a λ taking either the object or so.
Then again, perhaps this is an overkill and too low-level.

Personally, I'd use a block, e.g.

#+attr_latex: :options [t]{.1\textwidth}
#+begin_minipage
Cfit
#+end_minipage

Rasmus

-- 
This space is left intentionally blank

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

* Re: Custom column environment in beamer export
  2015-06-15 22:30 ` Rasmus
@ 2015-06-16  9:42   ` Suvayu Ali
  2015-06-16 11:57   ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2015-06-16  9:42 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Jun 16, 2015 at 12:30:09AM +0200, Rasmus wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > * Fitting technique					 :B_minipage:
> >   :PROPERTIES:
> >   :BEAMER_env: minipage
> >   :BEAMER_arg: 0.1\linewidth
> >   :END:
> > +/cFit/+
> 
> The closest would probably be something like
> 
> (add-to-list 'org-beamer-environments-extra
>              '("minipage"
>                "m"
>                "\\begin{minipage}%o%a\n\\structure{%h}"
>                "\\end{minipage}"))
> 
> Which would afford you something like
> 
> * slide
> ** Fitting technique                                            :B_minipage:
>   :PROPERTIES:
>   :BEAMER_env: minipage
>   :BEAMER_OPT: [t]{0.1\linewidth}
>   :BEAMER_ACT: <5>
>   :END:
>   /cFit/

Well, I would rather keep the formatting in the org file, so no
\structure in the template.  But otherwise your suggestion seems exactly
what I need :).

> Unfortunately, BEAMER_OPTs are wrapped in square brackets thanks to
> org-beamer--normalize-argument, so the above won't actually work (see
> org-beamer--format-block).  From the looks of it I'd be willing to call it
> a bug, but Nicolas may have had something in mind.

I was thinking the same.  That's why I felt the need for the old
BEAMER_arg property!

> Perhaps these days it would be nice to allow the third element of
> org-beamer-environments-extra to be a λ taking either the object or so.
> Then again, perhaps this is an overkill and too low-level.

This might be nice, but as you say could be overkill.  Although, there
are a few other cases which is harder to use with the current syntax.
Take minipage as an example, it takes 3 optional arguments[1].
Presently there is no way of dealing with something like that.  Removing
the autowrapping of brackets would allow such cases, but it would
probably break a few Org files in the wild.  From that perspective, a
lambda might be the way to go.

> Personally, I'd use a block, e.g.
> 
> #+attr_latex: :options [t]{.1\textwidth}
> #+begin_minipage
> Cfit
> #+end_minipage

Nice idea.  I have never really explored using blocks (other than for
raw latex), maybe I should ...

Thanks,

Footnotes:

[1] https://en.wikibooks.org/wiki/LaTeX/Boxes#minipage_and_parbox


-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Custom column environment in beamer export
  2015-06-15 22:30 ` Rasmus
  2015-06-16  9:42   ` Suvayu Ali
@ 2015-06-16 11:57   ` Nicolas Goaziou
  2015-06-16 12:37     ` Suvayu Ali
  2015-06-16 12:52     ` Rasmus
  1 sibling, 2 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2015-06-16 11:57 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> Unfortunately, BEAMER_OPTs are wrapped in square brackets thanks to
> org-beamer--normalize-argument, so the above won't actually work (see
> org-beamer--format-block).  From the looks of it I'd be willing to call it
> a bug, but Nicolas may have had something in mind.

IIRC it was a pre-8.0 feature already. In any case, it allows sloppy
writing for options, i.e., with or without square brackets.

> Perhaps these days it would be nice to allow the third element of
> org-beamer-environments-extra to be a λ taking either the object or so.
> Then again, perhaps this is an overkill and too low-level.

More simply, we can also add placeholders in templates, e.g.,

  %R raw action specification
  %O raw options argument

WDYT?


Regards,

-- 
Nicolas Goaziou

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

* Re: Custom column environment in beamer export
  2015-06-16 11:57   ` Nicolas Goaziou
@ 2015-06-16 12:37     ` Suvayu Ali
  2015-06-16 12:52     ` Rasmus
  1 sibling, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2015-06-16 12:37 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Rasmus

Hi Nicolas,

On Tue, Jun 16, 2015 at 01:57:06PM +0200, Nicolas Goaziou wrote:
> Rasmus <rasmus@gmx.us> writes:
> 
> > Unfortunately, BEAMER_OPTs are wrapped in square brackets thanks to
> > org-beamer--normalize-argument, so the above won't actually work (see
> > org-beamer--format-block).  From the looks of it I'd be willing to call it
> > a bug, but Nicolas may have had something in mind.
> 
> IIRC it was a pre-8.0 feature already. In any case, it allows sloppy
> writing for options, i.e., with or without square brackets.

Yes, I think so.

> > Perhaps these days it would be nice to allow the third element of
> > org-beamer-environments-extra to be a λ taking either the object or so.
> > Then again, perhaps this is an overkill and too low-level.
> 
> More simply, we can also add placeholders in templates, e.g.,
> 
>   %R raw action specification
>   %O raw options argument

Indeed, that would work well I think.  One can wrap the raw arguments
anyway you wish in the template.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Custom column environment in beamer export
  2015-06-16 11:57   ` Nicolas Goaziou
  2015-06-16 12:37     ` Suvayu Ali
@ 2015-06-16 12:52     ` Rasmus
  2015-06-16 13:33       ` Nicolas Goaziou
  1 sibling, 1 reply; 8+ messages in thread
From: Rasmus @ 2015-06-16 12:52 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Unfortunately, BEAMER_OPTs are wrapped in square brackets thanks to
>> org-beamer--normalize-argument, so the above won't actually work (see
>> org-beamer--format-block).  From the looks of it I'd be willing to call it
>> a bug, but Nicolas may have had something in mind.
>
> IIRC it was a pre-8.0 feature already. In any case, it allows sloppy
> writing for options, i.e., with or without square brackets.

The third argument is hard-coded to 'option in org-beamer--format-block
ATM.

>> Perhaps these days it would be nice to allow the third element of
>> org-beamer-environments-extra to be a λ taking either the object or so.
>> Then again, perhaps this is an overkill and too low-level.
>
> More simply, we can also add placeholders in templates, e.g.,
>
>   %R raw action specification
>   %O raw options argument
>
> WDYT?

Indeed.  That's the incremental fix.

Rasmus

-- 
9000!

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

* Re: Custom column environment in beamer export
  2015-06-16 12:52     ` Rasmus
@ 2015-06-16 13:33       ` Nicolas Goaziou
  2015-06-16 14:33         ` Suvayu Ali
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2015-06-16 13:33 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> The third argument is hard-coded to 'option in org-beamer--format-block
> ATM.

ox-beamer expects options to be wrapped within square brackets. If they
are not, it does that task. This is a bit drastic, but it works well in
practice.

> Indeed.  That's the incremental fix.

Done in cf5fd31f0c4f18bd0256157adb98306d53f8a52c.

Regards,

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

* Re: Custom column environment in beamer export
  2015-06-16 13:33       ` Nicolas Goaziou
@ 2015-06-16 14:33         ` Suvayu Ali
  0 siblings, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2015-06-16 14:33 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Rasmus

On Tue, Jun 16, 2015 at 03:33:03PM +0200, Nicolas Goaziou wrote:
> Rasmus <rasmus@gmx.us> writes:
> 
> > Indeed.  That's the incremental fix.
> 
> Done in cf5fd31f0c4f18bd0256157adb98306d53f8a52c.

Works great!  I went with this template:

(add-to-list 'org-beamer-environments-extra
	     '("minipage" "m" "\\begin{minipage}%O{%R}" "\\end{minipage}%"))

For my use case, I rarely use overlay actions, so I repurposed it for
environment arguments.

Thanks a lot!

PS: OT, within beamer I find minipage is easier to manage than columns.

-- 
Suvayu

Open source is the future. It sets us free.

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

end of thread, other threads:[~2015-06-16 14:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15 22:00 Custom column environment in beamer export Suvayu Ali
2015-06-15 22:30 ` Rasmus
2015-06-16  9:42   ` Suvayu Ali
2015-06-16 11:57   ` Nicolas Goaziou
2015-06-16 12:37     ` Suvayu Ali
2015-06-16 12:52     ` Rasmus
2015-06-16 13:33       ` Nicolas Goaziou
2015-06-16 14:33         ` Suvayu Ali

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