Latex技巧:LaTex插圖命令includegraphics參數詳解


Latex技巧:LaTex插圖命令includegraphics參數詳解

 

Latex插圖的命令是\includegraphics[選項]{文件}

  這里的選項在表 7.1, 7.2, 7.3 中列出。 因為 \includegraphics 不會結束 當前段落,所以它能夠在文本中放置圖形如   \includegraphics[width=12pt]{recycle.eps} 和  \includegraphics[width=12pt]{illusion.eps}

下面的命令將以 file.eps  的自然大小插入到 LATEX 文檔中:

\documentclass{article}

    \usepackage{graphicx}

    \begin{document}

    \includegraphics{file.eps}

\end{document}

image

image

image

如果加入的圖形文件沒有指明擴展名,那么 \includegraphics 會根據  \DeclareGraphicsExtensions 的擴展名列表自動為它加上擴展名(見第  9.1 節)。由於缺省的擴展名列表不包括空的擴展名, \includegraphics{file} 不會讀入 file。除非空的擴展名 已被加到擴展名列表中。 命令

\includegraphics[width=3in]{file.eps}

將 file.eps 插入文檔並且它的寬度被縮放到 3 英寸,高度也會 按相應的比例縮放。如果用 \textwidth 或 \em 等的函數來 指定寬度,而不是用像 3 英寸這樣的固定尺寸,將會使你的 LATEX 文 檔更具通用性。例如:

\includegraphics[width=\textwidth]{graphics.eps}

將所插入圖形縮放到和文本行的寬度一樣寬。而下面的命令

\includegraphics[width=0.80\textwidth]{graphics.eps} 

使得插入圖形的寬度為文本行寬的 80%。當與 calc 宏包配合使用 時,下面的命令可令圖形的寬度比文本行寬少 2 英寸:

\includegraphics[width=\textwidth-2.0in]{graphics.eps}

to (需要 graphicx 12/95 或以后的 版本。) 下面是一些使用 \includegraphics 命令來插入圖形的 例子。這里為方便起見,定義 \HR 如下:

\newcommand{\HR}{\rule{1em}{0.4pt}}

  在下面的幾個例子中,可以比較以下使用 scale,width,height,angle  以及 keepaspectratio 選項及其不同的順序所得到的不同效果。

\fbox{%<br>%<br>            \includegraphics[scale=.5]{w.eps}}

左\HR\fbox{%
\includegraphics[scale=.5]{w.eps}%
\HR 右

\fbox{%<br>%<br>            \includegraphics[width=10mm]{w.eps}}
左\HR\fbox{%
\includegraphics%
[width=10mm]{w.eps}%
\HR 右

\fbox{%<br>%<br>            \includegraphics[height=20mm,width=30mm]%<br>%<br>            {w.eps}}

左\HR\fbox{%
\includegraphics [height=20mm,width=30mm]%
{w.eps}}\HR 右

\fbox{%<br>%<br>            \includegraphics[height=20mm,width=30mm,%<br>%<br>            keepaspectratio]{w.eps}}

左\HR\fbox{%
\includegraphics [height=20mm,width=30mm,%
keepaspectratio]{w.eps}}%
\HR 右

\fbox{%<br>%<br>            \includegraphics[angle=-45]{w.eps}}

左\HR\fbox{%
\includegraphics [angle=-45]{w.eps}}%
\HR 右

\fbox{%<br>%<br>            \includegraphics[angle=-45,width=30mm]%<br>%<br>            {w.eps}}

左\HR\fbox{%
\includegraphics [angle=-45,width=30mm]%
{w.eps}}\HR 右

\fbox{%<br>%<br>            \includegraphics[width=30mm,angle=-45]%<br>%<br>            {w.eps}}

左\HR\fbox{%
\includegraphics [width=30mm,angle=-45]%
{w.eps}}\HR 右

\fbox{%<br>%<br>            \includegraphics[angle=-60,totalheight=15mm]{w.eps}}<tex2html_comment_mark>446

左\HR\fbox{%
\includegraphics [angle=-60,totalheight=15mm]%
{w.eps}}%
\HR 右

\fbox{%<br>%<br>            \includegraphics[angle=-60,totalheight=20mm,width=30mm]{w.eps}}<tex2html_comment_mark>452

左\HR\fbox{%
\includegraphics [angle=-60,totalheight=20mm,%
width=30mm]{w.eps}}%
\HR 右

\fbox{%<br>%<br>            \includegraphics[angle=-60,totalheight=20mm,width=30mm,keepaspectratio]{w.eps}}<tex2html_comment_mark>458

左\HR\fbox{%
\includegraphics [angle=-60,totalheight=20mm,%
width=30mm,keepaspectratio]%
{w.eps}}%
\HR 右



參考文獻:http://chenli-0925.blog.163.com/blog/static/3408462920109802115554/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM