emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* macro expansion in #+begin_latex
@ 2015-06-13  9:00 wero_sacero
  2015-06-13 16:58 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: wero_sacero @ 2015-06-13  9:00 UTC (permalink / raw)
  To: emacs-orgmode

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?

Thanks a lot,

Wero

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: macro expansion in #+begin_latex
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-06-13 16:58 UTC (permalink / raw)
  To: wero_sacero; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: macro expansion in #+begin_latex
  2015-06-13 16:58 ` Nicolas Goaziou
@ 2015-06-14  9:14   ` wero_sacero
  2015-06-14  9:53     ` Robert Klein
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: wero_sacero @ 2015-06-14  9:14 UTC (permalink / raw)
  To: wero_sacero, emacs-orgmode

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!

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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: macro expansion in #+begin_latex
  2015-06-14  9:14   ` wero_sacero
@ 2015-06-14  9:53     ` Robert Klein
  2015-06-14 10:07     ` Rasmus
  2015-06-14 17:04     ` Charles C. Berry
  2 siblings, 0 replies; 6+ messages in thread
From: Robert Klein @ 2015-06-14  9:53 UTC (permalink / raw)
  To: wero_sacero; +Cc: emacs-orgmode

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
> >
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: macro expansion in #+begin_latex
  2015-06-14  9:14   ` wero_sacero
  2015-06-14  9:53     ` Robert Klein
@ 2015-06-14 10:07     ` Rasmus
  2015-06-14 17:04     ` Charles C. Berry
  2 siblings, 0 replies; 6+ messages in thread
From: Rasmus @ 2015-06-14 10:07 UTC (permalink / raw)
  To: emacs-orgmode

wero_sacero <mail2wero@gmail.com> writes:

> 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?

How about org-latex-title-command?  Title is accessible via "%t" (Org 8.3).

Rasmus

-- 
This message is brought to you by the department of redundant departments

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: macro expansion in #+begin_latex
  2015-06-14  9:14   ` wero_sacero
  2015-06-14  9:53     ` Robert Klein
  2015-06-14 10:07     ` Rasmus
@ 2015-06-14 17:04     ` Charles C. Berry
  2 siblings, 0 replies; 6+ messages in thread
From: Charles C. Berry @ 2015-06-14 17:04 UTC (permalink / raw)
  To: wero_sacero; +Cc: emacs-orgmode

On Sun, 14 Jun 2015, 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?


In addition to the suggestions you already have, you can construct the 
`#+TITLE:' line like this:

#+header: :var bfn=(buffer-file-name)
#+BEGIN_SRC emacs-lisp :exports results :results value raw
(concat "#+TITLE: FileName: " bfn)
#+END_SRC

The `(buffer-file-name)' can be altered to use any function that returns 
suitable text or be a call to another src block.

HTH,

Chuck

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-14 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-06-14 10:07     ` Rasmus
2015-06-14 17:04     ` Charles C. Berry

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).