emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Source block returns error before first headline


From: Thomas S. Dye
Subject: [O] Source block returns error before first headline
Date: Tue, 01 May 2012 06:56:47 -1000

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}\\
        address@hidden
\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}\\
        address@hidden
\and
\alignauthor
Lawrence P. Leipuner\titlenote{}\\
        \affaddr{Brookhaven Laboratories}\\
        \affaddr{Brookhaven National Lab}\\
        \affaddr{P.O. Box 5000}\\
        address@hidden
\alignauthor
Sean Fogarty\titlenote{}\\
        \affaddr{NASA Ames Research Center}\\
        \affaddr{Moffett Field}\\
        \affaddr{California 94035}\\
        address@hidden
\alignauthor
Charles Palmer\titlenote{}\\
        \affaddr{Palmer Research Laboratories}\\
        \affaddr{8600 Datapoint Drive}\\
        \affaddr{San Antonio, Texas 78229}\\
        address@hidden
\additionalauthors{Additional authors: John Smith (The Th{\o}rv{\"a}ld Group, 
email:
      address@hidden), Julius P. Kumquat (The Kumquat Consortium, email:
      address@hidden).}
#+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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]