emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] double-O-LaTeX: retain meta-information during LaTeX Export
@ 2010-07-02 20:56 Eric Schulte
  2010-07-03  4:53 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Schulte @ 2010-07-02 20:56 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 861 bytes --]

Revoking org-latex's license to kill.

Hi,

I've noticed a sneaky bug when exporting to LaTeX.

Org-babel uses top-level #+BABEL: or #+PARAMETERS: lines to set global
values for header arguments.  When exporting to latex, the latex
exporter removes *all* meta-information header lines when exporting the
body [1].

Some Babel blocks rely on these lines and the header values they define
to control their behavior on export.  Does anyone know why these lines
are being removed?  I've experimented with the attached patch [2] in
which the LaTeX exporter *does not* remove these lines.  It fixes the
babel issues, and I haven't noticed any problems caused by leaving these
lines in (I think the lines are now being removed later in the export
process).

Thanks -- Eric

Footnotes: 
[1]  see `org-export-latex-first-lines' and `org-export-kill-licensed-text'

[2]  

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: revoke-org-latex-liscence-to-kill.patch --]
[-- Type: text/x-diff, Size: 1256 bytes --]

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index d725fc8..73a71b3 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1202,22 +1202,17 @@ If END is non-nil, it is the end of the region."
 	   (end (if (re-search-forward "^\\*+ " end t)
 		    (goto-char (match-beginning 0))
 		  (goto-char (or end (point-max))))))
-      (prog1
-	  (org-export-latex-content
-	   (org-export-preprocess-string
-	    (buffer-substring pt end)
-	    :for-LaTeX t
-	    :emph-multiline t
-	    :add-text nil
-	    :comments nil
-	    :skip-before-1st-heading nil
-	    :LaTeX-fragments nil
-	    :timestamps (plist-get opt-plist :timestamps)
-	    :footnotes (plist-get opt-plist :footnotes)))
-	(org-unmodified
-	 (let ((inhibit-read-only t))
-	   (add-text-properties pt (max pt (1- end))
-				'(:org-license-to-kill t))))))))
+      (org-export-latex-content
+       (org-export-preprocess-string
+	(buffer-substring pt end)
+	:for-LaTeX t
+	:emph-multiline t
+	:add-text nil
+	:comments nil
+	:skip-before-1st-heading nil
+	:LaTeX-fragments nil
+	:timestamps (plist-get opt-plist :timestamps)
+	:footnotes (plist-get opt-plist :footnotes))))))
 
 (defvar org-export-latex-header-defs nil
   "The header definitions that might be used in the LaTeX body.")

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [PATCH] double-O-LaTeX: retain meta-information during LaTeX Export
  2010-07-02 20:56 [PATCH] double-O-LaTeX: retain meta-information during LaTeX Export Eric Schulte
@ 2010-07-03  4:53 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-07-03  4:53 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode

Hi Eric,

no, you cannot remove this, unfortunately.  This is necessary code
in the case when the document title is taken from the document.

Try (with you patch) to export

-----------------------------------
#+OPTIONS: skip:nil

text before first
* Test


\begin{equation}
E=mc^2
\end{equation}
------------------------------------


It might work of you remove the license to kill from
only these special meta lines, but I have not tried.

- Carsten

On Jul 2, 2010, at 10:56 PM, Eric Schulte wrote:

> Revoking org-latex's license to kill.
>
> Hi,
>
> I've noticed a sneaky bug when exporting to LaTeX.
>
> Org-babel uses top-level #+BABEL: or #+PARAMETERS: lines to set global
> values for header arguments.  When exporting to latex, the latex
> exporter removes *all* meta-information header lines when exporting  
> the
> body [1].
>
> Some Babel blocks rely on these lines and the header values they  
> define
> to control their behavior on export.  Does anyone know why these lines
> are being removed?  I've experimented with the attached patch [2] in
> which the LaTeX exporter *does not* remove these lines.  It fixes the
> babel issues, and I haven't noticed any problems caused by leaving  
> these
> lines in (I think the lines are now being removed later in the export
> process).
>
> Thanks -- Eric
>
> Footnotes:
> [1]  see `org-export-latex-first-lines' and `org-export-kill- 
> licensed-text'
>
> [2]  diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index d725fc8..73a71b3 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1202,22 +1202,17 @@ If END is non-nil, it is the end of the  
> region."
> 	   (end (if (re-search-forward "^\\*+ " end t)
> 		    (goto-char (match-beginning 0))
> 		  (goto-char (or end (point-max))))))
> -      (prog1
> -	  (org-export-latex-content
> -	   (org-export-preprocess-string
> -	    (buffer-substring pt end)
> -	    :for-LaTeX t
> -	    :emph-multiline t
> -	    :add-text nil
> -	    :comments nil
> -	    :skip-before-1st-heading nil
> -	    :LaTeX-fragments nil
> -	    :timestamps (plist-get opt-plist :timestamps)
> -	    :footnotes (plist-get opt-plist :footnotes)))
> -	(org-unmodified
> -	 (let ((inhibit-read-only t))
> -	   (add-text-properties pt (max pt (1- end))
> -				'(:org-license-to-kill t))))))))
> +      (org-export-latex-content
> +       (org-export-preprocess-string
> +	(buffer-substring pt end)
> +	:for-LaTeX t
> +	:emph-multiline t
> +	:add-text nil
> +	:comments nil
> +	:skip-before-1st-heading nil
> +	:LaTeX-fragments nil
> +	:timestamps (plist-get opt-plist :timestamps)
> +	:footnotes (plist-get opt-plist :footnotes))))))
>
> (defvar org-export-latex-header-defs nil
>   "The header definitions that might be used in the LaTeX body.")
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-07-03  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-02 20:56 [PATCH] double-O-LaTeX: retain meta-information during LaTeX Export Eric Schulte
2010-07-03  4:53 ` Carsten Dominik

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