![为什么 fbox 在我的包含图形的左边和右边留有填充?](https://linux22.com/image/324599/%E4%B8%BA%E4%BB%80%E4%B9%88%20fbox%20%E5%9C%A8%E6%88%91%E7%9A%84%E5%8C%85%E5%90%AB%E5%9B%BE%E5%BD%A2%E7%9A%84%E5%B7%A6%E8%BE%B9%E5%92%8C%E5%8F%B3%E8%BE%B9%E7%95%99%E6%9C%89%E5%A1%AB%E5%85%85%EF%BC%9F.png)
我是 Tex 新手,这是我第一次写关于 tex 的论文,所以请多多包涵。当我尝试使用\includegraphics
在 a 内部添加边框时,我的图片和边框的左右两侧出现了一个神秘的间隙。\tikzpicture
\fbox
\begin{tikzpicture}[scale = 1]
\node[inner sep=0pt] (digit1) at (-4, 2){
{%
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{1pt}%
\fbox{
\includegraphics[width=.25\textwidth]{samplephoto}
}
}%
};
即使设置\fboxsep
为0pt
,左右两侧仍然存在间隙。有人可以帮忙吗?
答案1
比较这两个变体:\fbox{% ....\includegraphics...}%
和没有%
——原始版本引入了空白,扩大了框!
\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{1pt}%
\fbox{
\includegraphics[width=.25\textwidth]{samplephoto}
}
\fbox{%
\includegraphics[width=.25\textwidth]{samplephoto}%
}
\end{document}
答案2
答案3
使用
\begin{tikzpicture}[scale = 1]
\node[inner sep=0pt] (digit1) at (-4, 2){\frame{\includegraphics[width=.25\textwidth]{samplephoto}}};