* Something to watch out for when including files
@ 2016-09-20 15:21 Eric S Fraga
2016-09-20 17:10 ` Adam Porter
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Eric S Fraga @ 2016-09-20 15:21 UTC (permalink / raw)
To: Emacs Org mode mailing list
Hello all,
just wanted to help others avoid spending a long time trying to figure
out some strange (well, unexpected) behaviour in org...
I have a document for which the LaTeX export was ignoring a
#+begin_abstract ... #+end_abstract construct near the start of the
document. The text was simply not appearing in the LaTeX file.
Long story short: I had a #+include: directive as the first line of the
file which included an org file called preamble.org. In that preamble
file, the last headline had the tag :noexport:. It would seem that this
tag is not processed until after the include file has been included. I
hope that makes sense. In any case, this means that my abstract was
considered to be part of the noexport headline and was therefore not
exported.
Took me a very long time to figure out... the simple solution was to
remove that noexport section entirely from the preamble file.
I do wonder whether the org export approach (i.e. how it "includes"
files) is correct but I can understand why the implementation is the way
it is.
Thanks for listening!
eric
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.1.50.1, Org release_8.3.6-1149-g582233
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Something to watch out for when including files
2016-09-20 15:21 Something to watch out for when including files Eric S Fraga
@ 2016-09-20 17:10 ` Adam Porter
2016-09-20 23:32 ` Charles C. Berry
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Adam Porter @ 2016-09-20 17:10 UTC (permalink / raw)
To: emacs-orgmode
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> Took me a very long time to figure out... the simple solution was to
> remove that noexport section entirely from the preamble file.
Those are the worst to track down! Thanks for sharing. This would make
a good blog post too. :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Something to watch out for when including files
2016-09-20 15:21 Something to watch out for when including files Eric S Fraga
2016-09-20 17:10 ` Adam Porter
@ 2016-09-20 23:32 ` Charles C. Berry
[not found] ` <58a8c0419a56444fb6956cd709d26dec@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Charles C. Berry @ 2016-09-20 23:32 UTC (permalink / raw)
To: Eric S Fraga; +Cc: Emacs Org mode mailing list
On Tue, 20 Sep 2016, Eric S Fraga wrote:
> Hello all,
>
> just wanted to help others avoid spending a long time trying to figure
> out some strange (well, unexpected) behaviour in org...
>
> I have a document for which the LaTeX export was ignoring a
> #+begin_abstract ... #+end_abstract construct near the start of the
> document. The text was simply not appearing in the LaTeX file.
>
> Long story short: I had a #+include: directive as the first line of the
> file which included an org file called preamble.org. In that preamble
> file, the last headline had the tag :noexport:. It would seem that this
> tag is not processed until after the include file has been included. I
> hope that makes sense. In any case, this means that my abstract was
> considered to be part of the noexport headline and was therefore not
> exported.
>
> Took me a very long time to figure out... the simple solution was to
> remove that noexport section entirely from the preamble file.
>
I find myself in the habit of using inlinetasks tagged noexport for
various things and that might serve you in this case. That is, convert the
headline section to an inlinetask.
Another possibility is to use something like:
#+header: :exports results :results raw replace
#+NAME: import-include-dot-org
#+BEGIN_SRC emacs-lisp
(require 'ox-org)
(org-export-string-as "#+INCLUDE: include.org" 'org t)
#+END_SRC
which will strip out headlines tagged with noexport during the babel phase
of export (i.e. before parsing).
> I do wonder whether the org export approach (i.e. how it "includes"
> files) is correct but I can understand why the implementation is the way
> it is.
I agree about the implementation. Trying to make it smarter is asking for
trouble.
Chuck
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Something to watch out for when including files
[not found] ` <58a8c0419a56444fb6956cd709d26dec@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-09-21 6:44 ` Eric S Fraga
0 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2016-09-21 6:44 UTC (permalink / raw)
To: Charles C. Berry; +Cc: Emacs Org mode mailing list
On Tuesday, 20 Sep 2016 at 23:32, Charles C. Berry wrote:
> I find myself in the habit of using inlinetasks tagged noexport for
> various things and that might serve you in this case. That is, convert the
> headline section to an inlinetask.
Hi Chuck,
Yes, this would work. But, in the end, simply removing the section was
sufficient as it really wasn't necessary (and that's why I have
everything under version control... ;-).
> Another possibility is to use something like:
>
> #+header: :exports results :results raw replace
> #+NAME: import-include-dot-org
>
> #+BEGIN_SRC emacs-lisp
> (require 'ox-org)
> (org-export-string-as "#+INCLUDE: include.org" 'org t)
> #+END_SRC
>
> which will strip out headlines tagged with noexport during the babel phase
> of export (i.e. before parsing).
This is quite ingenious! I like it. Don't need it now but worth
keeping note of for the future. Thanks.
>> I do wonder whether the org export approach (i.e. how it "includes"
>> files) is correct but I can understand why the implementation is the way
>> it is.
>
> I agree about the implementation. Trying to make it smarter is asking for
> trouble.
Yes, probably.
Thanks again,
eric
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.90.1, Org release_8.3.3-535-g7213aa
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Something to watch out for when including files
2016-09-20 15:21 Something to watch out for when including files Eric S Fraga
` (2 preceding siblings ...)
[not found] ` <58a8c0419a56444fb6956cd709d26dec@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-09-21 15:22 ` Giacomo M
[not found] ` <b81ae1e313fc4a0c85fa5d63e3c29eb2@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
4 siblings, 0 replies; 6+ messages in thread
From: Giacomo M @ 2016-09-21 15:22 UTC (permalink / raw)
To: emacs-orgmode
Il 20/09/2016 17:21, Eric S Fraga ha scritto:
> I had a #+include: directive as the first line of the
> file which included an org file called preamble.org. In that preamble
> file, the last headline had the tag :noexport:. It would seem that this
> tag is not processed until after the include file has been included. I
> hope that makes sense. In any case, this means that my abstract was
> considered to be part of the noexport headline and was therefore not
> exported.
Lately I like to have headlines for all the logical parts of the
document, so also an "Abstract" headline with the abstract block inside.
Then I use the tag "ignore" and the org export extra "ignore-headlines"
(activated e.g. via "(ox-extras-activate '(ignore-headlines))" if you
use org-plus-contrib) to avoid exporting the headlines themselves. This
should also avoid the inheritance of tags in the last headline of the
include. Not vanilla org, but I find it handy.
Giacomo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Something to watch out for when including files
[not found] ` <b81ae1e313fc4a0c85fa5d63e3c29eb2@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-09-21 15:53 ` Eric S Fraga
0 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2016-09-21 15:53 UTC (permalink / raw)
To: Giacomo M; +Cc: emacs-orgmode@gnu.org
On Wednesday, 21 Sep 2016 at 15:22, Giacomo M wrote:
> Lately I like to have headlines for all the logical parts of the
> document, so also an "Abstract" headline with the abstract block inside.
> Then I use the tag "ignore" and the org export extra "ignore-headlines"
> (activated e.g. via "(ox-extras-activate '(ignore-headlines))" if you
> use org-plus-contrib) to avoid exporting the headlines themselves. This
> should also avoid the inheritance of tags in the last headline of the
> include. Not vanilla org, but I find it handy.
This is basically what I do. I even have (ignored) headlines that have
a content that is simply a @@latex:\newpage@@ directive!
The problem is that if you have a headline that is ignored, the text
that follows essentially belongs to the previous non-ignored
headline. If that previous headline has been commented out or has been
marked as not to be exported, the text after the ignored headline is
also therefore ignored when it comes to export.
Ignoring headlines is very fragile in the same way as described in my
original post.
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.90.1, Org release_8.3.3-535-g7213aa
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-21 18:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-20 15:21 Something to watch out for when including files Eric S Fraga
2016-09-20 17:10 ` Adam Porter
2016-09-20 23:32 ` Charles C. Berry
[not found] ` <58a8c0419a56444fb6956cd709d26dec@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-09-21 6:44 ` Eric S Fraga
2016-09-21 15:22 ` Giacomo M
[not found] ` <b81ae1e313fc4a0c85fa5d63e3c29eb2@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-09-21 15:53 ` Eric S Fraga
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).