1

I am trying to import an eps image of a flow diagram I created using Excel and exported as eps image using OpenOffice Impress. I followed the guide https://youtu.be/I4ZXTieTiAc to do this. I want to fit the image to paper width (to fit within defined paper margins), and not necessarily text width, because the journal I am submitting to uses two columns layout and I want the image to span the width of the paper minus the margins. To do this, I tried to implement the following codes:

\documentclass[12pt,letterpaper]{article}
\usepackage{graphicx}
\usepackage[letterpaper, left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\begin{document}

\begin{figure}
\centering
\includegraphics[width=\paperwidth, keepaspectratio]{myimage.eps}
\end{figure}

\end{document}

Above is just a testing example. In actual implementation, I am using \documentclass[journal = iecred,manuscript=article]{achemso} for document class for the journal I am submitting to. In any case, the image fails to scale, and ends up going outside the page to the right, although the image is properly fitted to the left margin. Setting width to \textwidth works, however, I want to scale it to paper width. Any ideas what might be causing the issue, and what I can do about it?

EDIT: From Displaying a wide figure in a two-column document, I realized for the result I wanted, I just had to use figure* instead of figure and use width=\textwidth. I still don't understand why width=\paperwidth would not work though.

dylee
  • 13
  • 1
    Paperwitdth would only work if there is no left margin I guess. Are you sure that you want a picture that has absolutely no margin/padding to be paper margins? – Dr. Manuel Kuehner Mar 08 '17 at 06:50
  • @Dr.ManuelKuehner Specifically, I want the image to fit within defined margins. As you can see in the test codes, I am defining the margins, however, the image still goes out of the page to the right. It's fitted to the left margin properly though. – dylee Mar 08 '17 at 06:55
  • Should yor final results looks like this?: http://tex.stackexchange.com/a/30988/124842 ... two column width + margin? – Bobyandbob Mar 08 '17 at 07:40
  • @Bobyandbob Actually, yes, and thank you. I realized for what I needed, I just had to use figure* instead of figure and width=\textwidth for what I needed to do. I still don't understand why width=\paperwidth would not work, but I suppose this will do. – dylee Mar 08 '17 at 08:24
  • To set a paper-wide instead of text-wide image you need to use either \includepdf from pdfpages (yes, it can input not only PDFs) or a package like eso-pic or textpos. Only if the image's resulting height is less than \textheight you may use something like \centerline{\includegraphics[width=\paperwidth,height=\textheight,keepaspectratio]{…}}. – Schweinebacke Mar 08 '17 at 08:42
  • \paperwidth is clearly too wide to fit in the text block of even a one column document and more than twice the width that will fit in a single column. – David Carlisle Mar 08 '17 at 08:53
  • @Schweinebacke You should mention that centerline will only work if the text block is in the centre of the page though. – David Carlisle Mar 08 '17 at 08:55
  • @DavidCarlisle: It's a comment only, not an answer. In the question the text block is centred. And something like also includes other solutions like negative \hspace with \makebox. I've currently no time for large answers to questions with not working examples. And I expect that it is a duplicate. – Schweinebacke Mar 08 '17 at 08:57
  • @Schweinebacke oh yes agree (just that passes by are likely to copy code out of comments, so I thought I'd add a warning:-) – David Carlisle Mar 08 '17 at 09:52

1 Answers1

2

You have specified

\usepackage[letterpaper, left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

so you have 2cm left and right margin, so \paperwidth (the width of the paper or pdf viewer) is 4cm wider than \textwidth (the width of the text block between those margins)

so

\includegraphics[width=\paperwidth...

will set the image flush to the left margin but sticking 4cm into the right, which will be 2cm off the paper.

David Carlisle
  • 757,742