Some help with common LaTeX problems

Some help with common LaTeX problems

What’s the easiest way to include a graphic (or graph, diagram, figure etc.) in my document?

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\centering
\caption{This is my picture}
\includegraphics[width=5in,height=3in]{adamsmith.jpg}
\end{figure}
\end{document}

Then compile using pdflatex.

I’m getting a “no BoundingBox” error when I compile my document.

Have you tried compiling the document with pdflatex? In WinEdt, select PDFLaTeX from the dropdown menu that’s below ‘Accessories’ on the menu bar, and to the right of the recycle bin icon. If you’re compiling from the command prompt and your document is named thesis.tex, type pdflatex thesis.

I’m trying to compile my document and I am using natbib to do the references, but the document won’t compile with PDFLaTeX.

It’s unfortunate that natbib (as far as I can see) relies on latex (not pdflatex) but latex gets confused if you have graphics in the document. My workaround for this is to temporarily place a % sign in front of any graphics to turn them into comments, rather than code. This means the graphics are initially excluded, and you can run latex/bibtex and natbib will work. Once all the references are good and ready, you can remove the % signs (a quick Find > Replace All will do the trick) and compile using pdflatex.

Leave a Reply

Your email address will not be published. Required fields are marked *