different rendering of images size and position of sphinx html to latex to pdf

1,746 views
Skip to first unread message

maning sambale

unread,
Dec 9, 2011, 7:14:33 AM12/9/11
to sphin...@googlegroups.com
Hi,

[Disclaimer before asking: A newbie with sphinx and latex here. :) ]

I am trying to compile a pdf version for printing of the OSGeo Live
DVD documentation [0] the sources are available in the svn [1].

I did the following:

1. Modified the conf.py for latex generation.
2. Created a separate index.rst as the source of the toctree since the
default index.rst doesn't have a logical ordering of rst files.
3. Run make latex and pdflatext textfile.tex

So far, I get good results, however some issues are:

1. Running pdflatex, I get lots of errors for gif and png images like this:
LaTeX Error: Unknown graphics extension: .gif.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.632 \includegraphics{usb_penlinux_licence2.gif}

2. Images doesn't align similar to the html output. See this html [2]
and this pdf image [3]

3. The project and osgeo logo are large and always on the last page of the
preceding project page. Unlike in the html where it is on the
upper-right corner. See this [4] and this [5]

What I want is to modify the rst files (and avoid tex munging if
possible) so that I can push my changes to svn.

As I said I am a newbie in sphinx and in this list. Maybe this was
asked before so please direct me to the relevant references. Thanks
in advance!


[0] http://live.osgeo.org/
[1] https://svn.osgeo.org/osgeo/livedvd/gisvm/trunk/doc/
[2] http://live.osgeo.org/en/sponsors.html
[3] http://farm8.staticflickr.com/7032/6481413627_8c62da9ce4_b.jpg
[4] http://live.osgeo.org/en/overview/geomajas_overview.html
[5] http://farm8.staticflickr.com/7001/6481413635_9e8b298986_b.jpg

--
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------

Guenter Milde

unread,
Dec 12, 2011, 3:04:14 AM12/12/11
to sphin...@googlegroups.com
On 2011-12-09, maning sambale wrote:

> I am trying to compile a pdf version for printing of the OSGeo Live
> DVD documentation [0] the sources are available in the svn [1].

> I did the following:

> 1. Modified the conf.py for latex generation.
> 2. Created a separate index.rst as the source of the toctree since the
> default index.rst doesn't have a logical ordering of rst files.
> 3. Run make latex and pdflatext textfile.tex

> So far, I get good results, however some issues are:

> 1. Running pdflatex, I get lots of errors for gif and png images like this:
> LaTeX Error: Unknown graphics extension: .gif.

...

GIF images are not supported by LaTeX. You need to convert them to PNG and
reference the png version in the source.


> 2. Images doesn't align similar to the html output. See this html [2]
> and this pdf image [3]

Neither alignment nor size is guaranteed to be equal in different output
media in all cases.

> 3. The project and osgeo logo are large and always on the last page of the
> preceding project page. Unlike in the html where it is on the
> upper-right corner. See this [4] and this [5]

To guarantee equal size, the size must be specified in "real" units (cm, pt,
inch) not in relative units (em, px). If there is no size specified for a
bitmap image, the size in the end document depends on the resolution (px per
inch) wich is configurable (while setting a fixed size in the source is
easier).


> What I want is to modify the rst files (and avoid tex munging if
> possible) so that I can push my changes to svn.

Try whether PNG images and specifying the size in the source already solve
your problems.

BTW: For scalable (vector) images, you need separate formats for HTML
(SVG) and LaTeX (PDF).

Günter

maning sambale

unread,
Dec 13, 2011, 4:06:02 AM12/13/11
to sphin...@googlegroups.com
Thanks Günter for the advice.

I was able to control image size by specifying the "real" units. The
"image on the last page of the preceding project page" problem still
persist. The images I am pertaining to are the project logos which
should be on the first page of the project page.

For example, here's a snip of one proeject page:
cat en/overview/openlayers_overview.rst
:Author: Chris Schmidt
:Author: OSGeo-Live
:Reviewer: Cameron Shorter, LISAsoft
:Version: osgeo-live4.0
:License: Creative Commons Attribution 3.0 Unported (CC BY 3.0)

.. _openlayers-overview:

.. image:: ../../images/project_logos/logo-OpenLayers-large.png
:alt: project logo
:align: right
:target: http://openlayers.org/
:height: 100 pt
:width: 100 pt

.. image:: ../../images/logos/OSGeo_project.png
:alt: OSGeo Project
:align: right
:target: http://www.osgeo.org
:height: 53 pt
:width: 150 pt


OpenLayers
================================================================================

Browser GIS Client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. image:: ../../images/screenshots/800x600/openlayers-basic.png
:scale: 100 %
:alt: screenshot
:align: right

On Mon, Dec 12, 2011 at 4:04 PM, Guenter Milde <mi...@users.sf.net> wrote:
>> 3.  The project and osgeo logo are large and always on the last page of the
>> preceding project page.  Unlike in the html where it is on the
>> upper-right corner.  See this [4] and this [5]
>
> To guarantee equal size, the size must be specified in "real" units (cm, pt,
> inch) not in relative units (em, px). If there is no size specified for a
> bitmap image, the size in the end document depends on the resolution (px per
> inch) wich is configurable (while setting a fixed size in the source is
> easier).
>

--

Guenter Milde

unread,
Dec 15, 2011, 2:44:39 AM12/15/11
to sphin...@googlegroups.com
On 2011-12-13, maning sambale wrote:
> Thanks Günter for the advice.

> I was able to control image size by specifying the "real" units.

Fine. BTW: it should suffice to specify just one of height or width.

> The "image on the last page of the preceding project page" problem
> still persist. The images I am pertaining to are the project logos
> which should be on the first page of the project page.

I can't tell you the reason for this without seeing the LaTeX source, as
this may depend on document class, \maketitle, stylesheets, packages, ...
as well as the image loading command and its context.

You could try to hand-edit the LaTeX source until you get the desired output
and post a diff - them we could try to reverse engineer the required changes
to the rst source or the config file.

Günter

Reply all
Reply to author
Forward
0 new messages