emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [ox-latex] Bad default value for image width?


From: Nicolas Goaziou
Subject: Re: [O] [ox-latex] Bad default value for image width?
Date: Wed, 10 Apr 2013 00:02:03 +0200

Hello,

Rasmus <address@hidden> writes:

> I don't like that tikz figures are wrapped in a resize box.  

Set `org-latex-image-default-width' to "".

> In particular this plain example is wrapped in a resize box:
>
> #+BEGIN_SRC Org
> * tikz test 
>
> [[file:test.tikz]]
>
> #+ATTR_LATEX: :width ""
> [[file:test.tikz]]
> #+END_SRC
>
> Produces:
> #+BEGIN_SRC latex
> [...]
> \resizebox{.9\linewidth}{!}{\input{test.tikz}}
> [...]
> #+END_SRC
>
> Default behavior should be to not wrap it in a resize box as most tikz
> users will set the width appropriately in their code.  The reason is
> the variable org-latex-image-default-width which is .9\linewidth by
> default.  And I can't seem to set width to nothing. . .  The problem
> is that resize box insertion depends on the following test
>
> #+BEGINS_SRC emacs-lisp
>  (when (or (org-string-nw-p width) (org-string-nw-p height))
>    ...)
> #+END_SRC
>
> which is always true due to the default

That's not correct. It is always true because (:width "") means width
becomes "\"\"", not "". IOW, `org-export-read-attribute' is unable to
parse a real empty string.

> meaning that I can't escape the resize box. . .
>
> Potential resolutions:
>   1. change the default of org-latex-image-default-width

This wouldn't help to solve the general problem. Though, you can change
it in your config to something else, as suggested above.

>   2. allow for a non-width (:width nil)
>   3. make a better test for the resize box.
>
> Let me know and I might be able to look into it.

I think the correct solution would be to fix `org-export-read-attribute'
so it can read empty strings.

If "" is really read as "", """" will still be read as "\"\"\"\"", and
it will not be possible to obtain "\"\"".

Another possibility is to read the empty string as the empty string
instead of nil, that is

  #+attr_latex: :prop1 :prop2 1

becomes (:prop1 "" :prop2 "1") instead of (:prop1 nil :prop2 "1"). It
may be confusing, though.


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]