当前位置:文档之家› Abstract Inferring and Debugging Path MTU Discovery Failures

Abstract Inferring and Debugging Path MTU Discovery Failures

Abstract Inferring and Debugging Path MTU Discovery Failures
Abstract Inferring and Debugging Path MTU Discovery Failures

Inferring and Debugging Path MTU Discovery Failures

Matthew Luckie University of Waikato mjl@https://www.doczj.com/doc/9e13238082.html,

Kenjiro Cho

Internet Initiative Japan

kjc@https://www.doczj.com/doc/9e13238082.html,

Bill Owens

NYSERNet

owens@https://www.doczj.com/doc/9e13238082.html,

Abstract

If a host can send packets larger than an Internet path can forward,it relies on the timely delivery of Internet Control Message Protocol(ICMP)messages advising that the pac-ket is too big to forward.An ICMP Packet Too Big message reports the largest packet size–or Maximum Transmission Unit(MTU)–that can be forwarded to the next hop.The iterative process of determining the largest packet size sup-ported by a path by learning the next-hop MTU of each MTU-constraining link on the path is known as Path MTU Discovery(PMTUD).It is fundamental to the optimal oper-ation of the Internet.There is a perception that PMTUD is not working well in the modern Internet due to ICMP mes-sages being?rewalled or otherwise disabled due to security concerns.This paper provides a review of modern PMTUD failure modes.We present a tool designed to help network operators and users infer the location of a failure.The tool provides fairly detailed information about each failure,so the failure can be resolved.Finally,we provide data on the failures that occurred on a large jumbo-capable network and?nd that although disabling ICMP messages is a prob-lem,many other failure modes were found.

1Introduction

Given a volume of data to send,it is desirable to encap-sulate the data in the fewest number of packets possible, as“much of the cost of packetised communication is per-packet rather than per-probe”[1].To send the fewest num-ber of packets possible,a host must determine the largest IP packet size–or Maximum Transmission Unit(MTU)–supported by the path.The iterative process to deter-mine the largest possible MTU on an end-to-end path by consecutively learning the next-hop MTU of each MTU-constraining link on the path is known as Path MTU Dis-covery(PMTUD).PMTUD allows a host or application to determine the largest IP packet size supported by an Inter-net path,and thus send the fewest number of packets.

Path MTU Discovery is documented in RFC1191for IPv4[2]and RFC1981for IPv6[3].An application or kernel determines the largest supported MTU on an Inter-net path in an iterative manner,starting with the outgoing interface’s MTU.It reduces the Path MTU each time a Pac-ket Too Big(PTB)message is received until the destination host is reached,using the next-hop MTU value included in each successive PTB message.When this approach to PM-TUD works,it allows an end host to quickly determine the Path MTU.There are,however,a number of well-known limitations of this technique[4],and work is in progress in the IETF to rede?ne the PMTUD method.This work discusses the current approach to PMTUD.

The failure modes of PMTUD are often dif?cult to de-bug,as they are triggered by relatively large packets.For example,a TCP connection may be established through a path where a PMTUD failure exists,as the TCP three-way handshake involves small packets that are unlikely to trigger a PMTUD failure.However,a PMTUD failure is likely to occur when either end of the TCP connection at-tempts to send a packet that is larger than can be forwarded through the path without fragmentation.A scenario like this is likely to cause the TCP connection to stall for some period of time before either failing,sending smaller pack-ets,or allowing retransmitted packets to be fragmented. This work introduces a technique for inferring and de-bugging PMTUD failures which occur on the forward path. Our technique uses a traceroute-like method to infer the lo-cation of a failure and the maximum packet size which can be forwarded through it.The technique does not infer fail-ures that occur on the reverse path,such as the over-zealous ?rewalling of all inbound ICMP packets–including PTB messages–in order to protect a machine from security con-cerns related to ICMP or crude Denial of Service(DoS) attacks[5].A recent study on the TCP behaviour of web-servers[6]found that PMTUD on the reverse path failed for 17%of81776targets tested and35%of500popular web-sites tested–presumably because of middle-boxes which blocked inbound ICMP to the web-servers.

The rest of this paper is organised as follows.We begin by reviewing some of the known PMTUD failures in Sec-tion2.We then discuss the debugging techniques used in this work to infer the location and mode of a PMTUD fail-ure,and discuss the implementation of these techniques in our publicly available tool,scamper,in Section3.In Sec-tion4,we discuss the data collection that we did in support of this work,and then present some analysis of the results obtained in Section5.Finally,we discuss a few anecdotes of strange behaviours we observed separate to the data col-lection for this study,before presenting our conclusions.

2Path MTU Discovery Failure Modes

2.1Router Con?guration Issues

The most well known PMTUD failure mode is the ICMP Black Hole discussed in RFC2923[4].The ICMP Black Hole problem has two halves;routers which do not send PTB messages due to miscon?guration or implementation bugs,and hosts which do not receive PTB messages due to a middle-box or?rewall?ltering them.The problem of router miscon?guration was?rst documented in RFC 1435[7],where it was reported that code had been added to some routers to provide the capability to disable ICMP message generation in order to protect old BSD hosts, which were faulty in their handling of some ICMP mes-sages.The RFC recommended that router code be updated to exclude PTB messages from suppression,as that par-ticular message type did not trigger the faulty behaviour. However,it appears that this recommendation has either not been widely implemented,or operators are not using it. In the modern Internet,a router which does not send any ICMP message is almost certainly con?gured that way due to security concerns.

2.2MTU Mismatches

An MTU mismatch occurs when a router and the path to the next-hop do not have a consistent understanding of the MTU.Speci?cally,a router believes that the path to the next hop is capable of forwarding packets larger than it ac-tually can.Such a mismatch causes PMTUD to fail be-cause the MTU change occurs below the IP layer,where a PTB message is not sent.A common scenario where this occurs is connecting a jumbo-capable gigabit Ethernet in-terface and a non-jumbo interface,which could be gigabit or fast Ethernet,across a switch.It can also occur if two jumbo interfaces are connected to a switch that does not support jumbo packets.The jumbo-capable Ethernet inter-face can send packets larger than1500bytes to the switch. However,the switch either cannot accept these packets,or cannot forward them to the next interface,and so the pack-ets are silently discarded.2.3No Suggested Next-Hop MTU

The original IPv4ICMP protocol[8]did not de?ne the next-hop MTU?eld that PMTUD relies on to determine the largest packet size supported to the next hop.The next-hop MTU?eld was?rst de?ned in RFC1191[2],and makes use of otherwise unused space in the ICMP mes-sage.Routers that do not set the next-hop MTU?eld in a PTB message are easily detected,as the unused space is set to zero.In the face of a PTB message without a suggested next-hop MTU,current practice in the NetBSD kernel–among others–is to determine the size of the packet that caused the PTB message by examining the length?eld re-turned with the IP header embedded in the PTB message and then select a smaller packet size from a table of known MTU values.

2.4Private Addressing

Some operators choose to use RFC1918[9]private ad-dresses when numbering router interfaces in order to avoid using public addresses.The use of RFC1918addresses can cause PMTUD to fail if PTB messages are sent with an RFC1918source address,since packets with RFC1918 source addresses are often dropped by ingress?lters at the network edge.

2.5Unspeci?ed Implementation Bugs There are other possibilities of PMTUD failure modes re-lated to implementation bugs.For example,a router may send a PTB message with a suggested next-hop MTU larger than the size of the packet which caused it to be sent.Pos-sible causes of this failure mode include not sending the next-hop MTU?eld in network byte order,or a router not adjusting internal state correctly when adding or remov-ing headers.Other possible implementation bugs include: sending a PTB message with the embedded IP packet mod-i?ed in some way such that the PTB message is unable to be matched with an active connection or application;sending an ICMP error message without generating a valid ICMP checksum;and sending an ICMP error message that is not a PTB message when it should have been.

3Debugging Techniques

We have implemented two forward path debugging tech-niques into scamper,our publicly available measurement tool.The initial goal of the PMTUD code in scamper was to enable the detection of IPv6-over-IPv4tunnels when com-paring IPv4and IPv6paths between pairs of dual-stack nodes[10].The code has evolved beyond this requirement, in part due to experiences in inferring tunnels in uncooper-ative paths.

To begin with,scamper conducts a standard traceroute with small UDP probes to unused ports.The purpose of this initial phase is to infer the forward IP path topology, determine which routers will provide ICMP feedback to small TTL-limited probes,and ensure that small probes are terminated somewhere in the path by an ICMP Des-tination Unreachable message so that scamper can distin-guish between large probes being silently discarded and all probes being silently discarded.After the traceroute com-pletes,scamper begins a PMTUD phase,where it solicits PTB messages in response to large probes until the desti-nation is reached.scamper infers that PMTUD has failed when it does not obtain an expected reply packet to a probe the size of the currently known Path MTU value.When a PMTUD failure is detected,it uses one of two debugging techniques to infer the location of the failure and the largest packet which can be forwarded.Before we describe the two debugging techniques in detail,we describe the process by which the next-hop MTU is inferred.

3.1Next-hop MTU Search

The purpose of the next-hop MTU search is to infer the largest packet size which can be forwarded to the next-hop. The general strategy is to,as quickly as possible,reduce a search space bounded by the smallest packet size to obtain a valid response and the largest packet size to not obtain a valid response,to?nd the underlying next-hop MTU.A binary search is not well suited to this task,for two rea-sons.First,MTU values tend to cluster due to the fairly limited combinations of media MTU values and encapsula-tions commonly used.Second,each probe that is discarded without the source receiving any ICMP feedback incurs a timeout delay that is often at least an order of magnitude larger than the delay incurred when probing with a pac-ket that does obtain ICMP feedback.By default,scamper will retry a probe that obtains no ICMP feedback once,?ve seconds after sending the initial probe.In this scenario,a choice of probe size that does not obtain ICMP feedback in-curs a ten second penalty before a different probe size can be tried.In order to determine the actual next-hop MTU as quickly and ef?ciently as possible,scamper is pre-loaded with a table of known MTU values.

When scamper begins a next-hop MTU search,it de?nes the lower bound by selecting an MTU in the table smaller than the failed probe,depending on three criteria.First, if the failed probe is larger than1500bytes,then scamper tries with a1500byte packet,as Ethernet is ubiquitous and likely to be the cause of an MTU restriction from larger frame sizes.Second,if the failed probe is larger than1454 bytes,then scamper tries with a1454byte probe because 1454is a lower bound of a series of MTU values that in-dicate some tunnel or encapsulation of IP over Ethernet. Otherwise,scamper selects the largest MTU from the table that is smaller than the size of the failed probe.The search for the initial lower bound is complete when ICMP feed-back is obtained;the upper bound is reduced each time a probe for the initial lower bound does not obtain feedback. After the lower bound is set,scamper then narrows the search space until it converges on the actual next-hop MTU. The approach to choosing a suitable probe size consists of three criteria,which are checked in order until a matching condition is found.First,if the lower bound of the search space is1500bytes or is a known MTU value in the table, and the upper bound is smaller than the next largest known MTU,then scamper probes with a packet one byte larger than the lower bound.The rationale for this is that if the search space is narrowed to within two entries in the MTU table,then there is a fair chance that the actual next-hop MTU is the current lower bound,and we can con?rm this by sending a probe one byte larger.Second,if the next largest MTU in the table is smaller than the current upper bound,then scamper chooses this MTU as its next probe size.The rationale for this decision is that scamper can quickly determine the next-hop MTU if it is one of the val-ues in the https://www.doczj.com/doc/9e13238082.html,stly,if scamper is working within two known MTU values,then it will resort to a binary search to determine the next-hop MTU.

3.2Inferring MTU without Feedback

This technique is used to infer the next-hop MTU and lo-cation of a hop that does not send PTB messages when it should.This technique is used when scamper does not ob-tain ICMP feedback with large packets the size of the cur-rent working Path MTU value.The technique consists of two stages.The?rst stage is a next-hop MTU search to in-fer the largest packet that can be forwarded,as described in Section3.1.The second stage is a Time-to-Live(TTL)or Hop-Limit(HLIM)search of the forward path to infer the hop where large packets are silently discarded by determin-ing the largest TTL or HLIM value that can be set in the IP header which still obtains an ICMP Time Exceeded mes-sage in response.This debugging technique is illustrated in Figure1.This technique can infer a series of failure modes which are dif?cult to distinguish from each other,as there are many reasons why a source host may not receive a PTB message,and we have incomplete information to de?ni-tively infer why.We can,however,use a few heuristics to narrow the failure modes down.

If the farthest hop from which we obtain an ICMP Time Exceeded message with a large TTL-limited probe is im-mediately before a hop from which we obtain no ICMP Time Exceeded messages,we infer that the failure is likely to occur at the next hop either because all ICMP messages are disabled,or all ICMP responses from the router are be-ing?ltered somewhere in the network,possibly due to the use of RFC1918addresses.If we are able to receive ICMP

1500T T L 255, S iz e 1

4543.

1.2.T T L 255, S iz e 1

500

4.

5.

T T L 255, S iz e 1

480

IC M P P o rt U n re

a c h a

b le

IC M P P o rt U n re

a c

h a b le 6.T T L 255, S iz e 1

50012. ICMP Time Exceeded

T T L 255, S iz e 1

4927.T T L 255, S iz e 1

4928.T T L 255, S iz e 1481

9.T T L 255, S iz e 1

481

10.T T L 1, S iz e 150

011.14.

T T L 3, S iz e 150

13.T T L 3, S iz e 150

0Dst

Src

R1

R3

15001480

*

1500

Figure 1:Inferring the MTU without feedback.An ICMP Black Hole exists between routers R1and R3where the MTU is restricted to 1480bytes.A PMTUD failure is de-tected with probes 1and 2,probes 3to 10infer that the next-hop MTU is 1480,and probes 11to 14infer that the large packets are probably being discarded at hop 2.Time Exceeded messages with small TTL-limited probes from adjacent hops but we only receive Time Exceeded messages with large probes from the ?rst hop in the path,we infer that the failure mode is likely to be either due to an interface being con?gured to not send any ICMP Destina-tion Unreachable messages,or an MTU mismatch between the adjacent routers,or the PTB message originating from a different interface than the interface that sends Time Ex-ceeded messages –with a source address that causes the PTB message to be subsequently ?ltered.

3.3Inferring MTU with Invalid Feedback

This technique is used when a PTB message is received in response to a large probe,but the next-hop MTU in-cluded in the PTB message is either not set,or is larger than the probe which triggered the message.This tech-nique uses a variation of the next-hop MTU search tech-nique described in Section 3.1;instead of using the absence of a PTB message to reduce the upper-bound of the search space,this technique uses the faulty PTB message.This method can converge on the actual next-hop MTU fairly rapidly if ICMP feedback is received for packets smaller

than the next-hop MTU past the faulty router,as the test for each probe size costs one round-trip-time (RTT).We use a slightly different technique if the path does not provide ICMP feedback after the faulty router due to another fail-ure further in the path.When this occurs,scamper works progressively downwards through the MTU table soliciting faulty PTB messages rather than moving progressively up-wards,as it would normally do.This is because scamper has to time-out on a probe which does not obtain ICMP feedback before it can send another probe,which has a much larger cost than sending packets which trigger faulty PTB messages.

3.4Limitations

As the techniques we described rely on ICMP messages as feedback,they can be unreliable when ICMP rate-limiting is encountered.By default,scamper will send each probe twice before trying another probe type,with a ?ve second timeout between each attempt.If two successive probes do not receive ICMP feedback due to rate-limiting,we may in-fer an incorrect next-hop MTU,or infer the wrong location of a failure,or infer a failure where one does not exist.

4Methodology

We collected PMTUD failure data from two IPv4hosts with 9000-byte MTU interfaces connected to networks that peer with Internet2,which itself is 9000-byte clean through the core,on April 28th 2005.The ?rst location was from NYSERNet in New York,and the second was an Internet2measurement machine in Chicago.The target list consists of 147NLANR AMP machines,which are typically either on university campuses connected to the Internet2network,or connected to networks that peer with Internet2.Most of the AMP machines connect to their host network with an Intel Pro100Ethernet interface,which is capable of send-ing 1500byte IP packets.Some have Gigabit Ethernet in-terfaces which are capable of sending IP packets larger than 1500bytes,but are not con?gured to do so.The purpose of this dataset is to understand PMTUD failures on networks that can natively carry jumbo packets,and thus will require fragmentation at least at the edge of the campus network closer to each individual AMP machine.

5Results

Of the 147AMP machines in each dataset,we were able to complete a traceroute to at least 134machines,or 91%of the target list.However,we inferred a PMTUD failure for 30%of the reachable machines.A summary of the fail-ures is presented in Table 1.We categorised the failures into four groups:failure points where no ICMP messages

Dataset:NYSERNet-east Intersection

Chicago,IL–Hostname:https://www.doczj.com/doc/9e13238082.html,–

Apr282005,20:10CDT–

147–Reachable:136(92.5%)134

40(29.9%)–

5(5unique)7unique No PTB messages:26(17unique)13(13unique)

2(2unique)2unique Target MTU Mismatch:7(7unique)6(6unique)

tempts to determine the cause of what appeared to be a bug were dif?cult.Initially,we were told the fault was some-how related to the next-hop having an MPLS header with room for three4-byte MPLS labels.It was also suggested that the fault could be a particular known router bug,al-though the bug number suggested seems unrelated.At this time we have been unable to determine the cause of the fault,and are pursuing this matter with a router vendor. Unspeci?ed router bugs can also prevent PMTUD from succeeding,as discussed in Section2.5.During the course of scamper’s development,we found an IPv6router which appeared to route IPv6packets over an IPv6-in-IPv4tunnel with an MTU of1480bytes.However,for IPv6packets larger than1480bytes,we did not receive any PTB mes-sages.Rather,it sent two Destination Unreachable,No Route messages.The?rst message was returned with the IPv6probe packet intact and caused scamper to cease PM-TUD to the target beyond it.The second message–which we picked up by accident while monitoring all ICMPv6 packets into the machine–was unable to be matched to any probe we sent,as the encapsulated probe packet had the source and destination port?elds zeroed out.We contacted the site responsible and reported the fault.To our knowl-edge,the fault was never identi?ed and corrected,and went away when the particular path was replaced with a native IPv6path.

7Conclusion

The consensus is that Path MTU Discovery–in its current form–is unreliable due to it relying on the timely delivery of PTB messages,which are disabled or?rewalled in many networks.We hypothesise that these failures go unnoticed in routine operational testing and monitoring,as they are only noticeable with larger probe packets.The default size of probe packets sent using traceroute and ping is too small to trigger PMTUD failures,and in the absence of packet loss with these basic connectivity measures,it is tempting to declare a path as fully operational.

In this paper,we presented a series of debugging tech-niques which infer PMTUD failures on the forward path. Using our implementation,we collected data on PMTUD failures found in jumbogram-capable networks.We found that of the reachable targets,30%had a failure that would prevent ef?cient end-to-end communication from taking place.Less than half of these failures were caused by a con?guration decision to disable the ICMP messages that are necessary for PMTUD to work.As the Internet MTU is raised,particularly as jumbo-capable Ethernet interfaces become more commonplace and jumbo transit services are offered,it seems likely that the classical PMTUD meth-ods will continue to be strained.Until the new approach to PMTUD is completed and widely deployed amongst end-hosts,we believe our tool is a useful operational utility.Acknowledgements

scamper’s development was generously funded by the WIDE project in association with CAIDA from April2004 to March2005.The NLANR Measurement and Network Analysis Group(NLANR/MNA)is supported by the Na-tional Science Foundation(NSF)under cooperative agree-ment no.ANI-0129677.Matt Zekauskas(Internet2)col-lected the nms1-chin dataset.Maureen C.Curran and Joe Groff provided valuable editorial assistance.Matt Brown, Nevil Brownlee,Alan Holt,and Perry Lorier provided use-ful feedback on the paper.

References

[1]C.A.Kent and J.C.Mogul.Fragmentation considered

harmful.ACM SIGCOMM Computer Communication Review,17(5):390–401,1987.

[2]J.Mogul and S.Deering.Path MTU Discovery.RFC

1191,IETF,November1990.

[3]J.McCann,S.Deering,and J.Mogul.Path MTU Dis-

covery for IP version6.RFC1981,IETF,August 1996.

[4]https://www.doczj.com/doc/9e13238082.html,hey.TCP problems with Path MTU Discovery.

RFC2923,IETF,September2000.

[5]R.van den Berg and P.Dibowitz.Over-zealous se-

curity administrators are breaking the Internet.In Proceedings of LISA’02:Sixteenth Systems Admin-istration Conference,pages213–218,Berkeley,CA, November2002.

[6]A.Medina,M.Allman,and S.Floyd.Measuring

the evolution of transport protocols in the Internet.

ACM SIGCOMM Computer Communication Review, 35(2):37–52,April2005.

[7]S.Knowles.IESG advice from experience with Path

MTU Discovery.RFC1435,IETF,March1993. [8]J.Postel.Internet Control Message Protocol.RFC

792,IETF,September1981.

[9]Y.Rekhter, B.Moskowitz, D.Karrenberg,G.J.

de Groot,and E.Lear.Address allocation for private internets.RFC1918,IETF,February1996. [10]K.Cho,M.Luckie,and B.Huffaker.Identifying

IPv6network problems in the dual-stack world.In Proceedings of the ACM SIGCOMM workshop on Network troubleshooting:research,theory and op-erations practice meet malfunctioning reality,pages 283–288,Portland,OR.,September2004.

titlesec宏包使用手册

titlesec&titletoc中文文档 张海军编译 makeday1984@https://www.doczj.com/doc/9e13238082.html, 2009年10月 目录 1简介,1 2titlesec基本功能,2 2.1.格式,2.—2.2.间隔, 3.—2.3.工具,3. 3titlesec用法进阶,3 3.1.标题格式,3.—3.2.标题间距, 4.—3.3.与间隔相关的工具, 5.—3.4.标题 填充,5.—3.5.页面类型,6.—3.6.断行,6. 4titletoc部分,6 4.1.titletoc快速上手,6. 1简介 The titlesec and titletoc宏包是用来改变L A T E X中默认标题和目录样式的,可以提供当前L A T E X中没有的功能。Piet van Oostrum写的fancyhdr宏包、Rowland McDonnell的sectsty宏包以及Peter Wilson的tocloft宏包用法更容易些;如果希望用法简单的朋友,可以考虑使用它们。 要想正确使用titlesec宏包,首先要明白L A T E X中标题的构成,一个完整的标题是由标签+间隔+标题内容构成的。比如: 1.这是一个标题,此标题中 1.就是这个标题的标签,这是一个标签是此标题的内容,它们之间的间距就是间隔了。 1

2titlesec基本功能 改变标题样式最容易的方法就是用几向个命令和一系列选项。如果你感觉用这种方法已经能满足你的需求,就不要读除本节之外的其它章节了1。 2.1格式 格式里用三组选项来控制字体的簇、大小以及对齐方法。没有必要设置每一个选项,因为有些选项已经有默认值了。 rm s f t t md b f up i t s l s c 用来控制字体的族和形状2,默认是bf,详情见表1。 项目意义备注(相当于) rm roman字体\textrm{...} sf sans serif字体\textsf{...} tt typewriter字体\texttt{...} md mdseries(中等粗体)\textmd{...} bf bfseries(粗体)\textbf{...} up直立字体\textup{...} it italic字体\textit{...} sl slanted字体\textsl{...} sc小号大写字母\textsc{...} 表1:字体族、形状选项 bf和md属于控制字体形状,其余均是切换字体族的。 b i g medium s m a l l t i n y(大、中、小、很小) 用来标题字体的大小,默认是big。 1这句话是宏包作者说的,不过我感觉大多情况下,是不能满足需要的,特别是中文排版,英文 可能会好些! 2L A T E X中的字体有5种属性:编码、族、形状、系列和尺寸。 2

ctex 宏包说明 ctex

ctex宏包说明 https://www.doczj.com/doc/9e13238082.html,? 版本号:v1.02c修改日期:2011/03/11 摘要 ctex宏包提供了一个统一的中文L A T E X文档框架,底层支持CCT、CJK和xeCJK 三种中文L A T E X系统。ctex宏包提供了编写中文L A T E X文档常用的一些宏定义和命令。 ctex宏包需要CCT系统或者CJK宏包或者xeCJK宏包的支持。主要文件包括ctexart.cls、ctexrep.cls、ctexbook.cls和ctex.sty、ctexcap.sty。 ctex宏包由https://www.doczj.com/doc/9e13238082.html,制作并负责维护。 目录 1简介2 2使用帮助3 2.1使用CJK或xeCJK (3) 2.2使用CCT (3) 2.3选项 (4) 2.3.1只能用于文档类的选项 (4) 2.3.2只能用于文档类和ctexcap.sty的选项 (4) 2.3.3中文编码选项 (4) 2.3.4中文字库选项 (5) 2.3.5CCT引擎选项 (5) 2.3.6排版风格选项 (5) 2.3.7宏包兼容选项 (6) 2.3.8缺省选项 (6) 2.4基本命令 (6) 2.4.1字体设置 (6) 2.4.2字号、字距、字宽和缩进 (7) ?https://www.doczj.com/doc/9e13238082.html, 1

1简介2 2.4.3中文数字转换 (7) 2.5高级设置 (8) 2.5.1章节标题设置 (9) 2.5.2部分修改标题格式 (12) 2.5.3附录标题设置 (12) 2.5.4其他标题设置 (13) 2.5.5其他设置 (13) 2.6配置文件 (14) 3版本更新15 4开发人员17 1简介 这个宏包的部分原始代码来自于由王磊编写cjkbook.cls文档类,还有一小部分原始代码来自于吴凌云编写的GB.cap文件。原来的这些工作都是零零碎碎编写的,没有认真、系统的设计,也没有用户文档,非常不利于维护和改进。2003年,吴凌云用doc和docstrip工具重新编写了整个文档,并增加了许多新的功能。2007年,oseen和王越在ctex宏包基础上增加了对UTF-8编码的支持,开发出了ctexutf8宏包。2009年5月,我们在Google Code建立了ctex-kit项目1,对ctex宏包及相关宏包和脚本进行了整合,并加入了对XeT E X的支持。该项目由https://www.doczj.com/doc/9e13238082.html,社区的开发者共同维护,新版本号为v0.9。在开发新版本时,考虑到合作开发和调试的方便,我们不再使用doc和docstrip工具,改为直接编写宏包文件。 最初Knuth设计开发T E X的时候没有考虑到支持多国语言,特别是多字节的中日韩语言。这使得T E X以至后来的L A T E X对中文的支持一直不是很好。即使在CJK解决了中文字符处理的问题以后,中文用户使用L A T E X仍然要面对许多困难。最常见的就是中文化的标题。由于中文习惯和西方语言的不同,使得很难直接使用原有的标题结构来表示中文标题。因此需要对标准L A T E X宏包做较大的修改。此外,还有诸如中文字号的对应关系等等。ctex宏包正是尝试着解决这些问题。中间很多地方用到了在https://www.doczj.com/doc/9e13238082.html,论坛上的讨论结果,在此对参与讨论的朋友们表示感谢。 ctex宏包由五个主要文件构成:ctexart.cls、ctexrep.cls、ctexbook.cls和ctex.sty、ctexcap.sty。ctex.sty主要是提供整合的中文环境,可以配合大多数文档类使用。而ctexcap.sty则是在ctex.sty的基础上对L A T E X的三个标准文档类的格式进行修改以符合中文习惯,该宏包只能配合这三个标准文档类使用。ctexart.cls、ctexrep.cls、ctexbook.cls则是ctex.sty、ctexcap.sty分别和三个标准文档类结合产生的新文档类,除了包含ctex.sty、ctexcap.sty的所有功能,还加入了一些修改文档类缺省设置的内容(如使用五号字体为缺省字体)。 1https://www.doczj.com/doc/9e13238082.html,/p/ctex-kit/

tabularx宏包中改变弹性列的宽度

tabularx宏包中改变弹性列的宽度\hsize 分类:latex 2012-03-07 21:54 12人阅读评论(0) 收藏编辑删除 \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{latexsym} \usepackage{CJK} \usepackage{tabularx} \usepackage{array} \newcommand{\PreserveBackslash}[1]{\let \temp =\\#1 \let \\ = \temp} \newcolumntype{C}[1]{>{\PreserveBackslash\centering}p{#1}} \newcolumntype{R}[1]{>{\PreserveBackslash\raggedleft}p{#1}} \newcolumntype{L}[1]{>{\PreserveBackslash\raggedright}p{#1}} \begin{document} \begin{CJK*}{GBK}{song} \CJKtilde \begin{tabularx}{10.5cm}{|p{3cm} |>{\setlength{\hsize}{.5\hsize}\centering}X |>{\setlength{\hsize}{1.5\hsize}}X|} %\hsize是自动计算的列宽度,上面{.5\hsize}与{1.5\hsize}中的\hsize前的数字加起来必须等于表格的弹性列数量。对于本例,弹性列有2列,所以“.5+1.5=2”正确。 %共3列,总列宽为10.5cm。第1列列宽为3cm,第3列的列宽是第2列列宽的3倍,其宽度自动计算。第2列文字左右居中对齐。注意:\multicolum命令不能跨越X列。 \hline 聪明的鱼儿在咬钩前常常排祠再三& 这是因为它们要荆断食物是否安全&知果它们认为有危险\\ \hline 它们枕不会吃& 如果它们判定没有危险& 它们就食吞钩\\ \hline 一眼识破诱饵的危险,却又不由自主地去吞钩的& 那才正是人的心理而不是鱼的心理& 是人的愚合而不是鱼的恳奋\\

配合前面的ntheorem宏包产生各种定理结构

%=== 配合前面的ntheorem宏包产生各种定理结构,重定义一些正文相关标题===% \theoremstyle{plain} \theoremheaderfont{\normalfont\rmfamily\CJKfamily{hei}} \theorembodyfont{\normalfont\rm\CJKfamily{song}} \theoremindent0em \theoremseparator{\hspace{1em}} \theoremnumbering{arabic} %\theoremsymbol{} %定理结束时自动添加的标志 \newtheorem{definition}{\hspace{2em}定义}[chapter] %\newtheorem{definition}{\hei 定义}[section] %!!!注意当section为中国数字时,[sction]不可用! \newtheorem{proposition}{\hspace{2em}命题}[chapter] \newtheorem{property}{\hspace{2em}性质}[chapter] \newtheorem{lemma}{\hspace{2em}引理}[chapter] %\newtheorem{lemma}[definition]{引理} \newtheorem{theorem}{\hspace{2em}定理}[chapter] \newtheorem{axiom}{\hspace{2em}公理}[chapter] \newtheorem{corollary}{\hspace{2em}推论}[chapter] \newtheorem{exercise}{\hspace{2em}习题}[chapter] \theoremsymbol{$\blacksquare$} \newtheorem{example}{\hspace{2em}例}[chapter] \theoremstyle{nonumberplain} \theoremheaderfont{\CJKfamily{hei}\rmfamily} \theorembodyfont{\normalfont \rm \CJKfamily{song}} \theoremindent0em \theoremseparator{\hspace{1em}} \theoremsymbol{$\blacksquare$} \newtheorem{proof}{\hspace{2em}证明} \usepackage{amsmath}%数学 \usepackage[amsmath,thmmarks,hyperref]{ntheorem} \theoremstyle{break} \newtheorem{example}{Example}[section]

Groff 应用

使用Groff 生成独立于设备的文档开始之前 了解本教程中包含的内容和如何最好地利用本教程,以及在使用本教程的过程中您需要完成的工作。 关于本教程 本教程提供了使用Groff(GNU Troff)文档准备系统的简介。其中介绍了这个系统的工作原理、如何使用Groff命令语言为其编写输入、以及如何从该输入生成各种格式的独立于设备的排版文档。 本教程所涉及的主题包括: 文档准备过程 输入文件格式 语言语法 基本的格式化操作 生成输出 目标 本教程的主要目标是介绍Groff,一种用于文档准备的开放源码系统。如果您需要在应用程序中构建文档或帮助文件、或为客户和内部使用生成任何类型的打印或屏幕文档(如订单列表、故障单、收据或报表),那么本教程将向您介绍如何开始使用Groff以实现这些任务。 在学习了本教程之后,您应该完全了解Groff的基本知识,包括如何编写和处理基本的Groff输入文件、以及如何从这些文件生成各种输出。

先决条件 本教程的目标读者是入门级到中级水平的UNIX?开发人员和管理员。您应 该对使用UNIX命令行Shell和文本编辑器有基本的了解。 系统要求 要运行本教程中的示例,您需要访问运行UNIX操作系统并安装了下面这些软件的计算机(请参见本教程的参考资料部分以获取相关链接): Groff。Groff分发版中包括groff前端工具、troff后端排版引擎和本教 程中使用的各种附属工具。 自由软件基金会将Groff作为其GNU Project中的一部分进行了发布,所 发布的源代码符合GNU通用公共许可证(GPL)并得到了广泛的移植,几乎对于所有的UNIX操作系统、以及非UNIX操作系统(如Microsoft?Windows?)都有相应 的可用版本。 在撰写本教程时,最新的Groff发布版是Version 1.19.2,对于学习本教 程而言,您至少需要Groff Version 1.17。 gxditview。从Version 1.19.2开始,Groff中包含了这个工具,而在以 前的版本中,对其进行了单独的发布。 PostScript Previewer,如ghostview、gv或showpage。 如果您是从源代码安装Groff,那么请参考Groff源代码分发版中的自述 文件,其中列举了所需的任何额外的软件,而在编译和安装Groff时可能需要 使用这些软件。 介绍Groff 用户通常在字处理软件、桌面发布套件和文本布局应用程序等应用程序环 境中创建文档,而在这些环境中,最终将对文档进行打印或导出为另一种格式。整个文档准备过程,从创建到最后的输出,都发生在单个应用程序中。文档通

TeX 使用指南(常见问题)

TeX 使用指南 常见问题(一) 1.\makeatletter 和\makeatother 的用法? 答:如果需要借助于内部有\@字符的命令,如\@addtoreset,就需要借助于另两个命令 \makeatletter, \makeatother。 下面给出使用范例,用它可以实现公式编号与节号的关联。 \begin{verbatim} \documentclass{article} ... \makeatletter % '@' is now a normal "letter" for TeX \renewcommand\theequation{\thesection.\arabic{equation}} \@addtoreset{equation}{section} \makeatother % '@' is restored as a "non-letter" character for TeX \begin{document} ... \end{verbatim} 2.比较一下CCT与CJK的优缺点? 答:根据王磊的经验,CJK 比CCT 的优越之处有以下几点: 1)字体定义采用LaTeX NFSS 标准,生成的DVI 文件不必像CCT 那样需要用patchdvi 处理后才能预览和打印。而且一般GB 编码的文件也不必进行预处理就可直接用latex 编译。2)可使用多种TrueType 字体和Type1 字体,生成的PDF 文件更清楚、漂亮。 3)能同时在文章中使用多种编码的文字,如中文简体、繁体、日文、韩文等。 当然,CCT 在一些细节上,如字体可用中文字号,字距、段首缩进等。毕竟CJK 是老外作的吗。 谈到MikTeX 和fpTeX, 应该说谈不上谁好谁坏,主要看个人的喜好了。MikTeX 比较小,不如fpTeX 里提供的TeX 工具,宏包全,但一般的情况也足够了。而且Yap 比windvi 要好用。fpTeX 是teTeX 的Windows 实现,可以说各种TeX 的有关软件基本上都包括在内。 3.中文套装中如何加入新的.cls文件? 答:放在tex文件的同一目录下,或者miktex/localtexmf/tex/latex/下的某个子目录下,可以自己建一个。 4.怎样象第几章一样,将参考文献也加到目录? 答:在参考文献部分加入 \addcontentsline{toc}{chapter}{参考文献}

listings 是专用于代码排版的 LaTeX宏包(及使用xltxtra进行中文支持)

listings 是专用于代码排版的 LaTeX宏包(及使用xltxtra进行中文支持) 分类:科研文献2012-10-17 11:25 1829人阅读评论(0) 收藏举报numbers文档测试floatc语言 listings是专用于代码排版的LaTeX 宏包,可对关键词、注释和字符串等使用不同的字体和颜色或颜色,也可以为代码添加边框、背景等风格。 1 基本用法 下面给出一份用于排版 C 语言HelloWorld程序代码的完整的LaTeX文档: \documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[language=C] int main(intargc, char ** argv) { printf("Hello world!\n"); return 0; } \end{lstlisting} \end{document} 注意,要使用 listings 宏包提供的语法高亮,需要xcolor宏包支持。 4 添加边框 listings 宏包为代码边框提供了很多风格,大体可分为带有阴影的边框与圆角边框。这里仅仅给出一个阴影边框的示例,至于其它边框风格,可查阅 listings宏包文档,里面给出了一些示例。 下面LaTeX源文档将为代码添加阴影边框,并将阴影设置为浅灰色:

\begin{lstlisting}[language={[ANSI]C}, keywordstyle=\color{blue!70}, commentstyle=\color{red!50!green!50!blue!50}, frame=shadowbox, rulesepcolor=\color{red!20!green!20!blue!20}] int main(intargc, char ** argv) { printf("Hello world!\n"); return 0; } \end{lstlisting} 5 添加行号 很多时候需要对文档中的代码进行解释,只有带有行号的代码才可以让解释更清晰,因为你只需要说第 x 行代码有什么作用即可。如果没有行号,那对读者而言就太残忍了,他们不得不从你的文字叙述中得知行号信息,然后去一行一行的查到相应代码行。 listings宏包通过参数 numbers 来设定行号,该参数的值有两个,分别是 left与 right,表示行号显示在代码的左侧还是右侧。下面为带有边框的代码添加行号,并设置行号字体为 \tiny: \begin{lstlisting}[language={[ANSI]C}, numbers=left, numberstyle=\tiny, keywordstyle=\color{blue!70}, commentstyle=\color{red!50!green!50!blue!50}, frame=shadowbox, rulesepcolor=\color{red!20!green!20!blue!20}] int main(intargc, char ** argv) { printf("Hello world!\n"); return 0; } \end{lstlisting} 6 全局设置 上面所给的各个示例中,lstlisting 环境后面尾随了很多参数,要是每使用一次lstlisting 环境就要设置这么多参数,那就没什么意思了。 可以使用 \lstset命令在LaTeX源文档的导言区设定好lstlisting 环境所用的公共参数,如下: \documentclass{article} \usepackage{listings}

浮动体环境下利用caption宏包制定标题

浮动体环境下利用caption宏包制定标题 Axel Sommerfeldt Released by ChinaT E X Documentation Workshop. April29,2011 Maker:Clark Ma Translator:Clark Ma

浮动体环境下利用caption宏包制定标题? Axel Sommerfeldt caption@sommerfee.de 2008/04/06 摘要 本宏包提供了在如figure和table等浮动体中定制标题的功能,并且能和许多其他宏包结合使用。 请注意:许多文档类已经预设好了制定标题的选项和命令。如果这些已有的预设选项对你已经很够用,那么就没有再使用caption宏包的必要。不过如果你 仅仅是对\captionof命令感兴趣,那么加载使用一个小capt-of宏包就是经常很 够用的。 引言 在标准的L A T E X文档类中,标题并没有得到应有的注意。简单的排版如普通的段落在下面这种情况下和正文之间的区别是不明显的: Figure1:White sand beaches.The pink smoothness of the conch shell.A sea abundant with possibilities.Duty-free shops?lled with Europe’s?nest gifts and perfumes.Play your favorite game of golf amidst the tropical greens on one of the many championship courses. 这种情况有必要改成这样,比如,使标题比正文略小一点,增加版口,使用和文章标题相同的字体族和字样来排印标题标签等,这将会好一些。正如下面这个:Figure2–White sand beaches.The pink smoothness of the conch shell.A sea abundant with possibilities.Duty-free shops?lled with Europe’s?nest gifts and perfumes.Play your favorite game of golf amidst the tropical greens on one of the many championship courses. 你可以利用这个宏包里的多种标题格式选项轻松地做到上述的效果,不过你也可以同样自由地定义你想要的格式。 i 请注意caption宏包仅仅是控制标题的效果。它并不能控制标题的位置。(但是你可以利用其他的如?oatrow宏包来控制标题的位置。[8].) ?本宏包版本号为4.8.2,最后增订于2008/04/06 1

xpinyin 宏包

xpinyin宏包 李清 sobenlee@https://www.doczj.com/doc/9e13238082.html, 2014/06/25v1.9 1简介 xpinyin是一个L A T E X宏包,提供了为汉字自动注音的功能。 2基本用法 xpinyin支持采用GBK和UTF-8编码的T E X源文件,建议总是使用UTF-8。如果使用L A T E X 或pdfL A T E X的编译方式,则根据编码的情况,xpinyin依赖CJK或者CJKutf8宏包。如果使用X?L A T E X,则依赖xeCJK宏包。如果它们没有在xpinyin之前被载入,xpinyin将根据编译方式自动选择,L A T E X或pdfL A T E X将使用CJKutf8。 xpinyin还依赖l3kernel和l3packages,使用(pdf)L A T E X下的GBK编码时,还将依赖xCJK2uni。 需要注意的是,xpinyin缺省将拼音的字体设置为与文档的主字体(\normalfont)相同,所以为了保证声调字母的正确输出,应该选用合适的西文主字体。也可以通过将在下一节介绍的?font?选项来单独设置拼音的字体。 X?L A T E X下的简单示例: \documentclass{article} \usepackage{xeCJK} \usepackage{xpinyin} \setmainfont{CMU Serif} \setCJKmainfont{SimSun} \begin{document} \xpinyin*{汉语拼音示例} \end{document}(pdf)L A T E X下的简单示例: \documentclass{article} \usepackage{CJKutf8} \usepackage{xpinyin} \usepackage[T1]{fontenc} \usepackage{lmodern} \begin{document} \begin{CJK}{UTF8}{gbsn} \xpinyin*{汉语拼音示例} \end{CJK} \end{document} 运行上述示例要求系统安装了设置的字体,源文件用UTF-8编码保存,使用相应的编译方式。 xpinyin可以与ctex宏包或文档类共同使用,使用方式与上面类似。 3用户手册 \begin{pinyinscope}[?options?] ..... \end{pinyinscope} 为pinyinscope环境中的汉字自动注音。例如 1\begin{pinyinscope} 2列位看官:你道此书从何而来?说起根由,虽近荒唐,细按则深有趣味。 3待在下将此来历注明,方使阅者\xpinyin{了}{liao3}然不惑。 4\end{pinyinscope} liè 列wèi位kàn看guān 官:nǐ你dào道cǐ此shū书cóng从hé何ér而lái来?shuō说qǐ起gēn根yoú由,suī虽jìn近huāng 荒táng唐,xì细àn按zé则shēn深yoǔ有qù趣wèi味。dài待zài在xià下jiāng将cǐ此lái来lì历zhù注míng明,fāng方shǐ使 yuè 阅zhě者liǎo了rán然bù不huò惑。 pinyinscope 1

LaTeX部分宏包介绍

\usepackage{geometry} % 利用geometry 可以很方便的设置页面的大小。 \usepackage{fancyhdr} % 用fancyhdr 来设置页眉和页脚十分方便,而且可以在配合CCT、CJK来设置中文的页眉等。 \usepackage{fancyvrb} % 用来得到一些加框的列举环境 \usepackage{fancybox} % 提供了\shadowbox, \doublebox, \ovalbox 和\Ovalbox 四个命令来生成不同形状的盒子。 \usepackage{amsmath,amsfonts,amssymb,graphicx} % EPS 图片支持 \usepackage{subfigure} % 使用子图形 \usepackage{indentfirst} % 中文段落首行缩进 \usepackage{bm} % 公式中的粗体字符(用命令\boldsymbol) \usepackage{multicol} % 正文双栏 \usepackage{picins} % 图片嵌入段落宏包比如照片 \usepackage{abstract} % 2栏文档,一栏摘要及关键字宏包 \usepackage{anysize} % 对于像book 等双面版式来说,这里的left 和right 再奇偶页会 互换。 \usepackage{hyperref} % 文献引用的宏包 \usepackage{listings}\lstloadlanguages{C,C++,matlab,mathematica} %程序清单关键字宏 包 \usepackage{color} % 可以产生有颜色的符号 \usepackage{units} % 用于美化单位及分式 \usepackage{tabularx} % 用于灵活地控制表格的生成 \usepackage{mathrsfs} % 用于产生一种数学用的花体字 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 关于各个宏包的说明。 % CJK宏包中重要的命令为: % \CJKcaption{GB} 章节标题为中文 % \CJKfamily{hei}{} %song, fs, kai, hei, songsl, fssl, kaisl, heisl % CTEX中文套装中定义了六种中文字体,分别是 % song, 宋体 % fs, 仿宋 % kai, 楷书 % hei, 黑体%以上这四种字体都是可以用的,并且还有对应的斜体可用(\it 即可) % li, 隶书%但看来这个是不能用的,怎样解决我还不知道,还不懂怎样安装字体 % yuan, 幼圆%这个也不能用 % geometry宏包重要的命令为: % \geometry{height=10in,a4paper,body={14cm,21cm}} %具体内容由自己改写 % fancyhdr宏包重要的命令为: % 如下面所用到的页眉和页脚的定义,很典型的 % fancyvrb宏包重要的命令为: % 很多,应用方法很灵活。具体查阅其说明文档 % fancybox宏包重要的命令为: % \shadowbox{}和\doublebox{},括号里面可以包含一个minipage环境,可以含一个图片 % amsmath,amsfonts,amssymb,graphicx宏包重要的命令为: % 这是一组非常重要的包,最重要的几个命令为:

tex范例

10月22日 一个比较好的Latex范例 由于用了一些和latex不兼容的宏包(pdfpages,主要用来加发表的文章做附件),只能用padlatex进行编译了(eps图片也要改为pdf图片)。 中文需要自己的宏包。 文中有些说明没有及时更改。 参数有些改了。有些%后的自己可以选择。 生成的pdf文件字体为cmr12,acrobat可以修改。还没找到用times roman字体的方法(latex 编译方法倒可以实现,就是宏包冲突,才改为paflatex编译)。 本主文件用pdflatex,bibtex,pdflatex,pdflatex编译通过。当然需要每部分的tex文件都齐全了。 希望对大家有所帮助。 \documentclass[a4paper,12pt,oneside]{book} \pdfoutput = 1 \usepackage{geometry} %页面宏包 \geometry{a4paper,left=4cm, right=2.5cm, top=2.5cm, bottom=2.5cm} %页面设置 \usepackage{amsmath} % AMS 数学公式等 \usepackage{amssymb} % AMS 数学字库 \usepackage{fleqn}%公式对齐用 \setlength{\mathindent}{2em}%公式对齐用 \usepackage{textcomp} %欧元等符号,摄氏度用到\textcelsius~%不能用在公式环境 %\usepackage{times} % Times New Roman字体 %\usepackage[mtbold,mtpluscal,mtplusscr]{mathtime} %用mathtime 宏包来把数学环境中的字体都变成Times New Roman 字体 \usepackage[final]{pdfpages}%插入pdf文件 \usepackage{verbatim} %插入pdf文件 \usepackage{multicol} %要生成单双列混合的分栏格式 \usepackage{glossary} %生成术语表的宏包 %页眉页脚%%%%%%%%%%%%%%%%%% %\pagestyle{plain} \usepackage{fancyhdr} %页眉页脚 \pagestyle{fancy}%页眉页脚式样 %\renewcommand{\chaptermark}[1]{% %\markboth{\chaptername %\ \thechapter.\ #1}{}} \renewcommand{\chaptermark}[1]{% \markboth{#1}{}} \renewcommand{\sectionmark}[1]{} %\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

写给LATEX类和宏包作者

L A T E X2ε Copyright c 1995–1998The L A T E X3Project :laughcry[laughcry2002@https://www.doczj.com/doc/9e13238082.html,] All rights reserved 12March1999 Contents 1 2 1.1 L A T E X2ε (2) 1.2 (3) 1.3 (3) 1.4 (4) 2 4 2.1 (4) 2.2 ‘docstrip’ ‘doc’ (5) 2.3 ? (5) 2.4 (5) 2.5 (6) 2.6 (De?ning text and math characters) (6) 2.7 (General style) (7) 3 / (The structure of a class or package)9 3.1 (Identi?cation) (10) 3.2 (Using classes and packages) (11) 3.3 (Declaring options) (12) 3.4 (A minimal class?le) (13) 3.5 (Example:a local letter class) (14) 3.6 (Example:a newsletter class) (14) 4 / (Commands for class and package writers)16 4.1 (Identi?cation) (16) 4.2 (Loading?les) (17) 4.3 (Option declaration) (18) 4.4 (Commands within option code) (18) 4.5 (Moving options around) (19) 1

latex编写表格

array 标准LaTeX 提供有array 和tabular 两个制表环境,它们的完整格式如下: \begin{array}[表格位置]{列样式} \end{array} \begin{tabular}[表格位置]{列样式} \end{tabular} \begin{tabular*}{表格总宽度}[表格位置]{列样式} \end{tabular*} 这两个环境的选项和参数定义是相同的,不过array 主要用于数组矩阵的排版,且只能用在数学环境中,如equation 等。 array 宏包扩展了 array 和tabular 环境功能,主要增加和增强了列样式选项,甚至可编程定义新的列样式;还增加了许多细部微调功能,如改变垂直表格线的粗细和自动调整表格间隙等。使用该宏包可以排印出外形美观、功能丰富的表格。 该宏包没有任何选项,扩展后的两个环境的列样式选项: 选项说明 l该列左对齐排列 c该列居中排列 r该列右对齐排列 p{列宽}设置该列宽度,文本顶对齐 @{声明}该列每行插入声明中文本 m{列宽}设置该列宽度,文本居中对齐 b{列宽}设置该列宽度,文本底对齐 >{声明}声明可以是命令或插入列元素之前的文本 <{声明}声明可以是命令或插入列元素之后的文本 |列边或列间加入一条垂直线 !{声明}用声明要求的样式取代列间垂直线

应用举例: 列样式还可设置为:>{\setlength{\parindent}{26pt}}p{列宽},对该列文本行或段落缩排。 源文件 Frank Mittelbach et al booktabs 它定义了三条划线命令:\toprule、\midrule 和\bottomrule,可分别对表格顶部、中部和底部使用不同粗细的水平线,见下例:

natbib宏包快速参考手册

Reference sheet for natbib usage (Describing version8.31b from2010/09/13) For a more detailed description of the natbib package,L A T E X the source?le natbib.dtx. Overview The natbib package is a reimplementation of the L A T E X\cite command,to work with both author–year and numerical citations.It is compatible with the standard bibliographic style?les,such as plain.bst,as well as with those for harvard,apalike,chicago,astron,authordate,and of course natbib. Loading Load with\usepackage[options]{natbib}.See list of options at the end. Replacement bibliography styles I provide three new.bst?les to replace the standard L A T E X numerical ones: plainnat.bst abbrvnat.bst unsrtnat.bst Basic commands The natbib package has two basic citation commands,\citet and\citep for textual and parenthetical citations,respectively.There also exist the starred versions\citet*and\citep*that print the full author list,and not just the abbreviated one.All of these may take one or two optional arguments to add some text before and after the citation. \citet{jon90}?Jones et al.(1990) \citet[chap.~2]{jon90}?Jones et al.(1990,chap.2) \citep{jon90}?(Jones et al.,1990) \citep[chap.~2]{jon90}?(Jones et al.,1990,chap.2) \citep[see][]{jon90}?(see Jones et al.,1990) \citep[see][chap.~2]{jon90}?(see Jones et al.,1990,chap.2) \citet*{jon90}?Jones,Baker,and Williams(1990) \citep*{jon90}?(Jones,Baker,and Williams,1990) Multiple citations Multiple citations may be made by including more than one citation key in the\cite command argument. \citet{jon90,jam91}?Jones et al.(1990);James et al.(1991) \citep{jon90,jam91}?(Jones et al.,1990;James et al.1991) \citep{jon90,jon91}?(Jones et al.,1990,1991) \citep{jon90a,jon90b}?(Jones et al.,1990a,b) 1

xeCJK 中文手册

xeCJK宏包 孙文昌 2008年6月10日 1简 xeCJK是一个XeLaTeX宏包,用于排版CJK文字,包括字体选择、标点控制等。提供四种标点处理方式:全部全角式、全部半角式、开明式、CCT格式。 全角标点 计算机(computer/calculation machine)是总称,一般在学术性或正式场合使用。在通常用语中,计算机一般指电子计算机中用的个人电脑。计算机是一种能够按照指令对各种数据和信息进行自动加工和处理的电子设备。它由多个零配件组成,如中央处理器、主板、内存、电源、显卡等。接收、处理和提供数据的一种装置,通常由输入输出设备、存储器、运算和逻辑部件以及控制器组成;有模拟式、数字式及混合式三种类型。 半角标点 计算机(computer/calculation machine)是总称,一般在学术性或正式场合使用。在通常用语中,计算机一般指电子计算机中用的个人电脑。计算机是一种能够按照指令对各种数据和信息进行自动加工和处理的电子设备。它由多个零配件组成,如中央处理器、主板、内存、电源、显卡等。接收、处理和提供数据的一种装置,通常由输入输出设备、存储器、运算和逻辑部件以及控制器组成;有模拟式、数字式及混合式三种类型。 开明 计算机(computer/calculation machine)是总称,一般在学术性或正式场合使用。在通常用语中,计算机一般指电子计算机中用的个人电脑。计算机是一种能够按照指令对各种数据和信息进行自动加工和处理的电子设备。它由多个零配件组成,如中央处理器、主板、内存、电源、显卡等。接收、处理和提供数据的一种装置,通常由输入输出设备、存储器、运算和逻辑部件以及控制器组成;有模拟式、数字式及混合式三种类型。 CCT 计算机(computer/calculation machine)是总称,一般在学术性或正式场合使用。在通常用语中,计算机一般指电子计算机中用的个人电脑。计算机是一种能够按照指令对各种数据和信息进行自动加工和处理的电子设备。它由多个零配件组成,如中央处理器、主板、内存、电源、显卡等。接收、处理和提供数据的一种装置,通常由输入输出设备、存储器、运算和逻辑部件以及控制器组成;有模拟式、数字式及混合式三种类型。 对于中英文混排,允许在非标点汉字和英文字母(a-z,A-Z)间断行。支持自动切换中英文字体。

相关主题
文本预览
相关文档 最新文档