emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Source block returns error before first headline
Date: Tue, 01 May 2012 06:56:47 -1000	[thread overview]
Message-ID: <m18vhbet68.fsf@tsdye.com> (raw)

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

                 reply	other threads:[~2012-05-01 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m18vhbet68.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).