1

I've seen this question asked, but I have not seen an answer that works for me.

I am trying to include screenshots from my program with includegraphics. I have many screenshots -- all of different pixel widths. I would like to be able to include them at the same 'scale' such that text in each remains the same size.

Long ago, I was able to do this with the [scale=0.75] option for includegraphics. This no longer works as it seems includegraphics now ignores the dpi information stored in the PNG file.

The PNG starts at 72dpi (I have changed it in an image editor to 300dpi, no change) and including it with scale=1.0, 0.5, and 0.1 all give identical results -- the image does not scale.

Any help is appreciated.

\documentclass[]{aiaa-tc}
\begin{document}
\begin{figure}
\includegraphics[scale=1.0]{example-image.png}
\end{figure}
\begin{figure}
\includegraphics[scale=0.5]{example-image.png}
\end{figure}
\begin{figure}
\includegraphics[scale=0.1]{example-image.png}
\end{figure}
\end{document}

I am running TeXShop on a Mac using pdftex.

sample image

Changing the first few lines...

\documentclass[]{article}
\usepackage{graphicx}

remedies the problem. Of course, I am submitting an AIAA paper, so it would be best to find a solution that works with this class file.

6
  • Welcome to TeX.SE. Please tell us which TeX distribution you employ, and please provide a compilable MWE that generates the problem behavior you wish to fix.
    – Mico
    Nov 16 '21 at 18:40
  • \includegraphics basically is just a wrapper to the back end driver so the code for say pdftex is completely different to that in xetex or luatex, so it never ignores a scale option it simply passes it on to the back end as a request to scale, but you have given no information about which system you are using. Nov 16 '21 at 18:47
  • 2
    please show a complete example, if possible using \includegraphics[scale=0.5]{example-image.png} as that file is generally available for tests. Nov 16 '21 at 18:57
  • When working on producing a MWE, I found that the problem is somehow caused by the aiaa-tc class. Switching to article and explicitly usepackage graphicx seems to work. Nov 16 '21 at 19:39
  • if you had used example-image rather than image people would have been able to run the example and seen the problem. Nov 16 '21 at 20:13
2

The class you are using does

\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}

so all images are unconditionally scaled as large as possible to fit in the text block.

This is clearly an intentional choice of the publisher so if you are using a journal that mandates this class, that is just the way it is.

So scale is more or less disabled, but you can re-specify width to scale the image:

enter image description here

\documentclass[]{aiaa-tc}
\begin{document}
\begin{figure}
\includegraphics[width=.5\textwidth]{example-image}
\end{figure}
\begin{figure}
\includegraphics[width=.2\textwidth]{example-image}
\end{figure}
\begin{figure}
\includegraphics[width=0.1\textwidth]{example-image}
\end{figure}
\end{document}
2
  • Thanks for finding that. Hard to see how it is intentional while still allowing you to set width=foo. It seems like a misguided idea to me. I am submitting a conference paper -- with no review of formatting. It should look the part, but nobody will be particularly picky. I'll remove that line from the class file and everything should work from there. Thanks Nov 16 '21 at 20:36
  • 1
    @user52485 yes it is a bit odd, but the main takeaway since my name is on the graphicx package is it's not my fault You could raise it with the class maintainers Nov 16 '21 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.