From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Help with export filter? Date: Sat, 19 Jul 2014 08:53:08 -1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8ZlD-0006G5-9V for emacs-orgmode@gnu.org; Sat, 19 Jul 2014 14:53:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8Zl6-0000mP-89 for emacs-orgmode@gnu.org; Sat, 19 Jul 2014 14:53:31 -0400 Received: from gproxy8-pub.mail.unifiedlayer.com ([67.222.33.93]:42444) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1X8Zl5-0000mH-WC for emacs-orgmode@gnu.org; Sat, 19 Jul 2014 14:53:24 -0400 Received: from [98.155.255.145] (port=49901 helo=manifi) by box472.bluehost.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82) (envelope-from ) id 1X8Zkw-0001vF-22 for emacs-orgmode@gnu.org; Sat, 19 Jul 2014 12:53:14 -0600 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode Aloha all, Inspired by discussions and code on the mailing list, I managed to cobble together the headline filter below. It "works" in that the pdf output from LaTeX export is exactly what I want. I'm thrilled! It has one unwanted side effect. In the tex file, a headline tagged with either :newpage: or :clearpage: includes some extra baggage, like this: \newpage \section*{Introduction\hfill{}\textsc{}} \label{sec-5} I tried setting the option tags:nil, but then my export tags had no effect. Can someone suggest how I can avoid the \hfill etc.? Or, am I picking nits here? ***** Filter headline tags #+name: filter-headline-tags #+BEGIN_SRC emacs-lisp :results silent (defun tsd-filter-headline-tags (contents backend info) "Ignore headlines with tag `ignoreheading' and/or start LaTeX section with `newpage' or `clearpage' command." (cond ((and (org-export-derived-backend-p backend 'latex) (string-match "\\`.*newpage.*\n" (downcase contents)) (string-match "\\`.*ignoreheading.*\n" (downcase contents))) (replace-match "\\\\newpage\n" nil nil contents)) ((and (org-export-derived-backend-p backend 'latex) (string-match "\\`.*clearpage.*\n" (downcase contents)) (string-match "\\`.*ignoreheading.*\n" (downcase contents))) (replace-match "\\\\clearpage\n" nil nil contents)) ((and (org-export-derived-backend-p backend 'latex 'html 'ascii) (string-match "\\`.*ignoreheading.*\n" (downcase contents))) (replace-match "" nil nil contents)) ((and (org-export-derived-backend-p backend 'latex) (string-match "\\(\\`.*\\)newpage\\(.*\n\\)" (downcase contents))) (replace-match "\\\\newpage\n\\1\\2" nil nil contents)) ((and (org-export-derived-backend-p backend 'latex) (string-match "\\(\\`.*\\)clearpage\\(.*\n\\)" (downcase contents))) (replace-match "\\\\clearpage\n\\1\\2" nil nil contents)))) #+END_SRC All the best, Tom -- T.S. Dye & Colleagues, Archaeologists 735 Bishop St, Suite 315, Honolulu, HI 96813 Tel: 808-529-0866, Fax: 808-529-0884 http://www.tsdye.com