From: Robert Klein <RoKlein@roklein.de>
To: wero_sacero <mail2wero@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: macro expansion in #+begin_latex
Date: Sun, 14 Jun 2015 11:53:50 +0200 [thread overview]
Message-ID: <20150614115350.6602ec51@zotac> (raw)
In-Reply-To: <CAMjgborT+_GdWa3qrShEkfX9UV8Ghkv=f7SSv=KbS7M_4tC4ZA@mail.gmail.com>
Hi,
On Sun, 14 Jun 2015 11:14:13 +0200
wero_sacero <mail2wero@gmail.com> 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 <mail@nicolasgoaziou.fr>:
> > Hello,
> >
> > wero_sacero <mail2wero@gmail.com> 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
> >
>
next prev parent reply other threads:[~2015-06-14 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-13 9:00 macro expansion in #+begin_latex wero_sacero
2015-06-13 16:58 ` Nicolas Goaziou
2015-06-14 9:14 ` wero_sacero
2015-06-14 9:53 ` Robert Klein [this message]
2015-06-14 10:07 ` Rasmus
2015-06-14 17:04 ` Charles C. Berry
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=20150614115350.6602ec51@zotac \
--to=roklein@roklein.de \
--cc=emacs-orgmode@gnu.org \
--cc=mail2wero@gmail.com \
/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).