在windows下,用latex插入格式為jpg,png等圖片會出現no bounding box 的編譯錯誤,此時有兩個解決辦法:
1、將圖片轉換為eps格式的圖片
\usepackage{graphicx}
\begin{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格式圖片:
\begin{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,畢竟為矢量圖形,這樣排版的質量更高。
