emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: [ox-latex] Bad default value for image width?
Date: Wed, 10 Apr 2013 00:02:03 +0200	[thread overview]
Message-ID: <8761zv9xd0.fsf@gmail.com> (raw)
In-Reply-To: <87haji85a7.fsf@pank.iue.private> (rasmus@gmx.us's message of "Sun, 07 Apr 2013 22:17:04 +0200")

Hello,

Rasmus <rasmus@gmx.us> 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

  parent reply	other threads:[~2013-04-09 22:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07 20:17 [ox-latex] Bad default value for image width? Rasmus
2013-04-07 20:38 ` Rasmus Pank Roulund
2013-04-08 19:35 ` Bastien
2013-04-09 21:08   ` Nicolas Goaziou
2013-04-09 21:30     ` Bastien
2013-04-09 22:02 ` Nicolas Goaziou [this message]
2013-04-10 11:52   ` Rasmus
2013-04-10 16:53     ` Nicolas Goaziou
2013-04-10 17:23       ` Rasmus
2013-04-10 20:13         ` Nicolas Goaziou
2013-04-11 15:36           ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761zv9xd0.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).