emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* New LaTeX exporter and source code blocks
@ 2012-05-05 19:53 Thomas S. Dye
  2012-05-05 20:58 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas S. Dye @ 2012-05-05 19:53 UTC (permalink / raw)
  To: Org-mode

Aloha,

The new LaTeX exporter doesn't properly handle source code blocks with
:exports results.  The following snippet exports correctly with the old
exporter. 

---- Org-mode source ----
#+name: ACM-categories
#+header: :var c=categories
#+header: :results latex 
#+header: :exports results
#+BEGIN_SRC emacs-lisp
  (defun category-record (r)
    (format "\\category{%s}{%s}{%s}[%s]" 
            (first r) (second r) (third r) (fourth r)))
  (let ( (i (mapcar (lambda (row)
            (category-record row))
          (cdr (cdr c)))))
     (mapconcat 'identity i "\n")
)
#+END_SRC

#+RESULTS: ACM-categories
#+BEGIN_LaTeX
\category{H.4}{Information Systems Applications}{Miscellaneous}[]
\category{D.2.8}{Software Engineering}{Metrics}[complexity measures, performance measures]
#+END_LaTeX
-------------------------

---- LaTeX output ----
\#+name: ACM-categories
\#+header: :var c=categories
\#+header: :results latex 
\#+header: :exports results
----------------------

Also, the new exporter seems to skip over #+BEGIN_LaTeX ... #+END_LaTeX
blocks.

---- Org-mode source ----
#+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
-------------------------

---- LaTeX output ----

----------------------

This is with the master branch pulled earlier today running on Emacs
23.4.  My initialization file is at the bottom.

Let me know if I can provide more information.

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

#+name: initialize-new-exporter
#+header: :tangle init-new.el
#+header: :results silent
#+header: :exports none
#+begin_src emacs-lisp 
  (add-to-list 'load-path "~/.emacs.d/src/org/contrib/lisp") ;; <- adjust
  (add-to-list 'load-path "~/.emacs.d/src/org/lisp") ;; <- adjust
  (add-to-list 'load-path "~/.emacs.d/src/org") ;; <- adjust
  
  (require 'org-install)
  (require 'org-export)
  (require 'org-e-latex)
  
  ;; this line only required until the upcomming Org-mode/Emacs24 sync
  (load "~/.emacs.d/src/org/lisp/org-exp-blocks.el")
  
  
  ;; Configure Babel to support all languages included in the manuscript
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((emacs-lisp . t)
     (org        . t)))
  (setq org-confirm-babel-evaluate nil)
  
  ;; Configure Org-mode
    (setq org-export-latex-hyperref-format "\\ref{%s}")
    (setq org-entities-user nil) 
    (add-to-list 'org-entities-user '("space" "\\ " nil " " " " " " " "))
    (setq org-e-latex-pdf-process '("texi2dvi --clean --verbose --batch %f"))
    (setq org-export-latex-packages-alist nil)
    (add-to-list 'org-export-latex-packages-alist '("" "hyperref"))
    (add-to-list 'org-export-latex-packages-alist '("" "graphicx"))

    (require 'org-special-blocks)
  
  (org-add-link-type 
     "cite" nil
     (lambda (path desc format)
       (cond
        ((eq format 'latex)
               (format "\\cite{%s}" path)))))
  
  (org-add-link-type 
     "acm" nil
     (lambda (path desc format)
       (cond
        ((eq format 'latex)
               (format "{\\%s{%s}}" path desc)))))
  
  (add-to-list 'org-e-latex-classes
                 '("acm-proc-article-sp"
                   "\\documentclass{acm_proc_article-sp}
                [NO-DEFAULT-PACKAGES]
                [PACKAGES]
                [EXTRA]"
                   ("\\section{%s}" . "\\section*{%s}")
                   ("\\subsection{%s}" . "\\subsection*{%s}")
                   ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                   ("\\paragraph{%s}" . "\\paragraph*{%s}")
                   ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
#+end_src

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-05 19:53 New LaTeX exporter and source code blocks Thomas S. Dye
@ 2012-05-05 20:58 ` Nicolas Goaziou
  2012-05-05 21:32   ` Thomas S. Dye
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2012-05-05 20:58 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

tsd@tsdye.com (Thomas S. Dye) writes:

> The new LaTeX exporter doesn't properly handle source code blocks with
> :exports results.  The following snippet exports correctly with the old
> exporter. 
>
> ---- Org-mode source ----
> #+name: ACM-categories
> #+header: :var c=categories
> #+header: :results latex 
> #+header: :exports results
> #+BEGIN_SRC emacs-lisp
>   (defun category-record (r)
>     (format "\\category{%s}{%s}{%s}[%s]" 
>             (first r) (second r) (third r) (fourth r)))
>   (let ( (i (mapcar (lambda (row)
>             (category-record row))
>           (cdr (cdr c)))))
>      (mapconcat 'identity i "\n")
> )
> #+END_SRC
> #+RESULTS: ACM-categories
> #+BEGIN_LaTeX
> \category{H.4}{Information Systems Applications}{Miscellaneous}[]
> \category{D.2.8}{Software Engineering}{Metrics}[complexity measures, performance measures]
> #+END_LaTeX
> -------------------------
>
> ---- LaTeX output ----
> \#+name: ACM-categories
> \#+header: :var c=categories
> \#+header: :results latex 
> \#+header: :exports results
> ----------------------

This is a known bug: affiliated keywords are left over if the block
disappears. It will be solved once org-element.el is merged into master
(see commit dec32064a72be7a20bbddcc1f8544a604619ad7b).

> Also, the new exporter seems to skip over #+BEGIN_LaTeX ... #+END_LaTeX
> blocks.

This is now fixed. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-05 20:58 ` Nicolas Goaziou
@ 2012-05-05 21:32   ` Thomas S. Dye
  2012-05-05 21:37     ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas S. Dye @ 2012-05-05 21:32 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> The new LaTeX exporter doesn't properly handle source code blocks with
>> :exports results.  The following snippet exports correctly with the old
>> exporter. 
>>
>> ---- Org-mode source ----
>> #+name: ACM-categories
>> #+header: :var c=categories
>> #+header: :results latex 
>> #+header: :exports results
>> #+BEGIN_SRC emacs-lisp
>>   (defun category-record (r)
>>     (format "\\category{%s}{%s}{%s}[%s]" 
>>             (first r) (second r) (third r) (fourth r)))
>>   (let ( (i (mapcar (lambda (row)
>>             (category-record row))
>>           (cdr (cdr c)))))
>>      (mapconcat 'identity i "\n")
>> )
>> #+END_SRC
>> #+RESULTS: ACM-categories
>> #+BEGIN_LaTeX
>> \category{H.4}{Information Systems Applications}{Miscellaneous}[]
>> \category{D.2.8}{Software Engineering}{Metrics}[complexity measures, performance measures]
>> #+END_LaTeX
>> -------------------------
>>
>> ---- LaTeX output ----
>> \#+name: ACM-categories
>> \#+header: :var c=categories
>> \#+header: :results latex 
>> \#+header: :exports results
>> ----------------------
>
> This is a known bug: affiliated keywords are left over if the block
> disappears. It will be solved once org-element.el is merged into master
> (see commit dec32064a72be7a20bbddcc1f8544a604619ad7b).
>
Great.  Looking forward to the merge.

>> Also, the new exporter seems to skip over #+BEGIN_LaTeX ... #+END_LaTeX
>> blocks.
>
> This is now fixed. Thank you.

Yes, LaTeX blocks are now exported.  Thanks.

Here is a problem with CAPTION and ATTR_LaTeX lines.  Note that the
\table{} environment wasn't established.

---- Org-mode ----
#+CAPTION: Frequency of Special Characters
#+ATTR_LaTeX: align=|c|c|l|

|---------------------+-------------+-------------------|
| Non-English or Math | Frequency   | Comments          |
|---------------------+-------------+-------------------|
| \O                  | 1 in 1,000  | For Swedish names |
|---------------------+-------------+-------------------|
| $\pi$               | 1 in 5      | Common in math    |
|---------------------+-------------+-------------------|
| \$                  | 4 in 5      | Used in business  |
|---------------------+-------------+-------------------|
| $\Psi^2_1$          | 1 in 40,000 | Unexplained usage |
|---------------------+-------------+-------------------|
------------------

---- LaTeX export ----
\#+CAPTION: Some Typical Commands
\#+ATTR$_{\mathrm{\LaTeX{}}}$: table* align=|c|c|l|

\begin{center}
\begin{tabular}{}
\hline
Command & A Number & Comments\\
\hline
\texttt{\textbackslash{}alignauthor} & 100 & Author alignment\\
\hline
\texttt{\textbackslash{}numberofauthors} & 200 & Author enumeration\\
\hline
\texttt{\textbackslash{}table} & 300 & For tables\\
\hline
\texttt{\textbackslash{}table*} & 400 & For wider tables\\
\hline
\end{tabular}
\end{center}
----------------------

When #+CAPTION: is used with figures the \figure{} environment isn't
established.

---- Org-mode ----
#+CAPTION: A sample black and white graphic (.eps format).

[[file:fly.eps]]
------------------

---- LaTeX export ----
\#+CAPTION: A sample black and white graphic (.eps format).

\includegraphics[width=.9\linewidth]{fly.eps}
----------------------

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-05 21:32   ` Thomas S. Dye
@ 2012-05-05 21:37     ` Nicolas Goaziou
  2012-05-05 22:55       ` Thomas S. Dye
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2012-05-05 21:37 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

tsd@tsdye.com (Thomas S. Dye) writes:

> Here is a problem with CAPTION and ATTR_LaTeX lines.  Note that the
> \table{} environment wasn't established.
>
> ---- Org-mode ----
> #+CAPTION: Frequency of Special Characters
> #+ATTR_LaTeX: align=|c|c|l|
>
> |---------------------+-------------+-------------------|
> | Non-English or Math | Frequency   | Comments          |
> |---------------------+-------------+-------------------|
> | \O                  | 1 in 1,000  | For Swedish names |
> |---------------------+-------------+-------------------|
> | $\pi$               | 1 in 5      | Common in math    |
> |---------------------+-------------+-------------------|
> | \$                  | 4 in 5      | Used in business  |
> |---------------------+-------------+-------------------|
> | $\Psi^2_1$          | 1 in 40,000 | Unexplained usage |
> |---------------------+-------------+-------------------|
> ------------------

Affiliated keywords (#+name:, #+caption:, #+attr_...) are expected to be
right before their corresponding element. The blank line you introduced
is wrong. Remove and it should export fine.

> When #+CAPTION: is used with figures the \figure{} environment isn't
> established.
>
> ---- Org-mode ----
> #+CAPTION: A sample black and white graphic (.eps format).
>
> [[file:fly.eps]]
> ------------------

Ditto.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-05 21:37     ` Nicolas Goaziou
@ 2012-05-05 22:55       ` Thomas S. Dye
  2012-05-06  6:31         ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas S. Dye @ 2012-05-05 22:55 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> Here is a problem with CAPTION and ATTR_LaTeX lines.  Note that the
>> \table{} environment wasn't established.
>>
>> ---- Org-mode ----
>> #+CAPTION: Frequency of Special Characters
>> #+ATTR_LaTeX: align=|c|c|l|
>>
>> |---------------------+-------------+-------------------|
>> | Non-English or Math | Frequency   | Comments          |
>> |---------------------+-------------+-------------------|
>> | \O                  | 1 in 1,000  | For Swedish names |
>> |---------------------+-------------+-------------------|
>> | $\pi$               | 1 in 5      | Common in math    |
>> |---------------------+-------------+-------------------|
>> | \$                  | 4 in 5      | Used in business  |
>> |---------------------+-------------+-------------------|
>> | $\Psi^2_1$          | 1 in 40,000 | Unexplained usage |
>> |---------------------+-------------+-------------------|
>> ------------------
>
> Affiliated keywords (#+name:, #+caption:, #+attr_...) are expected to be
> right before their corresponding element. The blank line you introduced
> is wrong. Remove and it should export fine.
Yes, it does.  Thanks.

I can't get a \begin{figure*} environment with multicolumn.

---- Org-mode ----
#+CAPTION: A sample black and white graphic (.eps format) that needs to span two columns of text.
#+ATTR_LaTeX: multicolumn
[[file:flies.eps]]
------------------

---- LaTeX export ----
\includegraphics[width=.9\linewidth]{flies.eps}
----------------------

All the best,
Tom

>
>> When #+CAPTION: is used with figures the \figure{} environment isn't
>> established.
>>
>> ---- Org-mode ----
>> #+CAPTION: A sample black and white graphic (.eps format).
>>
>> [[file:fly.eps]]
>> ------------------
>
> Ditto.
>
>
> Regards,

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-05 22:55       ` Thomas S. Dye
@ 2012-05-06  6:31         ` Nicolas Goaziou
  2012-05-06 17:53           ` Thomas S. Dye
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2012-05-06  6:31 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

Hello,

tsd@tsdye.com (Thomas S. Dye) writes:

> I can't get a \begin{figure*} environment with multicolumn.
>
> ---- Org-mode ----
> #+CAPTION: A sample black and white graphic (.eps format) that needs to span two columns of text.
> #+ATTR_LaTeX: multicolumn
> [[file:flies.eps]]
> ------------------

Indeed. This is fixed now. Thank you for your reports !


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-06  6:31         ` Nicolas Goaziou
@ 2012-05-06 17:53           ` Thomas S. Dye
  2012-05-06 18:17             ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas S. Dye @ 2012-05-06 17:53 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> I can't get a \begin{figure*} environment with multicolumn.
>>
>> ---- Org-mode ----
>> #+CAPTION: A sample black and white graphic (.eps format) that needs to span two columns of text.
>> #+ATTR_LaTeX: multicolumn
>> [[file:flies.eps]]
>> ------------------
>
> Indeed. This is fixed now. Thank you for your reports !

Yes, it is fixed now.  Thanks for all your help.

The new exporter does a nice job with the ACM-SIG template at
http://github.com/tsdye/orgmode-ACM-template.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: New LaTeX exporter and source code blocks
  2012-05-06 17:53           ` Thomas S. Dye
@ 2012-05-06 18:17             ` Nicolas Goaziou
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2012-05-06 18:17 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

tsd@tsdye.com (Thomas S. Dye) writes:

> The new exporter does a nice job with the ACM-SIG template at
> http://github.com/tsdye/orgmode-ACM-template.

Nice. 

I will merge some changes to the export engine during the next week,
then I'll try to send to the ML a little summary on the various ways to
control the output.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-05-06 18:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-05 19:53 New LaTeX exporter and source code blocks Thomas S. Dye
2012-05-05 20:58 ` Nicolas Goaziou
2012-05-05 21:32   ` Thomas S. Dye
2012-05-05 21:37     ` Nicolas Goaziou
2012-05-05 22:55       ` Thomas S. Dye
2012-05-06  6:31         ` Nicolas Goaziou
2012-05-06 17:53           ` Thomas S. Dye
2012-05-06 18:17             ` Nicolas Goaziou

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).