如何防止PNG、JPG文件无缘无故超大?

如何防止PNG、JPG文件无缘无故超大?

我正在使用具有 2 列的 Revtext 4.2 文档。我尝试使用以下代码行添加图片:

\begin{figure}[b]
    \includegraphics[width=\textwidth]{grad}
    \caption{Visualization of Gradient Descent}
    \label{fig:Gradient}
\end{figure}    

这放大了图片的大小,大约有半页那么大。下面是它的样子:

在此处输入图片描述

我尝试使用此线程中提供的解决方案在此处输入链接描述

并重写我的代码如下:

\begin{figure}
    \includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{grad}
    \caption{Visualization of Gradient Descent}
    \label{fig:Gradient}
\end{figure}    

这只会让情况变得更糟: 在此处输入图片描述

具有类似效果的完整代码:

\documentclass[%
 reprint,
%superscriptaddress,
%groupedaddress,
%unsortedaddress,
%runinaddress,
%frontmatterverbose, 
%preprint,
%preprintnumbers,
%nofootinbib,
%nobibnotes,
%bibnotes,
 amsmath,amssymb,
 aps,
%pra,
%prb,
%rmp,
%prstab,
%prstper,
%floatfix,
]{revtex4-2}

\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
%\usepackage{hyperref}% add hypertext capabilities
%\usepackage[mathlines]{lineno}% Enable numbering of text and display math
%\linenumbers\relax % Commence numbering lines

%\usepackage[showframe,%Uncomment any one of the following lines to test 
%%scale=0.7, marginratio={1:1, 2:3}, ignoreall,% default settings
%%text={7in,10in},centering,
%%margin=1.5in,
%%total={6.5in,8.75in}, top=1.2in, left=0.9in, includefoot,
%%height=10in,a5paper,hmargin={3cm,0.8in},
%]{geometry}

\usepackage{physics}
\usepackage{tikz}
\usepackage{caption}
\usetikzlibrary{quantikz}

\DeclareUnicodeCharacter{2212}{-}
\begin{document}

\date{\today}
\maketitle


\begin{figure}
    \includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{grad}
    \caption{Visualization of Gradient Descent}
    \label{fig:Gradient}
\end{figure}    

\bibliographystyle{plain}
\nocite{*}
\bibliography{reference.bib}
\end{document}

相关内容