emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Limit on macro snippet size?
@ 2015-09-14 16:40 Thomas S. Dye
  2015-09-14 17:01 ` Suvayu Ali
  2015-09-14 17:16 ` Eric S Fraga
  0 siblings, 2 replies; 11+ messages in thread
From: Thomas S. Dye @ 2015-09-14 16:40 UTC (permalink / raw)
  To: emacs-orgmode

Aloha all,

I couldn't find any information on this in the manual or the mailing
list, though I vaguely recall some discussion on the list a while back.

Is there a limit on the length of text that a macro like this will
process?

#+MACRO: green \textcolor{PaleGreen4}{$1}

I have 2 and 3 line sections of text passed to $1 that worked last
spring, but fail now.

All the best,
Tom

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

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

* Re: Limit on macro snippet size?
  2015-09-14 16:40 Limit on macro snippet size? Thomas S. Dye
@ 2015-09-14 17:01 ` Suvayu Ali
  2015-09-14 17:34   ` Thomas S. Dye
  2015-09-14 17:16 ` Eric S Fraga
  1 sibling, 1 reply; 11+ messages in thread
From: Suvayu Ali @ 2015-09-14 17:01 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi Tom,

On Mon, Sep 14, 2015 at 06:40:48AM -1000, Thomas S. Dye wrote:
> 
> I couldn't find any information on this in the manual or the mailing
> list, though I vaguely recall some discussion on the list a while back.
> 
> Is there a limit on the length of text that a macro like this will
> process?
> 
> #+MACRO: green \textcolor{PaleGreen4}{$1}
> 
> I have 2 and 3 line sections of text passed to $1 that worked last
> spring, but fail now.

Are you sure?  Here is a 3 line macro that seems to work fine for me:

  non-uniform acceptance ratio.  {{{note(Add note on RICH detectors
  relying on exactly this feature to discriminate between particle
  species.,inline)}}}

I have attached a screenshot of the relevant part of the output pdf to
show it actually works.  How does the failure happen, what do you see in
the exported file?

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: macro-output.png --]
[-- Type: image/png, Size: 8668 bytes --]

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

* Re: Limit on macro snippet size?
  2015-09-14 16:40 Limit on macro snippet size? Thomas S. Dye
  2015-09-14 17:01 ` Suvayu Ali
@ 2015-09-14 17:16 ` Eric S Fraga
  2015-09-14 17:24   ` Rasmus
  1 sibling, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2015-09-14 17:16 UTC (permalink / raw)
  To: Thomas S.Dye; +Cc: emacs-orgmode

On Monday, 14 Sep 2015 at 06:40, Thomas S.Dye wrote:
> Aloha all,
>
> I couldn't find any information on this in the manual or the mailing
> list, though I vaguely recall some discussion on the list a while back.

> #+MACRO: green \textcolor{PaleGreen4}{$1}

> Is there a limit on the length of text that a macro like this will
> process?

probably...  (others will answer, I'm sure)

Instead, I wonder whether it wouldn't just be easy enough to do:

#+begin_src org
  ,#+latex: \textcolor{PaleGreen4}{
  all of your text that can be several lines
  ,#+latex: }
#+end_src

Less fragile, so long as there are no paragraph breaks maybe...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-234-g8c85c9

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

* Re: Limit on macro snippet size?
  2015-09-14 17:16 ` Eric S Fraga
@ 2015-09-14 17:24   ` Rasmus
  2015-09-14 17:34     ` Suvayu Ali
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-09-14 17:24 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Less fragile, so long as there are no paragraph breaks maybe...

But much less portable.

I think the limitation is that no newlines are allowed, but I did not
check the source.

Rasmus

Example:

     #+macro: identity foo-$1

     {{{identity(Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis orci nec nunc viverra dictum. Quisque interdum dolor metus, non consectetur velit pulvinar nec. Ut elementum, mi sed scelerisque convallis, sem neque euismod ligula, vel consectetur mauris massa quis magna. Morbi maximus ante ut justo placerat, in posuere nulla auctor. Sed dapibus eros et augue interdum, in eleifend libero tincidunt. Nunc tortor lorem, placerat non ultrices non, rutrum ut dui. Etiam quam ex, dictum in nunc id, aliquam blandit urna. Cras efficitur scelerisque erat in porta. Ut egestas scelerisque neque et elementum. Duis in ligula vel ante sodales dapibus dapibus fermentum mi. Nullam ipsum nunc, sodales eget felis eget, porttitor rutrum felis. Duis tincidunt lectus ut augue porttitor sol
 licitudin. Morbi sit amet nisl sodales, pulvinar dolor sollicitudin, placerat nisl. Integer non consectetur purus.)}}}


     {{{identity(a 
     b
     c
     d
     e
     f
     g
     h
     i
     j
     k
     l
     m)}}}

     {{{identity(a

     b)}}}

-- 
Governments should be afraid of their people

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

* Re: Limit on macro snippet size?
  2015-09-14 17:24   ` Rasmus
@ 2015-09-14 17:34     ` Suvayu Ali
  0 siblings, 0 replies; 11+ messages in thread
From: Suvayu Ali @ 2015-09-14 17:34 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Sep 14, 2015 at 07:24:52PM +0200, Rasmus wrote:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> 
> > Less fragile, so long as there are no paragraph breaks maybe...
> 
> But much less portable.
> 
> I think the limitation is that no newlines are allowed, but I did not
> check the source.

But it works with newlines for me; see my reply to the original message.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Limit on macro snippet size?
  2015-09-14 17:01 ` Suvayu Ali
@ 2015-09-14 17:34   ` Thomas S. Dye
  2015-09-14 17:40     ` Suvayu Ali
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2015-09-14 17:34 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Hi Suvayu,

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

> Hi Tom,
>
> On Mon, Sep 14, 2015 at 06:40:48AM -1000, Thomas S. Dye wrote:
>> 
>> I couldn't find any information on this in the manual or the mailing
>> list, though I vaguely recall some discussion on the list a while back.
>> 
>> Is there a limit on the length of text that a macro like this will
>> process?
>> 
>> #+MACRO: green \textcolor{PaleGreen4}{$1}
>> 
>> I have 2 and 3 line sections of text passed to $1 that worked last
>> spring, but fail now.
>
> Are you sure?  Here is a 3 line macro that seems to work fine for me:
>
>   non-uniform acceptance ratio.  {{{note(Add note on RICH detectors
>   relying on exactly this feature to discriminate between particle
>   species.,inline)}}}
>
> I have attached a screenshot of the relevant part of the output pdf to
> show it actually works.  How does the failure happen, what do you see in
> the exported file?

\textcolor{PaleGreen4}\{the only weapons they had were a
few stones in some of the Canoes and these they threw overboard
when they found they were not wanted\}.

Note the curly brackets are escaped.  Not sure why ...

Tom

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

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

* Re: Limit on macro snippet size?
  2015-09-14 17:34   ` Thomas S. Dye
@ 2015-09-14 17:40     ` Suvayu Ali
  2015-09-14 17:42       ` Suvayu Ali
  2015-09-14 18:49       ` Thomas S. Dye
  0 siblings, 2 replies; 11+ messages in thread
From: Suvayu Ali @ 2015-09-14 17:40 UTC (permalink / raw)
  To: emacs-orgmode

Hey Tom,

On Mon, Sep 14, 2015 at 07:34:39AM -1000, Thomas S. Dye wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>
> > show it actually works.  How does the failure happen, what do you see in
> > the exported file?
> 
> \textcolor{PaleGreen4}\{the only weapons they had were a
> few stones in some of the Canoes and these they threw overboard
> when they found they were not wanted\}.
> 
> Note the curly brackets are escaped.  Not sure why ...

Easy-peasy!  Org recognises the first {..} as part of a latex command,
not the later.  You need snippets.  I always use them to make export
more robust.  Try this:

#+macro: green @@l:\textcolor{PaleGreen4}{@@$1@@l:}@@

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Limit on macro snippet size?
  2015-09-14 17:40     ` Suvayu Ali
@ 2015-09-14 17:42       ` Suvayu Ali
  2015-09-14 18:49       ` Thomas S. Dye
  1 sibling, 0 replies; 11+ messages in thread
From: Suvayu Ali @ 2015-09-14 17:42 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Sep 14, 2015 at 07:40:24PM +0200, Suvayu Ali wrote:
> Hey Tom,
> 
> On Mon, Sep 14, 2015 at 07:34:39AM -1000, Thomas S. Dye wrote:
> > Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> >
> > > show it actually works.  How does the failure happen, what do you see in
> > > the exported file?
> > 
> > \textcolor{PaleGreen4}\{the only weapons they had were a
> > few stones in some of the Canoes and these they threw overboard
> > when they found they were not wanted\}.
> > 
> > Note the curly brackets are escaped.  Not sure why ...
> 
> Easy-peasy!  Org recognises the first {..} as part of a latex command,
> not the later.  You need snippets.  I always use them to make export
> more robust.  Try this:
> 
> #+macro: green @@l:\textcolor{PaleGreen4}{@@$1@@l:}@@

Btw, this happens because of the newlines of course :).

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Limit on macro snippet size?
  2015-09-14 17:40     ` Suvayu Ali
  2015-09-14 17:42       ` Suvayu Ali
@ 2015-09-14 18:49       ` Thomas S. Dye
  2015-09-14 20:03         ` Suvayu Ali
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2015-09-14 18:49 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Hi Suvayu,

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

> Hey Tom,
>
> On Mon, Sep 14, 2015 at 07:34:39AM -1000, Thomas S. Dye wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>>
>> > show it actually works.  How does the failure happen, what do you see in
>> > the exported file?
>> 
>> \textcolor{PaleGreen4}\{the only weapons they had were a
>> few stones in some of the Canoes and these they threw overboard
>> when they found they were not wanted\}.
>> 
>> Note the curly brackets are escaped.  Not sure why ...
>
> Easy-peasy!  Org recognises the first {..} as part of a latex command,
> not the later.  You need snippets.  I always use them to make export
> more robust.  Try this:
>
> #+macro: green @@l:\textcolor{PaleGreen4}{@@$1@@l:}@@

This doesn't work for me.  The latex output isn't marked up, but the
text passed to $1 appears in the tex file.


All the best,
Tom

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

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

* Re: Limit on macro snippet size?
  2015-09-14 18:49       ` Thomas S. Dye
@ 2015-09-14 20:03         ` Suvayu Ali
  2015-09-14 20:25           ` Thomas S. Dye
  0 siblings, 1 reply; 11+ messages in thread
From: Suvayu Ali @ 2015-09-14 20:03 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Sep 14, 2015 at 08:49:17AM -1000, Thomas S. Dye wrote:
> Hi Suvayu,
> 
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > Hey Tom,
> >
> > On Mon, Sep 14, 2015 at 07:34:39AM -1000, Thomas S. Dye wrote:
> >> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> >>
> >> > show it actually works.  How does the failure happen, what do you see in
> >> > the exported file?
> >> 
> >> \textcolor{PaleGreen4}\{the only weapons they had were a
> >> few stones in some of the Canoes and these they threw overboard
> >> when they found they were not wanted\}.
> >> 
> >> Note the curly brackets are escaped.  Not sure why ...
> >
> > Easy-peasy!  Org recognises the first {..} as part of a latex command,
> > not the later.  You need snippets.  I always use them to make export
> > more robust.  Try this:
> >
> > #+macro: green @@l:\textcolor{PaleGreen4}{@@$1@@l:}@@
> 
> This doesn't work for me.  The latex output isn't marked up, but the
> text passed to $1 appears in the tex file.

Sorry, I have a shortcut for latex snippets to l.  Try replacing the l
with latex:

#+macro: green @@latex:\textcolor{PaleGreen4}{@@$1@@latex:}@@

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Limit on macro snippet size?
  2015-09-14 20:03         ` Suvayu Ali
@ 2015-09-14 20:25           ` Thomas S. Dye
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas S. Dye @ 2015-09-14 20:25 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Hi Suvayu,

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

>> > #+macro: green @@l:\textcolor{PaleGreen4}{@@$1@@l:}@@
>> 
>> This doesn't work for me.  The latex output isn't marked up, but the
>> text passed to $1 appears in the tex file.
>
> Sorry, I have a shortcut for latex snippets to l.  Try replacing the l
> with latex:
>
> #+macro: green @@latex:\textcolor{PaleGreen4}{@@$1@@latex:}@@

@@Perfect.@@  Many thanks!

All the best,
Tom

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

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

end of thread, other threads:[~2015-09-14 20:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 16:40 Limit on macro snippet size? Thomas S. Dye
2015-09-14 17:01 ` Suvayu Ali
2015-09-14 17:34   ` Thomas S. Dye
2015-09-14 17:40     ` Suvayu Ali
2015-09-14 17:42       ` Suvayu Ali
2015-09-14 18:49       ` Thomas S. Dye
2015-09-14 20:03         ` Suvayu Ali
2015-09-14 20:25           ` Thomas S. Dye
2015-09-14 17:16 ` Eric S Fraga
2015-09-14 17:24   ` Rasmus
2015-09-14 17:34     ` 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).