From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: new (LaTeX) exporter and date formatting Date: Wed, 23 May 2012 23:33:31 +0200 Message-ID: <871umay444.fsf@med.uni-goettingen.de> References: <87ehqbxrz1.fsf@med.uni-goettingen.de> <87sjerav34.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXJCY-0004e3-5h for emacs-orgmode@gnu.org; Wed, 23 May 2012 17:34:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXJCV-0002bj-1d for emacs-orgmode@gnu.org; Wed, 23 May 2012 17:34:37 -0400 Received: from plane.gmane.org ([80.91.229.3]:44244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXJCU-0002bR-Mg for emacs-orgmode@gnu.org; Wed, 23 May 2012 17:34:34 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SXJCQ-0006Ik-Hz for emacs-orgmode@gnu.org; Wed, 23 May 2012 23:34:30 +0200 Received: from vpn-2010.gwdg.de ([134.76.2.10]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 May 2012 23:34:30 +0200 Received: from andreas.leha by vpn-2010.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 May 2012 23:34:30 +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: emacs-orgmode@gnu.org Hi Nicolas, >> 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? >> [...] > > 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 Thanks a lot for that elaborate response. It got me where I wanted to be! > >> 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? Not that I am aware of. But we could start one quite easily. I got this list of LaTeX-babel supported languages from http://www.tug.org/texlive/Contents/live/texmf-dist/doc/generic/babel/babel.pdf: (just a quick hack...) | LaTeX babel | lang symbol | |--------------+-------------| | acadian | ?? | | albanian | sq | | afrikaans | af | | american | en-us | | australian | en-au | | austrian | de-at | | bahasa | ?? | | indonesian | id | | indon | ?? | | bahasai | ?? | | malay | ms | | meyalu | ?? | | bahasam | ?? | | basque | eu | | brazil | bt-br | | brazilian | bt-br | | breton | ?? | | british | en-gb | | bulgarian | bg | | canadian | en-ca | | canadien | fr-ca | | catalan | ca | | croatian | hr | | czech | cs | | danish | da | | dutch | nl | | english | en | | esperanto | ?? | | estonian | et | | finnish | fi | | francais | fr | | frenchb | fr | | french | fr | | galician | gl | | german | de | | germanb | de | | greek | el | | hungarian | hu | | icelandic | is | | interlingua | ?? | | irish | en-ie | | italian | it | | latin | la | | lowersorbian | sr | | magyar | ?? | | nagari | ?? | | naustrian | de-at | | newzealand | en-nz | | ngerman | de-de | | norsk | no-no | | samin | ?? | | nynorsk | no-no | | polish | pl | | portuges | pt | | portuguese | pt | | romanian | ro | | russian | ru | | sanskrit | sa | | scottish | en-gb | | serbian | sr | | slovak | sk | | slovene | sl | | spanish | es | | swedish | sv | | tamil | ta | | turkish | tr | | ukrainian | uk | | uppersorbian | sb | | welsh | cy | | UKenglish | en-gb | | USenglish | en-us | Regards, Andreas