Graphics, Figures & TablesTrouble with pdfTeX

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
luis
Posts: 14
Joined: Wed Dec 30, 2009 9:03 pm

Trouble with pdfTeX

Post by luis »

Hello everyone,

I've been using Latex for several years now. I started with MikTex and WinTex on WinXP and got really satisfied, being able to do all the things I ever needed to.

Last Spring I was finally able to kiss Windows goodbye and changed to Ubuntu. I'm using pdfTeX (which I think comes by default with Ubuntu) and Texmaker. The latter leaves a lot to be desired for, when compared to WinTex or TexnicCenter, but soon I managed to do pretty much all I need.

There has always been a problem with figures though, without any reason I can point, pdfTex randomly isolates images in pages. While some are correctly inserted between the text, for others pdfTex reserves a complete page, presenting it centered in the page with the remainder left in blank.

Where's the code I use to insert a figure:

Code: Select all

\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{figure.jpg} 
\caption{Blah blah blah}
\label{figure}
\end{figure}
So far this hadn't been much of a problem, but now I'm writing an article that has a page limit and pdfTex is simply blowing it up. I tried to round this problem using floating figures with the floatflt package. It positions the figure in the correct place, but the main text is rendered over it. I find it very strange for pdfTex not to handle floating figures.

I have another issue with figures: the captions' width is different from the main text. Is this a problem with margin definitions or seomthing else? The only width commands I'm using are these:

Code: Select all

\oddsidemargin 0.3in
\evensidemargin 0.1in
\textwidth 6.0in
Here's what I get when I run latex -version:

Code: Select all

pdfTeX using libpoppler 3.141592-1.40.3-2.2 (Web2C 7.5.6)
kpathsea version 3.5.6
Copyright 2007 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea is copyright 2007 Karl Berry and Olaf Weber.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX using libpoppler copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX using libpoppler source.
Primary author of pdfTeX using libpoppler: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea written by Karl Berry, Olaf Weber, and others.

Compiled with libpng 1.2.37; using libpng 1.2.37
Compiled with zlib 1.2.3.3; using zlib 1.2.3.3
Compiled with libpoppler version 0.12.0
Any hints? Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Trouble with pdfTeX

Post by frabjous »

I have to confess I'm a bit confused by a number of things in your post.

No version of (pdf)TeX comes with Ubuntu (at least not 9.04 or 9.10), but likely when you installed TeXmaker, the package dependencies installed TeXlive 2007, which is the latest version in the Ubuntu repositories. They're working on packaging TeXlive 2009, and hopefully it'll be ready soon, but in the meantime, you could manually install TeXlive 2009 using the install script here:

http://www.tug.org/texlive/acquire-netinstall.html

If you don't like TeXmaker for being not feature rich enough, by the way, you could try Kile, or TeXmakerX or AucTeX. (Or go a different way and try TeXworks or Gummi or even the gedit LaTeX plugin.) Kile is much more feature rich than even TeXnicCenter.

You are clearly not compiling your code with pdftex -- the code snippet you used showed latex code, so at the very least you are using pdflatex. True, this is built on pdftex, but why exactly are you blaming pdftex for the problem? How do you know the problem isn't with your graphical package (graphicx?), or with latex, or the image files themselves? You were probably using pdflatex on Windows too.

Yet, you gave the version number for latex -version rather than pdflatex -version. Not sure why you thought that relevant, since you are almost certainly not calling the former if you're including .jpg files.

In any case, if the problem persists after upgrading to TeXlive 2009, post a minimal working example actually showing the problem, along with the .jpg image. (A dummy image is fine if the problem shows with it too.)
luis
Posts: 14
Joined: Wed Dec 30, 2009 9:03 pm

Trouble with pdfTeX

Post by luis »

Hello frabjous,

I'm not awere of having any other compiler installed beyond pdfTex. This is the command Texmaker is using:

Code: Select all

latex -interaction=nonstopmode %.tex
As you can see from the initial post, this is calling pdfTex. Is there a way I can check if texLive is installed?

Meanwhile I'll work on that dummy. Thanks.
luis
Posts: 14
Joined: Wed Dec 30, 2009 9:03 pm

Trouble with pdfTeX

Post by luis »

So here's the dummy.

Edit by localghost: Attachments are uploaded to the forum server.
Attachments
dummy01.zip
Dummy source file with resulting output and sample graphics file.
(54.5 KiB) Downloaded 151 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Trouble with pdfTeX

Post by localghost »

Though in every case pdfTeX processes the source, you have to call pdflatex for direct PDF output. The two compilers latex and pdflatex pass different control options to this engine. Your sample document works fine for me when I use pdflatex as compiler. TeXmaker should offer similar options to choose between latex (DVI output, only EPS graphics files accepted) or pdflatex (PDF output, graphics files in JPG, PNG or PDF accepted).


Best regards and welcome to the board
Thorsten¹
luis
Posts: 14
Joined: Wed Dec 30, 2009 9:03 pm

Trouble with pdfTeX

Post by luis »

Hi localghost, tanks for the reply.

I tried to run the commands directly at the command line to see if anything changed. Using the pdflatex command I get exactly the same result as that posted above. Running latex the picture doesn't show up.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Trouble with pdfTeX

Post by localghost »

As I already explained in my last reply, latex doesn't accept external graphics files in JPG format. Decide which compiler engine to use in dependence on the desired format of the final output. If necessary you have to convert image files.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Trouble with pdfTeX

Post by frabjous »

I'm a bit confused by what the problem is.

If you don't want this image to be on its own page, remove the "p" placement option from the figure placement (which means "on a separate page of floats").

Code: Select all

\begin{figure}[ht]
\centering
\includegraphics[scale=0.7]{Interpolation.jpg} 
\caption{Caption caption caption caption caption caption caption caption caption caption caption caption caption caption.}
\label{Interpolation}
\end{figure}
Here's some help on float placement.
luis
Posts: 14
Joined: Wed Dec 30, 2009 9:03 pm

Trouble with pdfTeX

Post by luis »

Decide which compiler engine to use in dependence on the desired format of the final output.
Ok, so I decide to go with pdflatex. How do I avoid the isolation of figures in a single page, just as the dummy example shows?

Thank you.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Trouble with pdfTeX

Post by localghost »

Just do as frabjous already suggested.

Code: Select all

\begin{figure}[!ht]
  % figure contents
\end{figure}
Post Reply