emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* inline constant substitution
@ 2014-10-12 14:41 Paul Rudin
  2014-10-12 15:05 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Rudin @ 2014-10-12 14:41 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ


Suppose I have: 

#+CONSTANTS: foo=42

How can I make inline references to a constant on export in regular
text, rather than in a table?

I want to be able to write something like: 

  The value of foo is $foo 

in my org file, and then end up with:

  The value of foo is 42

when I export to LaTeX.

TIA.

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

* Re: inline constant substitution
  2014-10-12 14:41 inline constant substitution Paul Rudin
@ 2014-10-12 15:05 ` Nicolas Goaziou
  2014-10-12 17:13   ` Paul Rudin
  2014-10-13  1:00   ` Grant Rettke
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2014-10-12 15:05 UTC (permalink / raw)
  To: Paul Rudin; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hello,

Paul Rudin <paul-sqPYmOVXOov10XsdtD+oqA@public.gmane.org> writes:

> Suppose I have:
>
> #+CONSTANTS: foo=42
>
> How can I make inline references to a constant on export in regular
> text, rather than in a table?
>
> I want to be able to write something like: 
>
>   The value of foo is $foo 
>
> in my org file, and then end up with:
>
>   The value of foo is 42
>
> when I export to LaTeX.

Constants are for tables only. You can use a macro instead:

#+MACRO: foo 42

  The value of foo is {{{foo}}}.


Regards,

-- 
Nicolas Goaziou

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

* Re: inline constant substitution
  2014-10-12 15:05 ` Nicolas Goaziou
@ 2014-10-12 17:13   ` Paul Rudin
  2014-10-13 11:51     ` Eric S Fraga
  2014-10-13  1:00   ` Grant Rettke
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Rudin @ 2014-10-12 17:13 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Nicolas Goaziou <mail-Gpy5sJQTEQHwkn9pgDnJRVAUjnlXr6A1@public.gmane.org> writes:

> Paul Rudin <paul-sqPYmOVXOov10XsdtD+oqA@public.gmane.org> writes:
>
>> Suppose I have:
>>
>> #+CONSTANTS: foo=42
>>
>> How can I make inline references to a constant on export in regular
>> text, rather than in a table?
>>
>> I want to be able to write something like: 
>>
>>   The value of foo is $foo 
>>
>> in my org file, and then end up with:
>>
>>   The value of foo is 42
>>
>> when I export to LaTeX.
>
> Constants are for tables only. You can use a macro instead:
>
> #+MACRO: foo 42
>
>   The value of foo is {{{foo}}}.
>

Thanks. If I *also* want to use that value in a table is there a way to
do that? I experimented with:

#+TBLFM: @1$1={{{foo}}}

and 

#+TBLFM: @1$1="{{{foo}}}"

But neither of those work.

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

* Re: inline constant substitution
  2014-10-12 15:05 ` Nicolas Goaziou
  2014-10-12 17:13   ` Paul Rudin
@ 2014-10-13  1:00   ` Grant Rettke
  1 sibling, 0 replies; 6+ messages in thread
From: Grant Rettke @ 2014-10-13  1:00 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Paul Rudin, public-emacs-orgmode-mXXj517/zsQ



Should a noweb-ref be expanded as imagined inside of a table for this case?

Eg pseudo code:

,----
| #+NAME: foo
| #+begin_src emacs-lisp
| 42
| #+end_src
|
|
| #+NAME: ns
| |     n |
| |-------|
| |     1 |
| |     2 |
| | <<foo>> |
| |       |
`----

On Sun, Oct 12, 2014 at 10:05 AM, Nicolas Goaziou
<mail@nicolasgoaziou.fr> wrote:
>
>
> Hello,
>
> Paul Rudin <paul-sqPYmOVXOov10XsdtD+oqA@public.gmane.org> writes:
>
>> Suppose I have:
>>
>> #+CONSTANTS: foo=42
>>
>> How can I make inline references to a constant on export in regular
>> text, rather than in a table?
>>
>> I want to be able to write something like:
>>
>>   The value of foo is $foo
>>
>> in my org file, and then end up with:
>>
>>   The value of foo is 42
>>
>> when I export to LaTeX.
>
> Constants are for tables only. You can use a macro instead:
>
> #+MACRO: foo 42
>
>   The value of foo is {{{foo}}}.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>
>



-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

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

* Re: inline constant substitution
  2014-10-12 17:13   ` Paul Rudin
@ 2014-10-13 11:51     ` Eric S Fraga
  2014-10-13 19:38       ` Paul Rudin
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2014-10-13 11:51 UTC (permalink / raw)
  To: Paul Rudin; +Cc: emacs-orgmode

On Sunday, 12 Oct 2014 at 18:13, Paul Rudin wrote:
> Thanks. If I *also* want to use that value in a table is there a way to
> do that? I experimented with:
>
> #+TBLFM: @1$1={{{foo}}}
>
> and 
>
> #+TBLFM: @1$1="{{{foo}}}"
>
> But neither of those work.

What about simply:

| {{{foo}}} |

i.e. put the macro reference directly in the table?


-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-408-g39f5f0

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

* Re: inline constant substitution
  2014-10-13 11:51     ` Eric S Fraga
@ 2014-10-13 19:38       ` Paul Rudin
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Rudin @ 2014-10-13 19:38 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Eric S Fraga <e.fraga-hclig2XLE9Zaa/9Udqfwiw@public.gmane.org> writes:

> On Sunday, 12 Oct 2014 at 18:13, Paul Rudin wrote:
>> Thanks. If I *also* want to use that value in a table is there a way to
>> do that? I experimented with:
>>
>> #+TBLFM: @1$1={{{foo}}}
>>
>> and 
>>
>> #+TBLFM: @1$1="{{{foo}}}"
>>
>> But neither of those work.
>
> What about simply:
>
> | {{{foo}}} |
>
> i.e. put the macro reference directly in the table?

The value gets exported to LaTeX in the table, but that apparently
happens at export time. So if you have formulae in the table that refer
to that cell they don't compute using the value.

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

end of thread, other threads:[~2014-10-13 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-12 14:41 inline constant substitution Paul Rudin
2014-10-12 15:05 ` Nicolas Goaziou
2014-10-12 17:13   ` Paul Rudin
2014-10-13 11:51     ` Eric S Fraga
2014-10-13 19:38       ` Paul Rudin
2014-10-13  1:00   ` Grant Rettke

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