Latex 中插入图片no bounding box 解决方案

在windows下,用latex插入格式为jpg,png等图片会出现no bounding box 的编译错误,此时有两个解决办法:

1、将图片转换为eps格式的图片

usepackage{graphicx}

egin{figure}
    centering
    includegraphics[totalheight=2.5in]{test.eps}
    caption{这是一个测试图片}
    label{fig:test}
end{figure}

2、另一个简单的方法则需要一个名叫ebb的工具,先用ebb生成对应的BoundingBox文件,如输入命令: ebb my.jpg

生成my.bb 里面可能会有如下内容:

%%Title:my.jpg
%%Creator: ebb Version 0.5.2
%%BoundingBox: 0 0 404 302
这样用下面的方法就可以在文档中使用jpg格式图片:

egin{figure}
    centering
    includegraphics[totalheight=2.5in,bb= 0 0 404 302]{my.jpg}
    caption{这是一个测试图片}
    label{fig:test}
end{figure}

如果没有这一步处理,在生成文档时就会给你提示:

LaTeX Error: File `my.bb' not found.

或者(no BoundingBox)

ps:个人推荐latex下所有图片格式用eps,毕竟为矢量图形,这样排版的质量更高。

原文地址:https://www.cnblogs.com/energy1010/p/3169414.html