From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: new (LaTeX) exporter and date formatting Date: Wed, 23 May 2012 15:24:47 +0200 Message-ID: <87sjerav34.fsf@gmail.com> References: <87ehqbxrz1.fsf@med.uni-goettingen.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXBbS-0006WH-Mg for emacs-orgmode@gnu.org; Wed, 23 May 2012 09:27:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXBbN-0008EI-Lc for emacs-orgmode@gnu.org; Wed, 23 May 2012 09:27:50 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:45413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXBbN-0008Dt-Cp for emacs-orgmode@gnu.org; Wed, 23 May 2012 09:27:45 -0400 Received: by wefh52 with SMTP id h52so6024592wef.0 for ; Wed, 23 May 2012 06:27:43 -0700 (PDT) In-Reply-To: <87ehqbxrz1.fsf@med.uni-goettingen.de> (Andreas Leha's message of "Wed, 23 May 2012 08:55:53 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Leha Cc: emacs-orgmode@gnu.org Hello, Andreas Leha writes: > I am exporting a document containing dates like this inactive one > [2011-10-17 Mo]. > > I do not want to change the displaying of dates in org mode (as that > breaks indentation and point movement). But I'd like this to be > exported as "Mo, 17.10.2011". How do I do that? > > I found > ,---- > | org-e-latex-inactive-timestamp-format is a variable defined in `org-e-latex.el'. > | Its value is "\\textit{%s}" > `---- > but I have no idea what to change that to or whether that is the correct > place to achieve the different data format at all. Since you want to change contents, and not only markup, this isn't the correct place. You can either add a filter in `org-export-filter-timestamp-functions', or implement your own function to handle timestamp objects. If you choose the latter, you can install the function in `org-e-latex-translate-alist' to overwrite current latex exporter behaviour, or use `org-export-define-derived-backend' to implement your own back-end. Assuming you want to overwrite current behaviour, something along the lines of the following (untested) should do the work: #+begin_src emacs-lisp (defun my-e-latex-timestamp (timestamp contents info) (let ((value (org-translate-time (org-element-property :value timestamp)))) (setq value (replace-regexp-in-string org-ts-regexp1 (lambda (text) (concat (save-match-data (org-trim (match-string 5 value))) ", " (substring text 0 (1- (match-beginning 5))) (substring text (match-end 5)))) value)) (case (org-element-property :type timestamp) ((active active-range) (format org-e-latex-active-timestamp-format value)) ((inactive inactive-range) (format org-e-latex-inactive-timestamp-format value)) (otherwise (format org-e-latex-diary-timestamp-format value))))) (add-to-list 'org-e-latex-translate-alist 'my-e-latex-timestamp) #+end_src > Side note: > Ideally, in my opinion, the LaTeX-exporter would honor the > "#+LANGUAGE: XX" > setting and change the babel-settings accordingly That seems reasonable. Is there any translation table between language symbols and Babel options? > and offer the option to format the date/time-stamps differently for > different languages. I won't bother doing this, but export engine internals probably permit it. Regards, -- Nicolas Goaziou