latex格式设置问题以及压缩…
2014-03-11 16:46
155 查看
原文地址:latex格式设置问题以及压缩空间的若干技巧(后面的压缩空间的技巧还是作者:loveLifeAwayWWW
转载自:http://blog.sina.com.cn/s/blog_5e16f1770100gjjk.html
+-------------+
|TeX 常见问题2|
+-------------+
1。怎样在多栏环境中使用单栏图表?
答:如果你在多栏环境中使用 begin{figure} ...
end{figure}, 图形是不会出现的。如果你用另外的命令
begin{figure*} ...
end{figure*},
图形就会超出右边或有页的上边。解决的方法是把下面命令放在
begin{document}前面
makeatletter
newenvironment{tablehere}
{def@captype{table}}
{}
newenvironment{figurehere}
{def@captype{figure}}
{}
makeatother
然后用 figurehere 和 tablehere 在你平常用 figure[h....] 和
table[h...]的地方。
2。怎样得到度(degree)的符号?
答:在begin{document} 前面用
newcommand{grad}{ensuremath{^{circ}}}
,然后你在文中就可用 45grad等等了。
3。怎样得到一个欧元符号?
答:用usepackage{textcomp} 和
texteuro 或 usepackage{marvosym}
和 EUR都可以。
4。当我应用fancyhdr时,我得到了太多'Overfull vbox' 的信息?
答:这是因为缺省的标题空间太小的原因(文本的一行),不能包括fancy标题(1 line of text + 1
rule)。在导言里面加addtolength{headheight}{2.5pt}即可。
5。当我用 fancyhdr时,左边和右边的题有交叉重合?
答:这是因为section 等命令中的文本太长的原因,可用类似"section[short
version]{very long version
indeed}"来解决问题。
6。怎样从两栏页面中得到单栏的标题和摘要?
答:试试Donald Arseneau的
documentclass{article}
....
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
...
end{abstract}
end{@twocolumnfalse}
]
7。怎样改变只有几行文本的页边距?
答:把以下命令放在begin{document}前面
newenvironment{narrow}[2]{%
begin{list}{}{%
setlength{topsep}{0pt}%
setlength{leftmargin}{#1}%
setlength{rightmargin}{#2}%
setlength{listparindent}{parindent}%
setlength{itemindent}{parindent}%
setlength{parsep}{parskip}%
}%
item[]}{end{list}}
然后
begin{narrow}{1.0in}{0.5in}
... end{narrow} 就产生了左边缩小1.0
英寸和右边缩小 0.5 英寸的效果
8。我的文本在开始时就停止不编译?
答:这是因为每一次文本编译时都有对应的*.aux文件(前一次产生的),所以删去这个文件重新编译即可。
9。在eps上加公式的另一个方法。
答:1)建一个eps图形;
2)在你所想放置的地方写下文本(如公式);
3)在latex文本中用命令
usepackage{psfrag} ;
4)用命令
psfrag{formula}{some
text $sum_1^infty int
frac{a^2}{b_i}$
}让latex为做工作。
例如
documentclass[12pt]{article}
usepackage{psfrag}
usepackage{epsfig}
begin{document}
begin{figure}
begin{center}
psfrag{formula1}{some
text $sum_1^infty int
frac{a^2}{b_i}$}
psfrag{formula2}{other
text
$int_0^{frac{a^2}{b}}
sqrt{c}$}
epsfig{file=example.eps,
width=12cm}
end{center}
caption{The example
figure}
label{exampl}
end{figure}
end{document}
10。怎样把一个大表格横向放置?
答:用宏包usepackage{rotating},然后变换
begin{table}
....
end{table}
为
begin{sidewaystable}
....
end{sidewaystable}
注意这个旋转很可能在你的预览中不会再现。
11。关于itemize。
答: 清单至多有四级
$bullet$ - labelitemi
textbf{ --} - labelitemii
$ast$ - labelitemiii
$cdot$ - labelitemiv
你可重新定义
def{labelitemi}{$spadesuit$}
renewcommand{labelitemi}{$spadesuit$}
也可在itemize 环境中item命令中同时拥有不同的标签
begin{itemize}
item[$heartsuit$] ...
item[$diamondsuit$] ...
item[$clubsuit$] ...
end{itemize}
数字序列至多四级顺序可显示,如
1,2 ... - enumi
(a), (b) ... - enumii
i,ii,... - enumiii
A., B. ... - enumiv
你也可指明选项,如
begin{enumerate}
item[(1)]
item[(2)] ...
end{enumerate}
12。我怎样重新定义items之间的距离?
答:用miktex2.1中的mdwlist宏包,也可从CTAN的macros/latex/contrib/supported/mdwtools.zip
上下载后。
13。怎样改变行距?
答:用doublespace宏包,参数"coef"是baselinestretch文本中定义数值,则可用命令
begin{spacing}{coef}
% coef=2 时双倍行距了
... text
end{spacing}
14。 怎么定义一个定理型环境?
答:用theorem宏包,例子:
newtheorem{howto}{Questions}[section]
theoremstyle{change}
theorembodyfont{itshape}
theoremheaderfont{scshape}
15。怎样在latex中包括一每列的源文件?
答:例如
floatstyle{boxed}
restylefloat{figure}
begin{figure}[hb]
begin{listing}{1}
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
for (i = 0; i < argc; ++i)
printf("argv[%d] = %sn", i, argv[i]);
return 0;
}
end{listing}
caption{A numbered C
program}
end{figure}
16。怎样把附录A中的公式序号变为 A.1, A.2, .... B.1, B.2, ...的形式?
答: appendix
makeatletter
renewcommandtheequation{A.@arabicc@equation
}
makeatother
setcounter{equation}{0}
或者
renewcommand{theequation}{A.arabic{equation}}
17。怎样把一个 vertatim 放入 verbatim环境中?
答:用fancyvrb宏包定义自己的 verbatim环境。
18。怎样改变主文本中的字体?
答:命令: textnorml;申明: normalfontttfamiliy
19。怎样定义一个命令或申明 ?
答:例如一个命令:
newcommand{name}{1]{textsc{#1}}
一个申明:
newcommand{name}{1]{{normalfontscshape
#1}}
20。怎样合并字体命令?
答: textrm{...}
{rmfamily...} roman
familiy
textsf{...}
{sffamliy...} sans serif
family
texttt{...}
{ttfamily...} typewritter
family
textmd{...}
{mdserier...} medium
series
textbf{...}
{bfseries...} bold series
textup{...}
{upshape...} upright shape
textit{...}
{itshape...} italic shape
textsl{...}
{slshape...} slanted shape
textsc{...}
{scshape...} small caps
shape
size tiny scriptsize footnotesize small normalsize
large
Large LARGE huge Huge
emph{...} {em
...} emphasized
textnormal{...}
{normalfont...} document
font
21。 怎样在页眉和页脚中划一道横线?
答:用 fancyhdr宏包。
22。怎样改变章节字体(section fonts)?
答:用titlesec宏包,例如
usepackage[nops,sf,small,compact]{titlesec}
23。怎样做一个页面设置?
答: usepackage{fancyhdr}
pagestyle{fancy}
fancyhead{} %clear all
fields
fancyhead[RO, LE]{bfseries
LaTeXe{}
HOWTO}
fancyfoot[LE, RO]{thepage of
pageref{LastPage}}
fancyfoot[LO, CE]{}
fancyfoot[CO, RE]{Techical
Report}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.4pt}
24。怎样实现"page M of N"的形式?
答:用lastpage宏包,任何时候你都可在文本中用
pageref{LastPage},只是须注意当用了fancyhdr宏包时,lastpage宏包就须在它后面。
25。怎样实现下划线的标题?
答:
def@evenhead{makebox[0pt][l]{rule[-0.15cm]{textwidth}{0.1mm}}hbox{}%
textbfthepagehfilleftmark}%
def@oddhead{makebox[0pt][l]{rule[-0.15cm]{textwidth}{0.1mm}}hbox{}%
{rightmark}hfiltextbfthepage}%
26。 怎样把一个浮动对象固定下来?
答:例如
begin{figure}[h]
...
end{figure]
27。怎样定义一个新的浮动 "float" 形式?
答:用float宏包,用newfloat就可定义新的浮动形式,它的语法是:
newfloat{type}{placement}{ext}{within}
- type 是浮动新类型名
- placement 可以是 t, b, p, h 和 H
- ext 是以章节列序的任何图表的后缀名
floatstyle{style}, 其中 style
可以是
- plain, 空白
- boxed, 盒子
- ruled,
floatname{float}{floatname}
定义了浮动标题名,像图的 "Figure" 等等。
restylefloat{float}用于改变图表的标准浮动形式,例如可以
floatstyle{ruled}
restylefloat{table}
一个例子是:
documentclass{article}
usepackage{float, times}
thispagestyle{empty}
floatstyle{ruled}
newfloat{Program}{thp}{lop}[section]
floatstyle{boxed}
newfloat{algorithm}{thp}{loa}
floatname{algorithm}{Algorithm}
begin{document}
section{Let's begin}
This document show some possibilities of
texttt{float.sty}
for floating objects.
begin{Program}
begin{verbatim}
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
for (i = 0; i < argc; ++i)
printf("argv[%d] = %sn", i, argv[i]);
return 0;
}
end{verbatim}
caption{A simple C
program}
end{Program}
....
end{document}
28。 怎样让文字在一个窄小的浮动图周围?
答:用floatfig宏包,其改进宏包是floatflt宏包。语法是
begin{floatingfigure}[options]{width
of figure}
figure contents
end{floatingfigure}
一个例子是:
documentclass{article}
usepackage{floatfig,
epsfig}
...bla bla bla
par
begin{floatingfigure}{6cm}
... anything possible in figure environment
end{floatingfigure}
后面的文本将会和浮动图形平行 ,可惜floatfig宏包不是Miktex自带的。
也可用 <wrapfigure> 宏包,语法为
begin{wrapfigure}[nlines]{placement}{width}figure,
caption, etc.
end{wrapfigure}
- nlines定义了文本折行为,每一个方程占3行。
- placement水平位置(l,r)
- width图形宽度
一个例子是
begin{wrapfigure}{r}{3in}
begin{boxit}
begin{center} This is a
"wrapfigure" end{center}
caption{A wrapfigure
example}
end{boxit}
end{wrapfigure}
注意, wrapfigure
是不浮动的,所以它可能和浮动图形的顺序就不一样了,并且它不能在“列表list”中,详见王磊的插图指南。
也可用 picins 宏包,命令是
parpic(width,height)(x-off,y-off)[Options][Position]{Picture}
段落文本
除了 Picture 以外所有的命令都是可选的,详见王磊的插图指南。
29。怎样使图形并列?
答:用subfigure宏包。
一个例子是 begin{figure}
centering
mbox{
subfigure[Big]{includegraphics
...} quad
subfigure[Small]{includegraphics
...} quad
subfigure[Medium]{includegraphics
...} quad }
caption{Three subfigures}
label{fig:subfigures}
end{figure}
30。把一幅 .eps 横向放置后,怎样使标题变为相应的形式?
答: usepackage{rotating}
和
begin{sidewaysfigure}centering
includegraphics[width=?cm]{*.eps}
caption{...}
end{sidewaysfigure}
+-------------+
|TeX 常见问题3|
+-------------+
压缩空间
1。页面设置
a4 会给你一个较小的页面,为了使用更多的控制,可用 geometry宏包和命令 layout 。
2。改变长度
在latex里改变长度的命令是 addtolength 和 setlength。latex可认的是 cm, mm, in 和
pt. 变量可设为负数。一个例子是
addtolength{parindent}{-5mm}
一些有用的变量是:
页面设置
columnsep: 列间距
topmargin: 页眉到页边的距离
topskip: 页眉与正文的距离
textheight: 正文的高度
textwidth: 文本的宽度
oddsidemargin: 奇数页的左面页边距
evensidemargin : 偶数页的左面页边距
段落
parindent: 段落缩进距离
parskip: 段落间的距离
浮动图表
floatsep: 浮动对象之间的距离
textfloatsep: 最后一个浮动对象顶端或第一个浮动对象底端与正文之间的距离
intextsep : 文中浮动顶端与底端所留的距离
dbltextfloatsep 是在双列输出时用 textfloatsep 的数值
dblfloatsep 是在双列输出时用 floatsep 的数值
abovecaptionskip: 标题上方的距离
belowcaptionskip: 标题下方的距离
数学公式
abovedisplayskip: 公式前的距离
belowdisplayskip: 公式后面的距离
arraycolsep: 在一个array中列之间的空白长度
列表
topsep: 第一个item和前面版落间的距离
partopsep: 当在一个新页开始时加到 topsep 的额外空间
itemsep: 连续items之间的距离。
3。环境
宏包 atbeginend.sty 提供了
BeforeBegin{environment}{code-to-execute},
AfterEnd 等等命令。这些命令可去掉环境外面和内部的空间。例如
AfterBegin{itemize}{addtolength{itemsep}{-baselineskip}}
就在环境内以重新设置 itemsep 来压缩items之间的距离 。
mdwlist 宏包有一个 itemize* 环境; paralist
宏包提供了一个item之间距离压缩环境和一个使每个item不在新的一段开始的 inparaenum 环境。
4。图表
为了节约空间,可用 subfigure 宏包把多幅图形放在一人图形环境中,也可用 floatflt
宏包把图形用文本包围起来。
当有图表时, LaTeX 缺省值不会在超过 70% 的页中加文本。这个可有
begin{document}加上
renewcommandfloatpagefraction{.9}
renewcommandtopfraction{.9}
renewcommandbottomfraction{.9}
renewcommandtextfraction{.1}
setcounter{totalnumber}{50}
setcounter{topnumber}{50}
setcounter{bottomnumber}{50}
即可。
另外,可用 caption宏包减少标题尺寸。
对于一个大的表格,可用
setlength{tabcolsep}{1pt}来减少表格的列间距离;也可用resizebox{!}{5cm}{begin{tabular}
...
end{tabular}}把整个表格当作一个图形
5。标题
一个标题周围的距离是由 parskip, baselineskip等来决定的,要注意的是 LaTeX
宁愿在一页中留下空白,也不愿把一个标题放在此页的底部。如果你要重新定义这些命令,就应该仔细的读一下 titlesec
宏包。
6。文献里面的内容
宏包 mulitoc 可让在单列文本中有一个两列的表格内容存在。
可用 setspace 宏包来减少文献中的行间距离(在文本中也是一个道理)
begin{spacing}{0.9}
tableofcontents
end{spacing}
...
begin{spacing}{0.9}
bibliographystyle{plain}
bibliography{refs}
end{spacing}
如果选用了 natbib 宏包的话(推荐),就可以用 bibsep
来控制items之间的距离。否则就可在导言区里用下面的命令。
letoldthebibliography=thebibliography
letendoldthebibliography=endthebibliography
renewenvironment{thebibliography}[1]{%
begin{oldthebibliography}{#1}%
setlength{parskip}{0ex}%
setlength{itemsep}{0ex}%
}%
{%
end{oldthebibliography}%
}
转载自:http://blog.sina.com.cn/s/blog_5e16f1770100gjjk.html
+-------------+
|TeX 常见问题2|
+-------------+
1。怎样在多栏环境中使用单栏图表?
答:如果你在多栏环境中使用 begin{figure} ...
end{figure}, 图形是不会出现的。如果你用另外的命令
begin{figure*} ...
end{figure*},
图形就会超出右边或有页的上边。解决的方法是把下面命令放在
begin{document}前面
makeatletter
newenvironment{tablehere}
{def@captype{table}}
{}
newenvironment{figurehere}
{def@captype{figure}}
{}
makeatother
然后用 figurehere 和 tablehere 在你平常用 figure[h....] 和
table[h...]的地方。
2。怎样得到度(degree)的符号?
答:在begin{document} 前面用
newcommand{grad}{ensuremath{^{circ}}}
,然后你在文中就可用 45grad等等了。
3。怎样得到一个欧元符号?
答:用usepackage{textcomp} 和
texteuro 或 usepackage{marvosym}
和 EUR都可以。
4。当我应用fancyhdr时,我得到了太多'Overfull vbox' 的信息?
答:这是因为缺省的标题空间太小的原因(文本的一行),不能包括fancy标题(1 line of text + 1
rule)。在导言里面加addtolength{headheight}{2.5pt}即可。
5。当我用 fancyhdr时,左边和右边的题有交叉重合?
答:这是因为section 等命令中的文本太长的原因,可用类似"section[short
version]{very long version
indeed}"来解决问题。
6。怎样从两栏页面中得到单栏的标题和摘要?
答:试试Donald Arseneau的
documentclass{article}
....
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
...
end{abstract}
end{@twocolumnfalse}
]
7。怎样改变只有几行文本的页边距?
答:把以下命令放在begin{document}前面
newenvironment{narrow}[2]{%
begin{list}{}{%
setlength{topsep}{0pt}%
setlength{leftmargin}{#1}%
setlength{rightmargin}{#2}%
setlength{listparindent}{parindent}%
setlength{itemindent}{parindent}%
setlength{parsep}{parskip}%
}%
item[]}{end{list}}
然后
begin{narrow}{1.0in}{0.5in}
... end{narrow} 就产生了左边缩小1.0
英寸和右边缩小 0.5 英寸的效果
8。我的文本在开始时就停止不编译?
答:这是因为每一次文本编译时都有对应的*.aux文件(前一次产生的),所以删去这个文件重新编译即可。
9。在eps上加公式的另一个方法。
答:1)建一个eps图形;
2)在你所想放置的地方写下文本(如公式);
3)在latex文本中用命令
usepackage{psfrag} ;
4)用命令
psfrag{formula}{some
text $sum_1^infty int
frac{a^2}{b_i}$
}让latex为做工作。
例如
documentclass[12pt]{article}
usepackage{psfrag}
usepackage{epsfig}
begin{document}
begin{figure}
begin{center}
psfrag{formula1}{some
text $sum_1^infty int
frac{a^2}{b_i}$}
psfrag{formula2}{other
text
$int_0^{frac{a^2}{b}}
sqrt{c}$}
epsfig{file=example.eps,
width=12cm}
end{center}
caption{The example
figure}
label{exampl}
end{figure}
end{document}
10。怎样把一个大表格横向放置?
答:用宏包usepackage{rotating},然后变换
begin{table}
....
end{table}
为
begin{sidewaystable}
....
end{sidewaystable}
注意这个旋转很可能在你的预览中不会再现。
11。关于itemize。
答: 清单至多有四级
$bullet$ - labelitemi
textbf{ --} - labelitemii
$ast$ - labelitemiii
$cdot$ - labelitemiv
你可重新定义
def{labelitemi}{$spadesuit$}
renewcommand{labelitemi}{$spadesuit$}
也可在itemize 环境中item命令中同时拥有不同的标签
begin{itemize}
item[$heartsuit$] ...
item[$diamondsuit$] ...
item[$clubsuit$] ...
end{itemize}
数字序列至多四级顺序可显示,如
1,2 ... - enumi
(a), (b) ... - enumii
i,ii,... - enumiii
A., B. ... - enumiv
你也可指明选项,如
begin{enumerate}
item[(1)]
item[(2)] ...
end{enumerate}
12。我怎样重新定义items之间的距离?
答:用miktex2.1中的mdwlist宏包,也可从CTAN的macros/latex/contrib/supported/mdwtools.zip
上下载后。
13。怎样改变行距?
答:用doublespace宏包,参数"coef"是baselinestretch文本中定义数值,则可用命令
begin{spacing}{coef}
% coef=2 时双倍行距了
... text
end{spacing}
14。 怎么定义一个定理型环境?
答:用theorem宏包,例子:
newtheorem{howto}{Questions}[section]
theoremstyle{change}
theorembodyfont{itshape}
theoremheaderfont{scshape}
15。怎样在latex中包括一每列的源文件?
答:例如
floatstyle{boxed}
restylefloat{figure}
begin{figure}[hb]
begin{listing}{1}
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
for (i = 0; i < argc; ++i)
printf("argv[%d] = %sn", i, argv[i]);
return 0;
}
end{listing}
caption{A numbered C
program}
end{figure}
16。怎样把附录A中的公式序号变为 A.1, A.2, .... B.1, B.2, ...的形式?
答: appendix
makeatletter
renewcommandtheequation{A.@arabicc@equation
}
makeatother
setcounter{equation}{0}
或者
renewcommand{theequation}{A.arabic{equation}}
17。怎样把一个 vertatim 放入 verbatim环境中?
答:用fancyvrb宏包定义自己的 verbatim环境。
18。怎样改变主文本中的字体?
答:命令: textnorml;申明: normalfontttfamiliy
19。怎样定义一个命令或申明 ?
答:例如一个命令:
newcommand{name}{1]{textsc{#1}}
一个申明:
newcommand{name}{1]{{normalfontscshape
#1}}
20。怎样合并字体命令?
答: textrm{...}
{rmfamily...} roman
familiy
textsf{...}
{sffamliy...} sans serif
family
texttt{...}
{ttfamily...} typewritter
family
textmd{...}
{mdserier...} medium
series
textbf{...}
{bfseries...} bold series
textup{...}
{upshape...} upright shape
textit{...}
{itshape...} italic shape
textsl{...}
{slshape...} slanted shape
textsc{...}
{scshape...} small caps
shape
size tiny scriptsize footnotesize small normalsize
large
Large LARGE huge Huge
emph{...} {em
...} emphasized
textnormal{...}
{normalfont...} document
font
21。 怎样在页眉和页脚中划一道横线?
答:用 fancyhdr宏包。
22。怎样改变章节字体(section fonts)?
答:用titlesec宏包,例如
usepackage[nops,sf,small,compact]{titlesec}
23。怎样做一个页面设置?
答: usepackage{fancyhdr}
pagestyle{fancy}
fancyhead{} %clear all
fields
fancyhead[RO, LE]{bfseries
LaTeXe{}
HOWTO}
fancyfoot[LE, RO]{thepage of
pageref{LastPage}}
fancyfoot[LO, CE]{}
fancyfoot[CO, RE]{Techical
Report}
renewcommand{headrulewidth}{0.4pt}
renewcommand{footrulewidth}{0.4pt}
24。怎样实现"page M of N"的形式?
答:用lastpage宏包,任何时候你都可在文本中用
pageref{LastPage},只是须注意当用了fancyhdr宏包时,lastpage宏包就须在它后面。
25。怎样实现下划线的标题?
答:
def@evenhead{makebox[0pt][l]{rule[-0.15cm]{textwidth}{0.1mm}}hbox{}%
textbfthepagehfilleftmark}%
def@oddhead{makebox[0pt][l]{rule[-0.15cm]{textwidth}{0.1mm}}hbox{}%
{rightmark}hfiltextbfthepage}%
26。 怎样把一个浮动对象固定下来?
答:例如
begin{figure}[h]
...
end{figure]
27。怎样定义一个新的浮动 "float" 形式?
答:用float宏包,用newfloat就可定义新的浮动形式,它的语法是:
newfloat{type}{placement}{ext}{within}
- type 是浮动新类型名
- placement 可以是 t, b, p, h 和 H
- ext 是以章节列序的任何图表的后缀名
floatstyle{style}, 其中 style
可以是
- plain, 空白
- boxed, 盒子
- ruled,
floatname{float}{floatname}
定义了浮动标题名,像图的 "Figure" 等等。
restylefloat{float}用于改变图表的标准浮动形式,例如可以
floatstyle{ruled}
restylefloat{table}
一个例子是:
documentclass{article}
usepackage{float, times}
thispagestyle{empty}
floatstyle{ruled}
newfloat{Program}{thp}{lop}[section]
floatstyle{boxed}
newfloat{algorithm}{thp}{loa}
floatname{algorithm}{Algorithm}
begin{document}
section{Let's begin}
This document show some possibilities of
texttt{float.sty}
for floating objects.
begin{Program}
begin{verbatim}
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
for (i = 0; i < argc; ++i)
printf("argv[%d] = %sn", i, argv[i]);
return 0;
}
end{verbatim}
caption{A simple C
program}
end{Program}
....
end{document}
28。 怎样让文字在一个窄小的浮动图周围?
答:用floatfig宏包,其改进宏包是floatflt宏包。语法是
begin{floatingfigure}[options]{width
of figure}
figure contents
end{floatingfigure}
一个例子是:
documentclass{article}
usepackage{floatfig,
epsfig}
...bla bla bla
par
begin{floatingfigure}{6cm}
... anything possible in figure environment
end{floatingfigure}
后面的文本将会和浮动图形平行 ,可惜floatfig宏包不是Miktex自带的。
也可用 <wrapfigure> 宏包,语法为
begin{wrapfigure}[nlines]{placement}{width}figure,
caption, etc.
end{wrapfigure}
- nlines定义了文本折行为,每一个方程占3行。
- placement水平位置(l,r)
- width图形宽度
一个例子是
begin{wrapfigure}{r}{3in}
begin{boxit}
begin{center} This is a
"wrapfigure" end{center}
caption{A wrapfigure
example}
end{boxit}
end{wrapfigure}
注意, wrapfigure
是不浮动的,所以它可能和浮动图形的顺序就不一样了,并且它不能在“列表list”中,详见王磊的插图指南。
也可用 picins 宏包,命令是
parpic(width,height)(x-off,y-off)[Options][Position]{Picture}
段落文本
除了 Picture 以外所有的命令都是可选的,详见王磊的插图指南。
29。怎样使图形并列?
答:用subfigure宏包。
一个例子是 begin{figure}
centering
mbox{
subfigure[Big]{includegraphics
...} quad
subfigure[Small]{includegraphics
...} quad
subfigure[Medium]{includegraphics
...} quad }
caption{Three subfigures}
label{fig:subfigures}
end{figure}
30。把一幅 .eps 横向放置后,怎样使标题变为相应的形式?
答: usepackage{rotating}
和
begin{sidewaysfigure}centering
includegraphics[width=?cm]{*.eps}
caption{...}
end{sidewaysfigure}
+-------------+
|TeX 常见问题3|
+-------------+
压缩空间
1。页面设置
a4 会给你一个较小的页面,为了使用更多的控制,可用 geometry宏包和命令 layout 。
2。改变长度
在latex里改变长度的命令是 addtolength 和 setlength。latex可认的是 cm, mm, in 和
pt. 变量可设为负数。一个例子是
addtolength{parindent}{-5mm}
一些有用的变量是:
页面设置
columnsep: 列间距
topmargin: 页眉到页边的距离
topskip: 页眉与正文的距离
textheight: 正文的高度
textwidth: 文本的宽度
oddsidemargin: 奇数页的左面页边距
evensidemargin : 偶数页的左面页边距
段落
parindent: 段落缩进距离
parskip: 段落间的距离
浮动图表
floatsep: 浮动对象之间的距离
textfloatsep: 最后一个浮动对象顶端或第一个浮动对象底端与正文之间的距离
intextsep : 文中浮动顶端与底端所留的距离
dbltextfloatsep 是在双列输出时用 textfloatsep 的数值
dblfloatsep 是在双列输出时用 floatsep 的数值
abovecaptionskip: 标题上方的距离
belowcaptionskip: 标题下方的距离
数学公式
abovedisplayskip: 公式前的距离
belowdisplayskip: 公式后面的距离
arraycolsep: 在一个array中列之间的空白长度
列表
topsep: 第一个item和前面版落间的距离
partopsep: 当在一个新页开始时加到 topsep 的额外空间
itemsep: 连续items之间的距离。
3。环境
宏包 atbeginend.sty 提供了
BeforeBegin{environment}{code-to-execute},
AfterEnd 等等命令。这些命令可去掉环境外面和内部的空间。例如
AfterBegin{itemize}{addtolength{itemsep}{-baselineskip}}
就在环境内以重新设置 itemsep 来压缩items之间的距离 。
mdwlist 宏包有一个 itemize* 环境; paralist
宏包提供了一个item之间距离压缩环境和一个使每个item不在新的一段开始的 inparaenum 环境。
4。图表
为了节约空间,可用 subfigure 宏包把多幅图形放在一人图形环境中,也可用 floatflt
宏包把图形用文本包围起来。
当有图表时, LaTeX 缺省值不会在超过 70% 的页中加文本。这个可有
begin{document}加上
renewcommandfloatpagefraction{.9}
renewcommandtopfraction{.9}
renewcommandbottomfraction{.9}
renewcommandtextfraction{.1}
setcounter{totalnumber}{50}
setcounter{topnumber}{50}
setcounter{bottomnumber}{50}
即可。
另外,可用 caption宏包减少标题尺寸。
对于一个大的表格,可用
setlength{tabcolsep}{1pt}来减少表格的列间距离;也可用resizebox{!}{5cm}{begin{tabular}
...
end{tabular}}把整个表格当作一个图形
5。标题
一个标题周围的距离是由 parskip, baselineskip等来决定的,要注意的是 LaTeX
宁愿在一页中留下空白,也不愿把一个标题放在此页的底部。如果你要重新定义这些命令,就应该仔细的读一下 titlesec
宏包。
6。文献里面的内容
宏包 mulitoc 可让在单列文本中有一个两列的表格内容存在。
可用 setspace 宏包来减少文献中的行间距离(在文本中也是一个道理)
begin{spacing}{0.9}
tableofcontents
end{spacing}
...
begin{spacing}{0.9}
bibliographystyle{plain}
bibliography{refs}
end{spacing}
如果选用了 natbib 宏包的话(推荐),就可以用 bibsep
来控制items之间的距离。否则就可在导言区里用下面的命令。
letoldthebibliography=thebibliography
letendoldthebibliography=endthebibliography
renewenvironment{thebibliography}[1]{%
begin{oldthebibliography}{#1}%
setlength{parskip}{0ex}%
setlength{itemsep}{0ex}%
}%
{%
end{oldthebibliography}%
}
相关文章推荐
- mysql数据库插入中文以及乱码问题解决(统一设置为utf-8)格式
- 【iOS-Cocos2d游戏开发之八】开启高清(960*640)模式问题与解答、图片适配以及设置iphone横竖屏
- 设置角色遗留问题和为权限设置角色以及EasyUI Tabs的使用
- android设置软键盘搜索键以及监听搜索键点击时发生两次事件的问题解决
- QT获取系统时间,以及设置日期格式
- Android ListView的item背景色设置以及item点击无响应等相关问题
- *.tar.gz的打开以及问题解决,还有tar打包压缩的命令
- SQLSERVER2005的混和身份验证模式的设置以及SA登陆问题
- 代码中设置Edittext提示语hint的字体大小时遇到的机型适配问题(小米以及部分华为手机会有问题)
- 如何把word转成pdf格式以及如何从指定页开始设置页码技巧
- jquery下动态显示jqGrid以及jqGrid的属性设置容易出现问题的解决方法
- 使用表格时td不能设置宽度的问题以及文字不能换行问题
- 解决Android设置软键盘搜索键以及监听搜索键点击时发生两次事件的问题
- UVA 1593 Alignment of Code 注意格式问题。。以及可以用stringstream解决但是我没用
- 【Cocos2d游戏开发之八】开启高清(960*640)模式问题与解答、图片适配以及设置iphone横竖屏
- LaTeX中CTeX版本日期格式设置英文
- 关于JTable设置数据源以及获取焦点行数据问题
- ubuntu下运行等级设置以及引导加载程序路径问题
- ASP.NET MVC+EF框架+EasyUI实现权限管理系列(23)-设置角色遗留问题和为权限设置角色以及EasyUI Tabs的使用
- php上传图片,解决in_array无效的问题,以及判断图片格式类型