《LaTex辅谈:LaTeX命令速查手册.doc》由会员分享,可在线阅读,更多相关《LaTex辅谈:LaTeX命令速查手册.doc(11页珍藏版)》请在三一办公上搜索。
1、LaTex辅谈:LaTeX命令速查手册51。怎样在多栏环境中使用单栏图表?答:如果你在多栏环境中使用 beginfigure . endfigure, 图形是不会出现的。如果你用另外的命令 beginfigure* . endfigure*, 图形就会超出右边或有页的上边。解决的方法是把下面命令放在 begindocument前面makeatletternewenvironmenttableheredefcaptypetablenewenvironmentfigureheredefcaptypefiguremakeatother然后用 figurehere 和 tablehere 在你平常用
2、figureh. 和 tableh.的地方。2。怎样得到度(degree)的符号?答:在begindocument 前面用 newcommandgradensuremathcirc ,然后你在文中就可用 45grad等等了。3。怎样得到一个欧元符号?答:用usepackagetextcomp 和 texteuro 或 usepackagemarvosym 和 EUR都可以。4。当我应用fancyhdr时,我得到了太多Overfull vbox 的信息?答:这是因为缺省的标题空间太小的原因(文本的一行),不能包括fancy标题(1 line of text + 1 rule)。在导言里面加add
3、tolengthheadheight2.5pt即可。5。当我用 fancyhdr时,左边和右边的题有交叉重合?答:这是因为section 等命令中的文本太长的原因,可用类似sectionshort versionvery long version indeed来解决问题。6。怎样从两栏页面中得到单栏的标题和摘要?答:试试Donald Arseneau的documentclassarticle.begindocumenttwocolumnbegintwocolumnfalsemaketitlebeginabstract.endabstractendtwocolumnfalse7。怎样改变只有几行
4、文本的页边距?答:把以下命令放在begindocument前面newenvironmentnarrow2%beginlist%setlengthtopsep0pt%setlengthleftmargin#1%setlengthrightmargin#2%setlengthlistparindentparindent%setlengthitemindentparindent%setlengthparsepparskip%itemendlist然后 beginnarrow1.0in0.5in . endnarrow 就产生了左边缩小1.0 英寸和右边缩小 0.5 英寸的效果8。我的文本在开始时就停
5、止不编译?答:这是因为每一次文本编译时都有对应的*.aux文件(前一次产生的),所以删去这个文件重新编译即可。9。在eps上加公式的另一个方法。答:1)建一个eps图形;2)在你所想放置的地方写下文本(如公式);3)在latex文本中用命令 usepackagepsfrag ;4)用命令 psfragformulasome text $sum_1infty int fraca2b_i$ 让latex为做工作。例如documentclass12ptarticleusepackagepsfragusepackageepsfigbegindocumentbeginfigurebegincenterp
6、sfragformula1some text $sum_1infty int fraca2b_i$psfragformula2other text $int_0fraca2b sqrtc$epsfigfile=example.eps, width=12cmendcentercaptionThe example figurelabelexamplendfigureenddocument10。怎样把一个大表格横向放置?答:用宏包usepackagerotating,然后变换begintable.endtable为beginsidewaystable.endsidewaystable注意这个旋转很可
7、能在你的预览中不会再现。11。关于itemize。答: 清单至多有四级$bullet$ - labelitemitextbf - - labelitemii$ast$ - labelitemiii$cdot$ - labelitemiv你可重新定义deflabelitemi$spadesuit$renewcommandlabelitemi$spadesuit$也可在itemize 环境中item命令中同时拥有不同的标签beginitemizeitem$heartsuit$ .item$diamondsuit$ .item$clubsuit$ .enditemize数字序列至多四级顺序可显示,如
8、1,2 . - enumi(a), (b) . - enumiii,ii,. - enumiiiA., B. . - enumiv你也可指明选项,如beginenumerateitem(1)item(2) .endenumerate12。我怎样重新定义items之间的距离?答:用miktex2.1中的mdwlist宏包,也可从CTAN的macros/latex/contrib/supported/mdwtools.zip 上下载后。13。怎样改变行距?答:用doublespace宏包,参数coef是baselinestretch文本中定义数值,则可用命令beginspacingcoef % c
9、oef=2 时双倍行距了. textendspacing14。 怎么定义一个定理型环境?答:用theorem宏包,例子:newtheoremhowtoQuestionssectiontheoremstylechangetheorembodyfontitshapetheoremheaderfontscshape15。怎样在latex中包括一每列的源文件?答:例如floatstyleboxedrestylefloatfigurebeginfigurehbbeginlisting1#include int main(int argc, char *argv)int i;for (i = 0; i a
10、rgc; +i)printf(argv%d = %sn, i, argvi);return 0;endlistingcaptionA numbered C programendfigure16。怎样把附录A中的公式序号变为 A.1, A.2, . B.1, B.2, .的形式?答: appendixmakeatletterrenewcommandtheequationA.arabiccequation makeatothersetcounterequation0或者 renewcommandtheequationA.arabicequation17。怎样把一个 vertatim 放入 verb
11、atim环境中?答:用fancyvrb宏包定义自己的 verbatim环境。18。怎样改变主文本中的字体?答:命令: textnorml;申明: normalfontttfamiliy19。怎样定义一个命令或申明 ?答:例如一个命令: newcommandname1textsc#1一个申明: newcommandname1normalfontscshape #120。怎样合并字体命令?答: textrm. rmfamily. roman familiytextsf. sffamliy. sans serif familytexttt. ttfamily. typewritter familyt
12、extmd. mdserier. medium seriestextbf. bfseries. bold seriestextup. upshape. upright shapetextit. itshape. italic shapetextsl. slshape. slanted shapetextsc. scshape. small caps shapesize tiny scriptsize footnotesize small normalsize largeLarge LARGE huge Hugeemph. em . emphasizedtextnormal. normalfon
13、t. document font21。 怎样在页眉和页脚中划一道横线?答:用 fancyhdr宏包。22。怎样改变章节字体(section fonts)?答:用titlesec宏包,例如usepackagenops,sf,small,compacttitlesec23。怎样做一个页面设置?答: usepackagefancyhdrpagestylefancyfancyhead %clear all fieldsfancyheadRO, LEbfseries LaTeXe HOWTOfancyfootLE, ROthepage of pagerefLastPagefancyfootLO, CEf
14、ancyfootCO, RETechical Reportrenewcommandheadrulewidth0.4ptrenewcommandfootrulewidth0.4pt24。怎样实现page M of N的形式?答:用lastpage宏包,任何时候你都可在文本中用 pagerefLastPage,只是须注意当用了fancyhdr宏包时,lastpage宏包就须在它后面。25。怎样实现下划线的标题?答: defevenheadmakebox0ptlrule-0.15cmtextwidth0.1mmhbox%textbfthepagehfilleftmark%defoddheadmake
15、box0ptlrule-0.15cmtextwidth0.1mmhbox%rightmarkhfiltextbfthepage%26。 怎样把一个浮动对象固定下来?答:例如beginfigureh.endfigure27。怎样定义一个新的浮动 float 形式?答:用float宏包,用newfloat就可定义新的浮动形式,它的语法是:newfloattypeplacementextwithin- type 是浮动新类型名- placement 可以是 t, b, p, h 和 H- ext 是以章节列序的任何图表的后缀名floatstylestyle, 其中 style 可以是- plain,
16、 空白- boxed, 盒子- ruled,floatnamefloatfloatname定义了浮动标题名,像图的 Figure 等等。restylefloatfloat用于改变图表的标准浮动形式,例如可以floatstyleruledrestylefloattable一个例子是:documentclassarticleusepackagefloat, timesthispagestyleemptyfloatstylerulednewfloatProgramthplopsectionfloatstyleboxednewfloatalgorithmthploafloatnamealgorithm
17、AlgorithmbegindocumentsectionLets beginThis document show some possibilities of textttfloat.styfor floating objects.beginProgrambeginverbatim#include int main(int argc, char *argv)int i;for (i = 0; i argc; +i)printf(argv%d = %sn, i, argvi);return 0;endverbatimcaptionA simple C programendProgram.endd
18、ocument28。 怎样让文字在一个窄小的浮动图周围?答:用floatfig宏包,其改进宏包是floatflt宏包。语法是 beginfloatingfigureoptionswidth of figurefigure contentsendfloatingfigure一个例子是:documentclassarticleusepackagefloatfig, epsfig.bla bla blaparbeginfloatingfigure6cm. anything possible in figure environmentendfloatingfigure后面的文本将会和浮动图形平行 ,可
19、惜floatfig宏包不是Miktex自带的。也可用 宏包,语法为beginwrapfigurenlinesplacementwidthfigure, caption, etc.endwrapfigure- nlines定义了文本折行为,每一个方程占3行。- placement水平位置(l,r)- width图形宽度一个例子是beginwrapfigurer3inbeginboxitbegincenter This is a wrapfigure endcentercaptionA wrapfigure exampleendboxitendwrapfigure注意, wrapfigure 是不
20、浮动的,所以它可能和浮动图形的顺序就不一样了,并且它不能在“列表list”中,详见王磊的插图指南。也可用 picins 宏包,命令是parpic(width,height)(x-off,y-off)OptionsPositionPicture段落文本除了 Picture 以外所有的命令都是可选的,详见王磊的插图指南。29。怎样使图形并列?答:用subfigure宏包。一个例子是 beginfigurecenteringmbox subfigureBigincludegraphics . quadsubfigureSmallincludegraphics . quadsubfigureMediu
21、mincludegraphics . quad captionThree subfigureslabelfig:subfiguresendfigure30。把一幅 .eps 横向放置后,怎样使标题变为相应的形式?答: usepackagerotating和beginsidewaysfigurecenteringincludegraphicswidth=?cm*.epscaption.endsidewaysfigure+-+|TeX 常见问题3|+-+压缩空间1。页面设置a4 会给你一个较小的页面,为了使用更多的控制,可用 geometry宏包和命令 layout 。2。改变长度在latex里改
22、变长度的命令是 addtolength 和 setlength。latex可认的是 cm, mm, in 和 pt. 变量可设为负数。一个例子是 addtolengthparindent-5mm一些有用的变量是:页面设置columnsep: 列间距topmargin: 页眉到页边的距离topskip: 页眉与正文的距离textheight: 正文的高度textwidth: 文本的宽度oddsidemargin: 奇数页的左面页边距evensidemargin : 偶数页的左面页边距段落parindent: 段落缩进距离parskip: 段落间的距离浮动图表floatsep: 浮动对象之间的距离
23、textfloatsep: 最后一个浮动对象顶端或第一个浮动对象底端与正文之间的距离intextsep : 文中浮动顶端与底端所留的距离dbltextfloatsep 是在双列输出时用 textfloatsep 的数值dblfloatsep 是在双列输出时用 floatsep 的数值abovecaptionskip: 标题上方的距离belowcaptionskip: 标题下方的距离数学公式abovedisplayskip: 公式前的距离belowdisplayskip: 公式后面的距离arraycolsep: 在一个array中列之间的空白长度列表topsep: 第一个item和前面版落间的距
24、离partopsep: 当在一个新页开始时加到 topsep 的额外空间itemsep: 连续items之间的距离。3。环境宏包 atbeginend.sty 提供了 BeforeBeginenvironmentcode-to-execute, AfterEnd 等等命令。这些命令可去掉环境外面和内部的空间。例如 AfterBeginitemizeaddtolengthitemsep-baselineskip 就在环境内以重新设置 itemsep 来压缩items之间的距离 。mdwlist 宏包有一个 itemize* 环境; paralist 宏包提供了一个item之间距离压缩环境和一个使
25、每个item不在新的一段开始的 inparaenum 环境。4。图表为了节约空间,可用 subfigure 宏包把多幅图形放在一人图形环境中,也可用 floatflt 宏包把图形用文本包围起来。当有图表时, LaTeX 缺省值不会在超过 70% 的页中加文本。这个可有 begindocument加上renewcommandfloatpagefraction.9renewcommandtopfraction.9renewcommandbottomfraction.9renewcommandtextfraction.1setcountertotalnumber50setcountertopnumb
26、er50setcounterbottomnumber50即可。另外,可用 caption宏包减少标题尺寸。对于一个大的表格,可用 setlengthtabcolsep1pt来减少表格的列间距离;也可用resizebox!5cmbegintabular . endtabular把整个表格当作一个图形5。标题一个标题周围的距离是由 parskip, baselineskip等来决定的,要注意的是 LaTeX 宁愿在一页中留下空白,也不愿把一个标题放在此页的底部。如果你要重新定义这些命令,就应该仔细的读一下 titlesec 宏包。6。文献里面的内容宏包 mulitoc 可让在单列文本中有一个两列的
27、表格内容存在。可用 setspace 宏包来减少文献中的行间距离(在文本中也是一个道理)beginspacing0.9tableofcontentsendspacing.beginspacing0.9bibliographystyleplainbibliographyrefsendspacing如果选用了 natbib 宏包的话(推荐),就可以用 bibsep 来控制items之间的距离。否则就可在导言区里用下面的命令。letoldthebibliography=thebibliographyletendoldthebibliography=endthebibliographyrenewenvironmentthebibliography1%beginoldthebibliography#1%setlengthparskip0ex%setlengthitemsep0ex%endoldthebibliography%