天天看點

Latex中圖形的引用和插入

步驟:

1. 用圖形軟體輸出 EPS 格式的檔案,或PDF格式的圖形

2. 在源檔案的導言中加入下面代碼,這樣下面幾種類型的圖都可以插入

   \ifCLASSINFOpdf

   \usepackage[pdftex]{graphicx}

   \graphicspath{{../pdf/}{../jpeg/}}     % declare the path(s) where your graphic files are

    \DeclareGraphicsExtensions{.pdf,.jpeg,.png}

    \else

    \usepackage[dvips]{graphicx}

    \graphicspath{{../eps/}}

    \DeclareGraphicsExtensions{.eps}

\fi

3 插入浮動圖形(浮動圖形由latex自動指定位置,一般放在一頁的最前面或最後面)

\begin{figure}

\centering   //設定對齊格式

\includegraphics [width=0.75,height=2.5]{arch.pdf}  //指定圖形大小和圖形名稱,一般将該圖形放在latex檔案同一路徑下就不需要指明路徑

\caption{Proposed Secure Systolic Montgomery modular MultiplierArchitecture} 設定圖形标題

 \label{fig:arch} 設定圖形引用名稱

\end{figure}

或者使用\includegraphics[width=0.25\textwidth]{arch.pdf} //此處width=0.25和指令\textwidth配合可實作原圖按比例縮放的功能,此處代表原圖的寬度為頁面的大小的25%,高度按比例自動縮放。

4.想要把圖形插在自己指定位置并且需要交叉引用的話,要使用以下的格式:

\makeatletter

\def\@captype{figure}

\makeatother

\includegraphics [width=0.75,height=2.5]{arch.pdf}  //此處用法同3

\caption{...}

\label{...}

5.文中引用

In  Figure \ref{fig:arch}   //其中的fig:arch為定義該圖時的label名

6.{figure} and {figure*}的差別

figure相對本欄,figure* 相對于通欄。