emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* included text
@ 2019-11-02 22:50 Samuel Wales
  2019-11-03 13:38 ` Fraga, Eric
  0 siblings, 1 reply; 8+ messages in thread
From: Samuel Wales @ 2019-11-02 22:50 UTC (permalink / raw)
  To: emacs-orgmode

org has a bunch of mechanisms for included text, including macros, the
include statement, and maybe babel.

i want to take some text and stick it in a paragraph in a few
subtrees, but have it be in a single entry.

so like:

===
* my insertable text
alpha, beta, gamma
* one blog post
whatever whatever

some greek letters include [syntax for including] and more.
* another blog post
some types of radiation include [syntax for including].
===

what's the usual most non-breakable mechanism for this?

thanks.

-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

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

* Re: included text
  2019-11-02 22:50 included text Samuel Wales
@ 2019-11-03 13:38 ` Fraga, Eric
  2019-11-03 19:36   ` Samuel Wales
  0 siblings, 1 reply; 8+ messages in thread
From: Fraga, Eric @ 2019-11-03 13:38 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode@gnu.org

I use macros generally for this.  For longer bits of text, I reword and,
instead of repeating the text inline, I use internal links.  These links
can be inserted automatically if you use radio targets/links.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78

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

* Re: included text
  2019-11-03 13:38 ` Fraga, Eric
@ 2019-11-03 19:36   ` Samuel Wales
  2019-11-03 19:37     ` Samuel Wales
  0 siblings, 1 reply; 8+ messages in thread
From: Samuel Wales @ 2019-11-03 19:36 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org

can you give an example of using an internal link?  this would work
for me.  but i am not getting what you mean.

* text to be included
<<a b c>>
* blog post 1
twinkle star [syntactic magic]

?

On 11/3/19, Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
> I use macros generally for this.  For longer bits of text, I reword and,
> instead of repeating the text inline, I use internal links.  These links
> can be inserted automatically if you use radio targets/links.
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

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

* Re: included text
  2019-11-03 19:36   ` Samuel Wales
@ 2019-11-03 19:37     ` Samuel Wales
  2019-11-04  8:42       ` Fraga, Eric
  0 siblings, 1 reply; 8+ messages in thread
From: Samuel Wales @ 2019-11-03 19:37 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org

ah, or do you mean you refer the reader to the text by a regular link
instaed of including?  that's not what i am lokoing for here as these
are separate posts.

On 11/3/19, Samuel Wales <samologist@gmail.com> wrote:
> can you give an example of using an internal link?  this would work
> for me.  but i am not getting what you mean.
>
> * text to be included
> <<a b c>>
> * blog post 1
> twinkle star [syntactic magic]
>
> ?
>
> On 11/3/19, Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
>> I use macros generally for this.  For longer bits of text, I reword and,
>> instead of repeating the text inline, I use internal links.  These links
>> can be inserted automatically if you use radio targets/links.
>>
>> --
>> Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78
>>
>
>
> --
> The Kafka Pandemic
>
> What is misopathy?
> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>
> The disease DOES progress. MANY people have died from it. And ANYBODY
> can get it at any time.
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

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

* Re: included text
  2019-11-03 19:37     ` Samuel Wales
@ 2019-11-04  8:42       ` Fraga, Eric
  2019-11-04 12:40         ` John Kitchin
  2019-11-04 22:16         ` Richard Lawrence
  0 siblings, 2 replies; 8+ messages in thread
From: Fraga, Eric @ 2019-11-04  8:42 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode@gnu.org

On Sunday,  3 Nov 2019 at 12:37, Samuel Wales wrote:
> ah, or do you mean you refer the reader to the text by a regular link
> instaed of including?  that's not what i am lokoing for here as these
> are separate posts.

Yes, this is what I meant, in case the adjusted use case were of some
use.  But it would seem that it won't help you in this case.  Therefore,
I would suggest macros for short amounts of text or #+include for larger
text blocks.  Mind you, an alternative could be #+CALL-ing a src block
that generates the text as output?

-- 
: Professor Eric S Fraga, http://www.homepages.ucl.ac.uk/~ucecesf
: PGP/GPG key: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
: Use plain text email when possible: https://useplaintext.email/

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

* Re: included text
  2019-11-04  8:42       ` Fraga, Eric
@ 2019-11-04 12:40         ` John Kitchin
  2019-11-04 22:16         ` Richard Lawrence
  1 sibling, 0 replies; 8+ messages in thread
From: John Kitchin @ 2019-11-04 12:40 UTC (permalink / raw)
  To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org

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

Along the lines of what Eric suggested, you can put inline calls to
src-blocks in the text. Here are some ways you could get something like
what you describe I think.

* text to be included
 :noexport:

#+name: block-1
#+BEGIN_SRC python :results value :var a="a" b="b"
return f"<<{a} {b} c>>"
#+END_SRC

#+name: lorem
#+BEGIN_EXAMPLE
Aliquam erat volutpat.  Nunc eleifend leo vitae magna.  In id erat non orci
commodo lobortis.  Proin neque massa, cursus ut, gravida ut, lobortis eget,
lacus.  Sed diam.  Praesent fermentum tempor tellus.  Nullam tempus.
Mauris ac felis vel velit tristique imperdiet.  Donec at pede.  Etiam vel
neque nec dui dignissim bibendum.  Vivamus id enim.  Phasellus neque orci,
porta a, aliquet quis, semper a, massa.  Phasellus purus.  Pellentesque
tristique imperdiet tortor.  Nam euismod tellus id erat.
#+END_EXAMPLE

#+name: lorem-2
#+BEGIN_EXAMPLE
Pellentesque dapibus suscipit ligula.
#+END_EXAMPLE


#+name: block-2
#+BEGIN_SRC sh :results output :var content=lorem
echo $content
#+END_SRC


* blog post 1

twinkle star call_block-1() {{{results(=<<a b c>>=)}}}

Later call_block-1(a=1) {{{results(=<<1 b c>>=)}}}

or call_block-1(a=5, b=7) {{{results(=<<5 7 c>>=)}}}


call_block-2(lorem) {{{results(=Aliquam erat volutpat. Nunc eleifend leo
vitae magna. In id erat non orci commodo lobortis. Proin neque massa\,
cursus ut\, gravida ut\, lobortis eget\, lacus. Sed diam. Praesent
fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique
imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum.
Vivamus id enim. Phasellus neque orci\, porta a\, aliquet quis\, semper a\,
massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam
euismod tellus id erat.=)}}}

call_block-2(lorem-2) {{{results(=Pellentesque dapibus suscipit ligula.=)}}}





John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Nov 4, 2019 at 3:42 AM Fraga, Eric <e.fraga@ucl.ac.uk> wrote:

> On Sunday,  3 Nov 2019 at 12:37, Samuel Wales wrote:
> > ah, or do you mean you refer the reader to the text by a regular link
> > instaed of including?  that's not what i am lokoing for here as these
> > are separate posts.
>
> Yes, this is what I meant, in case the adjusted use case were of some
> use.  But it would seem that it won't help you in this case.  Therefore,
> I would suggest macros for short amounts of text or #+include for larger
> text blocks.  Mind you, an alternative could be #+CALL-ing a src block
> that generates the text as output?
>
> --
> : Professor Eric S Fraga, http://www.homepages.ucl.ac.uk/~ucecesf
> : PGP/GPG key: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
> : Use plain text email when possible: https://useplaintext.email/
>
>

[-- Attachment #2: Type: text/html, Size: 4039 bytes --]

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

* Re: included text
  2019-11-04  8:42       ` Fraga, Eric
  2019-11-04 12:40         ` John Kitchin
@ 2019-11-04 22:16         ` Richard Lawrence
  2019-11-05  0:25           ` Samuel Wales
  1 sibling, 1 reply; 8+ messages in thread
From: Richard Lawrence @ 2019-11-04 22:16 UTC (permalink / raw)
  To: Fraga, Eric, Samuel Wales; +Cc: emacs-orgmode@gnu.org

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

> Mind you, an alternative could be #+CALL-ing a src block
> that generates the text as output?

On these lines: I've been thinking recently that it would be great to be
able to tangle/export other kinds of blocks (quotes, examples, etc.) via
the same kind of mechanism that src blocks use.

This would be really useful for me for making e.g. handouts from the
file that contains notes for a talk or a paper.

I've done this in the past with src blocks containing Org source code.
So instead of writing

#+begin_quote
Yada yada
#+end_quote

I write

#+begin_src org :tangle handout.org
,#+begin_quote
Yada yada
,#+end_quote
#+end_src

and create the handout.org file via org-babel-tangle.

This works but it is pretty clunky, and you lose a lot of the benefit of
having the original quote block. For one thing, it no longer exports as
a quote from the original file, but as source code. I'd rather just
write:

#+begin_quote :tangle handout.org
Yada yada
#+end_quote

or even better:

#+name: yada-quote
#+begin_quote
Yada yada
#+end_quote

and then in handout.org, something like:

#+include: talk.org::#yada-quote

Is there anyone who would be interested in this besides just me and
Samuel? (Can this already be done somehow in a non-clunky way?? I find
John's suggestion intriguing but too clunky: it seems like I shouldn't
have to pass a block of text through a shell or Python interpreter just
to include it verbatim in another Org file!)

-- 
Best,
Richard

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

* Re: included text
  2019-11-04 22:16         ` Richard Lawrence
@ 2019-11-05  0:25           ` Samuel Wales
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Wales @ 2019-11-05  0:25 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: emacs-orgmode@gnu.org, Fraga, Eric

the include route seems brittle to me, as you have to name the file
you are in.  this would be interesting:

#+include: {{{input-file}}}::#yada-quote

(i have a bug in org more recent than a pretty old version so idk if
this is already possible.)


On 11/4/19, Richard Lawrence <richard.lawrence@berkeley.edu> wrote:
> "Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
>
>> Mind you, an alternative could be #+CALL-ing a src block
>> that generates the text as output?
>
> On these lines: I've been thinking recently that it would be great to be
> able to tangle/export other kinds of blocks (quotes, examples, etc.) via
> the same kind of mechanism that src blocks use.
>
> This would be really useful for me for making e.g. handouts from the
> file that contains notes for a talk or a paper.
>
> I've done this in the past with src blocks containing Org source code.
> So instead of writing
>
> #+begin_quote
> Yada yada
> #+end_quote
>
> I write
>
> #+begin_src org :tangle handout.org
> ,#+begin_quote
> Yada yada
> ,#+end_quote
> #+end_src
>
> and create the handout.org file via org-babel-tangle.
>
> This works but it is pretty clunky, and you lose a lot of the benefit of
> having the original quote block. For one thing, it no longer exports as
> a quote from the original file, but as source code. I'd rather just
> write:
>
> #+begin_quote :tangle handout.org
> Yada yada
> #+end_quote
>
> or even better:
>
> #+name: yada-quote
> #+begin_quote
> Yada yada
> #+end_quote
>
> and then in handout.org, something like:
>
> #+include: talk.org::#yada-quote
>
> Is there anyone who would be interested in this besides just me and
> Samuel? (Can this already be done somehow in a non-clunky way?? I find
> John's suggestion intriguing but too clunky: it seems like I shouldn't
> have to pass a block of text through a shell or Python interpreter just
> to include it verbatim in another Org file!)
>
> --
> Best,
> Richard
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

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

end of thread, other threads:[~2019-11-05  0:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-02 22:50 included text Samuel Wales
2019-11-03 13:38 ` Fraga, Eric
2019-11-03 19:36   ` Samuel Wales
2019-11-03 19:37     ` Samuel Wales
2019-11-04  8:42       ` Fraga, Eric
2019-11-04 12:40         ` John Kitchin
2019-11-04 22:16         ` Richard Lawrence
2019-11-05  0:25           ` Samuel Wales

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