Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-21 Thread Bastien
Hi Nicolas,

Nicolas Goaziou n.goaz...@gmail.com writes:

 What about excluding most tempting locations instead?

I pushed a change, mixing this suggestion and the suggestion
to be more explicit about where it is allowed:

http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=343a6dd0

Luke, let's us know if it is clearer.

-- 
 Bastien



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Eric S Fraga
Luke Crook l...@balooga.com writes:

 I tried creating a custom class and then tried creating a custom style.  But 
 I found the easiest to be the following;


 #+AUTHOR: author
 #+LATEX_HEADER: \newcommand{\orgauthor}{author}

[...]

 Works very well, apart from the duplication of author, email, date etc.

You could always use the new command in the org directive, assuming you
only use LaTeX export:

#+LATEX_HEADER: \newcommand{\orgauthor}{author}
#+AUTHOR: \orgauthor

This would avoid duplication.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.1, Org release_8.2.5h-660-gef207f



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Rasmus
Eric S Fraga e.fr...@ucl.ac.uk writes:

 Luke Crook l...@balooga.com writes:

 I tried creating a custom class and then tried creating a custom style.  But 
 I found the easiest to be the following;


 #+AUTHOR: author
 #+LATEX_HEADER: \newcommand{\orgauthor}{author}

 [...]

 Works very well, apart from the duplication of author, email, date etc.

 You could always use the new command in the org directive, assuming you
 only use LaTeX export:

 #+LATEX_HEADER: \newcommand{\orgauthor}{author}
 #+AUTHOR: \orgauthor

 This would avoid duplication.

I've used this snip to recover such fields

\makeatletter
\let\Title\@title
\let\Author\@author
\let\Date\@date
\makeatother


Obviously, this is only good for LaTeX. 

-- 
There are known knowns; there are things we know that we know




Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Bastien
Hi Nicolas,

thanks for the thorough answer, I agree.

Can we sum it up as Macros are only available in headlines and
paragraphs, for the sake of clarifying the Macro section in the
manual?

Also, it seems that macros are only fontified in headlines and
paragraphs, which matches the short description above.  Is there
any false positives/negatives you can think of?

Thanks,

-- 
 Bastien



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Nicolas Goaziou
Bastien b...@gnu.org writes:

 thanks for the thorough answer, I agree.

Champagne! ;)

 Can we sum it up as Macros are only available in headlines and
 paragraphs, for the sake of clarifying the Macro section in the
 manual?

The manual states:

  in paragraphs, verse blocks, table cells and some keywords

some keywords implicitly refers to AUTHOR, DATE, TITLE and CAPTION.

As you noticed, secondary strings are omitted in the manual, but still
valid locations: titles in headlines or inlinetasks, inline footnotes,
and plain list item tags.

I think that's all.


Regards,

-- 
Nicolas Goaziou



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Bastien
Nicolas Goaziou n.goaz...@gmail.com writes:

 Bastien b...@gnu.org writes:

 thanks for the thorough answer, I agree.

 Champagne! ;)

Hehe.

 Can we sum it up as Macros are only available in headlines and
 paragraphs, for the sake of clarifying the Macro section in the
 manual?

 The manual states:

   in paragraphs, verse blocks, table cells and some keywords

 some keywords implicitly refers to AUTHOR, DATE, TITLE and
 CAPTION.

Oops, I checked a (very) old version of the manual without noticing,
sorry for the noise.

 As you noticed, secondary strings are omitted in the manual, but still
 valid locations: titles in headlines or inlinetasks, inline footnotes,
 and plain list item tags.

Any reason not to mention secondary strings?

In this particular case, mentioning headlines and plain list items
would be useful, otherwise careful readers* may assume that macros
are not available there.

* I've met some.

Not a big deal anyway,

-- 
 Bastien



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Luke Crook
Rasmus rasmus at gmx.us writes:

 
 I've used this snip to recover such fields
 
 \makeatletter
 \let\Title\ at title
 \let\Author\ at author
 \let\Date\ at date
 \makeatother
 
 Obviously, this is only good for LaTeX. 
 

How would I implement this?  Is including in the .tex file sufficient?  
Having these in the Org-mode file itself?  When I try in the .tex file, it 
appears almost verbatim as;

Title at title
Author at author

I cannot get the substitution to work.









Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Luke Crook
Eric S Fraga e.fraga at ucl.ac.uk writes:

 You could always use the new command in the org directive, assuming you
 only use LaTeX export:
 
 #+LATEX_HEADER: \newcommand{\orgauthor}{author}
 #+AUTHOR: \orgauthor
 
 This would avoid duplication.

Brilliant!! Thank you.









Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Nicolas Goaziou
Bastien b...@altern.org writes:

 Nicolas Goaziou n.goaz...@gmail.com writes:

 As you noticed, secondary strings are omitted in the manual, but still
 valid locations: titles in headlines or inlinetasks, inline footnotes,
 and plain list item tags.

 Any reason not to mention secondary strings?

No reason besides clarity, maybe. A long list of locations could be
confusing.

 In this particular case, mentioning headlines and plain list items
 would be useful, otherwise careful readers* may assume that macros
 are not available there.

What about excluding most tempting locations instead?

  ...

  which can be referenced with {{{name(arg1, arg2)}}}.

  These references, called macros, can be inserted anywhere Org markup
  is recognized. In particular, this excludes all keywords but CAPTION,
  TITLE, AUTHOR and EMAIL, source blocks, example blocks and comments.

  In addition to user-defined macros...


Regards,

-- 
Nicolas Goaziou



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-19 Thread Rasmus
Luke Crook l...@balooga.com writes:

 Rasmus rasmus at gmx.us writes:

 
 I've used this snip to recover such fields
 
 \makeatletter
 \let\Title\ at title
 \let\Author\ at author
 \let\Date\ at date
 \makeatother
 
 Obviously, this is only good for LaTeX. 
 

 How would I implement this?  Is including in the .tex file sufficient?  
 Having these in the Org-mode file itself?  When I try in the .tex file, it 
 appears almost verbatim as;

For some reason your @ (the sign from email address) becomes at.
It needs to be @.  See the gmane version if you are in doubt.

Here's a working example.

#+TITLE: title
#+AUTHOR: name
#+LATEX: \newcommand{\myname}{\Author}
Remember to escape latex macros like
~\myname~ as ~@@latex:\myname@@~ in Org to get \myname


* make some latex commands :noexport:
# Local Variables:
# org-latex-title-command: \\makeatletter\n \
# \\let\\Title\\@title\n \
# \\let\\Author\\@author\n \
# \\let\\Date\\@date\\makeatother\n \
# \\maketitle
# End:



-- 
In theory, practice and theory are the same. In practice they are not




Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-18 Thread Bastien
Hi Luke,

Luke Crook l...@balooga.com writes:

 #+LATEX_HEADER: \newcommand{\orgtitle}TITLE

My understanding is that Org's macros cannot be used
within #+... options.

HTH,

-- 
 Bastien



Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-18 Thread Luke Crook
Bastien bzg at gnu.org writes:

 
 Hi Luke,
 
 Luke Crook luke at balooga.com writes:
 
  #+LATEX_HEADER: \newcommand{\orgtitle}TITLE
 
 My understanding is that Org's macros cannot be used
 within #+... options.
 
 HTH,
 


Bastien, thanks.  That would certainly explain it.  I think I will try to 
define my own class.






Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-18 Thread Luke Crook

I tried creating a custom class and then tried creating a custom style.  But 
I found the easiest to be the following;


#+AUTHOR: author
#+LATEX_HEADER: \newcommand{\orgauthor}{author}

#+EMAIL:  email
#+LATEX_HEADER: \newcommand{\orgemail}{email}

#+TITLE: Title
#+LATEX_HEADER: \newcommand{\orgtitle}{Title}

#+DATE:  Date
#+LATEX_HEADER: \newcommand{\orgdate}{Date}

Then in my custom Latex title page;

#+LATEX_HEADER: \input{template}


I use \orgauthor{} etc. for the relevant fields.

Works very well, apart from the duplication of author, email, date etc.

It would be great if org-mode added support for substitution to the #+ 
fields.






Re: [O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-18 Thread Bastien
Luke Crook l...@balooga.com writes:

 It would be great if org-mode added support for substitution to the #+ 
 fields.

Nicolas, what do you think?

-- 
 Bastien



[O] #+LATEX_HEADER:\newcommand{\orgtitle}{{{{TITLE}}}}

2014-03-17 Thread Luke Crook

I'm looking for a quick and dirty way to use the org-mode variables within 
Latex.

I thought the following might work;

#+TITLE: A nice title

#+LATEX_HEADER: \newcommand{\orgtitle}TITLE

And then in the .tex file;

\orgtitle{}


Suggestions?
Thanks