
我正在嘗試以 AMS 格式將圖片傳送到我的 Latex 文件中:
\documentclass[10pt,reqno]{amsart}
這就是我的照片應該在的地方:
\documentclass[10pt,reqno]{amsart}
\usepackage{pstricks,pst-node,pst-plot,pst-grad}
\usepackage{amssymb,amsfonts,amsmath}
\usepackage{pst-coil}
\usepackage[dvips]{graphicx}
%\usepackage{dsfont}
%\usepackage{graphicx}
%\usepackage{pictex}
%\usepackage{mathrsfs}
\usepackage[colorlinks]{hyperref}
\usepackage{amsmath}
\usepackage{amssymb}
%\usepackage{amsthm}
%\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{booktabs}
\usepackage{tikz-cd}
\usepackage[T1]{fontenc}
\usepackage{color} %May be necessary if you want to color links
\newtheorem{theorem}{{\bf Theorem}}[section]
\newtheorem*{maintheorem}{{\bf Main Theorem}}
\newtheorem{proposition}[theorem]{{\bf Proposition}}
\newtheorem*{proposition*}{{\bf Proposition}}
\newtheorem{definition}[theorem]{{\bf Definition}}
\newtheorem{lemma}[theorem]{{\bf Lemma}}
\newtheorem{lemma*}{{\bf Lemma}}
\newtheorem{notation}[theorem]{{\bf Notation}}
\newtheorem{convention}[theorem]{{\bf Convention}}
\newtheorem{terminology}[theorem]{{\bf Terminology}}
\newtheorem{example}[theorem]{{\bf Example}}
\newtheorem{corollary}[theorem]{{\bf Corollary}}
\newtheorem{remark}[theorem]{{\bf Remark}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% #############################################
%
% Title, Authors, etc
%
% #############################################
\title[ titles]%
{ Homology Structures }
%\subjclass{%
% Primary 52C15; Secondary 30F99, 57M50}
\author[X]{X} %
\date{March 03, 2024}
%\thanks{}
\begin{abstract}
We study
\end{abstract}
\maketitle
\vskip 48pt
\section{Introduction}
\begin{definition}
This is a definition.
\end{definition}
% <Canonical Examples>
\begin{figure}
\begin{center}
\fbox{\includegraphics[width=0.05\textwidth]{IMG_2.jpg}}
\caption{Caption here}
% \label{fig:figure_label}
\end{center}
\end{figure}
\end{document}
然而,無論我如何嘗試,比例仍然太大並且偏離中心。我反覆調整了比例、寬度等但沒有效果。堆疊上的許多修復似乎都無法解決我的問題。我什至減小了文件大小,但似乎不起作用。有解決辦法嗎?
編輯:新增了fbox。此外,影像在文件類文章中照常運作。僅當遇到此文檔類別時才會導致這些問題。
答案1
\documentclass{article}
\usepackage[dvips]{graphicx}
\begin{document}
\fbox{\includegraphics{example-image.jpg}}
\end{document}
您明確指定dvips
影像處理
\usepackage[dvips]{graphicx}
通常建議不要指定此項,並讓系統選擇最佳選項,但是在這種情況下,您的其他設定使 Latex+dvips 成為唯一的選項,如下所示:
你有一些技巧:
\usepackage{pstricks,pst-node,pst-plot,pst-grad}
所以不能使用 pdflatex,並且有 8 位元字體設定:
\usepackage[T1]{fontenc}
所以不能使用lualatex或xelatex。
LaTex/dvips 不能包含 jpg 文件,所以你應該有錯誤
! LaTeX Error: Cannot determine size of graphic in example-image.jpg (no Boundi
ngBox).
如果您提供邊界框,例如在.bb
文件中或作為
\includegraphics[bb=0 0 100 100]{example-image.jpg}
那麼 Latex 不會出錯,但 jpg 檔案會內聯到產生的 PostScript 中,就好像它是 EPS 檔案一樣,並在 PostScript 渲染器中產生錯誤。
因此輸出不應顯示影像。