Latex添加图片和总体书签

以下内容主要参考

http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Pictures

http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions

latex能支持多种图片格式,常用的如.jpg, .png, .eps等,.pdf也能接受。

下面来看看怎么添加图片。添加宏包:

\usepackage{graphicx}
 
定义图片的存放地址(如果没有定义就需要放在和tex文件相同的地方),这里放在叫做figures的子文件夹下:
\graphicspath{{figures/}}
 
下面是基本用法:
\includegraphics{myimage.png}
 
剪切:
\includegraphics*[viewport=30 30 120 120]{myimage.png} 
 
如果没有星号,那么
\includegraphics[viewport=30 30 120 120]{myimage.png}
结果是更改位置。
在写这些代码的时候尽量不要有空行。
 
缩放:
\includegraphics[scale=0.25]{myimage.png}
把图片变成了四分之一。
\includegraphics[scale=0.25]{myimage.png}
也可以指定长和宽进行缩放。如果只指定了其中之一,就是保持原比例不变进行缩放。
例如width=0.5\textwidth指的是图片宽度是文本的一半,高度随之变化。当然,如果width=\columnwidth就是没有缩放了。
 
旋转:
\includegraphics[angle=45]{myimage.png}
将结果逆时针旋转了45度。

翻转(左右):
\reflectbox{\includegraphics{myimage.png}} 
 
文字的缩放scalebox和旋转rotatebox:
\scalebox{2}{\rotatebox{60}{\reflectbox{This is really weird text!}}} \end{document} 
把翻转后的字旋转了60度,而且放大了两倍。
 
下面看看如何更改位置:
居中(整个页面中间):
\begin{center}
\includegraphics{myimage.png}
\end{center}

或者直接在include之前写/centering

 
添加标签(会对图片进行编号):
\begin{figure}[?]
\includegraphics[width=textwidth]{myimage}
\caption{mynote}\label{mylabel}
\end{figure} 

 上边的[?]可以去掉,如果保留的话,用于设置图片位置。参数如下:

h: 直接放在目前所处位置
t:  top,置顶
b: bottom,置底
p: 插入空白页之后h
!: 让latex决定
H: 需要用\usepackage{float},结果和h!差不多
 
 
如果想要两张图片放在一行,注释和编号一样,应该怎么做呢?
\begin{figure}[h!]
\includegraphics[width=textwidth]{myimage1}
\includegraphics[width=textwidth]{myimage2}
\caption{mynote}\label{mylabel}
\end{figure} 
 
图片说完了,书签的加法很简单,只需要添加
\usepackage[pdftex]{hyperref}
 
当然,每一个章节开头都需要设标签,比如:
\chapter{Related Work}
\label{chp:related_work}
以后引用也只需要Chapter~\ref{chp:related_work}就可以了。
现在,每一章的超链接出来了吧?
 
posted @ 2012-11-12 02:20  joywelt  阅读(2736)  评论(0编辑  收藏  举报