GeneralFigures corrupted when formatting directly to PDF

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Aski
Posts: 6
Joined: Wed Dec 03, 2008 3:29 pm

Figures corrupted when formatting directly to PDF

Post by Aski »

I am having trouble with my figures when formatting my document directly to PDF. When using the way via PS it works. How come?

Neither non-horizontal nor non-vertical lines drawn by command put or command path are drawn when formatting LaTeX => PDF.

Anyone having an explanation? (I am happy that I found out it worked with LaTeX => PS => PDF, I thought I would have trouble for days to make it work.)

Cheers, Aski

Recommended reading 2024:

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

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

noerv
Posts: 2
Joined: Wed Dec 03, 2008 4:41 pm

Figures corrupted when formatting directly to PDF

Post by noerv »

Aski wrote:I am having trouble with my figures when formatting my document directly to PDF. When using the way via PS it works. How come?

Neither non-horizontal nor non-vertical lines drawn by command put or command path are drawn when formatting LaTeX => PDF.

Anyone having an explanation? (I am happy that I found out it worked with LaTeX => PS => PDF, I thought I would have trouble for days to make it work.)

Cheers, Aski
Are your figures in *.eps format? If they are, this is the answer.
Aski
Posts: 6
Joined: Wed Dec 03, 2008 3:29 pm

Re: Figures corrupted when formatting directly to PDF

Post by Aski »

No, they are drawn direclty in LaTeX. Here is an example:
\begin{figure}[htb]
\centering
\setlength{\unitlength}{1cm}
\begin{picture}(7,6.5)
%triangel ABC
\put(2,3){\line(1,0){3}}
\put(2,3){\line(15,30){1.5}}
\put(5,3){\line(-15,30){1.5}}
\end{picture}
\caption{Likbent triangel, förlängning av benen}
\label{fig:LikbentForlangning}
\end{figure}

The horizontal line is drawn when formatting LaTeX=>PDF, but not the other two. I am using TeXnicCenter if that might influence the result
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figures corrupted when formatting directly to PDF

Post by localghost »

Aski wrote:No, they are drawn direclty in LaTeX. Here is an example: [...] The horizontal line is drawn when formatting LaTeX=>PDF, but not the other two. I am using TeXnicCenter if that might influence the result
This code can't work, neither with latex nor pdflatex. And trying to compile it, there are four errors. The reasons are three important rules for the (x,y) pairs in the \line(x,y){length} command.
  1. The used values for the slope have to be integers.
  2. Only the values 0,1,...,6 are allowed.
  3. The pair of values mustn't have a common divisor.
And your code violates rules 2 and 3. According to these rules, your code has to be modified as follows.

Code: Select all

\begin{figure}[!ht]
  \centering
  \setlength{\unitlength}{1cm}
  \begin{picture}(7,6.5)
    % triangle ABC
    \put(2,3){\line(1,0){3}}
    \put(2,3){\line(1,2){1.5}}
    \put(5,3){\line(-1,2){1.5}}
  \end{picture}
  \caption{Likbent triangel, förlängning av benen}\label{fig:LikbentForlangning}
\end{figure}
You should think about drawing such sketches with packages like pgf/tikZ.


Best regards
Thorsten¹
Post Reply