On 4/4/20 7:30 AM, Eric S Fraga wrote:
On Friday,  3 Apr 2020 at 16:49, Charles Millar wrote:
org-latex-classes includes

"default-koma-letter" "\\documentclass[11pt]{scrlttr2}"

There are no other entries that include scrlttr2 in org-latex-classes

I have a barebones header

#+LATEX_CLASS: scrlttr2 (I also have tried 'default-koma-letter')

It should be default-koma-letter here.

To figure out what is wrong, you may wish to export to LaTeX first and
then have a look at what has been generated.

In any case, to use the letter style, I have the following in my org
customization:

   (require 'ox-koma-letter)

and then use the "k" option for the exporter (C-c C-e k) to export as a
letter.


OK, started over.

Please see attached backtrace and the file I used.

Also, in my init file I commented out my customized latex classes, just in case. See attached latex-classes file for the org-latex-classes.
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  format-spec(nil ((116 . #("Mis-shapen chaos of well-seeming forms!" 0 39 
(:parent (#("Mis-shapen chaos of well-seeming forms!" 0 39 (:parent #7)))))) 
(97 . #("Romeo" 0 5 (:parent (#("Romeo" 0 5 (:parent #8)))))) (116 . 
#("Mis-shapen chaos of well-seeming forms!" 0 39 (:parent (#("Mis-shapen chaos 
of well-seeming forms!" 0 39 (:parent #9)))))) (115 . "") (107 . "") (100 . "") 
(99 . "Emacs 28.0.50 (Org mode 9.3.6)") (108 . "english") (76 . "English") (68 
#("1580" 0 4 (:parent #13)))))
  (concat (if (and with-subject (not (eq with-subject t))) (progn (format 
"\\KOMAoption{subject}{%s}\n" (if (symbolp with-subject) with-subject 
(mapconcat #'symbol-name with-subject ","))))) (format-spec hyperref-template 
spec) "\\begin{document}\n\n" (if subject (progn (format 
"\\setkomavar{subject}{%s}\n" subject))) (if title (progn (format 
"\\setkomavar{title}{%s}\n" title))) (if (or (org-string-nw-p title) 
(org-string-nw-p subject)) (progn "\n")))
  (let* ((with-subject (plist-get info :with-subject)) (with-title (plist-get 
info :with-title)) (title-as-subject (and with-subject (plist-get info 
:with-title-as-subject))) (subject* (org-string-nw-p (org-export-data 
(plist-get info :subject) info))) (title* (and with-title (org-string-nw-p 
(org-export-data (plist-get info :title) info)))) (subject (cond ((not 
with-subject) nil) (title-as-subject (or subject* title*)) (t subject*))) 
(title (cond ((not with-title) nil) (title-as-subject (and subject* title*)) (t 
title*))) (hyperref-template (plist-get info :latex-hyperref-template)) (spec 
(append (list (cons 116 (or title subject ""))) (org-latex--format-spec 
info)))) (concat (if (and with-subject (not (eq with-subject t))) (progn 
(format "\\KOMAoption{subject}{%s}\n" (if (symbolp with-subject) with-subject 
(mapconcat #'symbol-name with-subject ","))))) (format-spec hyperref-template 
spec) "\\begin{document}\n\n" (if subject (progn (format 
"\\setkomavar{subject}{%s}\n" subject))) (if title (progn (format 
"\\setkomavar{title}{%s}\n" title))) (if (or (org-string-nw-p title) 
(org-string-nw-p subject)) (progn "\n"))))
  (concat (and (plist-get info :time-stamp-file) (format-time-string "%% 
Created %Y-%m-%d %a %H:%M\n")) (org-latex--insert-compiler info) 
(org-latex-make-preamble info) (org-koma-letter--build-settings 'global info) 
(mapconcat #'(lambda (file) (format "\\LoadLetterOption{%s}\n" file)) 
(split-string (or (plist-get info :lco) "")) "") 
(org-koma-letter--build-settings 'buffer info) (format "\\date{%s}\n" 
(org-export-data (org-export-get-date info) info)) (let* ((with-subject 
(plist-get info :with-subject)) (with-title (plist-get info :with-title)) 
(title-as-subject (and with-subject (plist-get info :with-title-as-subject))) 
(subject* (org-string-nw-p (org-export-data (plist-get info :subject) info))) 
(title* (and with-title (org-string-nw-p (org-export-data (plist-get info 
:title) info)))) (subject (cond ((not with-subject) nil) (title-as-subject (or 
subject* title*)) (t subject*))) (title (cond ((not with-title) nil) 
(title-as-subject (and subject* title*)) (t title*))) (hyperref-template 
(plist-get info :latex-hyperref-template)) (spec (append (list (cons 116 (or 
title subject ""))) (org-latex--format-spec info)))) (concat (if (and 
with-subject (not (eq with-subject t))) (progn (format 
"\\KOMAoption{subject}{%s}\n" (if (symbolp with-subject) with-subject 
(mapconcat ... with-subject ","))))) (format-spec hyperref-template spec) 
"\\begin{document}\n\n" (if subject (progn (format 
"\\setkomavar{subject}{%s}\n" subject))) (if title (progn (format 
"\\setkomavar{title}{%s}\n" title))) (if (or (org-string-nw-p title) 
(org-string-nw-p subject)) (progn "\n")))) (let ((keyword-val (plist-get info 
:to-address)) (heading-val (org-koma-letter--get-tagged-contents 'to))) (format 
"\\begin{letter}{%%\n%s}\n\n" (org-koma-letter--add-latex-newlines (or (if 
(plist-get info :special-headings) (or heading-val keyword-val) (or keyword-val 
heading-val)) "\\mbox{}")))) (format "\\opening{%s}\n\n" 
(org-koma-letter--keyword-or-headline :opening #'(lambda (h i) (not 
(org-koma-letter--special-tag h i))) info)) contents (format "\\closing{%s}\n" 
(org-koma-letter--keyword-or-headline :closing #'(lambda (h i) (let 
((special-tag ...)) (and special-tag (string= "closing" special-tag)))) info)) 
(org-koma-letter--special-contents-inline (plist-get info 
:special-tags-after-closing) info) "\n\\end{letter}\n" 
(org-koma-letter--special-contents-inline (plist-get info 
:special-tags-after-letter) info) "\n\\end{document}")
  org-koma-letter-template(#("\n\n\n\\begin{verse}\nThen plai..." 17 62 
(:parent (verse-block ... ...)) 65 102 (:parent (verse-block ... ...)) 105 145 
(:parent (verse-block ... ...)) 148 193 (:parent (verse-block ... ...)) 196 238 
(:parent (verse-block ... ...)) 241 284 (:parent (verse-block ... ...)) 287 330 
(:parent (verse-block ... ...)) 333 370 (:parent (verse-block ... ...)) ...) 
(:export-options nil :back-end #s(org-export-backend :name koma-letter :parent 
latex :transcoders (... ... ... ... ...) :options (... ... ... ... ... ... ... 
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 
...) :filters nil :blocks nil :menu (107 "Export with KOMA Scrlttr2" ...)) 
:translate-alist ((export-block . org-koma-letter-export-block) (export-snippet 
. org-koma-letter-export-snippet) (headline . org-koma-letter-headline) 
(keyword . org-koma-letter-keyword) (template . org-koma-letter-template) (bold 
. org-latex-bold) (center-block . org-latex-center-block) (clock . 
org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) 
(dynamic-block . org-latex-dynamic-block) (entity . org-latex-entity) 
(example-block . org-latex-example-block) (export-block . 
org-latex-export-block) (export-snippet . org-latex-export-snippet) 
(fixed-width . org-latex-fixed-width) (footnote-definition . 
org-latex-footnote-definition) (footnote-reference . 
org-latex-footnote-reference) (headline . org-latex-headline) (horizontal-rule 
. org-latex-horizontal-rule) (inline-src-block . org-latex-inline-src-block) 
(inlinetask . org-latex-inlinetask) (italic . org-latex-italic) (item . 
org-latex-item) (keyword . org-latex-keyword) (latex-environment . 
org-latex-latex-environment) ...) :exported-data #<hash-table eq 61/4001 
0x155cb7abc4b9> :input-buffer "LearnKomaLetter.org" :input-file 
"/mnt/Data/ActiveFiles/Lear..." :latex-class "default-koma-letter" :lco 
"DINmtext" :author (#("Romeo" 0 5 ...)) :author-changed-in-buffer-p "Romeo" 
:from-address "" :phone-number "" :url "" ...))
  org-export-as(koma-letter nil nil nil (:output-file "LearnKomaLetter.tex"))
  org-export-to-file(koma-letter "LearnKomaLetter.tex" nil nil nil nil nil 
(lambda (file) (org-latex-compile file)))
  (let ((file (org-export-output-file-name ".tex" subtreep)) 
(org-koma-letter-special-contents)) (org-export-to-file 'koma-letter file async 
subtreep visible-only body-only ext-plist #'(lambda (file) (org-latex-compile 
file))))
  org-koma-letter-export-to-pdf(nil nil nil nil)
  (org-open-file (org-koma-letter-export-to-pdf nil s v b))
  (if a (org-koma-letter-export-to-pdf t s v b) (org-open-file 
(org-koma-letter-export-to-pdf nil s v b)))
  (lambda (a s v b) (if a (org-koma-letter-export-to-pdf t s v b) 
(org-open-file (org-koma-letter-export-to-pdf nil s v b))))(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)
#+LATEX_CLASS: default-koma-letter

* Preamble                                                         :noexport:
#+TITLE:  Mis-shapen chaos of well-seeming forms!
#+SUBJECT: Or: org-mode and KOMA-Script letters
#+DATE: 1580

#+AUTHOR: Romeo
#+PLACE: Verona, Italy

#+LCO: DINmtext
# NOTE: Check the KOMA-Script manual to find a LCO that fits the
#       envelope standards of your country.

# NOTE: Change the order of the backletter, use smart quotes and
#       include backaddress
#+OPTIONS: after-closing-order:(my_after_signature ps cc encl)
#+options: ':t backaddress:t subject:centered

# Remove the first header
#+LATEX_HEADER: \setkomavar{firsthead}{}

* To-address of the lovely Juliet                                        :to:
# NOTE: Explicit newlines are not necessary in TO and FROM
Juliet
House of Capulet
Verona

* From                                                                 :from:
House of Montague
Verona
* Location                                                         :location:
#+LATEX_HEADER: \usepackage{tikz}
#+BEGIN_CENTER
*Montague*
#+BEGIN_EXPORT latex
\tikz \draw (0,0) --+ (0,-1)
       arc [radius=1, start angle=-180, end angle=0]
       --+ (0,1) -- cycle
       node [below=1.5em,midway] {\bfseries M};
#+END_EXPORT
#+END_CENTER

* Dear Juliet,
# NOTE: Your letter is the first non-special heading.  The title of
# this heading may used as an opening.

#+BEGIN_VERSE
Then plainly know my heart's dear love is set
On the fair daughter of rich Capulet:
As mine on hers, so hers is set on mine;
And all combin'd, save what thou must combine
By holy marriage: when, and where, and how
We met, we woo'd, and made exchange of vow,
I'll tell thee as we pass; but this I pray,
That thou consent to marry us to-day.
#+END_VERSE

* Yours truly,                                                      :closing:
Romeo of House Montague
* some arbitrary LaTeX code                              :my_after_signature:
#+BEGIN_EXPORT latex
% this special heading was added dynamically.
#+END_EXPORT
* PS                                                                     :ps:
PS: "PS" is not typeset automatically by KOMA-Script

@@latex:\noindent@@ PPS: This is a feature!
* CC                                                                     :cc:
Paris and Lawrence.
* ENCL                                                                 :encl:
See also [[https://en.wikisource.org/wiki/The_Tragedy_of_Romeo_and_Juliet][The 
Tragedy of Romeo and Juliet]]
* some more arbitrary LaTeX code                               :after_letter:
#+BEGIN_EXPORT latex
% here we can place random LaTeX code, e.g. including PDFs via the pdfpages 
package.
#+END_EXPORT
Value:
(("default-koma-letter" "\\documentclass[11pt]{scrlttr2}")
 ("article" "\\documentclass[11pt]{article}"
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
  ("\\paragraph{%s}" . "\\paragraph*{%s}")
  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("report" "\\documentclass[11pt]{report}"
  ("\\part{%s}" . "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{book}"
  ("\\part{%s}" . "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
Original value was 
(("article" "\\documentclass[11pt]{article}"
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
  ("\\paragraph{%s}" . "\\paragraph*{%s}")
  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("report" "\\documentclass[11pt]{report}"
  ("\\part{%s}" . "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{book}"
  ("\\part{%s}" . "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))

Reply via email to