I want to export a block of org-mode source code in a tutorial I am writing. I have tried variations of the following. But nothing seems to give me org-mode code in the exported pdf. #+BEGIN_SRC org :results code replace org-mode code here #+END_SRC What is the right way to do it? Vikas
Vikas Rawal wrote:
> I want to export a block of org-mode source code in a tutorial I am
> writing.
>
> I have tried variations of the following. But nothing seems to give me
> org-mode code in the exported pdf.
>
> #+BEGIN_SRC org :results code replace
> org-mode code here
> #+END_SRC
>
> What is the right way to do it?
The following Org code block...
#+begin_src org
,#+begin_src <LANGUAGE> <HEADER-ARGS>
<BODY>
,#+end_src
#+end_src
... works for me (that is, is fontified correctly in the HTML export).
Best regards,
Seb
--
Sebastien Vauban
>
> The following Org code block...
>
> #+begin_src org
> ,#+begin_src <LANGUAGE> <HEADER-ARGS>
> <BODY>
> ,#+end_src
> #+end_src
>
> ... works for me (that is, is fontified correctly in the HTML export).
>
I think I could not express my objective clearly.
I want the org code block to be exported literally. So, for example, I would like the following block to be exported as if it was plain text, * in headlines being exported as such.
#+begin_src org :results replace
,#+begin_src org
** What are the major disputes in the literature
*** adulterated text
Instrument cultivated alteration any favourable expression law far
nor. Both new like tore but year. An from mean on with when sing pain.
Oh to as principles devonshire companions unsatiable an delightful.
The ourselves suffering the sincerity. Inhabit her manners adapted age
certain. Debating offended at branched striking be subjects.
,#+end_src
#+end_src
Vikas
[-- Attachment #1: Type: text/plain, Size: 1309 bytes --] > > I think I could not express my objective clearly. > > I want the org code block to be exported literally. So, for example, I would like the following block to be exported as if it was plain text, * in headlines being exported as such. > > #+begin_src org :results replace > ,#+begin_src org > ** What are the major disputes in the literature > *** adulterated text > Instrument cultivated alteration any favourable expression law far > nor. Both new like tore but year. An from mean on with when sing pain. > Oh to as principles devonshire companions unsatiable an delightful. > The ourselves suffering the sincerity. Inhabit her manners adapted age > certain. Debating offended at branched striking be subjects. > ,#+end_src > #+end_src > This seems to give the best output so far: : ** What are the major disputes in the literature : *** adulterated text : Instrument cultivated alteration any favourable expression law far : nor. Both new like tore but year. An from mean on with when sing pain. : Oh to as principles devonshire companions unsatiable an delightful. : The ourselves suffering the sincerity. Inhabit her manners adapted age : certain. Debating offended at branched striking be subjects. Is this the right way? I figures this from worg sources. Vikas [-- Attachment #2: Type: text/html, Size: 1765 bytes --]
Vikas Rawal <vikaslists <at> agrarianresearch.org> writes:
> I think I could not express my objective clearly.I want the org code block
to be exported literally.
Indent lines that begin with *, is this what you want?
#+BEGIN_SRC org
** What are the major disputes in the literature
*** adulterated text
Instrument cultivated alteration any favourable expression law far
nor. Both new like tore but year. An from mean on with when sing pain.
Oh to as principles devonshire companions unsatiable an delightful.
The ourselves suffering the sincerity. Inhabit her manners adapted age
certain. Debating offended at branched striking be subjects.
#+END_SRC
> > Vikas Rawal <vikaslists <at> agrarianresearch.org> writes: > > >> I think I could not express my objective clearly.I want the org code block > to be exported literally. > > > Indent lines that begin with *, is this what you want? I am not exactly sure what you are suggesting. The block below does not work for me. It is not exported literally. > #+BEGIN_SRC org > ** What are the major disputes in the literature > *** adulterated text > Instrument cultivated alteration any favourable expression law far > nor. Both new like tore but year. An from mean on with when sing pain. > Oh to as principles devonshire companions unsatiable an delightful. > The ourselves suffering the sincerity. Inhabit her manners adapted age > certain. Debating offended at branched striking be subjects. > #+END_SRC > > Vikas
Vikas Rawal <vikaslists <at> agrarianresearch.org> writes: > > > > > Vikas Rawal <vikaslists <at> agrarianresearch.org> writes: > > > > > >> I think I could not express my objective clearly.I want the org code block > > to be exported literally. > > > > > > Indent lines that begin with *, is this what you want? > > I am not exactly sure what you are suggesting. The block below does not work for me. It is not exported literally. > > > #+BEGIN_SRC org > > ** What are the major disputes in the literature > > *** adulterated text > > Instrument cultivated alteration any favourable expression law far > > nor. Both new like tore but year. An from mean on with when sing pain. > > Oh to as principles devonshire companions unsatiable an delightful. > > The ourselves suffering the sincerity. Inhabit her manners adapted age > > certain. Debating offended at branched striking be subjects. > > #+END_SRC > > > > > > Vikas > > There is a white space before *, but I didn't see that in your quote, is that because of your newsgroup reader client? See the link below: http://article.gmane.org/gmane.emacs.orgmode/85805 Lines start with * is exported to headings only when there is no white space before *. Sorry for my broken English.
[-- Attachment #1: Type: text/plain, Size: 1239 bytes --] Hi, Sorry if I misunderstood... If you create an Org source block like this with nothing inside: #+begin_src org #+end_src ...then, with your cursor inside, enter it with C-c ', write your org tree, and validate with C-c ' again, then export... Does it do what you want? FC On Sun, May 4, 2014 at 10:04 AM, Vikas Rawal < vikaslists@agrarianresearch.org> wrote: > > > > Vikas Rawal <vikaslists <at> agrarianresearch.org> writes: > > > > > >> I think I could not express my objective clearly.I want the org code > block > > to be exported literally. > > > > > > Indent lines that begin with *, is this what you want? > > I am not exactly sure what you are suggesting. The block below does not > work for me. It is not exported literally. > > > > #+BEGIN_SRC org > > ** What are the major disputes in the literature > > *** adulterated text > > Instrument cultivated alteration any favourable expression law far > > nor. Both new like tore but year. An from mean on with when sing pain. > > Oh to as principles devonshire companions unsatiable an delightful. > > The ourselves suffering the sincerity. Inhabit her manners adapted age > > certain. Debating offended at branched striking be subjects. > > #+END_SRC > > > > > > Vikas > [-- Attachment #2: Type: text/html, Size: 1958 bytes --]
Fletcher Charest <fletcher.charest@gmail.com> writes:
> Hi,
>
> Sorry if I misunderstood... If you create an Org source block like this with nothing inside:
>
> #+begin_src org
>
> #+end_src
>
> ...then, with your cursor inside, enter it with C-c ', write your org tree, and validate with C-c ' again, then export... Does it do
> what you want?
>
> FC
>
> On Sun, May 4, 2014 at 10:04 AM, Vikas Rawal <vikaslists@agrarianresearch.org> wrote:
>
> >
> > Vikas Rawal <vikaslists <at> agrarianresearch.org> writes:
> >
> >
> >> I think I could not express my objective clearly.I want the org code block
> > to be exported literally.
> >
> >
> > Indent lines that begin with *, is this what you want?
>
> I am not exactly sure what you are suggesting. The block below does not work for me. It is not exported literally.
>
> > #+BEGIN_SRC org
> > ** What are the major disputes in the literature
> > *** adulterated text
> > Instrument cultivated alteration any favourable expression law far
> > nor. Both new like tore but year. An from mean on with when sing pain.
> > Oh to as principles devonshire companions unsatiable an delightful.
> > The ourselves suffering the sincerity. Inhabit her manners adapted age
> > certain. Debating offended at branched striking be subjects.
> > #+END_SRC
> >
> >
>
> Vikas
Perfect solution.
On 04-May-2014, at 11:46 am, Han Fan <visayafan@gmail.com> wrote: > Fletcher Charest <fletcher.charest@gmail.com> writes: > >> Hi, >> >> Sorry if I misunderstood... If you create an Org source block like this with nothing inside: >> >> #+begin_src org >> >> #+end_src >> >> ...then, with your cursor inside, enter it with C-c ', write your org tree, and validate with C-c ' again, then export... Does it do >> what you want? >> >> FC > This is what works for me #+begin_src org :exports code #+end_src It does not work without ":exports code” I found the solution here: http://lists.gnu.org/archive/html/emacs-orgmode/2011-01/msg01117.html Vikas
Vikas Rawal wrote:
> On 04-May-2014, at 11:46 am, Han Fan <visayafan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Fletcher Charest <fletcher.charest-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>>
>>> Sorry if I misunderstood... If you create an Org source block like
>>> this with nothing inside:
>>>
>>> #+begin_src org
>>>
>>> #+end_src
>>>
>>> ...then, with your cursor inside, enter it with C-c ', write your
>>> org tree, and validate with C-c ' again, then export... Does it do
>>> what you want?
>
> This is what works for me
>
> #+begin_src org :exports code
>
> #+end_src
>
> It does not work without ":exports code”
I don't understand that, as ":exports code" is the default for Org code
blocks, as shown by:
╭────
│ org-babel-default-header-args:org is a variable defined in `ob-org.el'.
│ Its value is ((:results . "raw silent") (:exports . "code"))
│
│ Documentation:
│ Default arguments for evaluating a org source block.
╰────
Best regards,
Seb
--
Sebastien Vauban
>>
>> It does not work without ":exports code”
>
> I don't understand that, as ":exports code" is the default for Org code
> blocks, as shown by:
>
> ╭────
> │ org-babel-default-header-args:org is a variable defined in `ob-org.el'.
> │ Its value is ((:results . "raw silent") (:exports . "code"))
> │
> │ Documentation:
> │ Default arguments for evaluating a org source block.
> ╰────
Indeed, my bad.
I had "#+property: exports results” in the file header, something that I have been routinely copying from one file to another, since usually do not want to export code.
Sorry.
Vikas
Vikas Rawal wrote:
>>> It does not work without ":exports code”
>>
>> I don't understand that, as ":exports code" is the default for Org code
>> blocks, as shown by:
>>
>> ╭────
>> │ org-babel-default-header-args:org is a variable defined in `ob-org.el'.
>> │ Its value is ((:results . "raw silent") (:exports . "code"))
>> │
>> │ Documentation:
>> │ Default arguments for evaluating a org source block.
>> ╰────
>
> Indeed, my bad.
>
> I had "#+property: exports results” in the file header, something that I have
> been routinely copying from one file to another, since usually do not want to
> export code.
>
> Sorry.
Indeed, that explains a lot of the misunderstandings!
Best regards,
Seb
--
Sebastien Vauban