emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Question on LaTeX scaling of images


From: Nick Dokos
Subject: Re: [O] Question on LaTeX scaling of images
Date: Wed, 04 Jan 2012 19:19:46 -0500

François Pinard <address@hidden> wrote:

> Nick Dokos <address@hidden> writes:
> 
> > François Pinard <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]