From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Source block returns error before first headline Date: Tue, 01 May 2012 06:56:47 -1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPGNm-0004hK-QQ for emacs-orgmode@gnu.org; Tue, 01 May 2012 12:57:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPGNk-0007g5-FO for emacs-orgmode@gnu.org; Tue, 01 May 2012 12:56:58 -0400 Received: from oproxy1-pub.bluehost.com ([66.147.249.253]:45141) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SPGNk-0007ff-5X for emacs-orgmode@gnu.org; Tue, 01 May 2012 12:56:56 -0400 Received: from cpe-24-94-66-191.hawaii.res.rr.com ([24.94.66.191] helo=poto) by box472.bluehost.com with esmtpa (Exim 4.76) (envelope-from ) id 1SPGNe-0001rf-QD for emacs-orgmode@gnu.org; Tue, 01 May 2012 10:56:51 -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, I have a source code block that returns LaTeX results that should be placed before the first headline. The source block works correctly *if* if is placed after a headline, but if I place it before the headline it fails with Invalid read syntax: "#" I'm enclosing an excerpt, but will work up an ECM if this is necessary. All the best, Tom ---Excerpt ---- * Shouldn't need this heading #+BEGIN_LaTeX \title{A Sample {\ttlit ACM} SIG Proceedings Paper in Org-mode Format\titlenote{(Does NOT produce the permission block, copyright information nor page numbering). For use with ACM\_PROC\_ARTICLE-SP.CLS. Supported by ACM.}} \subtitle{[Extended Abstract] \titlenote{A full version of this paper is available as \textit{Author's Guide to Preparing ACM SIG Proceedings Using \LaTeX$2_\epsilon$\ and BibTeX} at \texttt{www.acm.org/eaddress.htm}}} #+END_LaTeX # Note that add-author-record isn't fully correct. It formats a comma # separated list, when it should return a list with the final element # separated by "and". #+name: author-list #+header: :var authors=authorlist #+header: :var add-authors=additional-authors #+header: :results latex #+header: :exports results #+BEGIN_SRC emacs-lisp (defun author-record (r) (if (> (length (first r)) 0) (format "\\alignauthor\n%s\\titlenote{%s}\\\\ \\affaddr{%s}\\\\ \\affaddr{%s}\\\\ \\affaddr{%s}\\\\ \\email{%s}" (first r) (second r) (third r) (fourth r) (fifth r) (sixth r)) "\\and") ) (defun non-empty (list) (let ( (i 0)) (mapcar #'(lambda (elem) (if (> (length (first elem)) 0) (incf i))) list) i) ) (defun add-author-record (r) (format "%s (%s, email: {\\texttt{%s}})" (first r) (second r) (third r))) (let ( (i (+ (non-empty (setcdr authors (cdr (cdr authors)))) (- (length add-authors) 2) )) (a (mapcar (lambda (row) (author-record row)) (setcdr authors (cdr (cdr authors))))) (b (mapcar (lambda (row) (add-author-record row)) (setcdr add-authors (cdr (cdr add-authors))))) ) (concat (format "\\numberofauthors{%s}\n\\author{\n" i) (mapconcat 'identity a "\n") "}" (if (> (length add-authors) 0) (concat "\n\\additionalauthors{Additional authors: " (mapconcat 'identity b ", ") ".}") ()))) #+END_SRC #+RESULTS: author-list #+BEGIN_LaTeX \numberofauthors{8} \author{ \alignauthor G.K.M. Tobin\titlenote{The secretary disavows any knowledge of this author's actions.}\\ \affaddr{Institute for Clarity in Documentation}\\ \affaddr{P.O. Box 1212}\\ \affaddr{Dublin, Ohio 43017-6221}\\ \email{webmaster@marysville-ohio.com} \alignauthor Lars Th{\o}rv{\"a}ld\titlenote{This author is the one who did all the really hard work.}\\ \affaddr{The Th{\o}rv{\"a}ld Group}\\ \affaddr{1 Th{\o}rv{\"a}ld Circle}\\ \affaddr{Hekla, Iceland}\\ \email{larst@affiliation.org} \and \alignauthor Lawrence P. Leipuner\titlenote{}\\ \affaddr{Brookhaven Laboratories}\\ \affaddr{Brookhaven National Lab}\\ \affaddr{P.O. Box 5000}\\ \email{lleipuner@reasearchlabs.org} \alignauthor Sean Fogarty\titlenote{}\\ \affaddr{NASA Ames Research Center}\\ \affaddr{Moffett Field}\\ \affaddr{California 94035}\\ \email{fogarty@amesres.org} \alignauthor Charles Palmer\titlenote{}\\ \affaddr{Palmer Research Laboratories}\\ \affaddr{8600 Datapoint Drive}\\ \affaddr{San Antonio, Texas 78229}\\ \email{cpalmer@prl.com}} \additionalauthors{Additional authors: John Smith (The Th{\o}rv{\"a}ld Group, email: {\texttt{jsmith@affiliation.org}}), Julius P. Kumquat (The Kumquat Consortium, email: {\texttt{jpkumquat@consortium}}).} #+END_LaTeX \maketitle #+BEGIN_abstract This paper provides a sample of a LaTeX document which resembles the style of original ACM LaTeX template ``Option 1: LaTeX2e - Strict Adherence to SIGS style''. The focus on this template is the usage with Emacs Org-mode. Therefore the content is reduced to a minimum. #+END_abstract -- Thomas S. Dye http://www.tsdye.com