emacs-orgmode
[Top][All Lists]

## Re: [O] fold paragraphs, export only contents of a node, hiding the 'nod

 From: John Hendy Subject: Re: [O] fold paragraphs, export only contents of a node, hiding the 'node heading text' Date: Sun, 1 Sep 2013 18:51:27 -0500

On Sun, Sep 1, 2013 at 4:17 PM, . . <address@hidden> wrote:
> Hello:
>
> Is there a way to export to Latex the text under a heading but
> not-exporting/printing to the .tex file the heading/TODO (node line) itself?
>
> The idea is to be able to fold paragraphs (via node creation for the
> paragraphs under it).
> But if I set the node to noexport (to hide the unnecessary heading/TODO text
> which was only there to allow folding the text under it) then the paragraph
> can't be exported either!
>
> This would be great to permit folding with great granularity and use the
> heading to describe the paragraph without showing it (like a comment only it
> folds!).
>

I never did dig into this as it still was a bit above my head, but it
seems like this could do what you want:
- https://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01329.html

In other words, you'd define a custom function like this:

(defun mapcdi-org-latex-headline-function (todo todo-type priority text tags)
"The docstring of my function."
(concat
(and todo (format "{\\bfseries\\sffamily %s} " todo))
(and priority (format "\\framebox{\\#%c} " priority))
text
(and tags
(format "\\hfill{}\\textsc{%s}" (mapconcat 'identity tags ":")))))

I think you'd just omit that "text" bit, and probably remove the other stuff to.

ETA: I just went ahead and gave it a whirl. It looks like this, or
something close, should let you do whatever you want with headlines
(go ahead and use priorities, tags, todo keywords, and the like and
still just get a blank headline:

(defun mapcdi-org-latex-headline-function (todo todo-type priority text tags)
"The docstring of my function."
(concat
(and todo (format "{}" todo))
(and priority (format "{} " ))

(and tags
(format "\\hfill{}\\textit{}" (mapconcat 'identity tags ":")))))

There most likely is a blank line where the headline *would* go. I
played around with trying to \vspace a negative line space like so,
and I think it's doing the right thing, or is at least close (there's
less space between the contents line and the paragraph text):

(defun mapcdi-org-latex-headline-function (todo todo-type priority text tags)
"The docstring of my function."
(concat
(and todo (format "{}" todo))
(and priority (format "{} " ))
(and text (format "{\\vspace{-\\baselineskip}}" ))
(and tags
(format "\\hfill{}\\textit{}" (mapconcat 'identity tags ":")))))

The only thing I noticed is that within a section, paragraphs by
default have no space and are indented (well, the first isn't, but
following paragraphs are). With this method, paragraphs within
sections are going to have the typical post-section spacing compared
to being treated like truly consecutive paragraphs. If you're okay
with that, then this will work. If not, you'll have to make a custom
latex template somehow so that the whole document is treated like one
long section. I'm not sure if that's possible given org's headline ->
section internals. You might be able to fiddle with something like the
above \vspace{} trick, though? You'd also have to have every paragraph
indented so that they weren't treated like the first paragraph in a
section (un-indented).

Anyway, hopefully this gets you on the right path!

#+begin_src test-file

#+options: num:nil

blah blah blah.

blah blah blah

A couple of separate paragraphs to see how far apart two paragraphs would be
normally. We'll add enough to line break just to make it interesting.

A couple of separate paragraphs to see how far apart two paragraphs would be
normally. We'll add enough to line break just to make it interesting.

#+end_src

Best regards,
John

>
> Thanks,
> Best regards,
> Mark