From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [ox-latex] Bad default value for image width? Date: Wed, 10 Apr 2013 00:02:03 +0200 Message-ID: <8761zv9xd0.fsf@gmail.com> References: <87haji85a7.fsf@pank.iue.private> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPgcD-00016E-E1 for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 18:02:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPgcC-0006IE-4l for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 18:02:09 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:47403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPgcB-0006I8-Ux for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 18:02:08 -0400 Received: by mail-wi0-f181.google.com with SMTP id hj8so4172903wib.14 for ; Tue, 09 Apr 2013 15:02:07 -0700 (PDT) In-Reply-To: <87haji85a7.fsf@pank.iue.private> (rasmus@gmx.us's message of "Sun, 07 Apr 2013 22:17:04 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Hello, Rasmus 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