emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: =?utf-8?Q?Fran=C3=A7ois?= Pinard <pinard@iro.umontreal.ca>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Question on LaTeX scaling of images
Date: Wed, 04 Jan 2012 19:19:46 -0500	[thread overview]
Message-ID: <21185.1325722786@alphaville.americas.hpqcorp.net> (raw)
In-Reply-To: Message from pinard@iro.umontreal.ca (=?utf-8?Q?Fran=C3=A7ois?= Pinard) of "Wed\, 04 Jan 2012 18\:18\:54 EST." <8739bvrr8h.fsf@iro.umontreal.ca>

François Pinard <pinard@iro.umontreal.ca> wrote:

> Nick Dokos <nicholas.dokos@hp.com> writes:
> 
> > François Pinard <pinard@iro.umontreal.ca> wrote:
> 
> >> P.S. Be comfortable to tell me, if you feel I'm abusing this forum
> >> with questions and should rather ask elsewhere.
> 
> > Not at all - this is exactly the right place.
> 
> Wow, thanks!  You might regret having opened that door! :-)
> 

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.
> 
> > This is probably a bug. Here is a work-around:
> > #+BIND: org-export-latex-image-default-option ""
> 
> Hey hey!  This works! :-)
> 
> 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?
> 

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

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: 
#+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: 
| \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=topgraph

  reply	other threads:[~2012-01-05  0:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 20:57 Question on LaTeX scaling of images François Pinard
2012-01-04 21:17 ` Nick Dokos
2012-01-04 23:18   ` François Pinard
2012-01-05  0:19     ` Nick Dokos [this message]
2012-01-05  8:08       ` Sebastien Vauban
2012-01-05 19:35         ` Nick Dokos
2012-01-05 22:04           ` Sebastien Vauban
2012-01-05 23:04             ` Nick Dokos

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=21185.1325722786@alphaville.americas.hpqcorp.net \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pinard@iro.umontreal.ca \
    /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).