emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Fwd: Small improvment of emacs-org mode concerning LaTeX-export
       [not found] <201011151658.17329.juergen.vollmer@informatik-vollmer.de>
@ 2010-11-16  9:28 ` Carsten Dominik
  2010-11-16 11:21   ` Stefan Vollmar
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2010-11-16  9:28 UTC (permalink / raw)
  To: emacs-orgmode Mode

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

Dear LaTeX hackers,

here is an interesting patch from Stefan Vollmer.
It attempts to automatically set the right language for
the babel style in LaTeX export (so this has nothing to
do with org-babel).  It looks good to me on a quick
glance, but can I ask some of you to take a closer
look, and test it?

Thanks!

- Carsten

Begin forwarded message:

> From: "Dr. Juergen Vollmer" <juergen.vollmer@informatik-vollmer.de>
> Date: November 15, 2010 4:58:01 PM GMT+01:00
> To: Carsten Dominik <carsten@orgmode.org>
> Subject: Small improvment of emacs-org mode concerning LaTeX-export
>
> Dear Carsten,
>
> please find enclodes a small improvment of your emacs org-mode.
>
> I added LaTeX's babel environment to use internationalized words  
> liek "Inhaltsverzeichnis" instead
> of "Table of content".
> The used language is derived frorm the (HTML)-LANGUGE variable which  
> the mapped to babel's options.
> Futhermore I added a new custom-variable to select the latex  
> inputenc-option.
>
> As base I used
> 	Org-mode version 7.3 (release_7.3.67.g0adc.dirty)
> which i cloned using your git-repository.
>
> With best regards
> Jürgen
>
> PS: I'm not a very skilled emacs-lisp hacker, but I hope my changes  
> are ok
>
> -- 
> Dr.rer.nat. Juergen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe
> Tel: +49(721) 92 04 87 1 Fax: +49(721) 92 04 87 2
> Juergen.Vollmer@informatik-vollmer.de
> www.informatik-vollmer.de
> Internet-Telefonie: www.skype.com Benutzer: juergen.vollmer
> -------------------------------------------------------------------------------
> Diese EMail ist elektronisch mittels GPG / PGP signiert.
> Diese elektronische Unterschrift ist in einem EMail-Anhang enthalten.
> Leider kann die Signatur ohne die Installation entsprechender  
> Programme
> weder geprüft noch angezeigt werden.
> Mehr dazu unter: http://www.gnupg.org oder auch http://www.pgpi.org
> -------------------------------------------------------------------------------

[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 11166 bytes --]

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 2affcba..83115c3 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -165,38 +165,39 @@ This option can also be set with the +OPTIONS line, e.g. \"-:nil\"."
   :type '(string :tag "File or URL"))
 
 (defcustom org-export-language-setup
-  '(("en" "Author"     "Date"  "Table of Contents" "Footnotes")
-    ("ca"  "Autor"      "Data" "&Iacute;ndex" "Peus de p&agrave;gina")
-    ("cs" "Autor"      "Datum" "Obsah" "Pozn\xe1mky pod carou")
-    ("da" "Ophavsmand" "Dato"  "Indhold" "Fodnoter")
-    ("de" "Autor"      "Datum" "Inhaltsverzeichnis" "Fu&szlig;noten")
-    ("eo"  "A&#365;toro"      "Dato" "Enhavo" "Piednotoj")
-    ("es" "Autor"      "Fecha" "&Iacute;ndice" "Pies de p&aacute;gina")
-    ("fi" "Tekij&auml;"     "P&auml;iv&auml;m&auml;&auml;r&auml;"   "Sis&auml;llysluettelo"  "Alaviitteet")
-    ("fr" "Auteur"     "Date"  "Table des mati&egrave;res" "Notes de bas de page")
-    ("hu" "Szerz&otilde;" "D&aacute;tum" "Tartalomjegyz&eacute;k" "L&aacute;bjegyzet")
-    ("is" "H&ouml;fundur" "Dagsetning" "Efnisyfirlit" "Aftanm&aacute;lsgreinar")
-    ("it" "Autore"     "Data"  "Indice" "Note a pi&egrave; di pagina")
-    ("nl" "Auteur"     "Datum" "Inhoudsopgave" "Voetnoten")
-    ("no" "Forfatter"  "Dato"  "Innhold" "Fotnoter")
-    ("nb" "Forfatter"  "Dato"  "Innhold" "Fotnoter")  ;; nb = Norsk (bokm.l)
-    ("nn" "Forfattar"  "Dato"  "Innhald" "Fotnotar")  ;; nn = Norsk (nynorsk)
-    ("pl" "Autor"      "Data" "Spis tre&#x015b;ci"  "Przypis")
-    ("sv" "F&ouml;rfattare" "Datum" "Inneh&aring;ll" "Fotnoter"))
+  '(("en" "Author"     "Date"  "Table of Contents" "Footnotes" "english")
+    ("ca" "Autor"      "Data" "&Iacute;ndex" "Peus de p&agrave;gina" "canadien")
+    ("cs" "Autor"      "Datum" "Obsah" "Pozn\xe1mky pod carou" "czech")
+    ("da" "Ophavsmand" "Dato"  "Indhold" "Fodnoter" "danish")
+    ("de" "Autor"      "Datum" "Inhaltsverzeichnis" "Fu&szlig;noten" "ngerman")
+    ("eo"  "A&#365;toro"      "Dato" "Enhavo" "Piednotoj" "esperanto")
+    ("es" "Autor"      "Fecha" "&Iacute;ndice" "Pies de p&aacute;gina" "spanish")
+    ("fi" "Tekij&auml;"     "P&auml;iv&auml;m&auml;&auml;r&auml;"   "Sis&auml;llysluettelo"  "Alaviitteet" "finnish")
+    ("fr" "Auteur"     "Date"  "Table des mati&egrave;res" "Notes de bas de page"  "francais")
+    ("hu" "Szerz&otilde;" "D&aacute;tum" "Tartalomjegyz&eacute;k" "L&aacute;bjegyzet" "magyar")
+    ("is" "H&ouml;fundur" "Dagsetning" "Efnisyfirlit" "Aftanm&aacute;lsgreinar" "icelandic")
+    ("it" "Autore"     "Data"  "Indice" "Note a pi&egrave; di pagina" "italian")
+    ("nl" "Auteur"     "Datum" "Inhoudsopgave" "Voetnoten" "dutch")
+    ("no" "Forfatter"  "Dato"  "Innhold" "Fotnoter" "norsk")
+    ("nb" "Forfatter"  "Dato"  "Innhold" "Fotnoter" "norsk")  ;; nb = Norsk (bokm.l)
+    ("nn" "Forfattar"  "Dato"  "Innhald" "Fotnotar" "nynorsk")  ;; nn = Norsk (nynorsk)
+    ("pl" "Autor"      "Data" "Spis tre&#x015b;ci"  "Przypis" "polish")
+    ("sv" "F&ouml;rfattare" "Datum" "Inneh&aring;ll" "Fotnoter" "english"))
   "Terms used in export text, translated to different languages.
 Use the variable `org-export-default-language' to set the language,
 or use the +OPTION lines for a per-file setting."
   :group 'org-export-general
   :type '(repeat
 	  (list
-	   (string :tag "HTML language tag")
+	   (string :tag "HTML and LaTeX language tag")
 	   (string :tag "Author")
 	   (string :tag "Date")
 	   (string :tag "Table of Contents")
-	   (string :tag "Footnotes"))))
+	   (string :tag "Footnotes")
+	   (string :tag "LaTeX's babel language option"))))
 
 (defcustom org-export-default-language "en"
-  "The default language of HTML export, as a string.
+  "The default language of HTML and LaTeX export, as a string.
 This should have an association in `org-export-language-setup'."
   :group 'org-export-general
   :type 'string)
@@ -1204,7 +1205,7 @@ on this string to produce the exported version."
 
       ;; Remove #+TBLFM and #+TBLNAME lines
       (org-export-handle-table-metalines)
-      
+
       ;; Run the final hook
       (run-hooks 'org-export-preprocess-final-hook)
 
@@ -2762,8 +2763,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
 #+AUTHOR:    %s
 #+EMAIL:     %s
 #+DATE:      %s
-#+DESCRIPTION: 
-#+KEYWORDS: 
+#+DESCRIPTION:
+#+KEYWORDS:
 #+LANGUAGE:  %s
 #+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s -:%s f:%s *:%s <:%s
 #+OPTIONS:   TeX:%s LaTeX:%s skip:%s d:%s todo:%s pri:%s tags:%s
@@ -2772,7 +2773,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
 #+EXPORT_EXCLUDE_TAGS: %s
 #+LINK_UP:   %s
 #+LINK_HOME: %s
-#+XSLT: 
+#+XSLT:
 #+CATEGORY:  %s
 #+SEQ_TODO:  %s
 #+TYP_TODO:  %s
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 33bfc5e..5aaea45 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -73,6 +73,22 @@
 	  org-closed-string"\\)")
   "Regexp matching special time planning keywords plus the time after it.")
 
+(defvar org-export-latex-language
+  "en"
+  "Export language code extracted from LANGUAGE key of `org-default-export-plist'
+and `org-infile-export-plist'")
+(defvar org-export-latex-babel-option
+  nil
+  "LaTeX's babel package option extraced from 5th element of
+`org-export-language-setup' using `org-export-latex-language'")
+
+(defcustom org-export-latex-default-inputenc "utf8"
+  "Default option value for LaTeX's inputenc package.
+This value is used only if the correct value could not be determined
+otherweise."
+  :group 'org-export-latex
+  :type 'string)
+
 (defvar latexp)    ; dynamically scoped from org.el
 (defvar re-quote)  ; dynamically scoped from org.el
 (defvar commentsp) ; dynamically scoped from org.el
@@ -258,8 +274,9 @@ For example \orgTITLE for #+TITLE."
   :type 'boolean)
 
 (defcustom org-export-latex-date-format
-  "%d %B %Y"
-  "Format string for \\date{...}."
+  "\\today"
+  "Format string for \\date{...} as aceepted by `format-time-string'.
+E.g. '%d %B %Y' or use LaTeX's '\\today'-command"
   :group 'org-export-latex
   :type 'string)
 
@@ -694,15 +711,19 @@ when PUB-DIR is set, use this as the publishing directory."
       (error "Need a file name to be able to export")))
 
   (message "Exporting to LaTeX...")
+
   (org-unmodified
    (let ((inhibit-read-only t))
      (remove-text-properties (point-min) (point-max)
 			     '(:org-license-to-kill nil))))
   (org-update-radio-target-regexp)
   (org-export-latex-set-initial-vars ext-plist arg)
+
   (setq org-export-opt-plist org-export-latex-options-plist)
+
   (org-install-letbind)
   (run-hooks 'org-export-latex-after-initial-vars-hook)
+
   (let* ((wcf (current-window-configuration))
 	 (opt-plist org-export-latex-options-plist)
 	 (region-p (org-region-active-p))
@@ -1205,6 +1226,15 @@ LEVEL indicates the default depth for export."
 	org-export-latex-options-plist
 	(org-combine-plists (org-default-export-plist) ext-plist
 			    (org-infile-export-plist))
+
+	org-export-latex-language (or
+				   (plist-get (org-combine-plists (org-default-export-plist)
+								  (org-infile-export-plist)) :language)
+				   "en")
+        org-export-latex-babel-option (nth
+				       5
+				       (assoc org-export-latex-language org-export-language-setup))
+
 	org-export-latex-class
 	(or (and (org-region-active-p)
 		 (save-excursion
@@ -1232,6 +1262,13 @@ LEVEL indicates the default depth for export."
 		(and (re-search-forward "^#\\+LaTeX_CLASS_OPTIONS:[ \t]*\\(.*?\\)[ \t]*$" nil t)
 		     (match-string 1))))
 	    (plist-get org-export-latex-options-plist :latex-class-options))
+
+	org-export-latex-class-options
+	(cond (org-export-latex-class-options
+	       (replace-regexp-in-string "\\[" (concat "[" org-export-latex-babel-option ",") org-export-latex-class-options))
+	      (t
+		(concat org-export-latex-class-options "[" org-export-latex-babel-option "]")))
+
 	org-export-latex-class
 	(or (car (assoc org-export-latex-class org-export-latex-classes))
 	    (error "No definition for class `%s' in `org-export-latex-classes'"
@@ -1355,7 +1392,7 @@ If END is non-nil, it is the end of the region."
 			  (match-string 0))
 		   (remove-text-properties (match-beginning 0) (match-end 0)
 					   '(:org-license-to-kill t))))))))))))
-	       
+
 
 (defvar org-export-latex-header-defs nil
   "The header definitions that might be used in the LaTeX body.")
@@ -1735,7 +1772,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
                              (string-match "\\<align=\\([^ \t\n\r]+\\)" attr)
                              (match-string 1 attr))
                   floatp (or caption label)
-		  placement     (if (and attr 
+		  placement     (if (and attr
 					 (stringp attr)
 					 (string-match "[ \t]*\\<placement=\\(\\S-+\\)" attr))
 				    (match-string 1 attr)
@@ -2324,7 +2361,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   "Set the coding system in inputenc to what the buffer is."
   (let* ((cs buffer-file-coding-system)
 	 (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs))
-		  "utf8")))
+		  org-export-latex-default-inputenc)))
     (when opt
       ;; Translate if that is requested
       (setq opt (or (cdr (assoc opt org-export-latex-inputenc-alist)) opt))
diff --git a/lisp/org.el b/lisp/org.el
index e2de48e..6d06336 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -260,7 +260,7 @@ With prefix arg HERE, insert it at point."
   (let ((a (member 'org-infojs org-modules)))
     (and a (setcar a 'org-jsinfo))))
 
-(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl)
+(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl org-latex)
   "Modules that should always be loaded together with org.el.
 If a description starts with <C>, the file is not part of Emacs
 and loading it will require that you have downloaded and properly installed
@@ -2610,8 +2610,8 @@ See also `org-agenda-jump-prefer-future'."
 The default is to do the same as configured in `org-read-date-prefer-future'.
 But you can alse set a deviating value here.
 This may t or nil, or the symbol `org-read-date-prefer-future'."
-  :group 'org-agenda 
-  :group 'org-time 
+  :group 'org-agenda
+  :group 'org-time
   :type '(choice
 	  (const :tag "Use org-aread-date-prefer-future"
 		 org-read-date-prefer-future)
@@ -3199,6 +3199,7 @@ will be appended."
 (defcustom org-export-latex-default-packages-alist
   '(("AUTO" "inputenc"  t)
     ("T1"   "fontenc"   t)
+    (""     "babel"     nil)
     (""     "fixltx2e"  nil)
     (""     "graphicx"  t)
     (""     "longtable" nil)
@@ -3220,6 +3221,7 @@ The packages in this list are needed by one part or another of Org-mode
 to function properly.
 
 - inputenc, fontenc:  for basic font and character selection
+- babel: internationalization
 - textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used
   for interpreting the entities in `org-entities'.  You can skip some of these
   packages if you don't use any of the symbols in it.

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







[-- Attachment #4: 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] 3+ messages in thread

* Re: Fwd: Small improvment of emacs-org mode concerning LaTeX-export
  2010-11-16  9:28 ` Fwd: Small improvment of emacs-org mode concerning LaTeX-export Carsten Dominik
@ 2010-11-16 11:21   ` Stefan Vollmar
  2010-11-16 11:58     ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Vollmar @ 2010-11-16 11:21 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode Mode


[-- Attachment #1.1: Type: text/plain, Size: 834 bytes --]

Dear Carsten,

small mixup due to similar names: the credit to the LaTeX export patch should go to "Juergen Vollmer".

Warm regards,
 Stefan

On 16 Nov 2010, at 10:28, Carsten Dominik wrote:

> Dear LaTeX hackers,
> 
> here is an interesting patch from Stefan Vollmer.
> It attempts to automatically set the right language for
> the babel style in LaTeX export (so this has nothing to
> do with org-babel).  It looks good to me on a quick
> glance, but can I ask some of you to take a closer
> look, and test it?


-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de   http://www.nf.mpg.de








[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4409 bytes --]

[-- Attachment #2: 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	[flat|nested] 3+ messages in thread

* Re: Fwd: Small improvment of emacs-org mode concerning LaTeX-export
  2010-11-16 11:21   ` Stefan Vollmar
@ 2010-11-16 11:58     ` Carsten Dominik
  0 siblings, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-11-16 11:58 UTC (permalink / raw)
  To: Stefan Vollmar; +Cc: emacs-orgmode Mode

Ooops, sorry about that.

- Carsten

On Nov 16, 2010, at 12:21 PM, Stefan Vollmar wrote:

> Dear Carsten,
>
> small mixup due to similar names: the credit to the LaTeX export  
> patch should go to "Juergen Vollmer".
>
> Warm regards,
> Stefan
>
> On 16 Nov 2010, at 10:28, Carsten Dominik wrote:
>
>> Dear LaTeX hackers,
>>
>> here is an interesting patch from Stefan Vollmer.
>> It attempts to automatically set the right language for
>> the babel style in LaTeX export (so this has nothing to
>> do with org-babel).  It looks good to me on a quick
>> glance, but can I ask some of you to take a closer
>> look, and test it?
>
>
> -- 
> Dr. Stefan Vollmar, Dipl.-Phys.
> Head of IT group
> Max-Planck-Institut für neurologische Forschung
> Gleuelerstr. 50, 50931 Köln, Germany
> Tel.: +49-221-4726-213  FAX +49-221-4726-298
> Tel.: +49-221-478-5713  Mobile: 0160-93874279
> E-Mail: vollmar@nf.mpg.de   http://www.nf.mpg.de
>
>
>
>
>
>
>

- Carsten

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

end of thread, other threads:[~2010-11-16 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201011151658.17329.juergen.vollmer@informatik-vollmer.de>
2010-11-16  9:28 ` Fwd: Small improvment of emacs-org mode concerning LaTeX-export Carsten Dominik
2010-11-16 11:21   ` Stefan Vollmar
2010-11-16 11:58     ` 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).