当我使用“figure”环境时,在我插入的图片之前,我的 pdf 中出现了一个我从未使用过的奇怪字符串“1.bb”。如果我更换另一张图片进行插入,“1.bb”就会消失。我想我的环境一定出了问题,但我插入了另一张图片,结果变成了一张干净的图片。我在源代码中搜索了单词“bb”,但什么也没找到。我想知道它是从哪里来的,如果我坚持要插入那张图片,我该如何删除它。
\begin{figure}
\centering
\includegraphics[width=3in]{//Users/wuzihan/Downloads/图片 1.jpg}
\caption{\ce{BF3}正比计数管的脉冲幅度谱}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=4in]{//Users/wuzihan/desktop/未命名图片.png}
\caption{坪曲线与脉冲幅度谱的关系}
\end{figure}
源代码的第一部分是这样的:
\documentclass[]{ctexart}
\usepackage{lmodern}
\usepackage[version=4]{mhchem}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\PassOptionsToPackage{hyphens}{url} % url is loaded by hyperref
\usepackage[unicode=true]{hyperref}
\hypersetup{
pdfborder={0 0 0},
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\date{}
答案1
空格是分隔符,除非使用引号,否则它会结束文件名,但要自动正确获取引号以使其在所有操作系统上的所有情况下都能正常工作并不容易。
如果您的图形文件名中有空格,您可以尝试该包grffile
,但我不会在文件名中使用空格和奇怪的字符。