Page 5 of 5
LaTeX graphics (JPEG) problems
Posted: Mon May 05, 2008 8:01 pm
by Johnny
M1kz, sounds excellent. I'll try that tomorrow morning. Thanks

LaTeX graphics (JPEG) problems
Posted: Tue May 06, 2008 9:45 am
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
LaTeX graphics (JPEG) problems
Posted: Tue May 06, 2008 9:56 am
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.
LaTeX graphics (JPEG) problems
Posted: Tue May 06, 2008 11:08 am
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.
LaTeX graphics (JPEG) problems
Posted: Tue May 06, 2008 11:13 am
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}
LaTeX graphics (JPEG) problems
Posted: Sun Aug 17, 2008 3:28 pm
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]
LaTeX graphics (JPEG) problems
Posted: Sun Aug 17, 2008 3:55 pm
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).
LaTeX graphics (JPEG) problems
Posted: Mon Aug 18, 2008 1:40 am
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.
LaTeX graphics (JPEG) problems
Posted: Mon Aug 18, 2008 11:48 am
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.
LaTeX graphics (JPEG) problems
Posted: Tue Aug 19, 2008 4:24 pm
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.