Latex下處理圖片一般用eps格式的文件.需要加載graphicx包
\usepackage{graphicx}
\begin{figure}
\centering
\includegraphics[totalheight=2.5in]{test.eps}
\caption{這是一個測試圖片}
\label{fig:test}
\end{figure}
圖\ref{fig:test}是測試圖形。
如果要處理jpg或者其它類型的文件,可以用工具轉換成eps格式.
更簡單的方法則需要一個名字叫ebb的工具,一般widows下裝上Ctex都會帶這個小工具,Linux下安裝Latex後一般也會有.
先用ebb生成對應的BoundingBox文件,如輸入命令: ebb test.jpg
生成test.bb 裏面可能會有如下內容:
%%Title:test.jpg
%%Creator: ebb Version 0.5.2
%%BoundingBox: 0 0 404 302
%%CreationDate: Sun Oct 25 19:51:22 2008
這樣用下面的方法就可以在文檔中使用jpg格式圖片:
\begin{figure}
\centering
\includegraphics[totalheight=2.5in,bb= 0 0 404 302]{test.jpg}
\caption{這是一個測試圖片}
\label{fig:test}
\end{figure}
圖\ref{fig:test}是測試圖形。
如果沒有這一步處理,在生成文檔時就會給你提示:
LaTeX Error: File `test.bb' not found.
或者(no BoundingBox)