Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-28 Thread Nicolas Goaziou
Suvayu Ali  writes:

> Personally I think having the option to shoot myself in the foot is
> preferable over not being able to configure.  But then others may not
> agree.  Is it possible to disallow :overlay when :environment is
> provided?  If so you could generate a warning during export.
>
> That said, the way I see it, most widely used list-like environments are
> of the "new item on a new line" kind (which are supported by overlays).
> I wanted to use inparaenum for ease of editing, in my slide I wanted an
> inline list (where overlays aren't really needed).  So setting the two
> attributes simultaneously is probably very unlikely.
>
> I am quoting my use case below in case that helps the discussion.
> Something like item (1) would have been nice, however I ended up using
> (2).
>
>
>   1) Asymmetries can be constructed that are,
>  #+attr_beamer: :environment "inparaenum" :options "i)"
>  1. CP-odd,
>  2. CPT-odd and
>  3. T-odd
>
>   2) Asymmetries can be constructed that are, i) CP-odd, ii) CPT-odd and
>  iii) T-odd.

Case 1 should now be supported.


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-28 Thread Suvayu Ali
On Wed, Nov 28, 2012 at 01:58:09PM +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Suvayu Ali  writes:
> >
> >> Images accept `:float', `:placement' and `:options' as attributes.
> >> `:float' accepts a symbol among `wrap', `multicolumn', and
> >> `figure', which defines the float environment for the table (if
> >> unspecified, an image with a caption will be set in a "figure"
> >> environment).  `:placement' is a string that will be used as
> >> argument for the environment chosen.  `:options' is a string that
> >> will be used as the optional argument for "includegraphics" macro.
> >> 
> 
> Since Beamer back-end doesn't redefine how images are handled, you can
> use the same properties as above, within an attr_latex keyword.
> 

Okay thanks.  :)

> About special environments for plain lists, I'm unsure if this is a good
> idea. AFAIK many don't support overlay specifications so it would lead
> to errors when one provides both a special environment and an overlay,
> i.e.:
> 
> --8<---cut here---start->8---
> #+attr_beamer: :environment inparaenum :overlay "+-"
> - item 1
> - item 2
> --8<---cut here---end--->8---
> 
> Also, Beamer has its own way to render standard lists (through themes)
> and it could cause problems with foreign packages.
> 
> On the other hand, I can still make it easy for an user to shoot himself
> in the foot: code-wise, it is cheap. What do you think?
> 

Personally I think having the option to shoot myself in the foot is
preferable over not being able to configure.  But then others may not
agree.  Is it possible to disallow :overlay when :environment is
provided?  If so you could generate a warning during export.

That said, the way I see it, most widely used list-like environments are
of the "new item on a new line" kind (which are supported by overlays).
I wanted to use inparaenum for ease of editing, in my slide I wanted an
inline list (where overlays aren't really needed).  So setting the two
attributes simultaneously is probably very unlikely.

I am quoting my use case below in case that helps the discussion.
Something like item (1) would have been nice, however I ended up using
(2).


  1) Asymmetries can be constructed that are,
 #+attr_beamer: :environment "inparaenum" :options "i)"
 1. CP-odd,
 2. CPT-odd and
 3. T-odd

  2) Asymmetries can be constructed that are, i) CP-odd, ii) CPT-odd and
 iii) T-odd.


Anyone else have any thoughts on this?

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-28 Thread Nicolas Goaziou
Hello,

Suvayu Ali  writes:

> On Wed, Nov 21, 2012 at 05:35:48PM +0100, Nicolas Goaziou wrote:
>> 
>> Plain lists accept two optional attributes: `:environment' and
>> `:options'.  The first one allows to use a non-standard environment
>> (i.e. "inparaenum").  The second one allows to specify optional
>> arguments for that environment (square brackets are not mandatory).
>> 
>
> Are these available for org-e-beamer too?  I tried without success.  It
> would be a great addition (along with the options for images
> below).  :)
>
>> Images accept `:float', `:placement' and `:options' as attributes.
>> `:float' accepts a symbol among `wrap', `multicolumn', and
>> `figure', which defines the float environment for the table (if
>> unspecified, an image with a caption will be set in a "figure"
>> environment).  `:placement' is a string that will be used as
>> argument for the environment chosen.  `:options' is a string that
>> will be used as the optional argument for "includegraphics" macro.
>> 

Since Beamer back-end doesn't redefine how images are handled, you can
use the same properties as above, within an attr_latex keyword.

About special environments for plain lists, I'm unsure if this is a good
idea. AFAIK many don't support overlay specifications so it would lead
to errors when one provides both a special environment and an overlay,
i.e.:

--8<---cut here---start->8---
#+attr_beamer: :environment inparaenum :overlay "+-"
- item 1
- item 2
--8<---cut here---end--->8---

Also, Beamer has its own way to render standard lists (through themes)
and it could cause problems with foreign packages.

On the other hand, I can still make it easy for an user to shoot himself
in the foot: code-wise, it is cheap. What do you think?


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-25 Thread Suvayu Ali
Hi Nicolas,

On Wed, Nov 21, 2012 at 05:35:48PM +0100, Nicolas Goaziou wrote:
> 
> Plain lists accept two optional attributes: `:environment' and
> `:options'.  The first one allows to use a non-standard environment
> (i.e. "inparaenum").  The second one allows to specify optional
> arguments for that environment (square brackets are not mandatory).
> 

Are these available for org-e-beamer too?  I tried without success.  It
would be a great addition (along with the options for images below).  :)

> Images accept `:float', `:placement' and `:options' as attributes.
> `:float' accepts a symbol among `wrap', `multicolumn', and
> `figure', which defines the float environment for the table (if
> unspecified, an image with a caption will be set in a "figure"
> environment).  `:placement' is a string that will be used as
> argument for the environment chosen.  `:options' is a string that
> will be used as the optional argument for "includegraphics" macro.
> 

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-25 Thread Thomas S. Dye
Nicolas Goaziou  writes:

> Hello,
>
> t...@tsdye.com (Thomas S. Dye) writes:
>
>> Would it be possible to add a :font attribute for tables? I'd like to be
>> able to say, e.g., :font "\\footnotesize" and have \footnotesize appear
>> between the float and table environments, near \centering in the LaTeX
>> output.
>
> This is now possible. Thanks for suggesting it.
>
>
> Regards,

Very nice.  Thank you!

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-25 Thread Rasmus
Nicolas Goaziou  writes:

> Rasmus  writes:
>
>> Nicolas Goaziou  writes:
>>
>>> I've changed the attribute syntax for tables, images and lists in
>>> e-latex back-end (new exporter). New this back-end conforms to the
>>> syntax used by Babel and every other back-end.
>>
>> Super cool!  I eagerly looking forward to using this for real world
>> tasks!
>
> I added another related feature that may come handy: math table
> clusters. Contiguous math tables sharing the same mode are enclosed
> within the same math environment. It allows to type, for example:

I actually needed that the other day, and 'defected' to pure LaTeX.
Thanks this will be very useful!

–Rasmus

-- 
A page of history is worth a volume of logic



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-25 Thread Nicolas Goaziou
Rasmus  writes:

> Nicolas Goaziou  writes:
>
>> I've changed the attribute syntax for tables, images and lists in
>> e-latex back-end (new exporter). New this back-end conforms to the
>> syntax used by Babel and every other back-end.
>
> Super cool!  I eagerly looking forward to using this for real world
> tasks!

I added another related feature that may come handy: math table
clusters. Contiguous math tables sharing the same mode are enclosed
within the same math environment. It allows to type, for example:

--8<---cut here---start->8---
  #+label: I_2
  #+attr_latex: :mode math :environment bmatrix
  | a | b |
  |---+---|
  | c | d |
  #+attr_latex: :mode math :environment bmatrix :math-prefix "\\times"
  | 1 | 0 |
  |---+---|
  | 0 | 1 |
  #+attr_latex: :mode math :environment bmatrix :math-prefix "="
  | 1 | 0 |
  |---+---|
  | 0 | 1 |
  #+attr_latex: :mode math :environment bmatrix :math-prefix "\\times"
  | a | b |
  |---+---|
  | c | d |
  #+attr_latex: :mode math :environment bmatrix :math-prefix "="
  | a | b |
  |---+---|
  | c | d |
--8<---cut here---end--->8---

and get:

--8<---cut here---start->8---
  \begin{equation}
\label{I_2}
\begin{bmatrix}
  a & b \\
  c & d \\
\end{bmatrix}
\times\begin{bmatrix}
  1 & 0 \\
  0 & 1 \\
\end{bmatrix}
=\begin{bmatrix}
  1 & 0 \\
  0 & 1 \\
\end{bmatrix}
\times\begin{bmatrix}
  a & b \\
  c & d \\
\end{bmatrix}
=\begin{bmatrix}
  a & b \\
  c & d \\
\end{bmatrix}
  \end{equation}
--8<---cut here---end--->8---


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-25 Thread Nicolas Goaziou
Hello,

t...@tsdye.com (Thomas S. Dye) writes:

> Would it be possible to add a :font attribute for tables? I'd like to be
> able to say, e.g., :font "\\footnotesize" and have \footnotesize appear
> between the float and table environments, near \centering in the LaTeX
> output.

This is now possible. Thanks for suggesting it.


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-23 Thread Giovanni Ridolfi
Da: Alan Schmitt 

A: Nicolas Goaziou 
Inviato: Venerdì 23 Novembre 2012 13:37

> Nicolas Goaziou  writes:

>> This is a bug which I fixed some hours ago. Though, you need to escape
> > the backslash.

> OK, it's working now.

> By the way, do I need to fully restart emacs after installing a new
> version of org-mode, or is there a simpler way to load it?

I think M-x org-reload should suffice.

Giovanni




Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-23 Thread Nicolas Goaziou
Alan Schmitt  writes:

> Nicolas Goaziou  writes:
>
>> This is a bug which I fixed some hours ago. Though, you need to escape
>> the backslash.
>
> OK, it's working now.
>
> By the way, do I need to fully restart emacs after installing a new
> version of org-mode, or is there a simpler way to load it?

Most of the time, M-x org-reload should do it. Though, when some
oddities happen afterwards, I restart Emacs nonetheless.


Regards,

-- 
Nicolas Goaziou




Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-23 Thread Alan Schmitt
Nicolas Goaziou  writes:

> This is a bug which I fixed some hours ago. Though, you need to escape
> the backslash.

OK, it's working now.

By the way, do I need to fully restart emacs after installing a new
version of org-mode, or is there a simpler way to load it?

Thanks,

Alan



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-23 Thread Nicolas Goaziou
Alan Schmitt  writes:

> Nicolas Goaziou  writes:
>
>> * Images (from manual)
>>
>>   #+caption: The black-body emission of the disk around HR 4049
>>   #+name: fig:SED-HR4049
>>   #+attr_latex: :options "5cm,angle=90"
>>   [[./img/sed-hr4049.pdf]]
>>
>>   #+attr_latex: :float wrap :placement "{r}{0.4\\textwidth}" :options 
>> "width=0.38\\textwidth"
>>   [[./img/hst.png]]
>
> I just tried this (using current head on master), but the following
>
> #+begin_src org
> #+attr_latex: :options "0.9}\linewidth"
> [[./objets.pdf]]
> #+end_src
>
> yields
>
> #+begin_src latex
> \includegraphics[(:options 0.9linewidth)]{./prototype.pdf}
> #+end_src latex
>
> The problem is that even if I remove the ":option", then I get
> "(0.9linewidth)" with extra parentheses and the backslash removed.
>
> This is for a beamer file.
>
> Is this a bug?

This is a bug which I fixed some hours ago. Though, you need to escape
the backslash.


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-23 Thread Alan Schmitt
Nicolas Goaziou  writes:

> * Images (from manual)
>
>   #+caption: The black-body emission of the disk around HR 4049
>   #+name: fig:SED-HR4049
>   #+attr_latex: :options "5cm,angle=90"
>   [[./img/sed-hr4049.pdf]]
>
>   #+attr_latex: :float wrap :placement "{r}{0.4\\textwidth}" :options 
> "width=0.38\\textwidth"
>   [[./img/hst.png]]

I just tried this (using current head on master), but the following

#+begin_src org
#+attr_latex: :options "0.9\linewidth"
[[./objets.pdf]]
#+end_src

yields

#+begin_src latex
\includegraphics[(:options 0.9linewidth)]{./prototype.pdf}
#+end_src latex

The problem is that even if I remove the ":option", then I get
"(0.9linewidth)" with extra parentheses and the backslash removed.

This is for a beamer file.

Is this a bug?

Alan



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-22 Thread Thomas S. Dye
Aloha Nicolas,

Nicolas Goaziou  writes:

> Hello,
>
> I've changed the attribute syntax for tables, images and lists in
> e-latex back-end (new exporter). New this back-end conforms to the
> syntax used by Babel and every other back-end.
>
> I've also added support for matrix editing.
>
> Here's an excerpt from the documentation in org-e-latex.el:
>
> Table export can be controlled with a number of attributes (through
> ATTR_LATEX keyword).
> 
> - The main one is the `:mode' attribute, which can be set to
>   `table', `math', `inline-math' and `verbatim'.  In particular,
>   when in `math' or `inline-math' mode, every cell is exported
>   as-is and the table will be wrapped in a math environment.  Also,
>   horizontal rules are ignored.  These modes are particularly
>   useful to write matrices.  Default mode is stored in
>   `org-e-latex-default-table-mode'.
> 
> - The second most important attribute is `:environment'.  It is the
>   environment used for the table and defaults to
>   `org-e-latex-default-table-environment' value.  It can be set to
>   anything, including "tabularx", "longtable", "array",
>   "bmatrix"...
> 
> - `:float' attribute defines a float environment for the table.
>   Possible values are `sidewaystable', `multicolumn' and `table'.
> 
> - `:width' and `:align' attributes set, respectively, the width of
>   the table and its alignment string.
> 
> - `:booktabs', `:center' and `:rmlines' values are booleans.  They
>   toggle, respectively "booktabs" usage (assuming the package is
>   properly loaded), table centering and removal of every horizontal
>   rule but the first one (in a "table.el" table only).
> 
> - `:math-prefix', `:math-suffix' and `:math-arguments' are string
>   which will be inserted, respectively, before the table within the
>   math environment, after the table within the math environment,
>   and between the macro name and the contents of the table.  The
>   latter attribute is necessary to matrix macros that require more
>   than one argument (i.e. "qbordermatrix").
> 
> Plain lists accept two optional attributes: `:environment' and
> `:options'.  The first one allows to use a non-standard environment
> (i.e. "inparaenum").  The second one allows to specify optional
> arguments for that environment (square brackets are not mandatory).
> 
> Images accept `:float', `:placement' and `:options' as attributes.
> `:float' accepts a symbol among `wrap', `multicolumn', and
> `figure', which defines the float environment for the table (if
> unspecified, an image with a caption will be set in a "figure"
> environment).  `:placement' is a string that will be used as
> argument for the environment chosen.  `:options' is a string that
> will be used as the optional argument for "includegraphics" macro.
>
> Here are some example to illustrate the changes, in particular in the
> table area:
>
> #+begin_src org
> #+LATEX_HEADER: 
> \usepackage{amsmath}\usepackage{booktabs}\usepackage{mathtools}\usepackage{rotating}
>
> * Tables
>
>   #+NAME: my-matrix
>   #+attr_latex: :mode math :environment array
>   #+attr_latex: :math-prefix "\\left(" :math-suffix "\\right)"
>   |  |  |
>   | a   |   b |
>   |-+-|
>   | c   |   d |
>
>   This is a reference to matrix [[my-matrix]].
>
>   #+attr_latex: :mode math :environment matrix
>   #+attr_latex: :math-prefix "M = \\left(" :math-suffix "\\right)"
>   | a | b |
>   |---+---|
>   | c | d |
>
>   #+attr_latex: :mode verbatim
>   | a | b |
>   |---+---|
>   | c | d |
>
>
>   #+attr_latex: :booktabs nil :align |r|l| :float sidewaystable
>   | 123 | 123 |
>   |-+-|
>   |   1 |   1 |
>
>   Some inlined matrix
>   #+attr_latex: :mode inline-math :environment bsmallmatrix
>   | a | b |
>   |---+---|
>   | c | d |
>   . As you can see.
>
>
>   Eventually some bordered matrix:
>
>   #+attr_latex: :mode math :environment bordermatrix
>   | | C_1 | C_2 |
>   |-+-+-|
>   | L_1 | a   | b   |
>   | L_2 | c   | d   |
>
> * Images (from manual)
>
>   #+caption: The black-body emission of the disk around HR 4049
>   #+name: fig:SED-HR4049
>   #+attr_latex: :options "5cm,angle=90"
>   [[./img/sed-hr4049.pdf]]
>
>   #+attr_latex: :float wrap :placement "{r}{0.4\\textwidth}" :options 
> "width=0.38\\textwidth"
>   [[./img/hst.png]]
> #+end_src

I think this is an improvement.  Thanks!

Would it be possible to add a :font attribute for tables? I'd like to be
able to say, e.g., :font "\\footnotesize" and have \footnotesize appear
between the float and table environments, near \centering in the LaTeX
output.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-22 Thread Alan Schmitt
Nicolas Goaziou  writes:

> Alan Schmitt  writes:
>
>> I think this has broken beamer export (new exporter). When I get back to
>> commit 359b10b3070588e8b751935b3fbcc2c9d8885a6a everything works, but
>> with this commit I have some error messages about the wrong number of
>> arguments for (item contents info) or (headline contents info) (for a
>> minimal test file).
>
> Actually, this is due to a more recent commit. It should be fixed now.

Yes, it now works. Thanks a lot.

Alan



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-22 Thread Nicolas Goaziou
Alan Schmitt  writes:

> I think this has broken beamer export (new exporter). When I get back to
> commit 359b10b3070588e8b751935b3fbcc2c9d8885a6a everything works, but
> with this commit I have some error messages about the wrong number of
> arguments for (item contents info) or (headline contents info) (for a
> minimal test file).

Actually, this is due to a more recent commit. It should be fixed now.

Thanks for the report.


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-22 Thread Alan Schmitt
Nicolas Goaziou  writes:

> Hello,
>
> I've changed the attribute syntax for tables, images and lists in
> e-latex back-end (new exporter). New this back-end conforms to the
> syntax used by Babel and every other back-end.

Hello,

I think this has broken beamer export (new exporter). When I get back to
commit 359b10b3070588e8b751935b3fbcc2c9d8885a6a everything works, but
with this commit I have some error messages about the wrong number of
arguments for (item contents info) or (headline contents info) (for a
minimal test file).

Alan



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-21 Thread Nicolas Goaziou
Rasmus  writes:

> BTW: on the lists:  very good idea.  I have often been bothered by
> only having one type of (LaTeX) lists.  Can I set it per list type?
> I.e. plain lists are inlined and enumerated are 'normal'?

No. Attributes only apply on a single list not on a whole list type.
Though, it's easy to implement with filters. For example:

#+begin_src emacs-lisp
(defun my-latex-inline-plain-lists (plain-list backend info)
  (when (org-export-derived-backend-p backend 'e-latex)
(replace-regexp-in-string
 "\\`begin{\\(itemize\\)}" "inparaitem"
 (replace-regexp-in-string
  "end{\\(itemize\\)}\\'" "inparaitem" plain-list nil nil 1)
 nil nil 1)))

(add-to-list 'org-export-filter-plain-list-functions
 'my-latex-inline-plain-lists)
#+end_src


Regards,

-- 
Nicolas Goaziou



Re: [O] [ANN] e-latex back-end: changes to attributes syntax

2012-11-21 Thread Rasmus
Nicolas Goaziou  writes:

> I've changed the attribute syntax for tables, images and lists in
> e-latex back-end (new exporter). New this back-end conforms to the
> syntax used by Babel and every other back-end.

Super cool!  I eagerly looking forward to using this for real world
tasks! 

Thank you so much.  

BTW: on the lists:  very good idea.  I have often been bothered by
only having one type of (LaTeX) lists.  Can I set it per list type?
I.e. plain lists are inlined and enumerated are 'normal'?

Again, thanks for this improvement to the already very nice LaTeX
exporter!

–Rasmus

-- 
C is for Cookie