From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Klein Subject: Re: macro expansion in #+begin_latex Date: Sun, 14 Jun 2015 11:53:50 +0200 Message-ID: <20150614115350.6602ec51@zotac> References: <87ioarzgtf.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z44c4-0002Jf-Au for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 05:54:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z44bz-0002sE-AX for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 05:54:00 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:59752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z44bz-0002rP-1U for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 05:53:55 -0400 In-Reply-To: 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: wero_sacero Cc: emacs-orgmode@gnu.org Hi, On Sun, 14 Jun 2015 11:14:13 +0200 wero_sacero wrote: > Thank you for the reply. > > But I don't think it's a good idea. For example: what can I do if want > to put a text like the title of my file in the latex header? is there > an other way? > > I know I can use the \@title function of latex, it works. but I need > it also for email, date, etc.. macro would be exactly what I want, but > maybe someone has thought something better! > I have a set-up to be able to use title, author etc. in LaTeX blocks. Every one of those documents has a (filled out) header like: #+TITLE: #+AUTHOR: Robert Klein #+EMAIL: roklein@roklein.de #+KEYWORDS: #+DESCRIPTION: #+LaTeX_HEADER: \newcommand{\mySubtitle}{} #+LaTeX_HEADER: \newcommand{\myProducer}{org-mode / pdflatex} Further down I #include a largish file with my standard settings which has the following in it: #+name: docinfo #+begin_src elisp :exports none (let ((props (org-export-get-environment))) (concat "#+LaTeX_HEADER: \\newcommand{\\myTitle}{" (org-element-interpret-data (plist-get props :title)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myAuthor}{" (org-element-interpret-data (plist-get props :author)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myDate}{" (org-element-interpret-data (plist-get props :date)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myCreator}{" (org-element-interpret-data (plist-get props :creator)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\myKeywords}{" (org-element-interpret-data (plist-get props :keywords)) "}\n" "#+LaTeX_HEADER: \\newcommand{\\mySubject}{" (org-element-interpret-data (plist-get props :description)) "}\n")) #+end_src #+CALL: docinfo() :exports results :results raw So, further down I can use all those \myTitle etc. commands in LaTeX, e.g.: #+LaTeX_HEADER: % Hyperref PDF Info #+LaTeX_HEADER: \hypersetup{ #+LaTeX_HEADER: pdfinfo={ #+LaTeX_HEADER: Author={\myAuthor}, #+LaTeX_HEADER: Title={\myTitle}, #+LaTeX_HEADER: Subject={\mySubject}, #+LaTeX_HEADER: Keywords={\myKeywords}, #+LaTeX_HEADER: Creator={\myCreator}, #+LaTeX_HEADER: Producer={\myProducer} #+LaTeX_HEADER: }} I also use document-wide properties for data org doesn't handle, e.g. # note: classify as `open access', `internal', `confidential' #+Property: documenttype form sheet #+Property: classification open access though I don't use it in a LaTeX block but in a elisp block w/ org output: #+name: dochead #+header: :var trustlevel=(org-entry-get nil "classification" t) #+header: :var doctype=(org-entry-get nil "documenttype" t) #+begin_src elisp :exports none :results value raw (let ((props (org-export-get-environment))) (concat "#+ATTR_HTML: :rules all\n" "#+ATTR_LATEX: :environment tabu :align ll|ll :booktabs t :width \\textwidth\n" "| Document Type: | " doctype " | Classification: | " trustlevel " |\n" "| Document Title: | " (org-element-interpret-data (plist-get props :title)) " | Author: | " (org-element-interpret-data (plist-get props :author)) " |\n")) #+end_src #+Call: dochead() :exports results :results raw I use this code to generate output intended for both HTML and LaTeX, so I can't use the \myXXX commands above (and, I'm creating org code here to be exported in the course of the current export). I won't claim this is `something better' than using {{{title}}} or so, but once I had the set-up working I'm happy with it. Best regards Robert > Thanks again! > > Wero > > 2015-06-13 18:58 GMT+02:00, Nicolas Goaziou : > > Hello, > > > > wero_sacero writes: > > > >> hi, is there anybody that know why in the lastest version of > >> org-mode exporting in latex, the macro like {{{title}}} is not > >> expanded if it is put in a begin_latex? > >> > >> In version 7.9... it was working, and I think it should work also > >> now. > >> > >> Can anyone explain me if it is a non-feature or a bug? > > > > It is a non-feature. Macro are not allowed in raw or verbatim > > environments. > > > > Regards, > > > > -- > > Nicolas Goaziou > > >