From: Carsten Dominik <carsten.dominik@gmail.com>
To: emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: Fwd: Small improvment of emacs-org mode concerning LaTeX-export
Date: Tue, 16 Nov 2010 10:28:13 +0100 [thread overview]
Message-ID: <C079C9AA-A0C7-4DAF-9176-2F4980F0C07A@gmail.com> (raw)
In-Reply-To: 201011151658.17329.juergen.vollmer@informatik-vollmer.de
[-- 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" "Í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 "\\<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
next parent reply other threads:[~2010-11-16 9:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201011151658.17329.juergen.vollmer@informatik-vollmer.de>
2010-11-16 9:28 ` Carsten Dominik [this message]
2010-11-16 11:21 ` Fwd: Small improvment of emacs-org mode concerning LaTeX-export Stefan Vollmar
2010-11-16 11:58 ` Carsten Dominik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C079C9AA-A0C7-4DAF-9176-2F4980F0C07A@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).