LaTeX graphics (JPEG) problems

User avatar
Johnny
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Johnny »

M1kz, sounds excellent. I'll try that tomorrow morning. Thanks :)
Stab Art Radiation Capital Structure Demolition LLC
User avatar
Eldesdichado
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Eldesdichado »

Hey Johnny, you might also want to compile your document enabling the write18 option or use pdflatex -shell-escape. It solved a problem I had when I wanted to convert an eps image into a pdf one while compiling. HTH
I am the dark one, -the widower; -the unconsoled, The prince of Aquitaine at his stricken tower: My sole star is dead, -and my constellated lute Bears the black sun of the melancolia.
User avatar
Johnny
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Johnny »

Thanks. The set up I'm using is Matlab to generate charts plus MiKTeX and TeXnicCenter, as used by M1kz. I can generate pdf charts easily enough in Matlab, so that part is ok. I'm going to check out the suggestion of M1kz today and see how I get on. I'll report back later.
Stab Art Radiation Capital Structure Demolition LLC
User avatar
Johnny
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Johnny »

I found this very useful document which explains clearly how to manipulate graphics files.

For me, part of the problem was to trim the large amounts of whitespace from around my

pdf files, particularly at the top and bottom. This allowed the caption to get closer to the

picture (less whitespace in between) and also to fit into a smaller space, therefore not take

up a whole page. The command I particularly found useful is [bb=llx, lly, urx, ury] with the

graphicx package, where the function trims away anything outside the bounding box with

lower left and upper right corners given by llx, lly and urx, ury respectively.
Stab Art Radiation Capital Structure Demolition LLC
User avatar
nikol
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by nikol »

as far as i remember all problems come from header set-up. i use always this and it works.



install graphicx, nice one! (google for it)



eps from MatLab works pretty well with this package. in the example Fig1.eps is saved.



\documentclass[11pt,a4paper,oneside]{article}



\usepackage{graphicx}

\usepackage{topcaption}



\begin{document}



\title{}



\author{}



\date{}



\maketitle



\section{Introduction}



bla-bla~\cite{glorific}



\begin{figure}[!hbp]

\centering

\topcaption{nice caption \label{fig:fig1}}

\includegraphics[width=0.75\textwidth]{Fig1}

\end{figure}



\begin{thebibliography}{99}



\bibitem[famous_author]{glorific} XYZ.



\end{thebibliography}



\end{document}
User avatar
Johnny
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Johnny »

Not a graphics question, but still probably the best thread for it.



I am writing a LaTeX document. From one particular point onwards, the

equations all have the same number attached to them. Does anyone

have any idea why this might happen?



edit: I've started a new thread for this question [url=/Show%20Post.aspx?PostIDKey=119157]here[/url]
Stab Art Radiation Capital Structure Demolition LLC
User avatar
Graeme
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Graeme »

That is quite spectacular....! Can you send me the tex file? I will look into it.



Btw, after a couple of years of iterating, we have settled on a procedure for graphics in latex and pdflatex which consistently produces good results. I'll try to summarise in due course (I must check with my Most Significant Other about what 'we' do).
Graeme West
User avatar
mj
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by mj »

my current approach for graphs is



do graph in EXCEL

copy it into Scientific Workplace using cut and paste

save as portable latex with .eps pictures

load .eps with adobe acrobat professional and save as .pdf



then use pdflatex



It works quite well but requires an annoying amount of purchased software.
Quant Job Interview Questions and Answers now available on lulu and createspace: www.markjoshi.com
User avatar
MadMax
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by MadMax »

I only use two formats for graphs:

.eps and .png

.png can be used for pdflatex and .eps I use for all other compilations.



MatLab produces .eps and .png graphs. Mathematica produces .eps and .bmp that can be converted to .png simply by opening it in Paint and saving as .png. Some other formats can be converted the same way.
User avatar
Graeme
Posts: 0
Joined: Thu Jan 01, 2004 12:00 am

LaTeX graphics (JPEG) problems

Post by Graeme »

So, here is our prefered solution:



1. picture from excel only: print the graph using pdfcreator. You get a single page pdf which you can save wherever you want with whatever name you want. Optional further step: select in the picture (adobe - tools - snapshot) save as jpeg, convert to ps using utility jpeg2ps.



2. picture from Matlab: save the picture as both a png and as an eps.



We prefer 2, but sometimes it is too much of a pain to port a graph from latex to matlab, so then fall back on 1.



In latex tex file:



\usepackage{graphics}



\usepackage{graphicx}



To include the picture in the tex file, at the appropriate point:



\begin{figure}[!ht]

\begin{center}

\includegraphics[width=????]{????}  %no filename extension

\end{center}

\caption{????}

\label{fig:????}

\end{figure}



In the case that excel was used, there is too much space around the diagram, so the following is about right:



\begin{figure}[!ht]

\vspace*{-10mm}

\begin{center}

\includegraphics[width=????]{????}  %no filename extension

\end{center}

\vspace*{-15mm}

\caption{????}

\label{fig:????}

\end{figure}



In the case that there is more than one picture around (with different extension) the correct extension is chosen automatically.



Where Matlab is source, latex will choose the eps file and pdflatex will choose the png file.



Where excel is source, pdflatex will choose the pdf file and latex will choose the ps file. So only if you are desperate for latex instead of pdflatex (inverse search capabilities is the only reason I can think of) then you do the 'optional further step' above. A bit dirty (fuzzy around the edges) but ok for draft. 



So: between 1 and 4 pictures with different extensions but same names, and you never refer to the extensions in latex.
Graeme West
Post Reply