Question

I have an org-mode file that I'm trying to export to a Beamer LaTeX PDF through XeTeX. It was working fine last night on this machine, and just as well on another machine on which I edited it afterward. Both are running org-mode 8, Emacs 24, same export process (3 runs of XeLaTeX)

When I synced back to this machine and tried to export again, I got the error Wrong block type at a headline named "". I checked all my headlines and gave them all names, but still got the same result.

Thanks to the wonders of indexed searchable FLOSS code, I immediately found the snippet online:

(env-format
      (cond ((member environment '("column" "columns")) nil)
        ((assoc environment
            (append org-beamer-environments-extra
                org-beamer-environments-default)))
        (t (user-error "Wrong block type at a headline named \"%s\""
                   raw-title))))

I'm not really solid on elisp at all, though, and I don't know most of what's going on here. From this snippet, what would I do to start debugging? (I realize I can start the emacs debugger, but it's not a PKE meter, I can't just wave it around.)

Was it helpful?

Solution

IMHE the best way to figure out what's wrong when you've found the relevant snippet of code is to use Edebug.

You should read the documentation to learn more about it, but basically here is my procedure:

  1. identify the part of the code that crashes
  2. instrument the code with Edebug (C-uC-M-x)
  3. re-execute the code and go step by step to figure out what's going on (n)
  4. If the problem is in another function, jump to it GOTO 2.

Iterate until you've understood the code and find a way to fix it.


OTHER TIPS

Posting this answer just so that the specific solution to the particular problem the error was flagging is understood.

Apparently the version of Beamer I have on the other machine has a "normal" Beamer environment that specifies an otherwise blank, unformatted block. This is not present in this machine's install, or at least org/XeLaTeX don't know about it.

My steps were:

  1. Search for all unnamed headings
  2. Name each of them uniquely
  3. Reproduce the error with the identifying string
  4. Check the block type property against the available type list given in org-beamer-mode
  5. Remove the offending type and replace it with another one

This is great and all, but I don't think it's the "best answer" because it involves no actual understanding of what the emacs interpreter was trying to tell me. If I didn't have a good idea of what was going on generally with the TeX, there's no way it would have worked. Dunno if this technique would impress anybody at an interview ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top