[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Ignore, skip, omit headline when exporting to LaTeX
From: |
edgar |
Subject: |
Ignore, skip, omit headline when exporting to LaTeX |
Date: |
Thu, 07 Jul 2022 20:00:01 +0000 |
User-agent: |
Horde Application Framework 5 |
Firstly, do tell me if I am breaking the nettiquete.
I found someone asking online how to ignore a headline when exporting
to LaTeX. This e-mail is to avoid creating an account on that forum
and to provide a solution.
(require 'ox-extra)
(defun org-export-ignore-headlines-latex (data backend info)
"Hack of `org-export-ignore-headlines' for LaTeX: add a
conditional for the latex backend and replace 'ignore' with 'ignoreltx'"
(when (org-export-derived-backend-p backend 'latex)
(org-element-map data 'headline
(lambda (object)
(when (member "ignoreltx" (org-element-property :tags object))
(let ((level-top (org-element-property :level object))
level-diff)
(mapc (lambda (el)
;; recursively promote all nested headlines
(org-element-map el 'headline
(lambda (el)
(when (equal 'headline (org-element-type el))
(unless level-diff
(setq level-diff (-
(org-element-property :level el)
level-top)))
(org-element-put-property
el
:level (- (org-element-property :level el)
level-diff)))))
;; insert back into parse tree
(org-element-insert-before el object))
(org-element-contents object)))
(org-element-extract-element object)))
info nil)
data))
(push '(ignore-latex-headlines
org-export-ignore-headlines-latex
org-export-filter-parse-tree-functions)
ox-extras)
(ox-extras-activate '(latex-header-blocks ignore-headlines
ignore-latex-headlines))
-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!
- Ignore, skip, omit headline when exporting to LaTeX,
edgar <=