From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Fwd: Small improvment of emacs-org mode concerning LaTeX-export Date: Tue, 16 Nov 2010 10:28:13 +0100 Message-ID: References: <201011151658.17329.juergen.vollmer@informatik-vollmer.de> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: multipart/mixed; boundary=Apple-Mail-6-207364326 Return-path: Received: from [140.186.70.92] (port=36803 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PIHpv-0002Ej-3V for emacs-orgmode@gnu.org; Tue, 16 Nov 2010 04:28:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PIHpq-00032T-Cz for emacs-orgmode@gnu.org; Tue, 16 Nov 2010 04:28:23 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:53576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PIHpq-00032L-1R for emacs-orgmode@gnu.org; Tue, 16 Nov 2010 04:28:18 -0500 Received: by bwz16 with SMTP id 16so427565bwz.0 for ; Tue, 16 Nov 2010 01:28:16 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Mode --Apple-Mail-6-207364326 Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable 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" > Date: November 15, 2010 4:58:01 PM GMT+01:00 > To: Carsten Dominik > 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 =20 > liek "Inhaltsverzeichnis" instead > of "Table of content". > The used language is derived frorm the (HTML)-LANGUGE variable which =20= > the mapped to babel's options. > Futhermore I added a new custom-variable to select the latex =20 > 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=FCrgen > > PS: I'm not a very skilled emacs-lisp hacker, but I hope my changes =20= > are ok > > --=20 > 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 =20 > Programme > weder gepr=FCft noch angezeigt werden. > Mehr dazu unter: http://www.gnupg.org oder auch http://www.pgpi.org > = --------------------------------------------------------------------------= ----- --Apple-Mail-6-207364326 Content-Disposition: attachment; filename=patch.diff Content-Type: text/x-patch; x-unix-mode=0666; name="patch.diff" Content-Transfer-Encoding: 7bit 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" "Índex" "Peus de pàgina") - ("cs" "Autor" "Datum" "Obsah" "Pozn\xe1mky pod carou") - ("da" "Ophavsmand" "Dato" "Indhold" "Fodnoter") - ("de" "Autor" "Datum" "Inhaltsverzeichnis" "Fußnoten") - ("eo" "Aŭtoro" "Dato" "Enhavo" "Piednotoj") - ("es" "Autor" "Fecha" "Índice" "Pies de página") - ("fi" "Tekijä" "Päivämäärä" "Sisällysluettelo" "Alaviitteet") - ("fr" "Auteur" "Date" "Table des matières" "Notes de bas de page") - ("hu" "Szerzõ" "Dátum" "Tartalomjegyzék" "Lábjegyzet") - ("is" "Höfundur" "Dagsetning" "Efnisyfirlit" "Aftanmálsgreinar") - ("it" "Autore" "Data" "Indice" "Note a piè 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ści" "Przypis") - ("sv" "Författare" "Datum" "Innehåll" "Fotnoter")) + '(("en" "Author" "Date" "Table of Contents" "Footnotes" "english") + ("ca" "Autor" "Data" "Índex" "Peus de pàgina" "canadien") + ("cs" "Autor" "Datum" "Obsah" "Pozn\xe1mky pod carou" "czech") + ("da" "Ophavsmand" "Dato" "Indhold" "Fodnoter" "danish") + ("de" "Autor" "Datum" "Inhaltsverzeichnis" "Fußnoten" "ngerman") + ("eo" "Aŭtoro" "Dato" "Enhavo" "Piednotoj" "esperanto") + ("es" "Autor" "Fecha" "Índice" "Pies de página" "spanish") + ("fi" "Tekijä" "Päivämäärä" "Sisällysluettelo" "Alaviitteet" "finnish") + ("fr" "Auteur" "Date" "Table des matières" "Notes de bas de page" "francais") + ("hu" "Szerzõ" "Dátum" "Tartalomjegyzék" "Lábjegyzet" "magyar") + ("is" "Höfundur" "Dagsetning" "Efnisyfirlit" "Aftanmálsgreinar" "icelandic") + ("it" "Autore" "Data" "Indice" "Note a piè 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ści" "Przypis" "polish") + ("sv" "Författare" "Datum" "Innehå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 "\\, 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. --Apple-Mail-6-207364326 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-6-207364326 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --Apple-Mail-6-207364326--