emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] attr_latex in new exporter
@ 2013-03-08  4:25 Thomas S. Dye
  2013-03-08 10:34 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2013-03-08  4:25 UTC (permalink / raw)
  To: Org-mode

Aloha all,

I think this behavior was introduced in the last week or so.

This in the Org file:

#+attr_latex: :height "2in"
[[file:saa-fig/wet-dry.jpeg]]

yields this in LaTeX output:

\begin{figure}[htb]
\centering
\includegraphics[width=.9\linewidth,height=2in]{saa-fig/wet-dry.jpeg}
\end{figure}

I think when :height is set, then the default :width should not be set.

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] attr_latex in new exporter
  2013-03-08  4:25 [BUG] attr_latex in new exporter Thomas S. Dye
@ 2013-03-08 10:34 ` Nicolas Goaziou
  2013-03-08 17:03   ` Thomas S. Dye
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2013-03-08 10:34 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

Hello,

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

> I think this behavior was introduced in the last week or so.
>
> This in the Org file:
>
> #+attr_latex: :height "2in"
> [[file:saa-fig/wet-dry.jpeg]]
>
> yields this in LaTeX output:
>
> \begin{figure}[htb]
> \centering
> \includegraphics[width=.9\linewidth,height=2in]{saa-fig/wet-dry.jpeg}
> \end{figure}
>
> I think when :height is set, then the default :width should not be
> set.

I think it should be fixed. Could you confirm it?

Thank you for reporting it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] attr_latex in new exporter
  2013-03-08 10:34 ` Nicolas Goaziou
@ 2013-03-08 17:03   ` Thomas S. Dye
  2013-03-08 17:38     ` aaronecay
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2013-03-08 17:03 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> I think this behavior was introduced in the last week or so.
>>
>> This in the Org file:
>>
>> #+attr_latex: :height "2in"
>> [[file:saa-fig/wet-dry.jpeg]]
>>
>> yields this in LaTeX output:
>>
>> \begin{figure}[htb]
>> \centering
>> \includegraphics[width=.9\linewidth,height=2in]{saa-fig/wet-dry.jpeg}
>> \end{figure}
>>
>> I think when :height is set, then the default :width should not be
>> set.
>
> I think it should be fixed. Could you confirm it?

There is a change, but not a fix.

Now I get this:

\begin{figure}[htb]
\centering
\includegraphics[width=0.7\textwidth,height=2in]{saa-fig/wet-dry.jpeg}
\end{figure}

I'm expecting this:

\begin{figure}[htb]
\centering
\includegraphics[height=2in]{saa-fig/wet-dry.jpeg}
\end{figure}

In other words, I'm looking to preserve the aspect ratio of the source
image. 

All the best,
Tom

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] attr_latex in new exporter
  2013-03-08 17:03   ` Thomas S. Dye
@ 2013-03-08 17:38     ` aaronecay
  2013-03-08 21:40       ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: aaronecay @ 2013-03-08 17:38 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode, Nicolas Goaziou

Hi Thomas,

I think the following patch (on top of current master) will fix the
problem:
-----cut-here-----
diff --git c/lisp/ox-latex.el w/lisp/ox-latex.el
index d17dd60..eefb272 100644
--- c/lisp/ox-latex.el
+++ w/lisp/ox-latex.el
@@ -1811,9 +1811,9 @@ used as a communication channel."
 	 ;; It is possible to specify width and height in the
 	 ;; ATTR_LATEX line, and also via default variables.
 	 (width (format "%s" (cond ((plist-get attr :width))
-				   ((eq float 'figure) "0.7\\textwidth")
+                                   ((plist-get attr :height) "")
+                                   ((eq float 'figure) "0.7\\textwidth")
 				   ((eq float 'wrap) "0.48\\textwidth")
-				   ((plist-get attr :height) "")
 				   (t org-latex-image-default-width))))
 	 (height (format "%s" (cond ((plist-get attr :height))
 				    ((or (plist-get attr :width)
-----cut-here-----

Nicolas, I’m not sure I understand the logic behind (memq float '(figure
wrap)) in the cond for setting height.  I think that it would be very
rare for someone to set the default height to something other than "",
but in the event that the user does so I don’t see why it shoudl make a
difference whether the image is floating or not.

-- 
Aaron Ecay

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [BUG] attr_latex in new exporter
  2013-03-08 17:38     ` aaronecay
@ 2013-03-08 21:40       ` Nicolas Goaziou
  2013-03-09 18:25         ` Thomas S. Dye
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2013-03-08 21:40 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

Hello,

aaronecay@gmail.com writes:

> I think the following patch (on top of current master) will fix the
> problem:

[...]

It does. Thank you.

> Nicolas, I’m not sure I understand the logic behind (memq float '(figure
> wrap)) in the cond for setting height.  I think that it would be very
> rare for someone to set the default height to something other than "",
> but in the event that the user does so I don’t see why it shoudl make a
> difference whether the image is floating or not.

figure and wrap float provide their own default width. A default height
would probably break image ratio in that case. So it is only used when
no width (implicit or explicit) is given.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [BUG] attr_latex in new exporter
  2013-03-08 21:40       ` Nicolas Goaziou
@ 2013-03-09 18:25         ` Thomas S. Dye
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2013-03-09 18:25 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Aaron and Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> aaronecay@gmail.com writes:
>
>> I think the following patch (on top of current master) will fix the
>> problem:
>
> [...]
>
> It does. Thank you.
>

Works here now.  Thanks!

All the best,
Tom

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-09 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-08  4:25 [BUG] attr_latex in new exporter Thomas S. Dye
2013-03-08 10:34 ` Nicolas Goaziou
2013-03-08 17:03   ` Thomas S. Dye
2013-03-08 17:38     ` aaronecay
2013-03-08 21:40       ` Nicolas Goaziou
2013-03-09 18:25         ` Thomas S. Dye

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).