From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Question on LaTeX scaling of images Date: Wed, 04 Jan 2012 19:19:46 -0500 Message-ID: <21185.1325722786@alphaville.americas.hpqcorp.net> References: <877h17rxsw.fsf@iro.umontreal.ca> <13826.1325711872@alphaville.americas.hpqcorp.net> <8739bvrr8h.fsf@iro.umontreal.ca> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rib3e-0005Br-CY for emacs-orgmode@gnu.org; Wed, 04 Jan 2012 19:19:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rib3d-0003ry-0c for emacs-orgmode@gnu.org; Wed, 04 Jan 2012 19:19:50 -0500 Received: from g1t0028.austin.hp.com ([15.216.28.35]:36355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rib3c-0003rj-OL for emacs-orgmode@gnu.org; Wed, 04 Jan 2012 19:19:48 -0500 In-Reply-To: Message from pinard@iro.umontreal.ca (=?us-ascii?Q?=3D=3Futf-?= =?us-ascii?Q?8=3FQ=3FFran=3DC3=3DA7ois=3F=3D?= Pinard) of "Wed\, 04 Jan 2012 18\:18\:54 EST." <8739bvrr8h.fsf@iro.umontreal.ca> 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: =?us-ascii?Q?=3D=3Futf-8=3FQ=3FFran=3DC3=3DA7?= =?us-ascii?Q?ois=3F=3D?= Pinard Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Fran=C3=A7ois Pinard wrote: > Nick Dokos writes: >=20 > > Fran=C3=A7ois Pinard wrote: >=20 > >> P.S. Be comfortable to tell me, if you feel I'm abusing this forum > >> with questions and should rather ask elsewhere. >=20 > > Not at all - this is exactly the right place. >=20 > Wow, thanks! You might regret having opened that door! :-) >=20 I'm regretting it already ;-) > >> [...] through "C-c C-e d", small icon-style images meant to be > >> inlined within the text [...] are getting spurious scaled fairly big > >> in the produced PDF. >=20 > > This is probably a bug. Here is a work-around: > > #+BIND: org-export-latex-image-default-option "" >=20 > Hey hey! This works! :-) >=20 > A consequent question, if I may. The bottom of the image is lined up > with the baseline of the text (at first glance at least) in the produced > PDF, while in the Emacs buffer, the center of the image is, which looks > a bit nicer. Do we have some control over this? >=20 There are various ways to do that in latex. The basic command is \includegraphics{foo.png}: this produces a box of a certain width and heigh= t, so you can use a box-making command to do what you want, e.g. \parbox[c]{1.2in}{\includegraphics{foo.png} or better: \raisebox{-\height / 2}{\includegraphics{foo.png}} The parbox does not measure its argument, so the only way to determine the width is trial and error. The raisebox does measure it and leaves the dimensions in \width and \height. Note that in order to do arithmetic you need to \usepackage{calc} (or really use low-level TeX stuff, which is the hair-shirt approach).=20 So you can do something like this: --8<---------------cut here---------------start------------->8--- ## +BIND: org-export-latex-image-default-option "" #+LaTeX_HEADER: \usepackage{calc} * foo This is an inline image:=20 #+LaTeX: \raisebox{-\height / 2}{\includegraphics{scomp3.png}} . It should not be scaled. --8<---------------cut here---------------end--------------->8--- Of course that's hardly a satisfactory state of affairs. The obvious way of doing it however does not work: ,---- | #+LaTeX: \raisebox{-\height / 2}{ | [[./scomp3.png]] | #+LaTeX: } `---- The latex exporter mangles it to: ,---- | This is an inline image:=20 | \raisebox{-\height / 2}{% | [[./scomp3.png][./scomp3.png]] | }% | . It should not be scaled. `---- and I don't know any way to convince it to do it "right". Unless somebody can come up with such a way, the only possibility that remains is to hack org-latex.el. Nick PS. I adapted the \raisebox approach from the discussion in http://www.tex.ac.uk/cgi-bin/texfaq2html?label=3Dtopgraph