Add New Notes

This commit is contained in:
geekard
2012-08-08 14:26:04 +08:00
commit 5ef7c20052
2374 changed files with 276187 additions and 0 deletions

BIN
Zim/.zim/index.db Normal file

Binary file not shown.

124
Zim/.zim/state.conf Normal file
View File

@@ -0,0 +1,124 @@
[History]
list=[["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4177,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:ltib",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:iw",133,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4177,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:ltib",256,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:merge",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:sparse",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:merge",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4177,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:ltib",269,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4692,null],["Research:Error Notes:b43",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:busybox",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:crdb",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:crdb:db",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:iw",133,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4692,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:ltib",269,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:sparse",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:uboot",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:udev",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:uboot",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:ltib",269,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4692,null],["Research:Error Notes",null,null]]
current=24
recent=[["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:busybox",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:crdb",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:crdb:db",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:iw",133,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:sparse",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:udev",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:uboot",0,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:ltib",269,null],["Research:Error Notes:\u7f16\u8bd1\u9519\u8bef:libnl",4692,null],["Research:Error Notes",null,null]]
[MainWindow]
windowsize=[1600,836]
show_sidepane=True
sidepane_pos=424
show_menubar=True
show_menubar_fullscreen=True
show_toolbar=True
show_toolbar_fullscreen=False
show_statusbar=True
show_statusbar_fullscreen=False
pathbar_type=recent
pathbar_type_fullscreen=none
readonly=False
windowpos=[-4,-4]
toolbar_style=None
toolbar_size=tiny
active_tabs=["Index",null,null,"Attachments"]
[ImportPageDialog]
windowsize=[500,400]
[NewPageDialog]
windowsize=[362,170]
[RenamePageDialog]
windowsize=[643,204]
[DeletePageDialog]
windowsize=[633,438]
[PropertiesDialog]
windowsize=[395,299]
[InsertDateDialog]
windowsize=[319,247]
lastusedformat=%A %d/%m/%Y
linkdate=True
calendar_expanded=False
[InsertImageDialog]
windowsize=[1280,749]
attach_inserted_images=False
last_image_folder=/home/geekard/Notes/Zim/Research/\u5d4c\u5165\u5f0fPowerPC\u4e0a\u7684\u6241\u5e73\u8bbe\u5907\u6811FDT
[InsertLinkDialog]
windowsize=[328,156]
[EditImageDialog]
windowsize=[339,268]
[AttachFileDialog]
windowsize=[500,400]
last_attachment_folder=/home/geekard/Notes/Zim/Research/Error_Notes/\u7f16\u8bd1\u9519\u8bef/crdb
insert_attached_images=False
[PromptExistingFileDialog]
windowsize=[637,165]
[InsertTextFromFileDialog]
windowsize=[500,400]
[PreferencesDialog]
windowsize=[537,422]
[AttachmentBrowserPlugin]
active=False
bottompane_pos=513
[TaskListDialog]
windowsize=[550,400]
hpane_pos=75
[InsertSymbolDialog]
windowsize=[350,400]
[InsertScreenshotDialog]
windowsize=[212,148]
[WordCountDialog]
windowsize=[316,146]
[CustomToolManagerDialog]
windowsize=[410,299]
[OpenPageDialog]
windowsize=[298,118]
[NotebookDialog]
windowsize=[500,400]
[PageWindow]
windowsize=[500,400]
[CalendarDialog]
windowsize=[222,258]
[TagsPlugin]
treeview=tagged
tagcloud_sorting=score
[ExportDialog]
windowsize=[400,325]
document_root_url=
selection=page
selected_page=NonSQL:\u4e3a\u4ec0\u4e48\u8981\u7528\u975e\u5173\u7cfb\u6570\u636e\u5e93\uff1f
format=HTML
template=Default
template_file=None
document_root=absolute
output_folder=None
index_page=
output_file=/home/geekard/\u4e3a\u4ec0\u4e48\u8981\u7528\u975e\u5173\u7cfb\u6570\u636e\u5e93\uff1f.html
[MovePageDialog]
windowsize=[411,157]
[FindAndReplaceDialog]
windowsize=[330,298]

56
Zim/Home.txt Normal file
View File

@@ -0,0 +1,56 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-17T19:57:22+08:00
====== Home ======
Created Saturday 17 September 2011
曾经有一段信息摆到我眼前,可是我没有珍惜.直到失去我才后悔莫及.如果上天能给我一个重来的机会,我希望将那段信息记为笔记,如果非要在这条笔记上加个期限,我希望是一万年.
这个笔记记录着我的学习、生活、科研等值得回味的内容。
好记性不如烂笔头,坚持就是胜利!
以动手实践为荣 , 以只看不练为耻;
以打印日志为荣 , 以单步跟踪为耻;
以空格缩进为荣 , 以制表缩进为耻;
以单元测试为荣 , 以人工测试为耻;
以模块复用为荣 , 以复制粘贴为耻;
以多态应用为荣 , 以分支判断为耻;
以Pythonic为荣 , 以冗余拖沓为耻;
以总结分享为荣 , 以跪求其解为耻;
The beauty of free software is that you have choices
necessity is the mother of invention
sed has more than one way to solve many problems. What is important is you understand your problem, and document your solution
“Time spent developing good habits is time well spent.”
Truth is the daughter of time
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." -- Bjarne Stroustrup
在学习过程中,我们要先宏观后微观:先对体系、结构、框架等有所了
解,慢慢再掌握使用方法,细节处理更要靠经验的积累。同时还要勤于思
考 what、why、how等问题。
我认为,在计算机科学中保持计算中的趣味性是特别重要的事情。 — Alan J. Perlis
http://www.ruanyifeng.com/blog/2011/04/on_hacker.html
"出于兴趣,解决某个难题,不管它有没有用,这就是黑客。" Playfully doing something difficult, whether useful or not, that is hacking.
1. 使用计算机不应受到任何限制。任何事情都应该亲手尝试。Access to computers--and anything that might teach you something about the way the world works--should be unlimited and total. Always yield to the Hands-On Imperative!
2. 信息应该全部免费。All information should be free.
3. 不信任权威提倡去中心化。Mistrust Authority--Promote Decentralization.
4. 判断一个人应该看他的技术能力而不是看其他标准。Hackers should be judged by their hacking, not bogus criteria such as degrees, age, race, or position.
5. 你可以用计算机创造美和艺术。You can create art and beauty on a computer.
6. 计算机使生活更美好。Computers can change your life for the better.

9
Zim/Interview.txt Normal file
View File

@@ -0,0 +1,9 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T20:39:22+08:00
====== Interview ======
Created Sunday 27 March 2011
some interview with famous people.

View File

@@ -0,0 +1,150 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T20:38:21+08:00
====== An Interview with Brian Kernighan ======
Created Sunday 27 March 2011
An Interview with Brian Kernighan
by Mihai Budiu
http://www.cs.cmu.edu/~mihaib/kernighan-interview
Spanish translation by Leonardo Boshell
July 2000
Introduction
During the summer of 1999 I had the chance to be a research intern at Bell Labs, the research arm of Lucent Technologies. I dared then to ask Dennis Ritchie and Brian Kernighan for an autograph on their C Book.
{{./kernighan.jpg}} {{./c-book.jpg.gif}}
In the summer of 2000 I went again at Bell Labs for a research stage. This time I boldly ventured to ask Brian Kernighan for an interview for the Romanian computer magazine PC Report Romania, for which I am assistant editor. He has very kindly replied:
Date: Mon, 10 Jul 2000 14:52:15 -0400
To: mihaib@research.bell-labs.com
From: "Brian Kernighan"
Subject: re: odd request
sure, no problem. i'm probably pretty boring, but since
i don't read romanian, you can make things up...
come by any time; i'm mostly around.
brian
The interview has appeared in the August issue of the magazine, in Romanian. However, I reckoned that Mr. Kernighan's opinions may make very interesting reading for an English-speaking audience too, so I decided to also release (with his approval) the interview in English. Here it is; enjoy! BTW: nothing is made up!
The Interview
M: What is the correct way to pronounce your name? I heard that it is not the obvious way?
K: It's pronounced Kernihan, the g is silent.
Brian Kernighan
M: You chose to work in computer science when this was not such an obvious career choice. Can you tell us about how you made this choice and what you think in retrospect about this choice?
K: It's true that I started working with computers probably in the mid to late sixties, when things were fairly early on, and it was entirely by accident. I think I saw my first computer in 1963; it was an old IBM 650. I didn't do any serious programming until in 1964 when I was in my last year of college. But it was fun, and it was before computer science was in any sense a field. When I went to graduate school there was a Computer Science program in the Electrical Engineering Department at Princeton. This was fairly typical of a lot of places: computer science was not a separate academic field, it was just part of some department that might have a computer or people interested in computation, so I just backed into it, entirely by accident. This has been a lucky accident, because obviously the field has had a lot of interesting things happen.
M: You've been in this area for a long time, and you've been a very important player in the evolution of computer science. Some of your work has had a profound impact. Can you point out some things that you consider fundamental advances in computer science in the last 30 years, some changes of paradigm that have happened?
K: I think that there have been a fair number of changes, not necessarily in ``computer science'', but in computing in general. Obviously the fact that hardware has gotten enormously faster: Moore's law, although it is a simple quantitative change, its exponential growth applied for 30 years makes an enormous change; some piece of that relies on computer science, but not much. At the same time, the thing I am more familiar with, and more interested in technically, is the use of various kinds of programming languages so that we're better able to convey to a machine what we want to do. The growth of languages, of the technology for understanding how to express things for a machine, has had an enormous impact as well. Of course, as machines had gotten more powerful, you could afford to devote more resources and use languages that were not efficient 25 or 30 years ago but which are now usable. Other important changes are algorithmic improvements, which truly belong to computer science; also the idea of NP-completeness, which enables us to think about what's easy and what's hard. But as far as I am concerned, the thing I find most interesting is the growth in programming languages.
M: Over the years you have worked on many different areas: graph algorithms, software engineering and software tools, digital typography, but most of your research was in programming languages. What are your current research interests?
K: [laughing] It's interesting, what I've been doing for the last couple of days is a hack-attack back to almost my earliest roots in computerized document preparation or digital typography if you like. I have been working on taking eqn, which is a program Lorinda Cherry and I wrote back in 1974, and converting it to produce output in XML or HTML, so we can put mathematics more easily on web pages. There are a lot of people who have tried various takes on this, but none of them seem to be very good or at least not ready for use yet. We have a local need for it, so I am sitting there and working on it, a C program that I wrote literally more than 25 years ago. It's a very small C program, and I am having great deal of fun trying to fix it up. This is one piece of what I am doing, a very small thing, but it's kind of fun go back and redo something that I've spent time on so many years ago.
The other thing that I'm working on is a language called AMPL which David Gay and Bob Fourer and I did; AMPL is a language for specifying optimization problems, for setting things up like linear programming problems. We're trying to wrap it up so that it can be used as part of larger processes. We're putting an object-oriented interface on it, so it can be buried inside of some other programs or used as a COM or CORBA object.
These are the two things that I'm doing at the moment.
M: Speaking of programming languages, does the eqn program still compile?
K: Yes, it still compiled, I probably hadn't compiled it for five or ten years and it compiled without any problem whatsoever. It's a very simple and small C program; I probably converted it to ANSI C back in the late '80s. What I've been doing is mostly throwing things away because the output language now is simpler than before.
M: Most people probably know you because of the C book, so let me ask you a couple of questions about the C language. C indeed has had a very profound influence; what do you think are the most valuable features of the C language?
The C Book
K: C is the best balance I've ever seen between power and expressiveness. You can do almost anything you want to do by programming fairly straightforwardly and you will have a very good mental model of what's going to happen on the machine; you can predict reasonably well how quickly it's going to run, you understand what's going on and it gives you complete freedom to do whatever you want. C doesn't put constraints in your way, it doesn't force you into using a particular programming style; on the other hand, it doesn't provide lots and lots of facilities, it doesn't have an enormous library, but in terms of getting something done with not too much effort, I haven't seen anything to this day that I like better. There are other languages that are nice for certain kinds of applications, but if I were stuck on a desert island with only one compiler I'd want a C compiler.
M: Actually C is also my favorite programming language, and I've written a lot of programs in it, but since I began writing compilers for C, I have to confess I've begun to like it less. Some things are very hard to optimize. Can you tell us about the worse features of C, from your point of view?
K: I can't comment on the ``worse'', but remember, C is entirely the work of Dennis Ritchie, I am but a popularizer and in particular I cannot say what is easier or hard to compile in C. There are some trivial things that are wrong with C: the switch statement could have been better designed, the precedences of some operators are wrong, but those are trivial things and everybody's learned to live with them. I think that the real problem with C is that it doesn't give you enough mechanisms for structuring really big programs, for creating ``firewalls'' within programs so you can keep the various pieces apart. It's not that you can't do all of these things, that you can't simulate object-oriented programming or other methodology you want in C. You can simulate it, but the compiler, the language itself isn't giving you any help. But considering that this is a language which is almost 30 years old now and was created when machines were tiny compared to what they are today, it's really an amazing piece of work and has stood the test of time extremely well. There's not much in it that I would change.
Sometimes I do write C++ instead of C. C++ I think is basically too big a language, although there's a reason for almost everything that's in it. When I write a C program of any size, I probably will wind-up using 75, 80, 90% of the language features. In other words, most of the language is useful in almost any kind of program. By contrast, if I write in C++ I probably don't use even 10% of the language, and in fact the other 90% I don't think I understand. In that sense I would argue that C++ is too big, but C++ does give you may of the things that you need to write big programs: it does really make it possible for you to create objects, to protect the internal representation of information so that it presents a nice facade that you can't look behind. C++ has an enormous amount of mechanism that I think is very useful, and that C doesn't give you.
M: I have a question about research in language design. It's interesting for instance that Java is very much hyped and the community is split among the merits and flaws of the language. The language has indeed acquired some nice features proposed by researchers in the area (like garbage collection), but also the researchers point some of its weaknesses (like the arrays which are covariant and they shouldn't be). There's a whole body of research done in programming languages nowadays, and a very interesting body of research in functional programming languages, but you don't see this research to really influence the real world, i.e. what people are really using on an everyday basis. Instead all sorts of ad-hoc languages pop up like Perl or Python or stuff like that. Where do you see the fault; what's not right?
K: That is unfortunately a very good question, and there's a certain amount of discussion here at Bell Labs between a very strong group in functional programming languages and a group using very much ad-hoc, pragmatic languages. I honestly don't know why the functional languages don't succeed. For instance ML, which is arguably the best combination, perhaps the one that ought to succeed: in spite of being a very well designed language, thought hard about by a lot of good people over a very long time, embodying an enormous amount of effort of compiler technology, still does not seem to be broadly used. I will oversimplify a lot, and probably offend my friends, by saying that the only thing people do with ML is to make ML compilers. [laughing] I'm overstating intentionally, but it has some of that flavor, and I don't really understand why. I think, speaking only for myself, part of the reason that ML in particular, and functional programming languages in general have not caught on more broadly, is that they're aimed at people who have mathematical sophistication, who are able to think in more abstract ways, that lots of other folks, and I include myself, have trouble with. Whereas languages like C are very operational, you can see how every single piece of them maps into what's going on in the machine in a very very direct sense. If I had been brought up at a different time and in a different environment perhaps I'd be totally comfortable in ML and would find C unsafe, a little dangerous, not very expressive. But my sense is that the functional languages come out of a fairly mathematical community and require a fairly mathematical line of reasoning and therefore are difficult for the people on the street.
M: So I guess, the suggestion is for the researchers to somehow lower the language level, to promote the good qualities?
K: I didn't really answer the other part of your question, why research in languages has not had as much effect as it should have. I think actually it has had an effect, in places like parser technology, code generation, no matter what the language is: research had a big effect on building language tools but less on the design of languages per se.
The languages that succeed are very pragmatic, and are very often fairly dirty because they try to solve real problems. C++ is a great example of a language that in many ways has serious flaws. One of the flaws is that it tried very hard to be compatible with C: compatible at the object level, compatible very closely at the source level. Because of this there are places where there's something ugly in the language, weird syntactic problems, strange semantic behaviors. In one sense this is bad, and nobody should ever do that, but one of the reasons that C++ succeeded was precisely that it was compatible with C, it was able to use the C libraries, it was usable by the base of existing C programmers, and therefore people could back into it and use it fairly effectively without having to buy into a whole new way of doing business. And this is not the case for ML, which was being done at about the same time and, at least partly, in almost the same place, but which took a very different view of the world. As a pragmatic thing, C++ is extremely successful but it paid a certain price by being compatible with the previous language.
M: So you're an advocate of incremental evolution. I see that you're an author of eight books, all of them co-authored. Does this mean that you have a collaborative research style?
K: If you're going to write a book it is a heck a lot easier to get someone else to do a lot of the work [laughing]. I have been very fortunate in having very good collaborators on all of these books and in that sense it is just enormously easy. It is easier to do something like a book, which needs six months or a year of work, if you've got somebody else who's also working on it with you. Also it's a sanity check, helping to make sure you don't go too far off in one direction: you've got somebody else steering you back into what they think is the right direction.
I think everything I've done I've done with somebody else: it's more fun to work with other people than to lock yourself in an office and do it all by yourself. And I think I'm probably better at listening and finding somebody who's got a good idea and then working with that person on the good idea rather than try to invent one of my own.
M: Speaking of sanity checks, I am working on a project which involves a large code base; some functions which are edited by several people: they constantly change the style of the indentation and identifiers. You have published some books on coding style: does your style always match your co-author's style, or do you have problems in reconciling?
K: [laughing] That's also a nice question. Occasionally I've had, ``trouble'' is not the word, but with co-authors, there have been discussions about where to put the braces, where to put the spaces and how to spell identifier names. Most of those things have been pretty trivial, partly because my co-authors have been right around here and we have grown up in the same kind of cultural background. But for instance when Rob Pike and I were working on ``The Practice of Programming'' a couple of years ago, we had pretty intense discussions about trivial keywords like ``where do you put the spaces''. How many spaces do you put? I like to put spaces after things like if and while and for and Rob does not. I won that part of the battle, but there was some other part of the battle I lost, I don't even remember now what it was. We definitely didn't agree 100%, but we came to a friendly settlement of the whole thing.
The more people you have working on something and the bigger the program, the harder it's going to be, and at some point you have to have agreed-upon standards that everybody sticks to and mechanized tools like pretty-printers that just enforce doing it by the rules, because otherwise you lose too much time and there's real chance for making mistakes.
M: You just mentioned pretty-printers; what other programming tools and programming environments do you favor?
K: When I have a choice I still do all my programming in Unix. I use Rob Pike's sam editor, I don't use Emacs. When I can't use sam I use vi for historical reasons, and I am still quite comfortable with ed [laughing]; I know, that's even before you guys where born. And it's partly a question of history: I knew Bill Joy when he was working on vi.
I don't use fancy debuggers, I use print statements and I don't use a debugger for anything more than getting a stack trace when the program dies unexpectedly. When I write code on Windows I use typically the Microsoft development environment: they know where all the files are, and how to get all the include files and the like, and I use them, even though in many respects they don't match the way I want do business. I also use good old-fashioned Unix tools; when I run Windows I typically import something like the mks toolkits and I have standard programs that I'm used to for finding things and comparing them and so on.
M: I'll shift again the subject. When I came to the U.S. I was very surprised to discover that there's very high quality research and also fundamental research --- research which is not necessarily aimed to a product or to making money --- such research is made not only in universities, but also in a few large companies. What can you tell us about research at Lucent, a large company, which used to be part of AT&T, an even bigger company?
K: I'll give you the official company line here, although I think that much of it is still true. Research has been a part of this company when it was called ``The Bell System'', AT&T, or Lucent, for a very long time: Bell Labs had its 75th anniversary this year. I think research started as a recognition that there were certain things that people didn't know how to do but had to figure how to do if they were to improve whatever product or service they were going to provide. Of course, in ancient times, that was telephone service; 30 or 40 years ago the telephone technology started to pick up a significant computer component and that brings research in computer science here. I think that the same sort of thing is true for companies like IBM, which runs very effective research labs as well; that's certainly another company that has a very long tradition of supporting the research environment.
There's the interesting question of ``how does a company justify the money it spends on research''. Lucent at this point has 150,000 employees or so; the research part of it, the part that is you and me, is somewhat less that 1% of that, maybe it's 1000 to 1500 people. The company's annual revenue was 38 billion $ in 1999, so we're spending about 400M$ annually on research to keep you and me sitting in comfortable offices thinking great thoughts. That actually seems like a pretty reasonable way to invest, a high-risk but potentially high-reward part of your assets. You have to be thinking ``where are we going to be a few years from now?'', what kinds of problems now bother us, that we have to get some kind of solution to, which we don't need today; it would be nice if we had it today, but we know that we're going to need it in the future. Unfortunately it's really hard to figure out how to do these things, sometimes even what the right problems are. I think that the best mechanism anybody has found yet is to take a small amount of money, 1% let's say, and hire a bunch of bright people, and put them into an environment where they are encouraged to talk to each other, to talk to the people in the rest of the company, to find out what kinds of problems the people in the rest of the company have; people in the rest of the company are also encouraged to come and say ``can you help with this problem that we have?'', and the hope is that by this almost random process, and it really is in many ways random...
M: [Interrupting] But not only that; you have research and development in many other companies; at Bell Labs you are also encouraged to publish!
K: ... I think that the question is ``how does this company differ from other companies in the fact that we publish?''. There're several things that you can see there. One is that the scale is much larger; Lucent Bell Labs may still be the biggest industrial research lab anywhere, doing research of the kind that you would find in the universities in the good old days, essentially undirected research, not focused on products immediately. IBM is at least comparable, and Xerox to some degree, and there are other companies like that. One of the issues is that research here, at least in the computer science group, and in all of the physical sciences, is between hard-core industrial, where they're basically doing research that's strongly focused on product, and academics, where they're mostly doing things because of curiosity or thinking further out. A big industrial lab is stretched between those two: it has more of a focus on things that might be practical, but at the same time it has a finger in the academic world, it has connections to the academic world. And it has to do that, because, among other things, that's the recruiting mechanism: the reason that you're here rather than at Cisco, let's say, is that Cisco doesn't do research; Cisco buys companies. It's not that Cisco is a bad place, Cisco is a wonderful place in many respects, but it does business differently than Lucent. One other thing that we do by playing in the academic world as well as in the industrial development is that we're able to interact with people of universities as equal colleagues, and therefore we can suck in people like you, who are with us for the summer, and perhaps will come back permanently. In this way we get a steady influx of good people. But to do that you have to put something back into the system. We have to let you in, we have to show you all the interesting things, and we have to let you write papers, and we have to write papers ourselves, because otherwise people wouldn't believe that we did anything interesting. So we have to be largely participating members of the scientific or academic community as well as contributing to the welfare or good of the company. That's an interesting and not solved problem, on how to do both of those things and keep from getting too far into one or the other camp.
M: You've mentioned Rob Pike; you've authored two books with him; I would like to ask a question about a controversial talk he gave, in which he argues that research in computer science systems is basically dead http://cm.bell-labs.com/who/rob/utah2000.pdf (mirror at http://linux.usc.edu/~ehovland/utah2000.pdf). What do you think about this statement?
K: In fairness, Rob is almost always right, although I wouldn't say that to his face [laughs]. I only looked at the slides of that talk recently, I didn't hear him give it, but I think that in many respects he's right. His observation is that it's hard to do systems work: the scale of things is too large for academic environments sometimes, the reward mechanisms in the academic environments may be wrong. As a result a lot of what happens in real systems work tends to be incremental, performance evaluation rather than synthesizing interesting new combinations. I don't know why that is the case: it may be that it's hard in an academic setting to get proper support, it may be that it takes too long --- Rob's observation is that real systems take five years or more, and that's roughly the duration of graduate studies --- so it's hard to get something that matches the career of a student. I wouldn't say that research in systems is ``dead'', but it's certainly not as alive as it could be.
M: Speaking of academia, I saw that you have taught at least two classes at Princeton. I would like to ask about your opinion on computer science education, because I heard complaints coming from the industry that undergraduates in computer science classes master too much useless theoretical skills and they don't know enough about real program development.
K: I've taught four courses at Princeton and Harvard in the last four or five years, at various levels, but that's not enough to qualify me as an ``expert'' in computer science education. Those are two particular schools and I've taught rather screwball things. I don't think universities should be in the business of teaching things that you should learn at a trade school; I don't think it is the role of a university to teach people how to use, let's say, Visual C++ and its Integrated Development Environment. I think the role of the university is to teach students how to program in a particular flavor of language that has for example object-oriented character, to help students understand the issues and trade-offs that go into families of languages, like C, C++ and Java, and how those relate to languages which slice it in a different way, like functional languages. Teaching students skills so that they can step immediately into a Windows development shop and are able to write COM programs is just not right. That's not what universities should be doing; universities should be teaching things which are likely to last, for a lifetime if you're lucky, but at least 5 or 10 or 20 years, and that means principles and ideas. At the same time, they should be illustrating them with the best possible examples taken from current practice.
At Princeton I taught a junior level course, a combination of software engineering and advanced programming: the students there, at least the seniors in that class, were largely very experienced in the kinds of things that industry probably wants. They were comfortable with Visual C++, they knew how to pick components off the net and glue them together, and they could write Java applications of considerable sophistication. Much of that may have been learned by summer jobs. If industry wants people who have more than a ``useless'' theoretical knowledge [laughs], what it should be doing is making sure it gets these bright kids from school and gives them interesting summer jobs that round out the theoretical ideas and the general insights with specifics of a particular application. People pick up that stuff remarkably fast and if they do interesting things on summer jobs they carry that back into their academic careers. I was pretty impressed by how much the students knew, stuff they had not all learned in class.
M: Speaking of students, what advice would you give to a computer science student who wants to pursue a research path? Maybe you see some areas to be more rewarding that other, and maybe some areas are not interesting anymore?
K: Well, don't take my advice on careers [laughs]. Unfortunately I don't think that there is any good advice. The interesting, sorry, I shouldn't be saying ``interesting'' --- the areas that are difficult are only two: one that it's too hard to write programs that work, and the other that it's too hard to use computers. So if you want things to work on, these are two that you could try. Of course, those are fairly general [laughs], there are a lot of special cases that you could play with. If you make any progress at all, on any aspect, then you have an opportunity to go on and pursue the purely academic side of it or alternatively you may go out and try to make your fortune in a start-up. And at this point it looks like a lot of people would rather make their fortune in a start-up than by spending 5 or 6 years getting a Ph.D. Maybe you're just misguided [laughs].... I think unfortunately the best advice you can give somebody is ``do what you think is interesting, do something that you think is fun and worthwhile, because otherwise you won't do it well anyway''. But that's not any real help.
M: Maybe you can help by being more concrete: can you recommend us some books, computer science books or otherwise, which you think have had a big influence on you?
K: The only computer science book I read more than once, that I actually pick up every few years and read parts of again, is The Mythical Man-Month by Fred Brooks, a great book. Partly it's very well written and partly the advice in it, even after more than 25 years, is still highly relevant. There are of course details that are different, some things we approach differently because we have more mechanization and more computer horse-power, but there's an enormous amount of good advice in that, so I recommend it highly. That's the only computer science book I can think of that you read for some combination of pleasure and insight.
There are other books that I reread that are relevant in computing. Books on how to write, write English in my particular case, like ``The Elements of Style'' by Strunk and White. I go back and I reread that every few years as well, because I think the ability to communicate is probably just as important for most people as the ability to sit down and write code. The ability to convey what it is that you're doing is very important.
There's also a great book How to Lie with Statistics, which you might find useful in your own research [laughter].
M: I'll change gears again. Unix and C were created at AT&T and were released under a license which at that time was virtually an open-source license, because AT&T had to do that: being a monopoly it had an agreement with the government, as far as I understand, not to make money out of computers. A lot of people credit this very fact, this liberal license, with the popularity and influence that both Unix and C have had. Recently Lucent has released Plan 9 under an open-source license. What do you think about this ``new'' phenomenon of open-source?
K: I think it's actually a good thing for the most part. The original Unix license was, as you say, largely done the way it was because AT&T was not permitted to be in any business except the telephone business, so they couldn't make serious money on any kind of software. Because of that they were forced into a very sensible decision, which was to give Unix away essentially for free to universities. They did sell it commercially for what amounted to a nuisance fee, but for universities they gave it away and as a result an entire generation of students and their faculty grew up thinking that Unix was the way that you did computing. Unix certainly was much more productive than commercial operating systems which were available at time, and because the source code came along with it, it was easy to see what was going on, and it was easy to make improvements. It built a community of people who were interested in it, motivated by the same things, who were able all to contribute and in that way work themselves up. I think that the current open-source movement has much of the same character. Many of the tools developed in open-source are based on Unix models. Linux is the obvious thing, being, at least on the outside, based on Unix; many of the things that come from the Free Software Foundation are reimplementations of standard tools and languages from Unix. There are of course other projects, arising because of some weird commercial pressure, like Mozilla, the Netscape code, which is now in the public domain, and to which people are contributing as well. I think that the open-source movement is in general a good thing. I am not sure that it will ever replace tailored, professional, rock-solid commercial products sold for profit. But what it might do in a lot of cases, and I think that genuinely it does do in some things like C compilers, is to provide a reference implementation and a standard that's pretty good and that other implementations have to roughly match or why would anybody pay for them? I think that in that sense it's a useful thing. As for Plan 9, I think that's too late, unfortunately. I think Plan 9 was a great idea and it should've been released under an open-source license when it was first done, eight years ago, but our legal guardians would not permit it. I think that they made a grievous mistake. The current open-source license is definitely worth having but it's not clear whether Plan 9, at least as a general-purpose operating system, will have much effect except in a relatively small niche. It has many things going for it which make it valuable in different areas, particularly where you need a small and highly portable operating system, but is it going to take over from Linux? Probably not.
M: I am getting ready to end on a lighter note, but first I'll ask another deeper question. Interpolating from the evolution of the area of computer science so far, what other great advances do you expect in the near, and I don't dare to ask, far future?
K: [laughs] If I could predict the future then I would invest more wisely and I wouldn't have to do these low-paid interviews [n.b. the interview is for free]. Geez, you know, unfortunately I am actually so bad at predicting things.... I am gonna guess that in some sense the situation in computing will be be almost the same: we make a lot of progress, we are able to undertake bigger projects, we can build things which are much more interesting and sophisticated than what we could do 10 years ago. If you look at the kinds of things running on the PC in front of us now, they are enormously more powerful, and flexible than they were 10 years ago. But the amount of messy, intricate, awful code that doesn't work very well and that's underneath all of that has also increased enormously. In some sense I guess we'll continue to make progress, but it'll always be kind-of grimy and not-really-done yet. Because people always take on more than they can reasonably handle, they're always overreaching, and they seem never to go back and clean up the stuff that they did before.
The other thing that I actually worry about is that computers are pervasive, they're just everywhere, in everything you do. You cannot turn around without being involved with something that depends critically on computers, and more and more of those are things that actually matter to us. It doesn't matter if the Sound Recorder on Windows works or not....
M: It matters now! [N.B. this interview is recorded using a PC and software sound recording]
K: .... if we lost this [interview], the Hell with it. But for example, when you fly back to Pittsburgh, you really really want the computers that control the avionics in the Airbus 320 to work properly and not make any mistakes. That's just one of the things that depend critically on our ability to write software that works and build hardware that supports it, and I don't think we know how to do that well yet. We're making progress, it's definitely better, the combination of languages and techniques like verification help, but we still have the same problem: as we understand better how to do the small things we take on bigger and more complicated things and so in a sense we're always up to our armpits in alligators.
M: The last question I have on my list is about your hobbies.
K: [laughing] Who's got time for hobbies? If I look at what my hobbies are at this point they amount to reading. When I am not fooling around or playing with computers or doing things that are related to work I find myself reading. Usually history books; I don't know why, it's kind of weird, but I like to read history books. Over my lifetime, over the last 20 or 30 years, I've got phases where I've got deep into something for 3, 4, 5 years. I went through a phase in which I tried to learn Japanese, for example; I can tell you, it takes longer than 3 years to learn Japanese! And so that was a failure. When I was a graduate student I spent roughly five years doing karate and I got to a point where I could sort-of survive, but I dropped it, it's no longer part of my life. And I went through a phase being very interested in investments, and that didn't change my life either, so obviously I wasn't very good at it. So the thing that I do at this point mostly is to read a lot.
M: Thank you very much!

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

7
Zim/Interview/DMR.txt Normal file
View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-06-03T10:46:02+08:00
====== DMR ======
Created 星期五 03 六月 2011

View File

@@ -0,0 +1,72 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-06-03T10:46:15+08:00
====== Memo ======
Created 星期五 03 六月 2011
**Proposing a Unix Portability Experiment**
Below is a memo that Steve Johnson and I gave to Elliot Pinson, our boss at the time, proposing the idea of buying a new machine to test the idea of porting Unix to a new architecture. It is, unfortunately, undated. Internal evidence from the document ("around March, 1976") suggests that it must date to ca. the beginning of 1976. The modified-date of the file as I found it is in 1978, but the file was certainly copied or fiddled, because the paper on the outcome of the experiment, "Portability of C Programs and the UNIX System", BSTJ 17 6, July-August 1978, confirms that the proposed machine (an Interdata 8/32) arrived in April 1977.
Johnson's PCC compiler, which would be used for the Interdata project and would later be used for the VAX (Unix 32V) here and at Berkeley (BSD) and then also by important startups like MIPS, SGI, Sun, was evidently in its own late formative stage at the time of writing.
This memo, of course, wasn't a surprise to Pinson. He'd been quite supportive of the idea, and the memo follows a familiar style: researchers want to spend money and time on something, management wants reassurance that the researchers have a moderately coherent idea. Writing this was our equivalent of writing a DARPA or NSF grant proposal, but one that was already a lock.
To explain probably-unfamiliar references: ALTRAN was a language and system for doing symbolic algebra, primarily on polynomials and rational forms; it was mostly the brainchild of W. Stanley Brown. The whole thing was written in hyper-portable Fortran. #3ESS was a not-widely-deployed telephone Central Office for small communities; it used a unique processor (the AP-3). At the time it looked like fun and value for the Bell System for us to move Unix to it, but this didn't pan out.
Unix Portability
S. C. Johnson
D. M. Ritchie
What We Want to Do
We propose a project with three major goals:
1.
to refine and extend the C language to make most C programs portable to a wide variety of machines, mechanically identifying non-portable constructions;
2.
to write a compiler for C which can be changed without grave difficulty to generate code for a variety of machines;
3.
to revise or recode a substantial portion of the Unix system in portable C, detecting and isolating machine dependencies, and demonstrate its portability by moving it to another machine.
From pursuing each goal we hope to attain a corresponding benefit:
1.
improved understanding of the proper design of languages which, like C, operate on a level close to that of real machines but which can be made largely machine-independent;
2.
a C compiler which can be adapted to other machines (independently of Unix), and which puts in practice some recent developments in the theory of code generation;
3.
a working, if perhaps crude and incomplete, implementation of Unix on at least one other machine, with the hope that other implementations will be fairly straightforward.
What We Cannot Do
The common theme here is portability on a bold, apparently unprecedented, scale: we are attempting to make `portable' a multi-access, multi-programming operating system complete with enough utility programs to make it useful as a production tool. It is clear that the degree of portability promised cannot approach that of ALTRAN, for example, which can be brought up with a fortnight of effort by someone skilled in local conditions but ignorant of ALTRAN itself. We do not plan that the C language be bootstrapped by means of a simple interpreter of an intermediate language; instead an acceptably efficient code generator must be written. The compiler will indeed be designed carefully so as to make changes easy, but for each new machine it will inevitably demand considerable skill even to decide on data representations and run-time conventions, let alone code sequences to be produced.
Likewise, although we hope to isolate the machine dependent portions of the operating system into a set of primitive routines, implementation of these primitives will involve deep knowledge of the most recondite aspects of the target machine, including the details of I/O operations and memory protection and relocation.
Next, the sheer bulk of code potentially involved is quite great, on the order of 100,000 lines, counting standard Unix utilities written in C but not subroutines or assembly-language routines and interfaces. Even if many of these utilities are dispensible at first, even if they are mostly portable anyway, even if we are able to discover non-portable constructs mechanically and unerringly, there will still be plenty of work in transporting them.
In view of the intrinsic difficulties of our project, we feel well justified in rejecting a number of sub-goals which might seem otherwise defensible. Thus, we cannot hope to make a portable Unix system compatible with software, file formats, or inadequate character set that may already exist on the machine to which it is moved; to promise to do so would impossibly complicate the project and, in fact, might destroy the usefulness of the result. If Unix is to be installed on a machine, its way of doing business must be accepted as the right way; afterwards, perhaps, other software can be made to work.
Where We Are
Each of the goals we mentioned initially has some characteristic problems associated with it. Since we have devoted careful attention only to the portability of C programs, and have uncovered several difficulties therein, we will discuss that aspect of the project.
Most of the C difficulties stem from the twin assumptions that pointers and integers require the same space in storage, and that pointers to an object of a given type (for example integers) are usable as pointers to a more finely-divided type (for example characters). The first assumption is stated explicitly in the C definition, and happens to be realistic on the only machines for which C has been completely implemented (PDP-11, H6000, S/370). It is used when two structures, which differ by substitution of an integer for a pointer, are assumed to be congruent; when the number `0' is used as an argument to a function expecting a pointer, to indicate a null value; and when a function delivering a pointer remains undeclared (and thus implicitly integer-valued). This assumption fails on some potentially interesting machines, such as the ESS #3 CC (a.k.a AP-3), which has 16-bit integers and 20-bit pointers.
The second assumption, that various sorts of pointers are compatible, is visible most dramatically in the current I/O interfaces to the operating system. The `read' call, for example, is equally happy to receive a character pointer as a destination for bytes as it is an integer pointer through which to store integers. This assumption too fails on many machines, including most word-oriented 16-bit machines as well as the Sigma 5.
If C, like PL/1 and Algol 68, required declarations of functions and of their arguments to be visible at the time of their use, the effects of these assumptions would be largely mitigated because the compiler could insert the appropriate conversions. It remains to be seen whether the burden of inserting such declarations is adequately compensated for. In any event, we have a useful tool (the `lint' program) for discovering inappropriate associations between integers and pointers; it can be modified, if need be, to produce the required declarations automatically.
Work on the portable C compiler is well under way; it uses the YACC-based `front-end' which has existed for some time. Examination of the operating system proper has not begun.
What We Want
We would like to obtain a new machine, and have easy access to it from the Research Unix machine, around March, 1976; by that time the new compiler should be working well. Two factors will govern the choice of this machine. It should not be so similar to the PDP-11 that the exercise becomes trivial, nor should it be so peculiar that the result is unnecessarily complicated or inefficient. Moreover, if the machine is attractive in its own right, then even the initial implementation of portable Unix may find an immediate market in the Bell System and elsewhere.
Copyright © 1998 Lucent Technologies Inc. All rights reserved.

View File

@@ -0,0 +1,181 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-06-03T09:31:20+08:00
====== Writings from the Past--Dennis M. Ritchie ======
Created 星期五 03 六月 2011
http://cm.bell-labs.com/cm/cs/who/dmr/notes.html
===== Writings from the Past =====
**Machine-readable** versions of early Unix material are hard to come by, even for us. "Backup" in those days (1969 through the early 70s) consisted of punched cards, paper tapes, or uploading to a Honeywell machine. We no longer have those cards, tapes, or the Honeywell.
When we got a **PDP-11** around 1971, we did get **DECtape**, and did save some material, though not enough. A few years ago Keith Bostic and Paul Vixie resurrected a PDP-11 DECtape drive and offered to read any old tapes we might have around, and I sent several to them. These notes are among the small treasures discovered there.
Two files named "**notes1**" and "**notes2**" were on the tape labelled "DMR", and their date, if I correctly interpret the time representation on the tape, is 15 March, 1972.
I reproduce them below. I have no memory of why I wrote them, but they look very much like something to have in front of me for a talk somewhere, because of the references to slides. From the wording at the end ("the public, i.e. other Labs users"), I gather that it intended to be internal to Bell Labs. HTML markup and the corrections and annotations in [] were added in September 1997, but otherwise it's original.
**Dennis**
===== notes1 =====
UNIX is **a general-purpose timesharing operating system** for the Digital Equipment Corp PDP-11.
It is the only such system known to me; in any case it is probably the first. DEC, in particular, shows no signs of producing a** multi-user** system.
==== Some history and credits. ====
UNIX was written by **K. Thompson**. I wrote much of the system software; Ken most of the rest; Other contributors have been Joe Ossanna, Doug McIlroy, and Bob Morris.
The first UNIX was on a** PDP-7**. Most features were present, some in rudimentary form.
UNIX-11 system was largely written in **Jan.-Mar., 1971**; since the[n] changes are generally refinements.
The charter for the project, and the reason the machine was obtained, **was to develop a document editing and formatting system**. The original notion was to **use UNIX as a development tool only, and have the editing system run stand alone**. [This is true as it applies to justifying the purchase of the PDP-11. The earlier work on the PDP-7 just happened in the course of doing research.]
It turned out, however, that it was quite practical to have the editing system run under UNIX, and this is [how it] operates.
The editing system is now being used by the Patent Division at Murray Hill to **prepare patent applications**. I undertand that the bulk of the applications are being done by UNIX. UNIX is also being tried out by two typists in the MH typing pool.
At the start I stated that UNIX was a general-purpose time-sharing system. I imagine the concept is familiar, but I want to bring out a few points.
**First, it is general purpose. **This means it may, or may not, be suitable **as a basis for various special-purpose applications**. The two things that come to mind are **management of large data bases** and applications requiring very **rapid real time response**.
For several reasons, not all defensible, very large files of information are not very well handled by the file system proper. I will return to this point.
In the real-time area, the system has no direct hooks to allow a user-written program to respond very rapidly to an external event. **"very rapidly", here, means in less than about half a second**, which is the approximate time to **swap programs off the disk**. There are thoughts about how to arrange this, but it has not been done.
Notice, however, that the system does in fact make rapid responses to events, in the sense that it is able to pick up characters from typewriter terminals even when they come only a few milliseconds apart. Thus if the "real-time" requirement is really that if **collecting characters **for a terminal or other machine, that ability is already there; what may be lacking is the possibility of **scheduling a non-system program** which wants to act on those characters within a very short time.
So far I have been talking about the disadvantages of the general-purpose system. The advantage lies in the ease with which program development can be done. With any reasonable number of users, responses to user's commands is quite fast, and the cycle of edit-translate-execute-debug is speed-limited by **thinking time, not compute time**. For example, it takes about **50** seconds to assemble and install a new UNIX system.
The time-sharing aspect of the system is also vital to a program development effort, since it means that several people can be using the machine at once.
Likewise when the system is adapted to deal with a particular application, the fact that **multi-programming** is built in from the start means that the most subtle problems which come up when several things must go on at approximately the same time have already been solved.
Given that UNIX is** excellent for program development**, but may have limitations as a base upon which to build a more specialized system, the question arises as to the advisibility of writing one's own system using UNIX. I can only say that of the several projects using UNIX, all have in fact decided to use it not only for development but to support their application directly. Often some modifications to the system have proved necessary, however. Typically these relate, though, to support of some device the standard UNIX does not provide for, and to rearranging the management of core memory.
==== HARDWARE ====
UNIX is running on at least five PDP-11, no two with the same complement of hardware. The slide shows the minimal complement possible.
The basic requirements above a PDP11 processor are
12 K core
some kind of disk
a clock
an EAE (extended arithmetic element, for multiply/divide
Some sort of tape, to provide for loading the system software and saving the disk
Above the minimum, it is of course desirable to have more core, lots of disk, communications interfaces, paper tape reader, and a ROM containing a bootload program.
A summary of the devices which have been attached to actual UNIX systems includes:
DC-11 communications interfaces attached by DATAPHONE to 10, 15, or 30 cps ASCII terminals (not DM-11 as yet)
RF fixed head disk (256K words)
RK moving head disk (1.2M words)
RP moving head disk (2314-style, 10 M words)
paper tape reader/punch
201 DATAPHONE interface
ACU on DATAPHONE
DECtape
Magtape (9-track)
card reader
line printer
==== SOFTWARE ====
There is a good deal of software that goes along with UNIX. It should be pointed out that it was all written using UNIX; none of it comes from DEC or elsewhere.
It should also be pointed out that almost all of it is being worked on in one way or another. That is while all I will list is usable, there are a number of things which we regard as desirable that are not complete.
The major pieces of UNIX software are:
assembler
link editor
text editor
FORTRAN compiler
B compiler
symbolic debugger
text formatting program
M6 macro processor
TMGL compiler-compiler, the last two contributed by Doug McIlroy
command line interpreter
many utilities, mostly to deal in one way or another with the file system
==== SYSTEM ====
The system proper can be regarded as falling into three parts:** the file system, the process control system, and the rest**.
I will only talk about the file system in any detail at all.
Files in UNIX are arranged in **a hierarchical, tree shaped structure.** There are two types of object: **files**, and **directories**. A directory is actually no more than a file, but its contents are controlled by the **system**, and the contents are names of other files. (A directory is sometimes called a catalog in other systems.)
Thus we have the type of arrangement shown in the slide: there is a** root** directory, which is the "base" of the tree (as usual, the tree is upside-down) which contains files and directories.
Each of the directories under the root also can contain files and directories, and so on.
In UNIX, files are named by giving a sequence of directories, separated by slashes, and ending in a file or directory (for example: ...)
The name of the root is "/", and so it begins the sequence.
(example...)
Every user always has a** current directory**, which belongs to him. Files can also be named with respect to the current directory, when the name does not begin with a "/". (examples: ...)
It is possible for the same file to appear in several different directories, under possibly different names. This feature is called "**linking**" (example).
It is also possible for the directory hierarchy to **be split** across several devices. Thus the system can store a directory, and all [files] and directories lower than it in the hierarchy, on a device other than the one on which the root is stored.
In particular, in our own version of the system, there is a directory "**/usr**" which contains **all user's directories**, and which is stored on a relatively large, but slow moving head disk, while the othe files are on the fast but small fixed-head disk.
notes2
One of the most interesting notions in the file system is the **special file**.
Certain files do not refer to disk files at all, but to** I/O devices**. By conve[n]tion, such special files reside in a **particular directory**, although this is not necessary. When a special file is read or written,** the device it refers to is activated**. For example, all the communications interfaces attached to typewriters have special files associated with them. Thus, provided you have permission, anyone can send a message to another user simply by **writing information onto his typewriter's special file**. There are special files, for example, to refer to the paper tape reader and punch, to the 201 dataphone, the console typewriter, and whatever other devices may be on the system. An effort is made to **make these special files behave exactly the same way that ordinary disk files** behave. This means that programs generally do not need to know whether they are reading or writing on some device or on a disk file.
The system calls to to I/O are designed to be** very simple** to use as well as efficient. There is no notion corresponding to GEFRC on the Honeywell machines and "access methods" in OS [/360 from IBM] because the direct use of system entries is so straightforward.
Files are **uniformly regarded as consisting of a stream of bytes**; the system makes** no assumptions as to their contents**. Thus the** structure of files** is controlled solely by the **programs **which read and write them. A file of ASCII text, for example, consists simply of a stream of characters **delimited by the new-line characters.** The notion of physical record is fairly well submerged.
For example, the system entry to read a file has only** three arguments**: the file which is being read; the location where the information is to be placed; and the number of bytes desired. Likewise the write call need only specify the file under consideration, th[e] location of the information, and the number of characters to write. The system takes care of** splitting the read or written information into physical blocks as required**.
The I/O calls are also apparently **synchronous**; that is, for example, when something is written, so far as the user is concerned, the writing has already been done. Actually the system itself contains** buffers **which contain the information, so that the physical writing may actually be delayed.
There is not distinction between **"random" and sequential I/O**. The read and write calls are sequential in that, for example, if you read 100 bytes from a file, the next read call will return bytes starting just after the last one read. It is however possible to move the read pointer around (by means of a "seek" call) so as to r**ead the file in any order**.
I should say that that it is not always desirable to ignore the fact of **physical record sizes**. Program which reads **one character** at a time from a file is clearly at a disadvantage compared to one which reads many, if only because of system overhead. Thus__ I/O bound programs are well-advised to read and write in multiples of the physical record size__ (which happens to be uniformly 512 bytes). But it is efficiency, not a logical requirement, which dictates this.
==== PROBLEMS ====
I mentioned earlier that UNIX was not especially suited to applications involving vast quantities of data. The reason is this: files are limited in size to **64K** bytes. The reason for this is not particularly defensible, but it has to do with the fact that the PDP-11 **word size is 16 bits**.
There are a couple of ways around this problem. One of them is simply to split one large logical file into several smaller actual files. This approach works for a while. The limitation here comes from the fact that** directories are searched in a linear fashion**. Thus if the are a vast number of files, it can become quite time-consuming tosearch directories to find the files they contain. We have not noticed this to be a problem, so far, it is only a worry.
Another way around the small file size is to use a disk as a special file. For various reasons, when an entire disk drive is accessed as a special file, the size limitation does not occur. Thus one can set up a program which manages its own data-- in effect is its own, special-purpose file system-- and expect reasonable results.
This again bears on the general versus special purpose system: it probably is more efficient anyway to do your own data management, provided the extra labor is worth the cost.
==== PROCESS CONTROL ====
As I said, the second part of UNIX is that part concerned with process control. __A process in UNIX is simply the execution of a program__. Each user has at least one process working on his behalf: its task is to read his typewriter and interpret what he types as commands to the system to do something. The program associated with this process is called the__ Shell__, and it has many valuable features, including the **redirection of I/O**, so that you can execute programs which ordinarily write, for example, on the typewriter, and arrange that their output go on a file.
I will not go into any details, except to say that either by use of the Shell, or from within a program, it is possible to create an asynchronously running process executing any program designated.
==== SUMMARY ====
If you are interested in using UNIX, there are a number of points about which you should be aware.
First, having to do with the PDP-11 hardware:
the PDP-11, although probably more powerful that most people realize, is not a large machine: a PDP-11 can only accommodate 28K 16-bit words of core.
Moreover, the 11-20 has no hardware protection features: any user can at any time crash the system by executing a program with any of an infinite variety of bugs. This fact is probably most important during program development.
The PDP11/45 essentially solves both of these problems, in a very cost-effective way-- it is hardly more expensive than an 11/20 when the total system cost is considered. It has hardware segmentation and 256K of core can be attached. Since we will be one of the first to get and 11/45, there will definitely be a UNIX on it very soon after it arrives. (however the date is still uncertain.)
Perhaps more important is the fact that **UNIX is essentially a two-man operation at present**. Anyone who contemplates a UNIX installation should have available some **fairly sophisticated programming talent **if any modifications planned, as they almost certainly will be. The amount of time that we can spend working on behalf of, or even advising, new UNIX users is limited. Documentation exists, but never seems to be complete.
There have been rumblings from certain departments about taking over the maintenance of UNIX for the public (i.e., other Labs users) but I cannot promise anything.

View File

@@ -0,0 +1,53 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-06-06T14:52:01+08:00
====== Guru of the Unix gurus ======
Created 星期一 06 六月 2011
http://www.salon.com/technology/feature/2000/09/01/rich_stevens/index.html
Guru of the Unix gurus
A year after his death, the programming community still treasures the influence of Rich Stevens.
By Rachel Chalmers
When Andrew Hume presented the Usenix Lifetime Achievement Award in San Diego in June, he managed to say exactly two words -- "Richard Stevens" -- before a standing ovation drowned him out. "I sat next to Richard's family at the presentation," says Tom Christiansen, a well-known figure in the Perl programming community who had known Stevens on and off for years. "It was stunning. I don't know if his family did, but I sure noticed a lot of the audience in tears."
"Usenix," (a word coined to get around trademark restrictions on the word "Unix") is the Advanced Computing Systems Association. W. Richard Stevens is the author of "TCP/IP Illustrated" and "Unix Network Programming," each of which runs to three volumes, and "Advanced Programming in the Unix Environment." Their influence among Unix users is hard to overstate. Thousands of programmers all over the world consider Stevens a guru and his works essential to their jobs.
"It blew my mind," says his sister, Claire Stevens. "I knew he wrote those books, but it never made a dent. I had absolutely no idea that all these people knew and were touched by him." Claire and Richard's wife, Sally, accepted the award on Stevens' behalf. Stevens died on Sept. 1, 1999. He was 48 years old.
His death hit the close-knit Unix community hard. Fiercely intelligent and deeply private, Stevens set an example for everyone in the Unix world. What he didn't know, he determined to find out; what he did know, he strove to pass on to anyone who was interested. A year after his death, memories of one of the Unix community's most beloved experts are still fresh and vital.
Christiansen's recollection is typical. The two were casual acquaintances from the academic conference circuit. "I remember I was doodling around on the piano, and Richard came over and said, 'I heard you doing that at some other conference and it inspired me to take up the piano again,'" Christiansen says. "On subsequent meetings he would tell me all about his progress. As with everything he talked about that he really loved, his eyes just kind of sparkled."
With Christiansen, Stevens talked about music. With cryptographer Greg Rose, a fellow pilot, he talked about flying. With Dave Hanson, who sat on the committee to assess his doctoral thesis, Stevens talked about yet another shared passion, skiing. To everyone who knew him, it seemed he cared about the things that mattered most to them.
"He was a very good listener and he knew something about every subject," says Claire. "He could always contribute something, or at least sound intelligent."
Yet Stevens was also an extraordinarily private man. Christiansen, Rose and Hanson all knew him for years, yet none felt that they knew him well. "I wouldn't say he was complex, but because of his intelligence he could come across that way," Claire admits.
He brought the full force of his intellect to bear on his work, and it showed. Stevens' books are regarded as models of the genre. "I remember he shocked me, because I ran into him at some conference and he said, 'I wish I'd brought the 'Perl Cookbook' so I could have had you autograph it for me,'" says Christiansen. "I don't consider my books to be in anywhere near the same league of serious, hard work as his. That he would say to me 'I should have got your autograph' was like Dennis [Ritchie, one of the original authors of Unix] saying it."
"He gave extremely cogent explanations of what's going on," says Rose. "His books are so much more readable than most computer books. A lot of authors look at the documentation and rewrite it with little or no interpretation. He took the time to understand."
His perseverance was an artifact of an apparently ferocious curiosity. "When I hit something that I don't understand, I take a detour and learn something new," said Stevens in an interview two years before his death. "This often makes my books late by a few months, but I think accuracy and completeness are essential."
It may have been Stevens' sense of himself as an outsider that inspired this level of dedication. He and his brother and sister were copper-mining brats, born in Africa to a metallurgical engineer; they divided their childhood among northern Rhodesia (now Zambia), Utah, New Mexico, Washington and South Africa. Stevens didn't start out in computer science at all, but in aerospace. It just happened that he graduated in 1973, when Boeing was laying off thousands of aerospace engineers. Programming, like piano, was a late acquisition that took.
"I really believe that my background is fundamental to the success of 'Unix Network Programming' and my other books," he said. "That is, I was not one of the developers at Berkeley or AT&T, so the writing of UNP was not a 'memory dump.' Everything that is in the book I had to dig out of somewhere and understand myself."
In fact, Stevens belonged to the generation of Unix geeks who pored over not-exactly-legal copies of John Lions' legendary commentary on the Unix source code. Lions firmly believed that no one could understand the theory of computer science without concrete examples, ideally embodied in C programs. Stevens seems to have agreed.
"Certainly his books do that. He tends to walk you through the code," says Hanson, who led the graduate seminars at the University of Arizona where Stevens discovered the Lions books. "It's not like you can read this stuff while you're sitting in front of the television. It's a particular style of learning about software that requires a very heavy investment upfront. But it pays off."
It's not as easy, or as obvious, as it sounds. Publishing code legibly is hard work, and calls for stubborn authors who insist on the best tools for the job. Stevens greatly admired and strove to emulate Donald Knuth, who wrote "The Art of Computer Programming," and Brian Kernighan, "The C Programming Language," whose books are as beautifully laid out as they are brilliantly written.
For his own work, he insisted on a text-formatting tool even more venerable and revered than Knuth's Tex. "Rich had told me that he gets to send 'troff,'" says Christiansen in awed tones, referring to a fairly archaic layout program. "He still used all the cool old tools, and he prepared camera-ready copy for the publisher. It's very, very rare that authors aren't forced to use Microsoft Word or unadorned SGML." Controlling his own means of production allowed Stevens to explain difficult concepts visually as well as verbally -- hence the apparently perverse theme of "TCP/IP Illustrated." Visualizing a protocol? It sounds crazy, but it works.
His books are so good that they have come to symbolize intelligence. In "Wayne's World II," Garth's girlfriend carries a copy of "Unix Network Programming." Stevens discovered this when he took his 13-year-old son to see the film. His son grabbed his arm and said, "Dad, that's your book!"
"I couldn't believe it," he told programmer Trent Hein. "My book was used to define the ultimate geek, and suddenly my son thinks I'm really cool."
His son was right.

View File

@@ -0,0 +1,154 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T21:03:52+08:00
====== Interview with Bill Joy ======
Created Sunday 27 March 2011
The following interview is taken from the August 1984 issue of Unix Review magazine (which briefly changed its name to Performance Computing, but then dropped out of print and went to an online-only format at www.unixreview.com). Permission has not been given to copy this, so you should only use it for your own personal or scholastic purposes. Do not distribute it without obtaining permission from the publisher of Unix Review.
Actually, I tried to get permission to distribute this with elvis, but the publisher wasn't sure who owned the copyright. Since they weren't sure it was theirs, they didn't feel they could give me permission. I've decided to make this available on my web site until somebody steps forward to claim it as theirs.
Interview with Bill Joy
By Jim Joyce
Bill Joy is one of those rare people who can carry on a rapid-fire technical conversation while coding at the keyboard. His seemingly inexhaustible energy has produced the C shell command interpreter, the vi screen editor and the Berkeley paging kernel, among other accomplishments. UNIX REVIEW sent Jim Joyce to Sun Microsystems, where Joy is Vice President in charge of Research and Development, to capture some of this energy.
REVIEW: How did vi come about?
JOY: It's an interesting story. I came to Berkeley in '75 as a theory student and got involved with Mike Harrison working on general context-free parsing algorithms, so I tried to write the thing in Pascal because Pascal had sets, which Ken Thompson had permitted to be of arbitrary length. The program worked, but it was almost 200 lines long - almost too big for the Pascal system. I talked to Thompson to figure out how I could make the Pascal system handle this program. Chuck Haley and I got involved in trying to make the Pascal system handle it, but the thing was wrong because it was building the entire thing in core. So I got sucked in, got department help, and built some hope of receiving enough support eventually to pay for this program to work under Pascal.
But while we were doing that, we were sort of hacking around on ed just to add things. Chuck came in late one night and put in open mode - where you can move the cursor on the bottom line of the CRT. Then George Coulouris from Queen Mary College came to Berkeley and brought along this thing called em, which stood for "editor for mortals." It had two error messages instead of one. It had a prompt, and its own strange version of open modes done for ITT terminals, which really didn't work very well on ADM-3As.
So Chuck and I looked at that and we hacked on em for a while, and eventually we ripped the stuff out of em and put some of it into what was then called en, which was really ed with some em features. Chuck would come in at night - we really didn't work exactly the same hours although we overlapped in the afternoon. I'd break the editor and he'd fix it and then he'd break it and I'd fix it. I got really big into writing manual pages, so I wrote manual pages for all the great features we were going to do but never implemented.
Eventually Chuck graduated with his Ph.D. for his part of the Pascal system. After he left, there was ex Version 0.1 at the Computer Center. There was a version of the editor from EP016, which stood for September 1, '76, the date that the binary was created - after which we promptly lost the source because we were making so many changes and didn't have SCCS.
Really, what started it all was that we got some ADM-3As to do screen editing. I remember right after Carter got elected, I was sitting in my apartment in Albany, CA, on a Saturday listening to people call Carter and ask stupid questions while I designed the screen editor. That dates it: it was probably '76. It was really a consequence of our initial frustration with Pascal. It went on from there. I stopped working on it whenever they made the reference cards - '78 - '79 - and I really haven't worked on it for five years.
Mike Horton brought his editor along from Bell Labs called hed for "Horton's editor." He was disappointed when vi won out over it. But vi had momentum with the local users - and Mark, somewhat out of frustration, went out and actually supported vi. That was nice, because I didn't have the patience to do it anymore. Just putting the termcap entries in that people would mail me would take hours a week, and I was tired after three or four years.
REVIEW: Didn't Bruce Englar implement the count fields feature?
JOY: Bruce suggested that. At one point there was an acknowledgment section in the documentation for the editor that mentioned all the people who had helped - I don't know if it's still there in Volume 2.
A lot of the ideas for the screen editing mode were stolen from a Bravo manual I surreptitiously looked at and copied. Dot is really the double-escape from Bravo, the redo command. Most of the stuff was stolen. There were some things stolen from ed - we got a manual page for the Toronto version of ed, which I think Rob Pike had something to do with. We took some of the regular expression extensions out of that.
REVIEW: What would you do differently?
JOY: I wish we hadn't used all the keys on the keyboard. I think one of the interesting things is that vi is really a mode-based editor. I think as mode-based editors go, it pretty good. One of the good things about EMACS, though, is its programmability and the modelessness. Those are two ideas which never occurred to me. I also wasn't very good at optimizing code when I wrote vi. I think the redisplay module of the editor is almost intractable. It does a really good job for what it does, but when you're writing programs as you're learning... That's why I stopped working on it.
What actually happened was that I was in the process of adding multiwindows to vi when we installed our VAX, which would have been in December of '78. We didn't have any backups and the tape drive broke. I continued to work even without being able to do backups. And then the source code got scrunched and I didn't have a complete listing. I had almost rewritten all of the display code for windows, and that was when I gave up. After that, I went back to the previous version and just documented the code, finished the manual and closed it off. If that scrunch had not happened, vi would have multiple windows, and I might have put in some programmability - but I don't know.
The fundamental problem with vi is that it doesn't have a mouse and therefore you've got all these commands. In some sense, its backwards from the kind of thing you'd get from a mouse-oriented thing. I think multiple levels of undo would be wonderful, too. But fundamentally, vi is still ed inside. You can't really fool it.
Its like one of those pinatas - things that have candy inside but has layer after layer of paper mache on top. It doesn't really have a unified concept. I think if I were going to go back - I wouldn't go back, but start over again.
I think the wonderful thing about vi is that it has such a good market share because we gave it away. Everybody has it now. So it actually had a chance to become part of what is perceived as basic UNIX. EMACS is a nice editor too, but because it costs hundreds of dollars, there will always be people who won't buy it.
REVIEW: How do you feel about vi being included in System V?
JOY: I was surprised that they didn't do it for so long. I think it killed the performance on a lot of the systems in the Labs for years because everyone had their own copy of it, but it wasn't being shared, and so they wasted huge amounts of memory back when memory was expensive. With 92 people in the Labs maintaining vi independently, I think they ultimately wasted incredible amounts of money. I was surprised about vi going in, though, I didn't know it was in System V. I learned about it being in System V quite a while after it had come out. They had this editor, se, but I guess it failed.
I think editors have to come out of a certain kind of community. You need a cultural context. As you mentioned before, Bruce Englar thought of a number of things, Dick Fateman contributed work to the cursor position after the join command - little things like that. There were just dozens of people involved, but if you are in an environment where management says, "This person shall do an editor," it doesn't necessarily work. It's funny, the politics at Bell Labs.
REVIEW: You had said, when you were giving a demonstration earlier today, that when you are on foreign systems you use ed.
JOY: That's right. Absolutely.
REVIEW: You don't even try to use vi?
JOY: I'm used to having a 24-line terminal with no ability to scroll back. The reason I use ed is that I don't want to lose what's on the screen. I used to have a Concept terminal which had eight pages of memory, like a mini-version of a window system. I just don't like to lose what's in the window. I'm looking forward to the editor that's going to be embedded in the window system Warren Teitelman is working on. Having editing functionality everywhere would be great in the same sense that it would be nice to have history everywhere.
REVIEW: So there will be a history mechanism in the new editor?
JOY: I would be surprised if there wasn't. Warren basically invented all those things. He's very keen on that. I tried to use EMACS and I liked it. The problem was I spent all my time programming it because it was improving so fast that my programs kept breaking. I got tired of maintaining my macros so I guess I'm looking forward to an editor I can learn and then forget about.
I started to write a new editor not too long ago and had it about half done after two days. It was going to have almost no commands, but, instead use what's basically the smalltalk editing menu, a scroll bar, and a thumb bar. Lines just went off the right and if your window wasn't big enough - too bad - it just threw them away. There was going to be an edit file, and a store and read file. That was it.
It was called be. I'll let you guess what that stands for. It actually stands for about eight different things.
REVIEW: Bill's editor?
JOY: That's one of the eight. It's also the English verb "to be" because it is. There are six more. I got tired of people complaining that it was too hard to use UNIX because the editor was too complicated. Since I sort of invented the editor that was most complicated, I thought I would compensate by also designing the editor that was most simple. But I got distracted. If I had just spent another day on it... I could actually edit a file on it. I actually used it to edit itself and scrunched the source code - sort of old home day, because we used to do that all the time.
I had threatened to remove all the copies of vi on January 1 of this year and force people to use be. I don't think it would have worked, though, because I don't know any of the root passwords here anymore. These editors tend to last too long - almost a decade for vi now. Ideas aren't advancing very quickly, are they?
REVIEW: So you use Interleaf now?
JOY: I use Interleaf for all my documentation. When I'm writing programs, I can type them in half the time with cat because the programs are six lines - a #include, main and a for loop and one or two variables. I actually use vi for editing programs. James Gosling did a really nice editor as part of a project at Carnegie Mellon University which is AWYSIWYG: Almost What You See Is What You Get. It's also a program editor built into the window system he's working on. I think that will ultimately replace vi.
Interleaf is very nice. I expect there to be a lot of competition for programs like that. I don't expect that to be the only one. By the end of next year there will be half a dozen UNIX-based integrated office systems. Interleaf is based on the formatting process.
I think you'll see others focused on database, calendar management, mail, and spreadsheets - you need all those things to have a generic office automation application. I don't really know who is going to win. I know about a few that are unannounced, but it's not clear which is the mode desirable. None of them are open, really. None are as programmable as UNIX. You really can't go in and add things that you need. That lack of programmability is probably what ultimately will doom vi. It can't extend its domain.
REVIEW: Some would argue that vi's domain is already far too extended.
JOY: That's probably fair, too. That's why it's so complicated, and has left and right parentheses commands. You start out with a clean concept and then sort of accrete guano. It lands on you and sticks and you can't do anything about it really.
REVIEW: What is it that Interleaf offers you that EMACS doesn't?
JOY: I can just look at my screen, and when I print it off, it's the same as it looks on the screen. It is formatted, and I'm tired of using vi. I get really bored. There have been many nights when I've fallen asleep at the keyboard trying to make a release. At least now I can fall asleep with a mouse in my hand. I use the Xerox optica mouse instead of the other one because it is color coordinated with my office. Did you notice? I prefer the white mouse to the black mouse. You've got to have some fun, right?
This business of using the same editor for 10 years - it's like living in the same place for 10 years. None of us does it. Everyone moves once a year, right?
REVIEW: What about Documenter's Workbench and Writer's Workbench?
JOY: I used to use diction. I wrote some papers for some conferences and used diction on them. But with Interleaf I don't even have a spell program.
REVIEW: Why?
JOY: Don't need one. Well, I guess I do. I could use one. It just doesn't have spell.
REVIEW: You don't use spell?
JOY: I don't spell things wrong. Except t-h-i-e-r. But no, I don't generally have trouble with spelling mistakes. What spell did for me was catch errors introduced by the substitute commands. With sentences in ed or something, you only see one line, and substitutes can be done wrong. With spell, you can catch fuzzballs that show up in your document. But diction is funny. I didn't like reading documents when diction got done with them.
REVIEW: Did you use suggest?
JOY: Yes, I've tried some of those things. I don't like reading things that have been heavily dictionized because they don't flow. I would like to have an expert system that would help me but I don't think those (style and diction) are close enough. I don't need double or spell either. I don't think any of those can help me write better or be better organized. I think an editor with a hierarchical sort of structure where I could look at the section outlines or make annotations in the margin would be helpful. Post-it notes are perhaps the greatest technological thing in the last 10 years. An electronic analog of the post-it would be wonderful so you could scribble on the document. I find much more of a need to just doodle on the screen than to run these programs. I think some of these tools are overkill. Writers Workbench is fine if you're stuck with troff and nroff.
I've never used pic. Some people have done great stuff with it, but it is too bad that instead of allowing you to think pictorially and draw pictorially, it forces you to translate images back into words and then compile back. That seems like the Linda Ronstadt song, "You're Taking the Long Way Around."
REVIEW: You've already mentioned the mouse. What other hardware do you see for the documenter to make things better?
JOY: I think the Macintosh proves that everyone can have a bitmapped display. The fundamental tension in UNIX that I think AT&T doesn't understand is that everyone is going to have a bitmap. Bitmap display is media compatible with dot matrix or laser printers. With a mouse to point with, you've got sort of a baseline of facilities around which you can build a document environment. I think you also need a full-page display. I think we'll have to wait for Big Mac from Apple, maybe two years away, to get full-page display. I think a lot of the implications for developers is that this kind of development has to come from the low end, the Volkswagen of the document industry.
Document preparation systems will also require large screen displays. Something like the Sun is what I think you need - a 19-inch screen where you can see a full page and be able to put up screens and menus with something that's fast enough to allow you to scroll at a reasonable rate. We don't know how to do that without a mouse, really. All of the good research was been done using a pointing device.
Touch finger, joystick, voice input are all either too late or too early.
REVIEW: Voice is too early and touch is too late?
JOY: I'm not sure voice yet works. I can't talk clearly enough. There was an editorial in Datamation about why the UNIX user interface is horrible. It was pretty poor, but the author does have some good things to say. I think he says something about people buying stoves. If you look at stoves and the way knobs are arranged. You'll see why it is that when you walk up to a random stove you can't tell which knob is going to turn on which burner. It's really stupid. There is no sensible way to put the knobs on the front to tell you. Some stoves have the knob in the center right next to the burners. That makes a lot more sense.
The point is that you want to have a system that is responsive. You don't want a car that talks to you. I'll never buy a car that says, "Good morning." The neat thing about UNIX is that it is very responsive. You just say, "A pipe to B" - it doesn't blather at you that "execution begins," or "execution terminated, IEFBR14."
The trouble is that UNIX is not accessible, not transparent in the way that Interleaf is, where you sit down and start poking around in the menu and explore the whole system. Someone I know sat down with a Macintosh and a Lisa and was disappointed because, in a half hour, he explored the whole system and there wasn't as much as he thought. That's true, but the point is in half an hour, almost without a manual you can know which button to push and you can find nearly everything. Things don't get lost. I think that's the key.
Systems are going to get a lot more sophisticated. Things will tend to get lost unless the interfaces are done in the Macintosh style. People who use these machines may run applications but won't necessarily be skilled at putting applications together. A lot of these people won't even have access to the underlying UNIX system.
The fundamental tension in System V is that it is oriented toward a character-mapped environment. The software you have to build is completely different. You don't assume a mouse and you don't assume a reasonable-sized display. You just forget it. Those are two different problems.
It's ultimately the media and the set of peripherals that you have on your machine that affects what the user sees. I don't think the Macintosh software is of any value. I'm not even sure it can be taken to a larger machine. You can spend your time making software small, or you can spend time making it functional and sensible. You can't do both. I think there is an ax that is going to chop the two apart.
You'll see WordStar, the database sort of word processing environment that doesn't have bitmaps, and you'll see the ones that do, and the difference between the two will be like night and day... The Macintosh's days are numbered. Non-bitmap machines have no future. Personal laser printers will see to that. The days of non-raster stuff are numbered, though sheer momentum will carry it to the end of the decade. These things come and go.
We went from printing terminals to dumb CRTs to smart CRTs, with tangents off toward storage display tube displays and black and white bitmaps. I think the days of even black and white bitmaps are very numbered. Color will take care of that. And then, with the demise of the last vacuum tube, which is the CRT, and with the advent of thin film transistors, which will be flat displays, it will all be color.
Black and white bitmaps supplanting CRTs make for a small wavelet, but if you don't see that little wavelet, you're really going to get hit by the tsunami that is to come.
I've wiped troff off my machine, and I'd rather live in the bitmap world than in the spell/diction world. I want to get mud in my face and arrows in my back with the bitmap.
REVIEW: The basic UNIX tools that can be used for documentation are plentiful but misunderstood. For example, the use of make to do document control. What are your views on that?
JOY: I think make is the program that causes people to write the things down that formerly were scribbled on the wall. It's sort of the graffiti recorder. That's the wonderful thing about it. People don't use SCCS and make enough. The people here doing documentation now use SCCS, mostly because I put all the documentation under SCCS and sort of twisted people's arms into using it.
REVIEW: Real programmers use cat as their editor.
JOY: That's right! There you go! It is too much trouble to say ed, because cat's smaller and only needs two pages of memory - plus you're not likely to get swapped out. That's why ed didn't prompt, you know. The performance of the system was just horrible. It would swap things out randomly and do all sorts of things. In ed you might type "a", but have no idea how far behind the system was. And it didn't matter, and long as it didn't get more that a few hundred characters behind and start throwing lines away without telling you.
Typically it wasn't that bad. If it had been prompting, you would have hit carriage return and wait for the prompt, and it would have taken three seconds to comment. That's something we noticed when we put em up. We put in the prompt and suddenly realized it had to go through the operating system.
I think UNIX has lived with grace for years. We've had the grace of people not being able to tell when the system was doing a bad job of scheduling the CPU. Now we can't hide behind time-sharing.
I think SCCS is misunderstood. I think make has never had a good document. Henry McGilton just finished rewriting a troff manual for the first time. Since troff has never really had a manual, he had to sit down and figure out what some of these things meant - backslash, right adjusting tab stops. No one ever really wrote a good manual for it - partially because Joe Osanna, who wrote troff, died in 1976. The program was written in assembly language, then translated line for line in C and it's all done with global variables - it's an ancient program. It's basically an accretion of all this completely unrelated stuff on top of a very, very small base. It's not surprising that people don't understand it.
When you look at the manual, tbl looks really good but you sort of get it right by iterative approximation; it's very difficult to get a good-looking table. I think the thing that's really missing is that none of these things help you with graphics or graphic design very much. I want a program that helps me learn how to draw and learn how to paint. Some attempt is made at that by pic but it's solving it in the wrong domain. I don't want to type "arc from A to B." I wouldn't mind saying that, though. Maybe that's the answer: talk to the program.
I think the hard thing about all these tools is that it takes a fair amount of effort to become proficient. Most people are lazy. I'm lazy. I'm enjoying using other people's software now. At Berkeley for so long, all the software we were using was stuff I had something to do with and that wasn't fun. I have fun with Interleaf because if it crashes, I don't feel responsible. I've even divested myself of responsibility for the operating system. I don't have to worry about that crashing. Editing without guilt.
REVIEW: All the directions you were talking about really assume a lot more compute power than we have at present.
JOY: I think that to make that assumption is bad. All projections that I see have memory going to $300 a megabyte by 1989. Soon the processor will be $50, and you'll be able to use it to refresh video. There are too many good things you'll be able to do with this stuff for it not to be available cheap. The real cost is very low. One has to wonder what software is going to be worth, too. It's going to be produced in such enormous volume.
When can that stuff go portable? You don't really want to have a telephone in the office or be tied to an office. You'd like to have the office with you and the phone with you. I want to be able to turn the phone off, thank you. I think that's going to require very different technology.
REVIEW: You mention everything but disks.
JOY: You might want to page over satellite telephone... Page fault, and the computer makes a phone call. Direct broadcast or audio disk - that's the technology to do that. It's half a gigabyte - and you get 100 kilobyte data rate or a megabyte or something. I don't remember. You can then carry around with you all the software you need. You can get random data through some communications link. It is very like Dick Tracy. Have you seen these digital pagers? You can really communicate digital information on a portable.
I don't think you need to have a disk with you. There are so many people who believe that you need to have a disk that you'll be able to have one because they'll make it cheap. That's the way things work. It's not what's possible but what people believe is possible. That's what makes imagination so wonderful, right? Silicon is such an incredible amplifier. If you can figure out what should be and you get people to believe you enough that they will give you money, you can almost make it come true. That's why bubble memory never made it. People didn't believe it was the right thing to do. But there's nothing wrong with bubble memory.
There's an incredible amount of momentum in the technology. Look at the momentum in vacuum tubes. It's all an economy of scale. There's an incredible momentum in UNIX. It really doesn't matter what UNIX is anymore. It ceased to matter when the vendors started adopting it. People used to call me up saying, "I don't know what UNIX is but I've got to have it! How do I get it?" It's at that point now.
REVIEW: Like designer jeans?
JOY: I don't buy designer jeans - well, what I'm wearing aren't bad jeans. They're my burlap sacks. Wrinkles are in, you know.

View File

@@ -0,0 +1,74 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-06-02T18:29:38+08:00
====== Interview with Dennis M. Ritchie ======
Created 星期四 02 六月 2011
http://www.linuxfocus.org/English/July1999/article79.html
This is an interview with Dennis M. Ritchie. The man who was one of the developers of C and the Unix OS.
Who is Dennis M. Ritchie?
Some people become important because they change history, others make history. Dennis Ritchie belongs to the second group of people. When most of us were still learning to walk, he developed the "C" language, the most used programming language. It is not necessary to stress the relevance of this contribution to the mankind.
But it was not enough for him. Dennis Ritchie and Ken Thompson developed the Unix operating system, i.e. The Operating System. Yes, He created UNIX.
He has not stop working on computers and operating systems, and as a result, Plan 9 and Inferno were developed by the group of researchers under his leadership.
His work has been recognized by numerous computer organizations: ACM award for the outstanding paper of 1974 in systems and languages; IEEE Emmanuel Piore Award (1982), Bell Laboratories Fellow (1983); Association for Computing Machinery Turing Award (1983); C&C Foundation award of NEC (1989): IEEE Hamming Medal (1990), etc.
Currently, Dennis M. Ritchie is head of the System Software Research department in the Computing Science Research Center of Bell Labs/Lucent Technologies in Murray Hill, NJ.
Interview part
LF: The same way many children want to be Superman, you are the idol of many C programmers and UNIX fans (among others) over the globe. How does it feel being adored by thousand of UNIX and C programmers? It's completely impossible to imagine ourselves today without UNIX nor C. When you created C and began to work on UNIX, did you expect it would be 'THE FUTURE' of Computer Science?
Dennis: These two questions are much the same, and ones that are often asked. Obviously the rewards and appreciation that I and my colleagues have received are very pleasant, and we do feel that we have helped create something of real value. But no, we did not really expect that this would be "the future" or even anticipate the eventual influence of the work. It was taken up in the spirit of "let's build something useful" and in the meantime do the work needed to help others take part. It's important to keep in mind that although the whole Unix and C or C++ segment is significant, the world of computer science and technology and real products is much larger. This is true both in the academic direction of the study of programming languages, and in the big-money area of software.
LF: If UNIX is the present and the past of the Operating Systems, C could be considered without doubt 'THE LANGUAGE', despite all the Object-Oriented languages that have appeared in the last years. How do you see C++ and Java, and the often flame wars between C and C++ programmers?
C has been characterized (both admiringly and invidiously) as a portable assembly language, and C++ tries to lift its level to object orientation and a more abstract approach to programming.
Dennis: C++ benefited enormously from C, because C had a fairly large acceptance even before the growth of C++, and C++ could use C both as a base to build a new language and as a tool to create its compilers. C has been characterized (both admiringly and invidiously) as a portable assembly language, and C++ tries to lift its level to object orientation and a more abstract approach to programming. The faults of both (in recently emerging standards) seem to be excessive ornamentation and accumulation of gadgetry. They both have a certain spirit of pragmatism, of trying to understand what's really needed. Java is manifestly a C++ descendant, at once cutting away some of the C legacy having to do with pointers, and adding the idea (not so new, but maybe now really feasible) of machine-independent object files. Now that it's been caught up in machinations between Sun and Microsoft (and also has its own problems with ornamentation) it's hard to guess where things will go.
LF: Now a hypothetical question: From todays perspectives and after so many years of C experience, Is there anything different you would have done if you had to design C from scratch?
Dennis: Finding a way (given the limitations of the time) to insist on what has been in the ANSI/ISO standard for some time: complete declaration of the types of function arguments, what the 1989 C standard calls function prototypes. There are many smaller details that are more messy than they should have been. For example, the meaning of the word "static", which is confusingly used for several purposes. I'm still uncertain about the language declaration syntax, where in declarations, syntax is used that mimics the use of the variables being declared. It is one of the things that draws strong criticism, but it has a certain logic to it.
LF: While C is a well established and completely defined language, operating systems are still very much in evolution. New ideas come as hardware gets faster and cheaper. What are the future key issues that will be at the basis of OS design? In particular, what is your opinion concerning micro-nano-kernels versus monolithic designs?
Dennis: I don't think this is really an interesting issue, framed that way. I do strongly prefer environments for applications that provide a structured, common name-space and mechanisms for accessing resources, along the lines of Unix (I include Linux here), Plan 9, Inferno. It looks to me that the idea of micro- or nano-kernels didn't really become important in real use, at least as the basis for general-purpose systems. In practice, what seems to happen is that the micro-kernel becomes specialized to the macro-system on top of it. It might remain a useful tool for internal structuring of a system, but doesn't really live on its own. Of course (the world being complicated) there are cases where very simple operating systems are useful for small, appliance devices that aren't intended for general-purpose use, whether desktop or machine room.
LF:UNIX is by now an operating system with a long history. It was also created many years ago and since then the capabilities and requirements of networks, hardware, services and applications have evolved enormously. What are the current limitations or handicaps of UNIX in face of present and near future user demands?
Dennis: I don't see any fundamental, technological ones, in terms of the basic system API ("system calls"). There is of course an enormous commercial/political issue in terms of jousting between the Unix commercial vendors and now between the various "free" Unix suppliers, including Linux and *BSD.
LF: Recently there is a great deal of concern with the approaching year 2000 and the potential for a melt down of the Internet due to the infamous Y2K bug. Do you believe there is any foundation in the apocalyptic predictions made by some experts?
Dennis: No intelligent comment on this, really. I will not be flying at 23:59 31 December 1999, but since I have not been near an airplane at New Year at any time in my life, this fact probably has little to do with Y2K.
LF: This wouldn't be a complete interview if we don't mention Inferno, the operating system you are currently working on. What were the main reasons to design a totally new operating system, together with Limbo, its own programming language? Also why Inferno/Limbo if there is JavaVM/Java? In other words, What Inferno has to offer that Java lacks?
Dennis: The Inferno work was the brainchild of Phil Winterbottom and Rob Pike, and it started just before the Java bandwagon (publicity machine) emerged. Java did have its own predecessor (internally called Oak), but at the time Inferno was hatched there was not yet any reason to think that the phenomenon would emerge, and although we became aware of Java, it was still somewhat unformed. I think it's one of those odd convergences that a venerable technology idea (a language implemented by a portable virtual machine) was revived both by Sun and by us. That said, the Inferno idea was from the start more interesting in terms of OS technology (a language and an OS that would work both on raw, and very cheap, minimal hardware, and also identically as an application under Windows or Unix or Linux). At the same time one has to give Sun credit for hooking better into the vastly explosive WWW/browser market.
LF: It seems to us that the future of Limbo as a programming language is tied to the expansion and popularity of Inferno as an operating system. Does it make sense to port Limbo to other operating systems? Or is its design and objectives too dependent on Inferno?
Dennis: Technologically, Limbo is not particularly dependent on Inferno. Realistically, it is indeed dependent, simply because a new language depends on an environment in which it is used.
LF: Taking a look to your career at Bell Labs, it seems that you have worked at every moment in the projects you really liked, and I presume this is also true with Inferno. Am I wrong asserting that you really enjoyed your work with UNIX and C design?
Dennis: I have indeed enjoyed my career at Bell Labs (which continues).
LF: I cannot avoid making a comparison between you and all the people that is currently working on non-profit projects for free, just because they like it - although I am sure they wouldn't refuse money for the work they do for free. Can you see yourself involved in projects like Linux, or similar, if you were not at Bell Labs? How do you see all these people from inside an innovative research lab with many years of experience on your shoulders? Since our magazine is mainly for Linux users we cannot forget to ask you a questions about Linux. First of all, what is your opinion about all the Linux momentum, and the decision of many companies to start developing software for it (Bell Labs, for example: Inferno has its own port to Linux)?
Dennis: Let me put these questions together. I think the Linux phenomenon is quite delightful, because it draws so strongly on the basis that Unix provided. Linux seems to be the among the healthiest of the direct Unix derivatives, though there are also the various BSD systems as well as the more official offerings from the workstation and mainframe manufacturers. I can't help observing, of course, the "free source" Unix-derived world seems to be suffering from exactly the same kind of fragmentation and strife that occurred and is still occurring in the commercial world.
LF: And the Big question about Linux. Have you ever used Linux? Well, If so, what's your opinion of it?
I very much admire Linux's growth and vigor.
Dennis: I haven't actually used it for real--in the sense of depending on it for my own day-to-day computing--, I am afraid to admit. My own computational world is a strange blend of Plan 9, Windows, and Inferno. I very much admire Linux's growth and vigor. Occasionally, people ask me much the same question, but posed in a way that seems to expect an answer that shows jealousy or irritation about Linux vs. Unix as delivered and branded by traditional companies. Not at all; I think of both as the continuation of ideas that were started by Ken and me and many others, many years ago.
LF: And Microsoft.... What do you think about the monopoly this company currently has over desktop computing? In the past sci-fi films depicted a world dominated by macro-computers that rule all aspects of our daily life. The current reality has showed us a different picture. Computers, in many respects, have been relegated to a simple appliance. You, who developed a operating system thought for programmers, who lived all that sci-fi scene, and who imagined the actual computing situation, how do you imagine the future of computing? What place do you think has Inferno and Linux in it?
Dennis: That's two questions. Microsoft does have some sort of monopoly over desktop computing, but that's not the only interesting computing in the world. Both alternate ways of supplying software (like Linux) and bits of the world that don't get in the news as much as Windows or browser wars (like very high-performance computing, very reliable computing, very small computing) will all have a place. I trust that both Linux and Inferno will prosper.

View File

@@ -0,0 +1,79 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T20:45:17+08:00
====== Leap In and Try Things ======
Created Sunday 27 March 2011
Leap In and Try Things: Interview with Brian Kernighan
Referred to as K&R
{{../An_Interview_with_Brian_Kernighan/kernighan.jpg}}{{../An_Interview_with_Brian_Kernighan/c-book.jpg.gif}}{{../An_Interview_with_Brian_Kernighan/brian_kernighan_studentssm.jpg}}{{../An_Interview_with_Brian_Kernighan/brian_kernighan_princeton.jpg}}
Referred to as "K&R"
Brian Kernighan (pronounced ker-ni-han), Professor of Computer Science at Princeton University, co-authored The C Programming Language, which has sold millions of copies and has been translated into 27 languages.
C is one of the most popular computer programming languages, and it has influenced nearly all languages in use today, including C++, C#, Java, Javascript, Perl, PHP, and Python.
Before becoming a full-time professor at Princeton, you had a long and brilliant career at AT&T Bell Labs. But lets go back further. Can you tell us about your childhood and early interests?
Professor Brian Kernighan
Professor Brian Kernighan
I was born in Canada and grew up in and around Toronto. My father was a chemical engineer, which gave me a bit of exposure to some kinds of science and engineering. I went to the University of Toronto in a program called “Engineering Physics”, which was meant for students who were pretty good in math and science but didnt have any idea what they wanted to do. It was extremely tough because there was a heavy workload and a lot of material — academically, I dont think I have ever worked as hard since. But it was a very good foundation for all kinds of later studies, and of course the experience of just working hard full time was good (though painful at the time). I didnt really encounter computers until I was nearly done with my undergrad education, but when I did first start to play with computers, I found them great fun, and of course still do.
What events and decisions led you to join Bell Labs?
I was a grad student at Princeton, and was lucky enough to be able to spend a summer at MIT in 1966, working on Project MAC. I met some amazing people, I worked on the state of the art time-sharing system CTSS, helping to build the next version, Multics, and I learned a lot. The Multics project included not only MIT but Bell Labs, so I at least knew of people from Bell Labs who were contributing as well. The following summer, I got a job at Bell Labs, where I worked with Doug McIlroy, the inventor of macros (among other things) and got to know the people who were working on Multics at the Bell Labs end. That worked out well enough that I returned for a second summer, this time working with Shen Lin, a wonderful computer scientist and applied mathematician. Shen and I worked on an interesting problem, graph partitioning, that was my PhD thesis topic. When I finished at Princeton six months later, Bell Labs offered me a job in the same group as Doug and Shen, and I never even thought about another job — Bell Labs was an idyllic place, with great people, lots of resources, and freedom to do anything at all.
You are probably best known to the world for co-authoring with Dennis Ritchie The C Programming Language, which is generally known as “Kernighan and Ritchie”, or just “K&R”. Can you tell us how you two met and came to write the book together?
Dennis was one of the people who had been involved with Multics at Bell Labs. He and I were in the same group, though I dont think we worked on anything together for several years. But at some point, I wrote a tutorial on how to program in B, which was the precursor language to C, and that led naturally to a tutorial on C when Dennis created that language. After a while, it seemed like a good idea to try a book on C, and I twisted Denniss arm into writing it with me. That was probably the smartest thing I ever did — Dennis is an exceptionally clear and elegant writer, and of course he knew the language better than anyone else, so the book was accurate and authoritative.
When writing the book, and afterwards, did you have an idea of what a major impact C would have on the computing world?
I certainly did not. I cant speak for Dennis, but Ill bet that he didnt either.
What do you think made the book, and C, so successful?
Lecturing
Lecturing
With C, Dennis managed to find a perfect balance between expressiveness and efficiency. It was just right for creating systems programs like compilers, editors, and even operating systems. C made it possible for a programmer to get close to the machine for efficiency but remain far enough away to avoid being tied to a specific machine. It was pretty clear how any C construct would be compiled, and it was possible to write quite good C compilers for almost any reasonable architecture. As a result, C became in effect a universal assembler: close enough to the machine to be cost effective, but far enough away that a C program could be compiled for and run well on any machine. I think the book has been successful in large part because of the success of C, though it probably helped that the book, like the language, is rather small and simple, and made it possible for people to do useful things quickly. And of course we were lucky in our timing, first with the appearance of comparatively cheap minicomputers like the PDP-11 and later with the arrival of the PC.
While writing the book, did you experience flashes of inspiration?
I dont think there were any flashes of inspiration in book-writing, at least that I recall. In fact, I more remember long periods of trying to figure out the right way to explain some idea, like pointers or how to do input without pointers. It always required a lot of rewriting to find the right way to express something.
You also worked with Dennis Ritchie, and Ken Thompson, on UNIX. In fact, you came up with the name. Can you tell us that story?
I did not work with Ken and Dennis on Unix itself, though I was one of the first users and Ive written some programs that became part of the core Unix tool set. As for the name, my memory (not always to be trusted) is that people were looking for a name, and I observed that Multics was “many of everything”, while Unix was “at most one of anything”; these were very weak puns on some Latin roots. I would have spelled it Unics just to be consistent with Multics, but someone else — no idea who — changed the spelling to the much better Unix.
It seems you have a passion for programming languages. What do you think of the languages in use today? How has C influenced them?
C has clearly influenced a number of languages. C++ is the most obvious; it adds a rich set of object-oriented features but is almost compatible at the source and object level with C. Java derives syntax and quite a few basic ideas from C. AWK steals syntax directly, as do languages like Javascript and Objective-C. Personally, I use a variety of languages, depending on what seems most appropriate for the task at hand. For the last few years, that has meant that Ive written a lot of AWK, a fair amount of Python and Javascript, some Java, and occasional C and C++. At this point, these are starting to blur in my mind, and it takes a day or two to switch from one to another, just because of trivial syntactic issues and different libraries. I like them or dislike them all more or less about the same, depending on what I find easy or unnecessarily difficult at the moment. But I still think that if I could only use one language, Id use C, just because I could build anything with it.
What led to your decision to join Princeton? How has this experience been different from the Labs?
At Princeton (image created by Amit Chatwani)
At Princeton (image created by Amit Chatwani)
Bell Labs was a wonderful place for me for over thirty years. But thats a long time to spend in one job. I had done occasional teaching over the years, and in 1996 I spent a full-time semester at Harvard, where with a huge class I learned that I could handle all of the mechanical challenges of teaching, and that it was still fun. So when Princeton made me an offer, it was not a leap into the unknown but a chance to do something that I really enjoyed, in a school that I really liked. Ive been here ten years now, and although I loved Bell Labs, this has turned out to be even better. The job is different in almost every way. I spend much of my time during the school year trying to teach well, interacting with students, advising undergraduate research, and the like. But summers are a complete change of pace, and I can usually spend time as a working programmer somewhere; that keeps me in touch with real-world software development. I enjoy the annual cycle.
In your mind, what challenges do students face today, both internally and externally? What advice do you have for them?
I was lucky — computing was a very young field and there was a lot that could be done without great resources or even much more than a good idea. Computing is a lot more mature today, at least in some ways, so its probably a lot harder to find the low-hanging fruit. But at the same time, students today have resources beyond the imagining of people of my age — an Internet that connects everyone, hardware that costs almost nothing, and free languages and tools and development environments that make it possible to create sophisticated systems by plugging together components that others have created. So the job is perhaps harder but also easier. My advice is to leap in and try things. If you succeed, you can have enormous influence. If you fail, you have still learned something, and your next attempt is sure to be better for it.
What suggestions or tips would you offer to graduates who are trying to figure what they want to do in life?
With students at University of Pennsylvania, 1995
With students at University of Pennsylvania, 1995
Do something you really enjoy doing. If it isnt fun to get up in the morning and do your job or your school program, youre in the wrong field. Not everyone is lucky enough to have a job or an academic program that rewards them continually, so perhaps your fun will come instead from some outside activity, or friends and family. But there has to be something that makes your life rewarding. Be open to as many experiences as you can, to maximize your chances of finding the really rewarding things. Dick (Richard) Hamming once told me, “Never say no.” That has to be applied with a bit of caution, of course, but the basic idea — try new things — is completely sound.
What advice would you offer to someone approaching retirement?
Dont retire. Or, more precisely, dont stop doing things. Keep learning and exploring. I retired from Bell Labs 10 years ago and took up teaching; its been more fun that I could have imagined and its probably added 10 years to my life. And if I retire from Princeton, Ill try to find something new that has that same effect — something that keeps me active, involved, learning, and meeting new people.
Shifting gears a bit, can you share your thoughts on India and its recent tremendous growth, facilitated by computers and the internet?
All that technology will help, but fundamentally, its the people who matter. Regrettably, I have never been to India, but I have a large number of Indian friends. They are almost without exception smart, skilled, motivated, energetic, and really nice. More than a billion people like that? Its amazing. India is going to have a great future.

View File

@@ -0,0 +1,66 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-06-03T16:06:11+08:00
====== interview with Rich Stevens, ======
Created 星期五 03 六月 2011
http://www.kohala.com/start/unpv12e/interview.html
Prentice Hall interview with Rich Stevens, author of Unix Programming, Volume 1: Networking APIs, Sockets and XTI, 2/e
October, 1997
Prentice Hall: How did you become involved in Unix networking, from a programming and author perspective?
Rich Stevens: During the 1980's, while I was at Health Systems International, we were doing Unix software development for a variety of platforms. We went through the normal sequences of hardware that most startups went through at that time: one VAX-11/750 running 4.2BSD, then a bigger VAX (785), then multiple VAXes (added an 8650), throw in some PCs running a flavor of operating systems (Venix, Xenix, DOS), and for good measure one IBM mainframe running VM.
Naturally, with multiple VAXes running 4.xBSD, you connect them together with an Ethernet and run TCP/IP, and TCP/IP was also available for the PC-based Unices and the mainframe. In addition to the standard utilities (ftp, rlogin) we started writing our own applications using sockets. Documentation was almost nonexistent (I had very worn copies of the two Leffler et al. documents from the 4.3BSD manual set) so when you needed an answer, you looked it up in the source code. After doing this for a while I realized that everything I was digging up should really be documented.
I really believe that my background is fundamental to the success of UNP and my other books. That is, I was not one of the developers at Berkeley or AT&T, so the writing of UNP was not a "memory dump". Everything that is in the book I had to dig out of somewhere and understand myself. This process of digging up the details and learning how things work leads down many side streets and to many dead ends, but is fundamental (I think) to understanding something new.
Many times in my books I have set out to write how something works, thinking I know how it works, only to write some test programs that lead me to things that I never knew. I try to convey some of these missteps in my books, as I think seeing the wrong solution to a problem (and understanding why it is wrong) is often as informative as seeing the correct solution.
Prentice Hall: How has the Unix network programming environment changed since the publication of the First Edition in 1990?
Rich Stevens: First, it is obvious that TCP/IP is the future, something that was not a given in 1990, with all the OSI hype that was taking place. Second, the Berkeley sockets interface has also become the de facto standard, despite X/Open's big push for TLI/XTI. Third, IP version 6 (IPv6) should be heavily used during the lifetime of the second edition, so there is a strong emphasis in the book for protocol-independent networking code, allowing applications to be developed for both IPv4 and IPv6. Lastly, the Posix.1g standard for both sockets and XTI is near final approval, so it was important for the rewrite to include this standard, along with the forthcoming Unix 98 standard.
Prentice Hall: How did the Second Edition evolve to 3 volumes and what will be covered in each volume?
Rich Stevens: When I started the rewrite over a year ago I started with the sockets chapter and things just grew and grew as I expanded this one chapter from the 1990 edition into over 20 chapters. My first attempt to make it "fit" was to take out the second half of the 1990 edition (applications) and make that a separate volume. I then realized that Chapter 3 from the 1990 edition (IPC, or interprocess communication) would not fit either. A hard decision was whether or not to include the six chapters on XTI. I decided to keep them because they are still used by some developers, often with protocols other than TCP/IP, and because XTI is part of the Posix.1g standard.
Volume 2 will be IPC, both the information from Chapter 3 of the 1990 edition along with coverage of the newer Posix.1b realtime IPC methods.
Volume 3 will be applications, some from the 1990 edition plus many new applications that have been developed since 1990.
Prentice Hall: Volume 1 is devoted primarily to sockets programming. How has this area changed since the publication of the First Edition and how is this change reflected in the book?
Rich Stevens: Besides more details on the topics from the 1990 edition, the following topics are new to the second edition: IPv4/IPv6 interoperability, protocol-independent name translation, routing sockets, multicasting, Posix threads, IP options, datalink access, client-server design alternatives (how many different ways are there to write a Web server?), virtual networks and tunneling, and network program debugging techniques.
Although most of these topics are demonstrated using the sockets API under Unix, many of these are what I call "network programming fundamentals" that can be implemented on systems other than Unix, and using an API other than sockets.
Prentice Hall: How would you describe the code in Volume 1 and how will your readers be able to access this code?
Rich Stevens: The code is available to anyone on the Internet and should compile easily on most current Unix systems. The majority of the 10,000 lines of C code are functions that one can use as building blocks (a network programming toolchest) inside their own network applications. Many of these functions help hide the differences between IPv4 and IPv6, and can aid the reader in developing protocol-independent code.
Prentice Hall: Why is there such a continuing demand for information on Unix when certain persons in the Pacific NorthWest would have us believe that NT is taking over the world?
Rich Stevens: As Scott McNealy says, Unix has been "dying" at an annual growth rate of about 20% per year for the past 10 years. Without starting a religious debate I can state that Unix is a time-tested, industrial strength system that has enough critical mass to continue for many, many years. It usage continues to grow in the commercial world (just witness how many of the world's Web servers run on Unix platforms) along with the free versions (e.g., the phenomenal growth of Linux). The absolute number of Unix systems will never equal that of Windows, but who cares? As a writer I just need to know that the audience for my books is not declining, and the total number of Unix programmers is increasing, not declining.
Prentice Hall: Every book which you have written has been extremely successful and enjoyed a long shelf life. Can you describe the process and effort you put into the development of your books?
Rich Stevens: I have a couple of credos when writing a book. I must also admit that two Prentice Hall books that have helped shape these beliefs are Kernighan and Ritchie's C book, and Kernighan and Pike's "The UNIX Programming Environment".
First, the book must be technically accurate. If you are going to show code, include the code directly from its source files and make certain that it compiles and runs correctly. If you are going to show terminal input and output, use the "script" program to produce a verbatim copy, to avoid any typographical errors. Having many competent technical reviewers helps here too, as no author knows everything about a subject.
Second, the book must be typeset nicely. I think this is critical for a programming book, so that the reader can tell what are commands, what the user types in, what are comments, and so on. The appearance of source code is also critical to understanding the code. To guarantee this I produce camera ready copy of all my books, a time consuming step, but worth it in the end, I believe. Books by Don Knuth and Brian Kernighan are a continual source of inspiration in this area.
Third, I try to demonstrate and not dictate. One small program is often worth a thousand words. One of the reviewers for the second edition of UNP complained about my usage of the third person when writing, as in "When we run this program". But I really envision many readers sitting down with the book at a terminal, with all the examples from the book on line, and going through the steps and examples outlined in the book. I use the term "we" to mean the reader and myself.
Fourth, I like pictures to explain something. If I cannot draw something, I don't understand it. This is especially critical in the area of networking: draw the processes involved, draw the networking connections (or IPC) between the processes, show which files are open by which process, and so on. That's where I came up with the term "Illustrated" for my TCP/IP series, to distinguish it from the other TCP/IP books in the market.
UNP also deserves the "Illustrated" adjective, as it contains lots and lots of figures. Whenever I need to understand something new, I have to draw a picture of what's involved, and I then include these pictures in the books.
Fifth, I firmly believe that my readers want all the details, not glossy overviews. That's why the second edition has grown so much from the 1990 edition. I think that most readers of the new edition will read only half of the book, but each reader will read a different half. This also means that it is essential that the book be usable as a reference, which means lots of references to other related sections of the book, and a thorough index.
Sixth, I never include anything I do not understand. I hate hand waving when I read a book (which often indicates that the author doesn't understand something) so I avoid it at all costs. When I hit something that I don't understand, I take a detour and learn something new. This often makes my books late by a few months, but I think accuracy and completeness are essential. Many times I start a section on some topic, allocating (say) three days to write it. Two weeks later I am finishing the section because I got side tracked on something that I needed to cover, but which I didn't understand completely.
© Prentice-Hall, Inc. A Simon & Schuster Company Upper Saddle River, New Jersey 07458

41
Zim/LaTex.txt Normal file
View File

@@ -0,0 +1,41 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T19:53:11+08:00
====== LaTex ======
Created Sunday 27 March 2011
然后 TeX Live 2009 的中文支持主要分为两部分,基于 XeTeX 的,和基于传统 CJK 宏包的。(我这里只讨论 LaTeX的如果你希望尝试 ConTeXt 和 luatex可以参考 Li Yanrui 的 blog [3],他有很详细的介绍。)
基于 XeTeX 的方案
-----------------
这是我们推荐的方案,又可分为高层与低层两种,分别适用于不同需求的用户。
首先,安装所需的宏包:
sudo tlmgr install xecjk ctex
===== 高层的方案 =====
是使用 ctex 宏包自带的文档类,例如原来用 article 文档类的就改用 ctexart 文档类,原来用 book文档类的就改用 ctexbook 文档类这样绝大部分你会遇到的中文问题比如字体设置、hyperref的调用、章节标题的设置等等都自动为你解决了。详情可以看 ctex 宏包的文档 [4]。下面是一个小例子:
\documentclass{ctexart}
\begin{document}
你好TeX Live 2009
\end{document}
默认情况 (__winfonts__) 下,你需要宋体 (SimSun)、仿宋 (simfang)、黑体 (simhei)、楷体 (simkai)、隶书(LiSu)、幼圆 (YouYuan) 这六套 Windows 字体,如果你的字体不全,可以编辑**ctex-xecjk-winfonts.def** 文件 (用 kpsewhich 来找) 来修改设置,也可以选择 Adobe Reader等软件所带的 Adobe Song Std, Adobe Heiti Std, Adobe Kaiti Std, Adobe FangsongStd 四款字体,这时需要给 ctexart 加上__ [adobefonts]__ 选项。又或者你可以不用这些预置的字体使用__ [nofonts]__选项然后参考 ctex-xecjk-winfonts.def 文件,自己定义对应各个 CJK 字体族的字体。
===== 低层的方案 =====
则是用原来你自己的宏包,结合 xeCJK 宏包来配置字体,下面是一个小例子:
\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document}
你好TeX Live 2009
\end{document}
当然,你得有 SimSun 这个字体。
不管选用高层的还是低层的,都可以直接用 xelatex 命令直接编译你的文档。

7
Zim/LaTex/BibTeX.txt Normal file
View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-26T20:11:54+08:00
====== BibTeX ======
Created Saturday 26 November 2011

View File

@@ -0,0 +1,129 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-26T19:58:19+08:00
====== BibTeX-How to cite a website ======
Created Saturday 26 November 2011
http://win.ua.ac.be/~nschloe/content/bibtex-how-cite-website
Submitted by Nico on Sun, 21/06/2009
With the increasing importance of the internet for scientific research, need increases for properly citing online resources. Unfortunately, when the main LaTeX citation machinery BibTeX was created, this was not to be forseen; this is why there is to date no canonical way to cite, say, a website. Different workarounds have emerged, using for example some trickery with the **@MISC **type (see below), but the right way™ hasn't been found yet.
This could change with the advent of __biblatex__. Its new entry type __@ONLINE__ is supposed to contain references to web resources and doesn't give room for confusion anymore.
With the BibTeX entry
@ONLINE{Doe:2009:Online,
author = {Doe, Ringo},
title = {This is a test entry of type {@ONLINE}},
month = jun,
year = {2009},
url = {http://www.test.org/doe/}
}
and the LaTeX file
\documentclass{article}
\usepackage{biblatex} #不用设置样式
\bibliography{test.bib}
\title{BibTeX Website citatations with the \textsf{biblatex}~package}
\date{}
\begin{document}
\maketitle
\**nocite**{Doe:2009:Online} #nocite 与cite的区别是前者不会显示引用计数
\printbibliography
\end{document}
one gets a nicely typeset list of references.
Note that there are plenty of more options and entry types in the biblatex package, such as (the currently usused) @AUDIO and @VIDEO.
Because of its supposedly large impact on the (La)TeX community, the author of biblatex still declares the package as 'beta' which is why it is not included in TeXlive, for example. Should you for this or some other reason be unable to install biblatex, there are (inferior) alternatives to use for URL citations in a reference list.
===== Alternatives =====
=== Using the natbib package ===
The natbib package extends the functionality of regular bibtex to a certain degree, and allows for website citations as well. There is **no specific entry** type for online resources, but __@MISC, @OTHER, and @BOOKLET__ work quite well.
@BOOKLET{Doe:2009:Booklet,
title = {This is a test entry of type {@BOOKLET}},
author = {Doe, John},
month = jun,
year = {2009},
url = {http://www.test.org/doe/}
}
@MISC{Doe:2009:Misc,
author = {Doe, Paul},
title = {This is a test test entry of type {@MISC}},
month = jun,
year = {2009},
url = {http://www.test.org/doe/}
}
@OTHER{Doe:2009:Other,
author = {Doe, Brian},
title = {This is a test entry of type {@OTHER}},
month = jun,
year = {2009},
url = {http://www.test.org/doe/}
}
Note that standard bibstyles (such as plain) will **not typeset** the url key contents of the individual entries; it is required to use one of natbib's own entries, e.g. plainnat.
\documentclass{article}
**\usepackage{natbib}**
**\bibliographystyle{plainnat}**
**\usepackage{url}**
\title{BibTeX Website citatations with the \textsf{natbib} package}
\date{}
\begin{document}
\maketitle
\nocite{Doe:2009:Other,
Doe:2009:Misc,
Doe:2009:Booklet}
\bibliography{test}
\end{document}
===== Using the url package =====
The most elemental way to include web references is via the howpublished key of the** @MISC **entry. Use
@MISC{Doe:2009:Misc,
author = {Doe, George},
title = {This is a test test entry of type {@MISC} and `howpublished'},
month = jun,
year = {2009},
howpublished={\url{http://www.test.org/doe/}}
}
and
\documentclass{article}
**\bibliographystyle{plain}**
**\usepackage{url}**
\begin{document}
\nocite{Doe:2009:Misc}
**\bibliography{mybib}**
\end{document}

View File

@@ -0,0 +1,89 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-26T20:10:51+08:00
====== BibTeX使用介绍 ======
Created Saturday 26 November 2011
http://latex.yo2.cn/articles/latex-bibtex-introduction.html
BibTeX 是一种格式和一个程序, 用于协调LaTeX的参考文献处理.
BibTeX 使用数据库的的方式来管理参考文献. BibTeX 文件的后缀名为 .bib . 先来看一个例子
@article{name1,
author = {作者, 多个作者用 and 连接},
title = {标题},
journal = {期刊名},
volume = {卷20},
number = {页码},
year = {年份},
abstract = {摘要, 这个主要是引用的时候自己参考的, 这一行不是必须的}
}
@book{name2,
author ="作者",
year="年份2008",
title="书名",
publisher ="出版社名称"
}
说明:
第一行@article 告诉 BibTeX 这是一个文章类型的参考文献. 还有其它格式, 例如 article, book, booklet, conference, inbook, incollection, inproceedings, manual, misc, mastersthesis, phdthesis, proceedings, techreport, unpublished 等等.
接下来的"name1", 就是你在正文中应用这个条目的名称.
其它就是参考文献里面的具体内容啦.
===== 在LaTeX中使用BibTeX =====
为了在 LaTeX 中使用BibTeX 数据库, 你必须先做下面三件事情:
1) 设置参考文献的类型 (bibliography style). 标准的为 plain:
\bibliographystyle{plain}
将上面的命令放在 LaTeX 文档的 \begin{document}后边. 其它的类型包括
unsrt 基本上跟 plain 类型一样, 除了参考文献的条目的编号是按照引用的顺序, 而不是按照作者的字母顺序.
alpha 类似于 plain 类型, 当参考文献的条目的编号基于作者名字和出版年份的顺序.
abbrv 缩写格式 .
2) 标记引用 (Make citations). 当你在文档中想使用引用时, 插入 LaTeX 命令
\cite{引用文章名称}
"引用文章名称" 就是前边定义@article后面的名称.
3) 告诉 LaTeX 生成参考文献列表 . 在 LaTeX 的结束前输入
\bibliography{bibfile}
这里bibfile 就是你的 BibTeX 数据库文件 bibfile.bib .
===== 运行 BibTeX =====
分为下面四步
用LaTeX编译你的 .tex 文件 , 这是生成一个 .aux 的文件, 这告诉 BibTeX 将使用那些应用.
用BibTeX 编译 .bib 文件.
再次用LaTeX 编译你的 .tex 文件, 这个时候在文档中已经包含了参考文献, 但此时引用的编号可能不正确.
最后用 LaTeX 编译你的 .tex 文件, 如果一切顺利的话, 这是所有东西都已正常了.
例子: 将上面的 BibTeX 的的例子保存为 bibtex-example.bib .
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{gkai}
%我是在linux下用使用latex的, window用户将上一行改为\begin{CJK}{GBK}{kai}
text\cite{name1}\cite{name2}
中文
把Latex中的 Reference 写成中文的"参考文献"
%如果文档类是article之类的, 用\renewcommand\refname{参考文献}
%如果文档类是book之类的, 用\renewcommand\bibname{参考文献}
\renewcommand\refname{参考文献}
\bibliographystyle{plain}
\bibliography{ bibtex-example.bib}
\end{CJK}
\end{document}
将上面的内容保存为bibtex-example.tex .
latex编译一次, bibtex 编译一次, 再用 latex编译两次就大功告成了!

View File

@@ -0,0 +1,32 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-11-27T12:17:00+08:00
====== Bibtex 文献排序 ======
Created Sunday 27 November 2011
http://blog.csdn.net/forsiny/article/details/4805778
通过设置 bibliographystyle 就可以达到上述目的Bibtex 自身已具备排序的功能而且可以选择自己想要的排序方式。Bibtex 已自带有 8 种样式,分别如下(下面内容摘自 LaTeX 编辑部):
plain按字母的顺序排列比较次序为作者、年度和标题
unsrt样式同plain只是按照引用的先后排序
alpha用作者名首字母+年份后两位作标号,以字母顺序排序
abbrv类似plain将月份全拼改为缩写更显紧凑
ieeetr国际电气电子工程师协会期刊样式
acm美国计算机学会期刊样式
siam美国工业和应用数学学会期刊样式
apalike美国心理学学会期刊样式
BibTeX 提供了一个外部的 BibTeX 工具程序,源文件经过 LaTeX 编译后还要使用BibTeX 对数据库文件编译一次,最后再用 LaTeX 连续编译两遍,才能得到正确结果。 可用下图解释这四个编译步骤的作用:
Kurs T: System skladu publikacji LATEX
文献数据库可根据要求自行编写,其格式有:文章、书籍、技术报告、会议论文集和博士论文等十几种,每种格式都有一些必填和选填的项目,如作者、标题、出版社、发表年度、...等等,最后存储为 .bib 文件。
如果对生成的参考文献样式仍有不满意之处,还可将编译信息文件*.bbl 中的参考文献列表源程序拷贝到论文尾部,然后进行手工调整。

View File

@@ -0,0 +1,338 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T22:09:28+08:00
====== LaTeX-从新手到TeXPert ======
Created Wednesday 07 September 2011
http://latex.yo2.cn/articles/latex_from_beginner_to_texpert_zh.html
原文: LaTeX: From beginner to TeXPert, 也可参见这里.
本文是介绍TeX排版系统, 但你阅读下面的信息后, 你将能够:
下载和安装LaTeX(包括Windows, linux, 或者Mac系统)
使用LaTeX创建简单的文档
安装新的LaTeX宏包
在LaTeX文档中插入表格和图像
使用LaTeX的交互引用, 脚注和基本的参考文献用法
在LaTeX文档中插入数学公式
这些主题已经覆盖写文档的基本任务. 然而, 注意到, 但使用LaTeX系统的时候, 你可以很容易创建看起来非常专业的文档, 并且LaTeX是全面和可扩展的. 还有许多在这篇基础引导性文章没有提及的功能. 幸运的是, LaTeX的文档非常丰富. 如果你对碰到什么问题, 可以向你的老朋友Google寻求帮助.
===== 什么是LaTeX? =====
LaTeX是一个排版系统, 它允许作者创建一个高质量的文档, 而不用过多关心格式, 分页, 对象的位置和其它一些将作者从写作上分心的格式设置. LaTeX的发音为 “lay-tech”, 它是原始排版系统TeX (”tech”)的一个扩展. 你可以在Wikipedia上找到 TeX 和 LaTeX 的历史.
LaTeX在一个专业领域被广泛的使用. 在数学, 物理, 经济, 统计和其它一些学术和专业领域, 它们的文档需要经常使用LaTeX来排版数学符号, 因为LaTeX能简单而高质量地支持数学符号.一些出版公司也使用基础TeX的系统来排版文档.
===== LaTeX 是怎样工作的? =====
LaTeX与传统的字处理软件有下列两个基本的不同:
* 一般地, 使用容易学的LaTeX的标记语言来写LaTeX文档, 而不是使用图形界面来确定格式[1].
* 在输入文本之后需用LaTeX编译生成文档, 而不像其它字处理软件, 它可以使用下面的文档的总长度, 表格的数目等信息来优化表格, 图形, 断页等.
下面是一个非常基本的LaTeX文档的例子:
\documentclass{article}
\author{Your Name}
\title{Test Document}
\begin{document}
\maketitle
This is a test document
\end{document}
使用任何一个LaTeX发行版, 保存上面的文本到一个后缀为 ".tex" 的文件, 然后用LaTeX来编译就可以生成一个文档了.
LaTeX被设置成在不同的系统可得到同样的输出. 因此, 如果你发布上面的文本, 其他人可以使用某个LaTeX发行版的 , 而不用关注他的操作系统, 都将得到完全一样的结果. LaTeX可以输出各种格式的文件, 但最流行的是PDF格式.
===== 如何得到LaTeX软件 =====
从技术上来说, 你只需要LaTeX引擎(一些二进制的文件和库)就可以将简单的文本tex文件转化为优美的PDF文件. LaTeX可以以命令行形式被使用, 因而*nix和Dos的支持者将觉得这非常好. 然而使用一个LaTeX前端编辑器将使得操作跟简单. 大多数的LaTeX前端编辑器本质上都是文本编辑器, 但还有下面的功能:
* 编译LaTeX文档, 而不是使用命令行.
* 让LaTeX语言跟容易的书写(命令补全, 创建模板化表格等).
这这篇文档中, 我假设你已经有了一个LaTeX引擎和一个前端编辑器. 每个操作系统下你都有很多的LaTeX引擎和一个前端编辑器供选择. 我将描述最流行和最容易安装的开源的工具的安装. 不同发行版间的唯一区别是应用时的一些配置和用法不同, 你也可以自由地选择其它的发行版.
===== 关于文件格式的一点注记 =====
LaTeX 可以生成多种格式的输出文件, 包括 PDF 和 DVI (与设备独立的格式) 文件. 生存文件的格式依赖于是否使用PdfLaTeX或另一个程序来编译文件. 编辑器默认会创建 PDF 文件, 主要到改变相应的设置会影响输出文件的格式.
====== LaTeX 基础知识 ======
==== LaTeX 命令 ====
LaTeX 命令通常是以一个反斜杠(backslash)开头, 和具有形式\command[options]{argument. 例如,
\section{Introduction}
将定义一个叫 “Introduction” 的新的小节. 符号“%” 定义一个注记, 这一行它后面的字符都将被认为是注记, 而被 LaTeX 忽略. 如果你需要在文档中输入字符“%” , 使用命令: \%.
在 LaTeX** 使用引号的方式**有点不同. 为了插入一个引号, 使用标准的 "文本" , 就是两次字符 ` (位于键盘的左上方).
==== 导言区(preamble) ====
文档中, 行 “\begin{document}” 之前的部分称为导言区. 一个典型的导言区可以像这样:
\documentclass{article}
\usepackage{graphicx}
\title{Test}
\author{Test}
\date{}
在上面的例子中:
\documentclass{article} 告诉 LaTeX , 这个文件是的类型是文章 (article). 其它类型有: 书本(book), 信 ( letter) 和 演示文稿 ( slides) .
\usepackage{graphicx} 告诉 LaTeX 使用 graphicx 宏包 , 它允许用户在文档中包含许多类型的图像. 将会在后面介绍宏包的用法.
\title{} and \author{}显然就是定义文章的标题和作者.
\date{} 告诉 LaTeX 留下一行生成日期. \date{April 2006}将会生成日期 “April 2006″ . 如果只使用 \date{} 将告诉 LaTeX 使用今天的日期.
命令\documentclass{} 有一些参数. 例如, \documentclass[11pt,twocolumn]{article} 将文档的主体为设为两栏格式. 注意参数之间用逗号隔开. 其它的一些参数包括:
* oneside 或 twoside - 改变边界, 设置成单页或双页文档
* landscape - 将文档的格式从 portrait 改为 landscape.
* titlepage 或 notitlepage - 定义是否使用分离的标题页面, 或者标题, 作者和日题出现在文章的顶部.
==== 文档的主体(The document body) ====
导言区后边, 也就是 \begin{document} 和 \end{document} 之间的部分是文档的主体. 大多数的 LaTeX 文档只是一个简单的纯文本. 为了开始一个新的段落, 输入__两个回车__. LaTeX 会自动忽略一个空白的行. 为了强制断行, 使用\\ .
==== 文档的结构 (Document structure) ====
定义一个文档的结构可使用命令 \section{}. LaTeX 是__基于结构的文档__. 结构的标记有:
\section{Name}
\subsection{Name}
\subsubsection{Name}
\paragraph{Name}
为了插入一个**没有标号的小节**, 使用命令 \section*{Name}. 章节的会自动的连续的编号.
命令 \paragraph{}不是必须的, 除非你想为一个段落插入一个标题. 例子:
1 Section command
Section star command
this section is not numbered
2 Section command
Test here the the numbering continuous normally
2.1 Subsection command
Test here
Paragraph command this paragraph have a title.
===== 环境(Environments) =====
环境是一块特殊的文本. 例如, itemize 和 enumerate 环境相应地创建项目和编号列表. 下面的标记:
\begin{itemize}
\item First thing
\item Second thing
\item Third thing
\end{itemize}
\begin{enumerate}
\item First numbered thing
\item Second numbered thing
\end{enumerate}
将生成一个项目列表和接下来的一个编号列表.
注意到环境都是以 \begin{environmentname} 开头和以 \end{environmentname} 结尾. 它们可以被嵌套, 所以一个项目列表可能包含另一个项目列表或者编号列表等.
另外一下经常被使用的环境有:
引用环境 (Quote): \begin{quote}…\end{quote} 创建一小节缩进的引用的文本
Verbatim环境: \begin{verbatim} … \end{verbatim} 类似于HTML中的 **pre** . 在 verbatim 环境中, 文本将显示为__等宽格式的字体__和特殊字符将被忽略. 当书写源代码的时候, Verbatim 环境非常有用.
Description 环境: \begin{description} \item[First item] text \end{description} 生成一个列表和或项目, 它有一个粗体的名字和之后悬挂缩进的文本
===== 改变字体的样式 (Modifying text styles) =====
LaTeX 背后一个基本的思想是解决作者的格式问题. 然后, 有时还是需要手动得设置指定字体样式.
* 插入粗体 (bold text), 使用 \textbf{text here}
* 插入斜体 (italic text), 使用 \emph{text here}
* 插入但等宽字体 (monospace text), 使用 \texttt{text here} (" tt " 代表打字机 (teletype)
为了在句子中使用 verbatim 文本, 使用 \verb | your text here | . 注意可以使用任意的分界符, 例如\verb+your text here+ 将显示同样的效果.
===== 宏包(Packages) =====
使用宏包可以扩展 LaTeX 的 功能. 宏包的安装主要分为下面两步:
* 用 LaTeX 运行 .ins 文件来生成 .sty 和 .cls 文件
* 将两个新创建的文件拷贝到适当的目录下, 然后更新 LaTeX 数据库
但是, 也有一些例外. 文件类型 .sty 和 .cls 分别代表 样式 (style) 和 类 (class). 如果一个宏包不是 .ins 格式而是 .sty 和 .cls 文件, 则不需要用LaTeX处理, 直接跳到第二步. 另外, 当用LaTeX处理 .ins 文件时候, 通常会生成一个 .dtx 文件. 这个文件可以通过LaTeX来创建这个__宏包的手册__.
注意: 用 LaTeX 处理宏包文件, 只需要用你的LaTeX前端编辑器打开, 然后按通常处理一个 tex 文件编译.
接下来, 介绍两个流行的宏包: graphicx 和 gemetry . 这些宏包已经在 gwTeX 和 MikTeX 上默认安装了, 而不需要另外下载安装它们.
===== graphicx 宏包 =====
graphicx 宏包用于在 LaTeX 文档插入图像. 为了使用它, 首先在文档的导言区加上命令 \usepackage{graphicx}. 然后使用下面的命令插入图形.
\includegraphics[options]{filename.png}
graphicx 宏包支持许多文件类型, 包括 PDF, PNG 和 JPG. 注意此时需要__用 PdfLaTeX 编译你的文档__. 它的主要参数有:
width=Xin
height=Xin
scale=X (Where x is between **0 and 1**)
===== geometry宏包 =====
用 LaTeX 处理格式化的文档是非常简单的, 但你需要改变它的默认格式的时候就变得有点复杂了. 使用 geometry 宏包就改变你文档的某些设置, 包括边距等. 下边是一个将四周边距改为 1 in 的例子 :
\usepackage[margin=1in]{geometry}
===== 图形和表格 =====
图形和表格都是 LaTeX 中的__环境__, 然而它们有一些特殊的属性, 例如命令 \caption{}, 这将生成图形和表格的标题. 它们被称为__浮动__对象, 因为它们在最终编译生成文档中的位置依赖当前 LaTeX 样式的算法.
==== 图形 (Figures) ====
为了插入一个图形, 使用
\begin{figure}[hbtp]
\caption{Figure name}
\begin{center}
\includegraphics{filename.pdf}
\end{center}
\label{your-reference-key}
\end{figure}
在上面的代码中,
* \begin{figure} 只是告诉 LaTeX 现在开始一个图形 (figure) 环境
* [hbtp] 决定 LaTeX 如何放置这个图形 (当前位置here (h), 底部bottom (b), 顶部top(t), 页面page(p)). LaTeX 首先会尝试在将图形插入到当前位置 (tex 文件中的**插入点**), 如果没有足够的空间或者其它审美考虑, 它将尝试把图形先放在**当前页面**的底部, 然后是顶部, 最后是一个特殊页面来放置这个浮动对象. 如果强制图形只出现在原来的位置, 使用命令 \begin{figure}[h], 而忽略其它参数 b, p 和 t
* \caption{Figure name}生成图形的名称
* \begin{center} 只是告诉 LaTeX 将图形放置在页面的中间. 不要忘记在结束 figure 环境前结束 centering 环境.
* \includegraphics{…} 指定你要插入图形文件的位置
* \label{your-reference-key} 是一个标签, 它将允许你在文本中引用这个图形. 例如, 你的图形标签为 "fig1" , 当你需要引用它时输入 \ref{fig1}
===== 表格 (Tables) =====
LaTeX 中一个浮动表格由__两个环境__组成: 表格, 在文本中浮动的实体, 和 tabular (制表的内容). 例如,
\begin{table}[hbtp]
\caption{This table is an example}
\begin{center}
\begin{tabular}{c|cc}
First row, first column & First row second column & First row, third column \\ \hline
Second row, first column & Second row, second column & Second row, third column \\
Third row, first column & Third row, second column & Third row, third column \\
\multicolumn{3}{c}{…}
\end{tabular}
\end{center}
\label{exampletable}
\end{table}
除了代码 \begin{tabular} … \end{tabular} 之间的内容外它的意思跟前面图形环境的描述是一样的. 下面我们来看 tabular 环境是怎样工作的:
* \begin{tabular}{c|cc} 告诉 LaTeX 开始一个新的包含3个居中列的 tabular 环境. 第一个"c"之后的竖线 (”|”) 告诉 LaTeX 第一列有一个垂直的边线. 使用{lcrr}能创建 4 列, 第一列左对其, 第二列居中, 第三列和第四列右对齐
* 表格单元用符号 “&”分离, 表格行用符号“\\”分离.
* \hline 生成一条水平线
* \multicolumn{3}{c}{Text here} 创建一个有 3 列的行, 居中格式, 并且包含文本 “Text here”
创建和插入表格还有一些跟复杂的参数, 但是上面的例子应该已经包含90%的应用了.[2]
===== 注释 (Annotations) =====
LaTeX 能够自动创建一些重要的注释, 例如脚注, 交叉引用, 表格的目录和参考文献. 注意到下面的命令需要 LaTeX 自动对正文元素进行计数, 从而需要 LaTeX 需要运行两次才能显示效果.
==== 脚注(Footnotes) ====
为了插入一个脚注, 只需要输入 \footnote{Footnote text here}. LaTeX 自动插入一个脚注数目和文本.[3]
==== 交叉引用 (Cross references) ====
为了引用一个表格或图形的标签, 使用 \ref{your-reference-key} 其中 “your-reference-key” 是表格或图形环境中命令 \label{your-reference-key} 的参数.
==== 表格的目录 (Table of contents) ====
为了插入一个表格目录, 在文档的开始的地方使用 \tableofcontents . (你必须运行 LaTeX 两次来获得表格目录和正确的引用.)
==== 参考文献(Bibliography) ====
为了创建一个参考文献列表, 在你文档的最后, 使用
\begin{thebibliography}{99}
….
\bibitem{key1} Disarray, General. 2006. “\LaTeX{}: From beginner to \TeX pert.” \emph{General Disarray Blog}. Available online at \textt{http://generaldisarray.wordpress.com}. ….
\end{thebibliography}
你必须手动输入参考文献的项目. 在正文中引用一个项目, 使用 \cite{key}, 参数{99}告诉 LaTeX 这是一个最多 99 个项目的参考文献. LaTeX 必须知道这个参数才能正确地调整参考文献项目左边的编号.
一个跟有效的创建参考文献的方法是使用__ BibTeX__, 它允许你维护一个引用项目的数据库, 当需要引用它们时调用这个数据库. 也有一些图形化的工具来管理的你引用数据库, 所以你需要要努力去对引用加代码, 而只是将它们改成不同的格式. 然而 BibTeX 在编译的时候变得比较复杂, 作为一个介绍, 你可以看在这个页面.
===== 插入数学公式 (Inserting mathematics) =====
在 LaTeX 插入数学公式的方法有几种. 最通常用的方法是内联记号(inline notation) 和 displaymath 环境 (displaymath environment).
==== 内联 记号(Inline) ====
在一个段落中插入数学符号, 而有不影响其它文本的格式, 将数学公式用 $ 符号括起来. 例如, , $a^2+b^2=c^2$ 是我们熟悉的公式.
==== Display math ====
displaymath 环境让你数学符号__单独占一行__. 代码
\[
a^2+b^2=c^2
\]
将创建一个段落分割和一个居中的方程.
==== Equation ====
equation 环境可以用来数学公式的编号和引用标记, 例如,
\begin{equation}
a^2+b^2=c^2
**\label{pythag}**
\end{equation}
就像 displaymath 生成同样的方程, 但是它还会在右边生成一个编号, 并且你可以使用 \ref{pythag}来引用这个方程.
==== Equation array ====
eqnarray 环境能够允许你输入多行的公式, 并设定对齐点. 例如,
\begin{eqnarray}
a&=&b+c\\
d&=&e+f
\end{eqnarray}
==== 数学记号 (Mathematical notation) ====
有一些命令来插入一些特殊的**数学算子和符号**. 它们可以在网上很容易的找到, 如果你不能想出一个有效的命令, Google查找一下. 下面有一些经常用的命令:
* 希腊字母: 一般来说, 它就是拼写的单词. 例如 \beta, \gamma 和 \epsilon. 大写则使用 \Gamma.
* 特殊符号 (Misc symbols): \leftarrow (使用 \Leftarrow 得到一个双向肩头), \rightarrow, etc., \leftrightarrow (<==>, if and only if), <, >, \leq (less than or equal to), \geq (greater than or equal to)
* 指数和分量 (Indexing and exponents): 下标使用下划线 (x_i) 和 上标使用 “^” (a^2). 为了使用 “i sub j comma k” 你只需要输入 “i_{j,k}” 来告诉 LaTeX “j,k”都是下标. 在LaTeX 中括号通常表示一组内容, 而它本身并不会在文档中出现.
* 另外的一些算子: \sum{1/x} or \sum_{i=1}^{\infty}{x_i}, \prod (the product), \coprod (the coproduct), \sin, \log, \max, etc.
* 修饰符号 (Decorations): \hat{x}, \tilde{x} , \overline{x}, \underline{x}, \overrightarrow{x}, \overbrace{x}, \underbrace{x}, \vec{x}
* 分数 (Fractions): \frac{a}{b} puts a over b.
* 括号 (Brackets): For brackets use “(”, “[” or \lbrace and \rbrace for “{” and “}”. However, if the notation that your typing is not inline, use \left( <math here> \right) or \left\lbrace <math here> \right\rbrace.
* 矩阵 (Matrices) : 为了输入一个矩阵, 在display 或者 equation 环境下, 使用
\left[ \begin{array}{ccc}
a & b & c \\
d & e & f
\end{array}\right]
注意array 环境的使用跟前面提到的表格环境很相似.
===== 进一步的参考 (For further reference) =====
上面的介绍只是 LaTeX 的一部分功能, 还有很多没有介绍, 推荐一个非常好的文档 The Not-So-Short Introduction to LaTeX (pdf).
===== 注记(Notes) =====
[1] 尽管LaTeX是用命令工作, 但例如 Scientific Word 是在图形界面上操作, 和 LyX 是一个非常好的开源, 基于 LaTeX 的 what-you-see-is-what-you-mean 的字处理系统, 它采用图形化界面但也允许使用LaTeX命令. 关于Lyx的介绍可一参见这里: LyX 和 LaTeX CJK 的配合, LyX和xetex中文的配置方法.
[2] OpenOffice 可是使用 Calc2LaTeX 来将 Calc spreadsheets转化为 LaTeX 表格tables. MS Office 用户可尝试工具 Excel2LaTeX. 这些工具都是跨平台的 .LaTeX使用excel2latex插入表格
[3] 为了创建一个贡献(attribution)脚注, 第一个脚注将用星号作标记, 使用 \thanks{text here}命令.

View File

@@ -0,0 +1,62 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T16:15:21+08:00
====== LaTeX发行版自带字体 ======
Created Saturday 24 September 2011
http://blog.sina.com.cn/s/blog_5e16f1770100ludh.html
可能有不少人像我一样在用LaTeX不久就开始跟字体较劲。我走的是这样一个过程
- 最初用惯了Word从而无法理解为什么LaTeX调用字体那么难
- 为了在LaTeX中调用字体想用现有的工具一蹴而就像TTFshapeMTFIxGBKfonts往往不能轻易成功沮丧
- 之后重新静下心来逐渐了解了什么是字体LaTeX中字体成功调用的方式才注意到MappingTFMvf等文件的相互关系理顺了这一切后把前面几个软件装不成功的字体装好我印象中装上过VerdanaGE Quartz等几个
- 后来发现也有些宏包有现成的字体可用那个时候主要就是关心TrueType字体所以见到了winfonts宏包这个宏包不在MiKTeX的宏包列表中开始用上一些系统中有的字体
- 又发现OpenType字体更棒再去看的时候才知道解包OpenType不但麻烦还会失去glyphs
- 在一个相当漫长的时间内没有动过LaTeX再碰它时又是从一篇Philipp Lehman的《The font installation guide》开始这篇文章100多页从头到尾看完已经比较清楚如何用fontinst来安装手头拥有的Type1字体。也正是从这篇文章开始喜欢上了 Minion字体并且成功安装。由于安装过程相当繁琐我还写了一些安装Type1字体的批处理有时间的话会整理出来因为通用性太差
- 再次碰字体就是在CTAN上看到MinionPro宏包这时我已经开始搜集字体所以MinionPro宏包要求的所有Optical Size我都有。MinionPro包特别大装上它后刷新文件名数据库都慢几十秒这也说明了OpenType字体的复杂性。我想要不是Adobe把这个经典字体免费提供应该不会有谁有心去为它生成那么多的TFM文件1511个之多。Minion Pro字体对我而言真的是压倒性的我估计学校允许的话我的论文都会申请用这个字体排版。
- 后来XeTeX被port到Windows我这才终于把MiKTeX升级到2.7beta并且花了大量时间研究XeTeX。XeTeX似乎就是为字体而生的但同样需要有字体的相关知识这些知识并不同于前面Type1字体而更多是字体的OpenType features这些featuresType1字体要么是根本没有(calt, salt),有也不容易打开(smcp, onum)。
但XeTeX同样有这样那样的问题而且如果直接访问OpenType字体编译速度就更不如PDFLaTeX访问Type1字体那么快在长文章中表现得非常明显。所以才有了今天这个帖子因为在这几天求助区的讨论过程中自己又回去看了看。加上之前也注意到其实打开$texmf/fonts目录就能发现LaTeX发行版中早就自带了不少字体这些字体虽然是免费功能上确不输专业字体。更重要的是这些字体很多都是精心设计过的字体包用来同时载入正文和数学环境的字体保持文档统一的风格在严谨的学术文章中也确实不该想在哪改字体就在哪改
原来自己有个文本文件,就是记录机器上可以为我所用的现成字体包(主要来自于$texmf\doc\latex\psnfss\psnfss2e.pdf文档的介绍但最近去到tug看过早就有人写了完整的LaTeX字体巡礼
http://www.tug.dk/FontCatalogue/
这个网站罗列了156个LaTeX中可以免费使用的字体并且给出了例子和调用的源代码需要注意的是这些字体并非默认安装在机器上但至少都能从 CTAN得到——不光是宏包还有字体文件因为像winfontsMinionPro这些宏包需要用户自己拥有相应的字体CTAN上并没有。不过拾人牙慧的工作还是要作那就是推荐一下几个字体/字体包:
1. Palatino
Will Robertson的文档总是用Palatino这字体的名气也不小。胖胖的很活泼笔锋也优雅有羽毛笔的进化痕迹。LaTeX中最省事的是用\usepackage{mathpazo}来统一修改正文和数学字体,这个宏包还有[sc, osf]参数分别对应小大写字母和不齐线数字。此外还有一个palatinox宏包可以直接调用Windows系统中的Palatino Linotype这是微软认证发布赫尔曼·察普夫的原作相关网址是http://www.ctan.org/tex-archive/fonts/truetypemetrics/palatinox/%EF%BC%8C%E9%9C%80%E8%A6%81%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85%E3%80%82%E5%9C%A8%E8%BF%99%E4%B8%AAURL%E7%9A%84%E4%B8%8A%E4%B8%80%E5%B1%82%E8%BF%98%E8%83%BD%E7%9C%8B%E5%88%B0%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%BB%8F%E5%85%B8%E5%AD%97%E4%BD%93frutiger%EF%BC%8C%E5%8F%AA%E6%98%AF%E6%88%91%E6%89%8B%E5%A4%B4%E6%B2%A1%E6%9C%89Linotype Frutiger。
2. Garamond
1530年诞生的经典字体LaTeX中通过mathdesign可以使用\usepackage[garamond]{mathdesign}来使用。Garamond字体十分大气打印在纸张上也特别好看法国很多口袋图书用的是Garamond。
需要注意的是虽说免费URW的garamond字体在默认安装的发行版中可能不存在但是可以下载到例如
http://ctan.binkerton.com/nonfree/fonts/urw/garamond/
下载所有pfb文件
ugmr8a.pfb ugmri8a.pfb ugmm8a.pfb ugmmi8a.pfb
放到font\type1\里面的某个目录后刷新数据库即可
3. Times
除了\usepackage{times}外,\usepackage{mathptmx}可以把数学字体也改成类似Times的字体。这个字体真的不需要再多说什么了总之我觉得看久了眼睛会累但是打印的效果非常稳妥。
4. Utopia
Utopia有点像Times但更宽敞一些。\usepackage{fourier}统一修改正文和数学字体为Utopia\usepackage[adobe-utopia]{mathdesign}则是mathdesign的调用方法差别不太明显。
5. Avant Garde/Courier/Bookman/New Century Schoolbook
不是我懒这几个字体在PSNFSS中是可以搭配着用的
\usepackage{avant}只载入Avant Garde
\usepackage{bookman}则同时载入Bookman(衬线)Avant Garde(无衬线)和Courier(等宽)字体
\usepackage{newcent}同时载入New Century Schoolbook(衬线)Avant Garde(无衬线)和Courier(等宽)字体
6. Charter
十分饱满的衬线字体,适合屏幕阅读。\usepackage{charter}
7. Helvetica/Optima
这两个字体放一块是因为我觉得它们是无衬线字体比较适合用来作幻灯片。Helvetica可以\usepackage{helvet}Optima没有写成宏包的形式就可以用\renewcommand{\sfdefault}{uop}然后\renewcommand* \familydefault{\sfdefault}来调用。在幻灯片这样的尺寸上Optima变化的线宽才显现出优美来。
不过beamer的作者认为Optima不适合做幻灯片
8. 其他数学宏包
建议看看ftp://tug.ctan.org/pub/tex-archi ... t_Survey/survey.pdf 这篇文章,介绍得相当详细,而且有效果图展示。
9. Minion Pro
http://tug.ctan.org/tex-archive/fonts/minionpro/ 有详细的安装说明只要不出错是肯定能安上的装了Acrobat Reader 7.0以上的用户都能在Acrobat安装目录下找到MinionPro-Bold.otf, MinionPro-BoldIT.otf, MinionPro-It.otf, MinionPro-Regular.otf这四个文件按照安装说明拆解它们四个已经能满足日常文档的需要。此外MnSymbol宏包MiKTeX 可以自动安装是配合Minion Pro的数学宏包最好装上不过\usepackage{MinionPro}就够了会自动载入MnSymbol宏包。
其实用来用去才发现LaTeX自带的这些字体才是真正经过时间和实践检验的经典字体是TUG智慧的结晶。而且这150多种字体也涵盖了绝大部分LaTeX能触及到的字体使用领域。这是不应该被遗忘的宝藏。

View File

@@ -0,0 +1,176 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-26T20:44:39+08:00
====== LaTeX学习笔记 ======
Created Monday 26 September 2011
===== 安装 =====
参考http://www.nsknet.or.jp/~tony/TeX/install/win/tex.htm
===== 最简单的例子 =====
\documentclass[11pt]{jarticle}
\textwidth=50mm
\begin{document}
あああああああああああああ
\end{document}
如何将tex文件转化为pdf文档日语
platex xyz.tex
dvipdfmx xyz.dvi
如何将dvi文件转化为gif/png
dvipng --gif -T tight -D 200 xyz.dvi
dvipng -T tight -D 200 xyz.dvi
省略 --gif 参数则输出为png格式。-D为放大百分比。
\documentclass: 文档类型;[11pt]:文档类型参数;{jarticle}:文档类型的值。两列分栏显示,则指定文档类型参数为[twocolumn,11pt]。
===== 页面布局 =====
{{~/sync/notes/zim/LaTex/LaTeX学习笔记/pageFormating.png}}
**页面基准点**:从纸的左上角算起,向右向下各移动 1inch(2.54cm) 处的点。通过该点的水平线称为**上基准线**,垂直线称为**左基准线**。
各种布局参数参见the not so short of Latex
\topmargin 页眉上端到上基准线的距离。
\headheight 页眉高度。
\headsep 页眉下端到正文上端的距离。
\topskip 正文上端到正文第一行的距离。
**\textheight 正文的高度。**
**\textwidth 正文的宽度。**
\evensidemargin 偶数页(左页)中,正文的左端到左基准线的距离。
\oddsidemargin 奇数页(右页)中,正文的左端到左基准线的距离。
\footskip 正文下端到页脚下端的距离。
\marginparwidth 页面右侧脚注的宽度。
\marginparpush 页面右侧脚注之间的距离。
\marginparsep 页面右侧脚注到正文的距离。
\columnsep 二分栏时左右栏之间的距离。
\columnseprule 二分栏时左右栏之间分隔线的宽度。
===== 页码 =====
==== 页码格式 ====
通过 \pagestyle{格式} 来指定页码格式。格式有以下几种:
empty 空白页眉、页脚
plain 空白页眉,但是在页脚的中央输出页码
headings 空白页脚,但是在页眉输出页码、章节编号以及标题
myheadings 自定义
通过 \renewcommand{**\thepage**}{\roman{page}}命令可以改变页码的格式。其中蓝色部分为定义颜色的命令,包括如下几种:
\arabic 阿拉伯数字 1, 2, 3, ...
\roman 罗马数字(小写) i, ii, iii, ...
\Roman 罗马数字(大写) I, II, III, ...
\alph 英文字母(小写) a, b, c, ...
\Alph 英文字母(大写) A, B, C, ...
通过 \setcounter{page}{10} 可以将页码设置为10。
===== 多个文档的结合 =====
通过 \input{文档名} 命令可以结合多个文档。文档名不用带扩展名.tex。
===== 命令 =====
==== 命令的分类 ====
命令包括单独命令(命令单独使用)、环境命令(成对使用, 如begin{..}和end{..}),以及宏命令。
==== 命令的参数 ====
documentclass[11pt]{jbook}{}表 示必须参数,[]表示可选参数。
==== 命令的作用范围 ====
某些命令一旦声明则对其后的所有文字均有效称为__声明型命令__例如斜体itshape字号增大 Large等。将这一类命令用{}括起来可以规定其__作用范围__例如
aaaa{\itshape bbbb{\Large ijkl}bbbb}aaaa
将显示为 aaaabbbbijklbbbbaaaa。
===== 其他 =====
**由文字结束的命令之后的空白将被忽视。**
一些命令
\itshape 斜体
\normalfont 正常字体
\sffamily 黑体?
\Large 字号增大
\LaTeXe 显示LaTeX2e的logo
\\ 换行
===== 宏命令 =====
定义方法newcommand{cmd}[arg]{def} 其中cmd为命令名以开头区分大小写可 以使用汉字arg为参数个数最大为9def为命令内容其中可以使用#1、#2...#9的方式使用参数。
newcommand{mytest}[4]{$#1#4^2+#2#4+#3=0$} mytest{a}{b}{c}{x}
使用 renewcommand{cmd}[arg]{def} 可以重新定义命令。
===== 包 =====
包相当于外挂插件。用下面的命令调用usepackage{包名}
===== 章节 =====
定义章节的命令
部 part Level -1(书籍、报告)Level 0(论文)
章 chapter Level 0
节 section Level 1
小节 subsection Level 2
小小节 subsubsection Level 3
段落 paragraph Level 4标题之后不换行
小段落 subparagraph Level 5标题之后不换行
另外,用 setcounter{secnumdepth}{数字} 来设置**自动编号的深度**(即编号到哪一级别)。
===== 附录 =====
用 appendix 命令开始定义附录。附录内至少要有一个 chapter。
===== 目录 =====
用 tableofcontents 插入目录。一般在 tableofcontents 之后使用一个 __clearpage __以便在新的一页开始正文。 用 setcounter{tocdepth}{数字} 设置目录的显示级别。
===== 首行缩进 =====
使用 parindent=数字 可以定义该命令之后所有段落的首行缩进值。使用 noindent 可以暂时取消该命令之后的一个段落的首行缩进。
===== 换行、分段、换页 =====
段内换行 \\
设定行间距 \baselineskip=数字
临时改变行间距 \\[增加值],例如\\[8mm]将使得该 行的行间距增加8mm。增加值可以为负数
分段 \par
设定段间距 \parskip=数字
换页 \clearpage
===== 空格 =====
空格包括句间空格和词间空格两种。句间空格要比词间空格稍大一些。
==== 句间空格 ====
__小写__字母后面跟标点符号时该标点符号之后的空格被认为是句间空格。大写字母后面接标点符号标点符号后的空格会被误认作是词间空格此时需要在标 点符号之前插入 \@ 命令来强制LaTeX将后面的空格作为句间空格处理。例如
as well as I\@. Hence, ...
==== 词间空格 ====
书写缩写、省略号等情况下,点 . 之后的空格会被误认为是句间空格。使用 (空格) 代替普通的半角空格可以强制该空格为词间空格。例如
Yamada et al. wrote the report.
==== 不可分断空格 ====
**用 ~ 代替空格**,可使得排版时不会在此处换行。例如 Mr.~Lamport。也可以使用 mbox命令例如 mbox{Minoru Sakaguchi}。
===== 对齐 =====
一行对齐leftline{左对齐} centerline{居中} rightline{右对齐}
多行对齐begin{flushleft}...end{flushleft}begin{center}... end{center}begin{flushright}...end{flushright}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,164 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-26T21:31:51+08:00
====== LaTex初学者模板 ======
Created Monday 26 September 2011
http://latex.yo2.cn/articles/latex-learning-3.htmlj
% a4paper - A4纸 11pt -字体 twoside -双面 openany -新章节可在偶数页开始
\documentclass[a4paper,11pt,twoside,openany]{article}
%------------------------------纸张大小----------------------------------
% 定义转换成pdf文档的纸张大小应与\paperwidth \paperheight一致
%\special{pdf: pagesize width 20cm height 30cm}
% true的含义是保持尺寸不会随一些参数的变化而变化具体可见Knuth的TeXbook
%\paperwidth 20 true cm % 纸张宽
%\paperheight 30 true cm % 纸张高
%------------------------------页面布局----------------------------------
%\textwidth 10 true cm % 正文宽
%\textheight 20 true cm % 正文高
%\headheight 14pt % 页眉高
%\headsep 16pt % 页眉距离
%\footskip 27pt % 页脚距离
%\marginparsep 10pt % 边注区距离
%\marginparwidth 100pt % 边注区宽
%----------------------------页边空白调整-------------------------------
\def\marginset#1#2{ % 页边设置 \marginset{left}{top}
\setlength{\oddsidemargin}{#1} % 左边(书内侧)装订预留空白距离
\iffalse % 如果考虑左侧(书内侧)的边注区则改为\iftrue
\reversemarginpar
\addtolength{\oddsidemargin}{\marginparsep}
\addtolength{\oddsidemargin}{\marginparwidth}
\fi
\setlength{\evensidemargin}{0mm} % 置0
\iffalse % 如果考虑右侧(书外侧)的边注区则改为\iftrue
\addtolength{\evensidemargin}{\marginparsep}
\addtolength{\evensidemargin}{\marginparwidth}
\fi
% \paperwidth = h + \oddsidemargin+\textwidth+\evensidemargin + h
\setlength{\hoffset}{\paperwidth}
\addtolength{\hoffset}{-\oddsidemargin}
\addtolength{\hoffset}{-\textwidth}
\addtolength{\hoffset}{-\evensidemargin}
\setlength{\hoffset}{0.5\hoffset}
\addtolength{\hoffset}{-1in} % h = \hoffset + 1in
\setlength{\voffset}{-1in} % 0 = \voffset + 1in
\setlength{\topmargin}{\paperheight}
\addtolength{\topmargin}{-\headheight}
\addtolength{\topmargin}{-\headsep}
\addtolength{\topmargin}{-\textheight}
\addtolength{\topmargin}{-\footskip}
\addtolength{\topmargin}{#2} % 上边预留装订空白距离
\setlength{\topmargin}{0.5\topmargin}
}
% 调整页边空白使内容居中,两参数分别为纸的左边和上边预留装订空白距离
\marginset{10mm}{12mm}
%-----------------------------字体支持-----------------------------------
\usepackage{times} % 使用 Times New Roman 字体
\usepackage{CJK,CJKnumb,CJKulem} % 中文支持宏包
%\usepackage{ccmap} % 使pdfLatex生成的文件支持复制等
%\usepackage[mtbold,mtpluscal,mtplusscr]{mathtime}%数学环境用Times New Roman
%-----------------------------页眉页脚-----------------------------------
\usepackage{fancyhdr} % 页眉页脚相关宏包
\pagestyle{fancy} % 页眉页脚风格
%-----------------------------段落字体格式-------------------------------
\usepackage{color} % 支持彩色
\usepackage{indentfirst} % 首行缩进宏包
%\setlength{\parindent}{2em} % 段落缩进
\setlength{\parskip}{0.7ex plus0.3ex minus0.3ex} % 段落间距
%\linespread{1.2} % 行距倍数
\renewcommand{\baselinestretch}{1.2} % 行距倍数(同上)
%\renewcommand{\CJKglue}{\hskip 0pt plus 0.08\baselineskip} % 汉字字距
%\newcommand{\aaa}{这是测试} % 自定义文字块例子
\newcommand{\song}{\CJKfamily{song}} % 宋体
\newcommand{\hei}{\CJKfamily{hei}} % 黑体
\newcommand{\fs}{\CJKfamily{fs}} % 仿宋
\newcommand{\kai}{\CJKfamily{kai}} % 楷体
\newcommand{\li}{\CJKfamily{li}} % 隶书
\newcommand{\you}{\CJKfamily{you}} % 幼圆
\newcommand{\wuhao}{\fontsize{10.5pt}{12.6pt}\selectfont} % 五号字体
\newcommand{\xiaosi}{\fontsize{12pt}{14pt}\selectfont} % 小四字体
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont} % 四号字体
%\marginparpush %
%-----------------------------超链接和标签-------------------------------
\iffalse % 将这里改为\iftrue即可使用
\ifx\pdfoutput\undefined % Not run pdftex
% \ifx
% \usepackage[dvips]{hyperref}
% \else
\usepackage[dvipdfm]{hyperref}
% \fi
\AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}} % GBK -> Unicode
\else
\usepackage[pdftex]{hyperref}
\fi
\hypersetup{CJKbookmarks,%
bookmarksnumbered,%
colorlinks,%
linkcolor=blue,%
citecolor=blue,%
hyperindex,%
plainpages=false,%
pdfstartview=FitH}
\fi
%--------------------------------注释------------------------------------
\iffalse % 将这里改为\iftrue即可使用
%注释掉一段内容
\usepackage{verbatim}
\begin{comment}
This is a comment example.
\end{comment}
\fi
%\makeatletter % @ is now a normal "letter" for Tex
%\makeatother % @ is restored as a "non-letter" for Tex
%--------------------------------其他宏包--------------------------------
%\usepackage{amsmath,amsthm,amsfonts,amssymb,bm} % 数学宏包
%\usepackage{graphicx,psfrag} % 图形宏包
%\usepackage{makeidx} % 建立索引宏包
%\usepackage{listings} % 源代码宏包
%---------------------------------正文-----------------------------------
\begin{document} % 开始正文
% song-宋体 hei-黑体 fs-仿宋 kai-楷体 li-隶书 you-幼圆 com为 song+hei
\begin{CJK*}{GBK}{com} % 开始中文环境
\CJKtilde % 重定义~代表的空白距离
\CJKindent % 段首缩进
\CJKcaption{GB} % 中文章节标题
\author{ceo} % 作者
\title{一个latex例子} % 题目
\maketitle % 生成标题
%\thispagestyle{empty} % 设置首页的页眉页脚风格
%\setlength{\baselineskip}{3ex plus1ex minus1ex} % 调整行距
\TeX{}~是由图灵奖得主\index{Knuth, Donald E.}~Donald E. Knuth\cite{texbook}~
编写的计算机程序,用于文章和数学公式的排版。
1977~年~Knuth~开始编写~\TeX{}~排版系统引擎的时候,\\ % 换行
是为了探索当时正开始进入出版工业的数字印刷设备的潜力。 \newline % 换行
他特别希望能因此扭转那种排版质量下降的趋势,使自己写的书和文章免受其害。
\noindent % 不缩进
% 下面是特殊字符 # $ % ^ & _ { } ~ \ ... 的输入
\# \$ \% \^{} \& \_ \{ \} \~{} $\backslash$ \ldots
\indent % 恢复缩进
%不用CJKulem包时\textit{我a} 或 \emph{我a} 或 {\em 我a}使英文斜体、中文变字体
% 用CJKulem包后\textit{我a} 依然是英文斜体、中文变字体,后两者变为加下划线
\textit{中文textit} \emph{中文emph} {\em 中文em}
\textbf{粗体textbf} % 粗体,对于中文推荐用黑体字代替粗体
\uline{下划线uline} % 下划线需要CJKulem包
\textcolor{yellow}{黄yellow} % 颜色需要color包
{\color{blue}蓝blue} {\color{red}红red} {\color{green}绿green}
{\hei 黑体}{\sihao 四号} {\song\xiaosi 宋体小四} % 字体大小
{\tiny hi} {\small hi} {\normalsize hi} {\large hi} {\Large hi} {\huge hi}
\clearpage % 换页,\newpage也可以推荐\clearpage
我们现在使用的~\TeX{}~系统是在~1982~年发布的1989~年又略作改进,增进了
对~8~字节字符和多语言的支持。\TeX{}~以具有优异的稳定性,可以在各种不同
类型的计算机上运行,以及几乎没有错误而著称。\TeX{}~的版本号不断趋近于~$\pi$
现在为$3.14159$。
\clearpage
\end{CJK*} % 结束中文环境
\end{document} % 结束正文

View File

@@ -0,0 +1,180 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-26T20:18:40+08:00
====== Latex Companion读书笔记 ======
Created Monday 26 September 2011
http://simon-guo.blogspot.com/2009/01/latex.html
===== LaTeX基本操作 =====
\hyphenation{word list} %断字命令;
\showthe\topmargin %显示某个参数的数值或者内容;
在tex编译过程中出现行溢出(overflow hbox)是由于断字程序不知道在何处进行断字,可以使用如下命令来减少这样的问题,
\sloppy这样会降低断字标准使输出不如默认状态下的输出出色可以使用\fussy命令来回复到原始状态
如果想查看哪一行发生了行溢出,可以在文档类中加入[draft]参数。
\frontmatter \mainmatter \& \backmatter \appendix修改文章的页码标记方式
\frontmatter %在文章正文之前使用罗马数字标记页码;
\mainmatter %文章正文用阿拉伯数字标记;
\backmatter %文章的结尾部分用
\label \ref \pageref %用来生成文章的标记和引用;
===== 列表: =====
\itemize \enumberate \description \list %可以通过参数改变列表的编号;
\flushleft \flushright \center %段落的对齐方式;
\quote \verse \quotation %引用命令;
\verbatim 和 verbatim 这个package %逐字打印命令和软件包;
\verbatiminput{filename} %可以将Ascii文件嵌入到当前文件中来
\tabular \longtabular \supertabular %表格命令;
表格和图片的浮动体环境可以将图片或者表格放置到合适的位置
页面的格式:\pagestyle %页面格式主要包括页码的显示位置和页眉的显示方式等;
normal
headings
no
myheadings %自定义显示方式;
\markboth{leftPage}{rightpage} %分别标记左右页眉;
fancy %需要用到fancyhdr 这个package
用法如下:
\fancyhf{} % delete current setting for header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
使用\fancyhdr来定制文档的页眉和页脚
\rightmark %当前的节名;
\leftmark %当前的章名;
\chaptermark \sectionmark \subsectionmark命令用来定义\leftmark和\rightmark;
===== 和LaTeX相关的文件扩展名 =====
.tex LaTeX源文件
.sty Package 文件;
.dtx 文档化的TeX文件
.ins .dtx的安装文件
.dvi 设备无关文件;
.log 编译时的信息;
.toc 生成目录需要的文件,改文件存储了章节标题;
.lof 生成图片列表的文件;
.lot 生成表格列表的文件;
.aux 一个向下次编译传递信息的辅助文件;改文件通常还包含交叉引用信息;
.idx 生成索引用到的辅助文件;
===== LaTeX扩展 =====
新建命令\newcommand{name}[num][defaultA, defaultB]{definitions}
num用来指定命令能接受的参数的个数如果不给定新建的命令将不会接受任何参数
如果num不为0则必须给定num个数的参数如果参数为空必须加一个{}并存在num个{}
defaultA和defaultB用来定义一个optional的参数如果参数的个数小于num则会使用optional的参数
\newcommand %命令不能创建已经存在的命令,如果要修改现有的命令可以使用\renewcommand命令来实现
\providecommand %命令用来创建命令,如果该命令已经存在则其将被忽略;
===== 新建环境 =====
\newenvironment{name}[num]{before}{after}
before 和after分别是该命令开始和结尾的定义
\newenvironment的用法和\newcommand的用法比较类似
可以将自己定义的命令和环境放到一个文件中其他文件就可以以package的形式来引用在该文件中定义的命令
Package的定义如下
\ProvidePackage{demo}
\newcommand{cmd1}{}
\newcommand{cmd2}{}
\newenvironment{env1}{\beforecmd}{\endcmd}
===== 字体操作 =====
字体: %如果遇到既要改变字体也要改变字号的情况,则应首先改变字号的大小;然后改变字体;
\textrm{...} roman \textsf{...} sans serif
\texttt{...} typewriter
\textmd{...} medium \textbf{...} bold face
\textup{...} upright \textit{...} italic
\textsl{...} slanted \textsc{...} small caps
\emph{...} emphasized \textnormal{...} document font
===== 字体尺寸: =====
\tiny tiny font
\scriptsize very small font
\footnotesize quite small font
\small small font
\normalsize normal font
\large large font
\Large larger font
\LARGE very large font
\huge huge
\Huge largest
===== 字体的绝对大小: =====
\tiny 5pt 6pt 6pt
\scriptsize 7pt 8pt 8pt
\footnotesize 8pt 9pt 10pt
\small 9pt 10pt 11pt
\normalsize 10pt 11pt 12pt
\large 12pt 12pt 14pt
\Large 14pt 14pt 17pt
\LARGE 17pt 17pt 20pt
\huge 20pt 20pt 25pt
\Huge 25pt 25pt 25pt
字体使用的建议:文档中字体使用的越多,文档越漂亮;
===== 文档对象的间隔 =====
修改行距:
\linespread{factor} 例如\linespread{1.6}产生2倍行距
\baselinestretch{num} %改变行间距;
\ziju{num} %中文CCT改变字间距的方式该命令不会影响英文的字距
===== 设置首行缩进和段落间距: =====
\setlength{parindent}{0pt} %设置首行缩进为0
\setlength{parskip}{1ex} %设置段落间距为1ex
\ccwd %一个汉字的宽度在中文CCT环境中使用
===== 单词和句子之间的距离 =====
水平距离\hspace{length} %可以用该命令插入一个水平间距;
垂直距离\vspace{length} %该命令可以用来改变两个段落之间的垂直间距;
\stretch{length} %定义一个将一行宽度充满的橡皮长度;系统会根据当前的状态赋值;
\bigskip 和\smallskip %获得一个预定义的垂直距离;
===== 修改页面布局 =====
页面的布局是通过一系列的参数来控制的,我们可以通过修改这个参数的数值来修改页面布局;
页面布局参数主要有:
\hoffset %正文的水平偏移;
\voffset %正文的垂直偏移;
\oddsidemargin %奇数页正文和侧栏之间的距离;
\evensidemargin %偶数页正文和侧栏之间的距离;
\topmargin %
\headheight
\headsep
\textheight
\textwidth
\marginparsep
\marginparwidth
\footskip
===== 修改页面参数的命令有: =====
\setlength{parameter}{length}
\addtolength{parameter}{length}
===== LaTeX中的盒子操作 =====
\parbox[pos]{width}{text} %将段落放到一个盒子中;
\makebox[width][pos]{text} %将文本放到一个width宽度位于pos的盒子中
\framebox[width][pos]{text} %和\makebox命令类似不同之处在于盒子内部的文本有矩形框
\raisebox{lift}[depth][height]{text} %用来控制盒子在垂直方向的距离;
\rule[lift]{width}{height} %用来生成水平方向和垂直方向的线条;
===== 文章结构命令 =====
\part{} %部分;
\chapter{} %章;
\section{} %
\subsection{}
\subsubsection{}
\paragraph{} %段落
\subparagraph{} %子段落;
解读sty|cls文件 %风格,样式文件定义;
article.sty %文章风格;
- art10.sty %10pt;
- art11.sty %11pt;
- art12.sty %12pt;
article.cls %2e版本的article样式文件
- size10.clo %10pt对应art10.sty;
- size11.clo %11pt, 对应art11.sty;
===== 常用\LaTeXe工具包 =====
\usepackage{indenrst} %首行缩进工具包indenrst.sty;

View File

@@ -0,0 +1,92 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T20:33:52+08:00
====== TeX 相关名词的不完全考察 ======
Created Wednesday 07 September 2011
http://lyanry.is-programmer.com/posts/513.html
TeX
TeX 是二十世纪七十年代末Donald E. Knuth高德纳 开发的一个排版程序。
TeX 首先是一个程序,它可以将一种标记语言文本处理成一种可用于打印或屏幕阅读的文档,比如 DVI 文件、PS 文件或者 PDF 文件。在概念不发生混淆的时候,我们将 TeX 所能够处理的那套标记语言也叫做 TeX。
我们学习 TeX通常是指使用 TeX 标记语言来写源文档,这个过程可以称作”排版“。排版结束后,将所写的源文档交给 TeX 程序处理(编译),最终输出 DVI 文件、PS 文件或 PDF 文件等格式。
比如说下面有一份文件名为 hello.tex 的 TeX 源文档,其内容如下:
Hello World!
\bye
上面 TeX 源文档的第一行是文档的正文文本。第二行是一个 TeX 标记,它的作用是告诉 TeX 程序:“这里已经是文档末尾,处理完后您就可以退出了。” 要使用 TeX 程序对该文档进行处理,可在终端(控制台)运行以下命令:
$ tex hello.tex
完后就可以得到一份 hello.dvi 文件。这份文件的内容很简单,只有一串 “Hello World!” 文本。
由于 TeX 程序会根据 TeX 源文档中的各种标记来生成相应的排版格式,这个过程可以看作是 TeX 标记指示 TeX 程序来完成各项排版任务,所以下文中就将 TeX 标记统一称为 “TeX 排版指令” 或简称为 “TeX 指令”。另外,习惯上将 TeX 程序称为 “TeX 引擎”
TeX 指令大概有 300 多条,使用这些指令可以实现科技文档、乐谱、棋谱、文学作品等各式各样的文档排版,简直是无所不能了。
Plain TeX
使用 TeX 指令排版文档就好像是我们使用筷子来吃饭年幼时可能很不方便假以时日娴熟之后管你是炒、炸、蒸、煮一双筷子统统拿下。但是对于西餐而言使用筷子来吃也是可行的但这终归是不方便的还是老老实实地刀子、叉子并用才使得。同理TeX 指令用于排版一些专业领域的文档,也是不方便的,人们希望在撰写自己专业领域的知识文档时,能够有一套量身定做的排版指令。
TeX 系统的开发者 Knuth 意识到了这个问题,就在 TeX 指令的基础上,又添加了 600 多条复合指令,称之为 Plain TeX 指令。一条 Plain TeX 指令实际上是由多条 TeX 指令复合而成的,这是利用 TeX 指令的宏机制来实现的。
对于不大懂计算机编程的同学对于宏也许不是很了解这里也有一个比喻可以帮助你来理解。给你一套积木让你组装成一个房子的模型我们可以将你组装好的房子模型称为积木的“宏”。TeX 指令就好比积木Plain TeX 指令就好比积木组装成的房子模型,所以 Plain TeX 指令就是 TeX 指令的宏。这里头有点弯弯绕,仔细体会应该能明了的。对于一套基于 TeX 指令实现的宏指令,通常称之为 TeX 宏包。
总之要清楚这样一个概念Plain TeX 仅仅是一个 TeX 宏包,其诞生的目的是为了便于使用 TeX 排版。由于 Plain TeX 是 Knuth 写的,很权威,所以后来就将这 600 多条的 Plain TeX 指令与 300 多条的 TeX 指令合在一起构成了 TeX 标准指令集。
Knuth TeX
当 Knuth 感觉 TeX 系统已经足够稳定与完善之时,宣布 TeX 项目冻结,以后只进行 bug 的修正。由于 TeX 系统的源代码一直都是公开的, Knuth 欢迎他人将 TeX 继续改进成为更好的排版程序。只是出于能够兼容 Knuth TeX 指令的目的也或许为了满足他个人对于完美的追求Knuth 设计了一个测试,对于 TeX 的改进版本,只有通过这项测试,才能以 "TeX" 命名,否则就必须换个名字。
我们可以将Knuth 开发的 TeX 程序TeX 指令集Plain TeX 宏指令集统称为 Knuth TeX。
NTS 、 e-TeX 与 ExTeX
NTS (New Typesetting System) 项目的任务就是要继续扩展 TeX。这个项目由德国 TeX 用户组织于 1992 年发起,后来不知怎么回事一直拖到 1998 年才算是真正地开始,并计划使用 Java 将 Knuth TeX 重新实现与改进Knuth TeX 是使用 WEB 语言实现的WEB=Pascal+TeX。在 1999 年至 2000 年间NTS 项目的运作比较积极。但是后来又不知怎么回事,到了现在的 2007 年,这个项目又一直没有什么动静了。
e-TeX 最初是 NTS 项目的一个并行项目,由 NTS 项目组成员负责,后来转由 Peter Breitenlohner 负责。e-TeX 项目的主要任务是对 TeX 进行扩展,在 Knuth TeX 的基础上又增加了许多有用的排版指令。
e-TeX 与 NTS 的区别在于:前者只是对 Knuth TeX 进行修修补补,而后者是计划使用 Java 语言对 TeX 重新实现并加以改进。从我所阅读的材料来看NTS 项目基本上已经败落,而 e-TeX 则是下文要讲到的 LaTeX、pdfTeX 等项目的重要基础。
2002 年,德国,一些专家和开发人员组织成一个小团体,发起了 ExTeX 项目。ExTeX 项目是基于 NTS 的,并借鉴了 e-TeX、pdfTeX、Ω (Omega) 等项目的经验,它的理想是实现一个新的基于 Java 实现的 TeX。这个项目现在依然在运作中但愿它能很好的生存下去。
LaTeX
由于 Knuth 写的 Plain TeX 宏包虽然比最初的 TeX 指令集高级了一些,但它还是过于停留在排版的层次上,而不是从文档撰写者的角度出发,强调文档内容的逻辑性而不是格式。就像对于吃西餐,对于大多数人而言,只希望有一套真正的刀子和叉子就可以了,因为他们真正的目的是吃西餐,而不是研究如何基于筷子的原理寻找制造出刀子和叉子的方法。所以,在 Knuth TeX 出现后没有几年Leslie Lamport 便基于 Knuth TeX 指令集 (TeX 指令集Plain TeX 宏包) 开发了 LaTeX 宏包。
LaTeX 的出现,主要目的是简化 TeX 的使用,让文档撰写者有更多的精力集中在文档内容的写作上。譬如 LaTeX 可以自动给出文档的标题,章节, 表格目录,交叉索引,公式编号, 文献引用,浮动图表等。另外 LaTeX 也强调了文档的格式与内容的分离,它鼓励文档撰写者将文档的格式单独集中在一些文档中,在写文档时,只需要少许指令加载这些格式文档即可对所撰写的文档进行格式化排版。如果你大概知道一些 HTML 与 CSS 的知识,那么就可以很好地明白 LaTeX 所提倡的格式与内容分离的观念。
LaTeX 自问世以来也在不断地发展着。LaTeX 最初的正式版本为 2.09,在经过几年的发展之后,许多新的功能,机制被引入于其中。但是用户在享受 LaTeX 这些新功能所带来的便利之时,它所伴随的副作用也开始显现,这就是许多宏包的不兼容性,譬如标准的 LaTeX 2.09、引入了“新字体选择机制”(NFSS) 的 LaTeX 、SLiTeX、AMSLaTeX 等宏包相互之间无法兼容,这给 LaTeX 使用者和维护者都带来很大的麻烦。
为结束 LaTeX 宏包之间兼容性糟糕的状况Frank Mittelbach 等人发起了 LaTeX3 项目,目标是建立一个最优的、有效的、统一的、标准的指令集。这是一个长期目标,向这个目标迈出第一步就是在 1994 年发布的 LaTeX2e。LaTeX2e 采用了 NFSS 作为标准,加入了很多新的功能,同时还兼容旧的 LaTeX 2.09。LaTeX2e 每 6 个月更新一次,修正发现的错误并加入一些新的功能。
在 LaTeX 3 最终完成之前LaTeX2e 将是标准的 LaTeX 版本。我们现在所指的 LaTeX通常是指 LaTeX2e。
还要注意一点LaTeX2e 宏包的底层也不再是基于 Knuth TeX 指令集来实现了,而是基于 e-TeX所使用的 TeX 引擎也不再是 Knuth 所开发的那个 TeX 程序了,至少我所知的 TeX Live 套件中 LaTeX 所使用的 TeX 引擎是 pdftex。至于什么是 TeX Live 与 pdftex在下文中会讲到的。
PDFTeX
1997 年Han The Thanh 基于 Knuth TeX 实现了 PDFTeX。
PDFTeX 在实现上可以分为两个模块。一个模块保留了原先Knuth的所有代码可以按照 Knuth TeX 那样直接输出 dvi 文档。另一个模块主要是实现基于 TeX 源文档直接输出 pdf 文档,在该模块的实现中,加入了大量的 C 代码;通过与 C 库的连接,可以处理一些简单的问题,比如插入各种格式的图片等。
PDFTeX 在算法上面比较的杰出方面,是 HZ 特性(具体是什么,我也不清楚),可以取得较好的排版效果。
在 TeXLive 套件中etex、latex、pdfetex、pdflatex、pdfelatex 等命令都是指向 pdftex 命令的连接。
对于目前较为流行的绘图宏包 PGF/TikZ还有用于制作演示文档的 Beamer 宏包,也都对 PDFTeX 提供了最好的支持。另外 ConTeXt 也力推使用 PDFTeX 作为 TeX 引擎。
这也许能够说明PDFTeX 已经成为目前 TeX 引擎的事实标准。目前该项目已被 PDF 项目组承接过去继续开发。
ConTeXt
ConTeXt 是基于 TeX 实现的一个宏包,其设计目的与 LaTeX 类似,但是它远比 LaTeX 年轻,因此也更能跟随 TeX 的一些新生功能;在设计上也相对统一,不像 LaTeX 那样容易出现某些宏包相互冲突的现象。ConTeXt 给予了用户更强大的文档布局控制能力,即便用户并不怎么了解 TeX。
ConTeXt 集成了 MetaFun作为矢量图形绘制语言。MetaFun 是 MetaPost 的超集,可以独立使用,也可以用于 ConTeXt 文档布局,可以实现精妙的排版效果。
ConTeXt 允许用户使用不同种语言的用户界面,即 ConTeXt 排版指令可以用多种语言表述目前支持英语、荷兰语、德语、法语以及意大利语。在不改变用户界面的情况下ConTeXt 也可以调用不同的 TeX 引擎对源文档进行处理。
ConTeXt 项目运作的非常积极,开发者非常注重自由软件开发哲学——经常发布,有时一天会发布两次。
Small_feed 评论 (2)
1
[回复]
Avatar_small
yulewang 说:
2007年11月01日 23:25 呵呵,参考我的文章以后要注明哦....比如pdftex当中的很多介绍是参考我在水木上的文章吧。 HZ特性或者叫HZ算法是字体设计大师Zapf设计的两个使得排版更加漂亮的算法。可以说都是基于Knuth的badness定义的断行算法的改进。第一个算法是margin kerning可以允许标点符号比如逗号或者hyphen放到margin线上这样的话不但使得margin线的区域在肉眼看来更加整齐事实上是不整齐而且也使得断行效果更好这个容易理解行距事实上被增大了所以badness会减小。第二个算法是font expansion就是当某行badness比较大时适当地增大或者减小字体轮廓曲线当然这个得保证改变量如此小以至于肉眼看不出来而使得字体box长度发生变化而达到减小badness的目的。 >目前该项目已被 PDF 项目组承接过去继续开发。没有PDF项目组是LuaTeX team。pdftex和luatex的开发组是相同的LuaTeX是pdfTeX的一个后继者。

View File

@@ -0,0 +1,47 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T20:14:43+08:00
====== TeX 系统的演变 ======
Created Wednesday 07 September 2011
http://lyanry.is-programmer.com/posts/332.html
原文见王越的 google pages本文仅将其原有繁体中文转换为简体把原文中的英文标点转换为中文标点原文中一些词句我认为有错误就对其进行修订。
当年,高爷爷发现出版社将他的巨著 TAOCP 排版得乱七八糟,因此,立志编写出一套计算机排版系统,来发挥计算机排印的潜能。这套系统,就被他称作为 TeX。如今TeX 已经在全世界得到广泛的应用,和高爷爷高超的技术是分不开的。
TeX 系统的思想,起源于高爷爷在斯坦福大学的一个叫做文学编程的试验。所谓文学编程,和今天的 python 编程类似,也就是说,编写程序和编写文档是一个统一的过程,编写完的程序,通过编译器,就能够被编译执行;同时,如果通过一个文本生成程序,就能够得到该程序的技术资料。
TeX就是在这种环境下被高爷爷弄出来的。而这种编程思想就是体现在一种叫做 WEB 的语言上。WEB 语言的特别之处,就是当 WEB 文件通过不同的命令就能够生成不同的东西。经过几年的发展WEB 语言成型,同时 TEX 系统成型。
WEB 语言究竟是什么东西?事实上,就是一个 WEB 文件同时包含了 TEX 文档和 Pascal 语言,当 WEB 文件被 tangle 命令处理的时候,我们就得到了一个 pascal 语言文件,这个文件,可以直接被 pascal 编译器编译后执行。而对 WEB 文件使用 weave 命令进行处理,可得到 TeX 文档,这个文档由 tex 命令处理后,生成 dvi 文件,可用于打印。
TeX 系统,就是用这么一个 WEB 语言写就的,如果您对于这个怎么互相循环感到奇怪,那您不妨想象 C 语言编译器也是用 C 语言写就的。这是一个循序渐进、不断添加新指令的过程。
当今的 TeX 系统,事实上就是一个 web 文件,这个文件可是高爷爷亲手编写的,当你得到这个文件以后,对其执行 tangle 命令,你就可以得到一个叫做 tex.p 的文档,对这个文档,使用 pascal 编译器进行编译,就得到了一个 TeX 系统。而 web 文件由 weave 命令处理后,可得到一个 tex 文件,当你运行 tex 来编译这个文件的时候,你得到的是讲述 TeX 系统所有实现的文档。
整个 TeX 系统共有 300 个基本指令。使用这些指令,我们可以排版任何文档。当然,由于这些指令比较底层,用起来比较复杂,于是我们的高爷爷又基于这些指令,添加了 600 个指令,这就是我们今天的 TeX 系统。详细的指令用法,高爷爷都写到了他的 The TeXbook 中,这个可是他的一笔重要收入。
Pascal 语言是学院派的典范 (我承认最典范的学院派语言是 scheme)但是在实际生产中pascal 语言自然就不能胜任了。20 世纪 80 年代随着苹果机的流行,使得 pascal 语言被很广泛地使用,以至于苹果公司需要把其他语言写的程序改成 pascal 代码,再在苹果机中运行。但是在 20 世纪 90 年代,网络迅速发展,导致 Unix 系统的需求迅速扩大C 语言开始登上编程舞台pascal 就不再吃香了。一大群学校纷纷改授 C 语言,同时 C 语言编译器的进步也异常迅猛,此时的大型应用也大都使用 C 语言编写。TeX 作为最牛 B 的排版软件,自然也应当使用 C 语言咯。因此,需要把 WEB 代码中的 pascal 换成 C 代码的想法付出水面,实现这个想法的的 WEB 系统就叫做 WEB2C。
事实上,这个是一个不得已的决定,由于大家对于高爷爷期望很高,一直认为他会不断地修改 TeX 系统,使之变得更加强大,因此本来一些手动地把 WEB 语言改变到 C 语言的计划,比如 Common TeX ,都无法成功,因为这使得 C 代码无法和高爷爷的 WEB 代码同时修正发布。因此只能够选择由机器自动地转码。而不幸的是,后来高爷爷认为 TeX 不需要再做任何修改了,当然这个是后话。 WEB2C 就在这种被动的想法下面被提出来了。
WEB2C 事实上就是 Lex 和 Yacc 写的一个语法转换器,尝试把 pascal 语言转换到 C 语言。中途会经历各种恶心的过程,当 pascal 语言变到了 C 语言以后,一群计算机专家们就很高兴地能够 make 它们,在浪费办公室电费和打法自己的时间中享受独特的乐趣。事实上这个也是一个无奈的决定。因为转好的代码,基本上不能用肉眼进行分析。
不管怎么样,我们的 WEB 语言终于到 C 语言了。接下来,由于 TeX 太伟大,所以,有了很多的基于 TeX 的包,包括字体,有用的宏。因此,我们的目录结构变得越来越复杂,如果当年的高爷爷乘坐时光机器看看今天的 TDS一定会使他大开眼界。同时网络的发展导致可能本机器上的 TeX 需要搜索其他机器上的文件。这个就导致了一个严重的问题,就是 TeX 需要在许多的目录中找文件,需要耗费非常长的时间,而且如果一到网络上查找文件,速度还要降得更加慢。
因此,我们需要改动原先仅仅在当前目录或者由用户声名路径的目录下面找文件的架构。而此时的问题是,不能在 TeX 上面改,因为 metapost 等诸多的 TeX 相关软件也需要找文件,在 TeX 中实现一次再在 metapost 中实现一次是一个错误的决定。因此TUG 的 Karl 老大有了一个办法。首先开发了一个库,叫做 kpathsea然后让 TeX 和它的相关软体,通过 kpathsea 查找文件。而查找文件的数量庞大导致的速度慢,就采用数据库的方法解决。先查找一次,记录下来,以后慢慢享用。这个数据库,就是 ls-R。
最早的 WEB2C 的查找方案,就是定义了一个叫做 TEXINPUTS 的环境变量,告诉 kpathsea 在TEXINPUTS 所定义的环境下,找到文件。但是这个导致了一个新的问题,也就是不同的 TeX 需要寻找不同的东西,而一个 TEXINPUTS 无法把它们区分开来。因此我们这才想到应该使用不同的路径比如TEXINPUTS.latex 变量,来给 LaTeX 查找路径TEXINPUTS.context 变量给 ConTeXt 查找。而这些变量,就定义在 texmf.cnf 当中。
这个文件,还定义了许多的 TeX 的目录树,比如 texmf 目录,可以给整套的 TeX 系统查texmf.os可以给特性的系统查。当我们的系统添加了什么新的东西就放在 texmf-local 吧。而用户自己的东西,嗯,规定他们在$HOME/texmf。
还有最后一个问题,那就是 kpathsea 如何查找 texmf.cnf 呢?事实上是通过定义环境变量达到目的的。这个变量叫做 TEXMFCNF所有在这个环境变量中的 texmf.cnf 都被搜索到。这也使得,用户可以自己写一个 texmf.cnf把所在路径加入到自己的 TEXMFCNF而不需要重写整个 texmf.cnf。如果这个变量没有定义那么默认我们找 texmf/web2c 这个路径下的 texmf.cnf。
整个 TeX 系统的实现过程到目前的科技发展水平为止,就是这个样子,说不定过了几年 C 语言不再吃香,因此搞出一个 web2python。又过了几年 pascal 复苏,大家又重新使用 WEB 语言写东西,或者过了几年网络和硬盘速度足够快,我们扔掉了 kpathsea。这些事情或许都会发生谁也不知道。
但是这一切的被动,都是由于高爷爷大师光环的光芒,使得 tex.web 这个文件成为永恒。 1990 年 TeX 系统发布了 3.1 版本,高爷爷兴奋地表示, tex.web 是一个好东西,没有 bug我们不要再改动 tex.web 了,大家一定要改,那我也没办法,但是不要和我争哦,一定要改名。 TeX 在 20 世纪 80 年代末虽然做了一次大的改动,可以处理 8 位的字符而Unix Plan 9 系统的发布,奠定了 Unicode 编码方案的基础。 TeX 在目前的情况下,是落后于整个时代的。
如今TeX 在多国语言的支持上,始终处于半吊子的状态,需要一大批黑客们日夜 hack 才可以被更多的场合支持。 TeX 使用的字体、输出,也受到时代的局限。 TeX 所用到的各种字体文件的庞杂程度,可能一个熟悉这个系统的人也不能完全讲明白。而同时发展起来的 X Window 系统,却对当今流行的字体和当今的字体渲染技术,拿捏非常到位。
显然,我们本来可以修改而使得 TeX 变得更好,但是高爷爷大师形象的光芒,使得各种尝试 (pdftex, etex, xetex, luatex,omega,aleph, ant, etc.),都不能算是正统。一方面,由于没有现成的由手工转换得到的 C 代码,修改 TeX 并不简单。许多的新 TeX 实现,都是给高爷爷的 tex.web 加上一串的 ch 和 fix 文件,这就使得他们严重地依赖原本的 TeX使之变得异常复杂好比于 C++ 对于 C 的扩充。另一方面,这些诸多的新时期的 TeX 实现,种类繁多,虽然大多数对于老的 TeX 的功能都尽量做到不变,但是新添加的功能,却导致彼此的不兼容。我们都不知道,更加漂亮的 TeX 架构,路在何方。

View File

@@ -0,0 +1,43 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T20:37:10+08:00
====== The levels of TeX ======
Created Wednesday 07 September 2011
http://www.tug.org/levels.html
LaTeX vs. MiKTeX: The levels of TeX
A friend asked us once, “Should I use LaTeX or MiKTeX?” In various guises, this is a common question, seemingly innocent, but actually betraying a fundamental confusion about the levels of operation in the TeX world. As a further confusion, the word “TeX” can be used to refer to any of a myriad of items at any level. Starting at the top:
===== Distributions =====
: MiKTeX, TeX Live, … These are the large collections of TeX-related software to be downloaded and installed. When someone says “I need TeX on my system”, they're usually looking for a distribution.
===== Front ends =====
: Emacs, TeXworks, TeXShop, TeXnicCenter, WinEdt, … These editors are what you use to create a document file. Some (e.g., TeXShop) are devoted to TeX specifically, others (e.g., Emacs) can be used to edit any sort of file. TeX documents are independent of any particular editor; the actual TeX typesetting program itself does not include any sort of editor whatsoever.
===== Engines =====
: TeX, pdfTeX, XeTeX, LuaTeX, … These are the actual executable binaries which implement the different __TeX dialects.__ The LaTeX format is implemented with both the pdfTeX (pdflatex) and XeTeX (xelatex) engines, for example. When someone says “TeX can't find my fonts”, they usually mean an engine.
===== Formats =====
: LaTeX, plain TeX, pdfLaTeX, … These are the__ TeX-based languages__ in which you actually write documents. When someone says “TeX is giving me this mysterious error”, they usually mean a format.
===== Packages =====
: geometry, lm, … These are add-ons to the basic TeX system, developed independently, providing additional typesetting features, fonts, documentation, etc. The CTAN web sites provide access to the vast majority of packages in the TeX world.
===== Output formats =====
TeX source files can be typeset into several different output formats, depending on the engine. Notably, the pdfTeX engine (despite its name) can output both DVI and PDF files.
At a high level, the output format that gets used depends on the program you invoke. If you run latex (which implements the LaTeX format), you will get DVI; if you run pdflatex (which also implements the LaTeX format), you will get PDF.
To get HTML, XML, etc., output, the tex4ht program is commonly used. This utility uses TeX to do its job, but the TeX engines themselves do not implement HTML output.
===== ConTeXt =====
ConTeXt is a special case, straddling levels. It contains a format at the level of__ plain TeX and LaTeX__, but unlike the other formats, it is invoked via a separate utility (e.g., texmfstart) which then indirectly runs a TeX engine. This makes it possible to support a wide array of advanced features, such as integrated graphics and XML input, since the startup utility can control the flow of processing.

View File

@@ -0,0 +1,72 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T20:41:17+08:00
====== Things with “TeX” in the name ======
Created Wednesday 07 September 2011
New TeX users are often baffled by the myriad terms with “TeX” in the name. The goal of this answer is to clarify some of the more common such terms.
===== TeX =====
itself TeX proper is a **typesetting system** based on a set of low-level **control sequences** that instruct TeX how to lay out text on the page. For example, \hskip inserts a given amount of horizontal space into the document, and \font makes a given font available in a document. TeX is fully programmable using an integrated macro scripting language that supports variables, scoping, conditional execution, control flow, and function (really, macro) definitions. See what is TeX? for some background information on TeX and some reference documents for pointers to descriptions of TeX control sequences, data types, and other key parts of TeX.
====== TeX macro packages (a.k.a. TeX formats) ======
Some of TeXs control sequences are **tedious** to use directly; they are intended primarily as building blocks for higher-level — and therefore more user-friendly — **abstractions**. For example, there is no way in base TeX to specify that a piece of text should be typeset in a larger font. Instead, one must keep track of the current size and typeface, load a new font with the same typeface but a (specified) larger size, and tell TeX to use that new font until instructed otherwise. Fortunately, because TeX is **programmable**, it is possible to write a macro that hides this complexity behind a simple, new control sequence. (For example, it is possible to define \larger{my text} to typeset “my text” in at a font size next larger than the current one.)
While some users write their own, perfectly customized set of macros — which they then typically **reuse** across many documents — it is far more common to rely upon a **macro package**, a collection of TeX macros written by experts. For the users convenience, these macro packages are often combined with the base** TeX engine** into a standalone executable. The following are some of that macro packages that you are likely to encounter:
==== 1.Plain TeX (executable: tex) ====
~~See Books on TeX and Plain TeX, Online introductions: TeX, Should I use Plain TeX or LaTeX? and Freely available (La)TeX books.~~ Note that the Plain TeX executable is called** tex**; the base TeX engine is generally provided by a separate executable such as initex or as a -ini flag to tex.
==== 2.LaTeX (executable: latex) ====
~~ See Books on TeX and its relations, (La)TeX Tutorials, etc., Online introductions: LaTeX, Specialized (La)TeX tutorials and Directories of (La)TeX information.~~ Note that there have been two major versions of LaTeX: **LaTeX2e** refers to the current version of LaTeX while LaTeX 2.09 is the long-since-obsolete (since 1994) version (cf. What is LaTeX2e? for more information).
===== 3.ConTeXt (executable: texmfstart) =====
See What is ConTeXt?.
===== 4.Texinfo (executables: tex, makeinfo) =====
~~See What is Texinfo?.~~ makeinfo** converts** Texinfo documents to HTML, DocBook, Emacs info, XML, and plain text. Tex (or wrappers such as texi2dvi and texi2pdf) produce one of TeXs usual output formats such as DVI or PDF. Because tex loads the Plain TeX macros, not the Texinfo ones, a Texinfo document must begin with \input{texinfo} to explicitly load the Texinfo macro package.
==== 5.Eplain — Extended Plain TeX (executable: eplain) ====
See What is Eplain?.
====== Modified tex executables ======
The original tex executable was produced in the late 1970s (cf. What is TeX?) and consequently lacked some** features** that users have come to expect from todays software. The following programs address these issues by augmenting the **TeX engine** with some additional useful features:
===== 1.PDFTeX (executable: pdftex) =====
TeX, which predates the PDF file format by a decade, outputs files in a TeX-specific format called DVI (cf. What is a DVI file?). In contrast, PDFTeX can output both DVI and PDF files. In PDF mode, it lets documents exploit various PDF features such as** hyperlinks**, bookmarks, and annotations, PDFTeX additionally supports two sophisticated micro-typographic features: character protrusion and font expansion. See What is PDFTeX?.
===== 2.XeTeX (executable: xetex) =====
XeTeX reads **UTF-8** encoded Unicode input, and extends TeXs font support to include modern formats such as TrueType and OpenType; these extensions to its capabilities make it well-suited to multi-lingual texts covering different writing systems. See What is XeTeX?.
===== 3.LuaTeX (executable: luatex) =====
TeX is programmed in its own arcane, integrated, macro-based programming language. LuaTeX adds a **second programming engine** using a modern scripting language, Lua, which is embedded in a TeX-alike engine; it too reads UTF-8 and uses TrueType OpenType fonts. See What is LuaTeX?.
===== 4.e-TeX (executable: etex) =====
e-TeX is an extension of TeXs programming interface; as such its only indirectly useful to end users, but it can be valuable to package developers; there is an increasing number of macro packages that** require** the use of e-TeX. As well as existing in etex, e-TeX features are usually available in the pdftex executables provided in the standard distributions; XeTeX and LuaTeX also provide e-TeXs programming facilities. See What is e-TeX?.
(Note: e-TeX, which enhances the TeX engine, is not to be confused with Eplain, which enhances the Plain TeX macro package.)
__宏包和引擎是相对独立的一个宏包可以被多个引擎使用。__
Because each of the above **derive from a base TeX engine,** it is in principle possible to **combine any of them with one of the TeX macro packages **listed earlier to produce __extended executables__. For example, the pdflatex, xelatex and lualatex executables each combine LaTeX with an enhanced TeX engine. Indeed, most (if not all) of the development of ConTeXt is now using LuaTeX.
Some executables combine the features of __multiple enhanced TeX engines__: for example, pdftex now (in current distributions) offers both PDFTeX and e-TeX extensions into a single executable This executable may be offered with a LaTeX format (as latex or pdflatex) or with a Plain TeX format (as pdftex). (Tex remains with an unadorned TeX executable using Plain TeX, for people such as Knuth himself, who want the certainty of the “original”.)
===== TeX distributions =====
A TeX distribution provides a structured collection of TeX-related software. Generally, a TeX distribution includes a set of “core” TeX executables such as tex and latex; various fonts optimized for use with TeX; helper programs such as the BibTeX bibliographic-database formatter, editors, integrated development environments, file-format-conversion programs; numerous LaTeX packages; configuration tools; and any other goodies the distributor chooses to include.
Commonly encountered TeX distributions include **TeX Live, MiKTeX and MacTeX**; older ones include ozTeX, CMacTeX and teTeX.
Some TeX distributions target a specific operating system and/or processor architecture; others run on multiple platforms. Many TeX distributions are free; a few require payment. See (La)TeX for different machines for a list of free and shareware TeX distributions and Commercial TeX implementations for a list of commercial TeX distributions.
===== Summary =====
What does it all mean? — the simple lists of objects, alone, offer no help for the beginner. The FAQ team expects this answer only to be of use for people who are seeking guidance elsewhere (possibly within these FAQs) and coming across an unexpected name like “blahTeX”.
The subject matter covered by this answer is also addressed in a page on the TUG site, “the Levels of TeX”.
This answer last edited: 2011-06-01

View File

@@ -0,0 +1,17 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:19:55+08:00
====== What is PDFTeXengine,Tex系统底层功能提供者 ======
Created Wednesday 07 September 2011
One can reasonably say that PDFTeX is (today) the__ main stream__ of TeX distributions: most LaTeX and many ConTeXt(Latex和context只是__宏包__它提供了方便的高级抽象) users nowadays use PDFTeX whether they know it or not (more precisely, they use PDFTeX extended by e-TeX). So what is PDFTeX?
__e-Tex__ 是对PDFTeX引擎的扩展引擎。
PDFTeX is a development of TeX that is capable of generating typeset PDF output in place of DVI. PDFTeX has other capabilities, most notably in the area of** fine typographic detail** (for example, its support for optimising __line breaks__), but its greatest impact to date has been in the area of PDF output.
PDFTeX started as a topic for Hàn The Thànhs Masters thesis, and seems first to have been published in TUGboat 18(4), in 1997 (though it was certainly discussed at the TUG96 conference in Russia).
While the world was making good use of “pre-releases” of PDFTeX, Thành used it as a test-bed for the micro-typography which was the prime subject of his Ph.D. research. Since Thành was finally awarded his Ph.D., day-to-day maintenance and development of PDFTeX 1.0 (and later) has been in the hands of a group of PDFTeX maintainers (which includes Thành); the group has managed to maintain a stable platform for general use.
Development of PDFTeX has mostly __stopped __(only bug fixes, and occasional small development items are processed): future development is focused on LuaTeX.

View File

@@ -0,0 +1,25 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:27:37+08:00
====== PDFTeX and LuaTeX ======
Created Wednesday 07 September 2011
As is said elsewhere in these FAQs, development of __PDFTeX is “in essence” complete__ — no new facilities are being developed at the time of writing. The PDFTeX team has announced that they have __frozen__ PDFTeXs specification in its current state (version 1.40.11), and that nothing but bug corrections will be provided up to the time of the final release, PDFTeX 1.50.0. (The interpretation of the statement seems to allow sensible changes that are beyond any reasonable definition of bug\dots)
In parallel with the running-down of PDFTeX development, development of a new system,__ LuaTeX__ is under way. Lua is a script language, designed to offer an interpreter that may be incorporated into other applications. LuaTeX consists of a TeX-like __engine__ with a lua interpreter embedded in it; the lua interpreter has access to many of the data structures used for typesetting, and the user may also interpolate chunks of lua code into their (La)TeX macros, or as call-backs for use when the TeX-like engine does certain operations.
This arrangement offers the prospect of __a “semi-soft” typesetting engine__: it will have its basic behaviour, but the user gets to redefine functionality if an idea occurs — there will be no need to persuade the world first, and then find a willing developer to work on the sources of of the distribution.
The LuaTeX project is (with monetary support from various sources) pursuing avenues that many of the other current projects have in their sights, notably **Unicode** character representations and support for** OpenType** fonts. The intention is to integrate the extensions pioneered by Aleph.
The current released version (Beta 0.70.1, in June 2011) of LuaTeX is supposed at least to demonstrate the final functionality. This stability was declared with version 0.50.0, released near the end of December 2009. Much work remains to be done, and this remains a beta-release. TeX Live 2010 incorporates (at the time of writing) LuaTeX version 0.60.2, and current MiKTeX (version 2.9) offers version 0.70.0.
__ConTeXt Mark 4 can already make use of LuaTeX;__ much of its code already appears in two forms — a TeX-based version (.mkii) and a .mkiv version, which uses LuaTeX extensions (including lua scripting). LaTeX packages that support its use are appearing (some of them providing re-implementations of existing ConTeXt code).
LuaTeX snapshot
systems/luatex (or browse the directory); catalogue entry
PDFTeX distribution
systems/pdftex (or browse the directory); catalogue entry
This answer last edited: 2011-07-10

View File

@@ -0,0 +1,11 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:24:11+08:00
====== The XeTeX project ======
Created Wednesday 07 September 2011
===== XeTeX引擎 =====
, by Jonathan Kew, is a successor to the shareware TeX/GX program for Macintoshes. It is a__ Unicode-based__ TeX implementation which is able to make direct use of the __fonts installed on a system__. It supports the advanced **typographical features** available in modern font technology (OpenType, AAT on Mac OS X, Graphite). XeTeX was originally developed for Mac OS X but it is now fully integrated in TeX Live on a wide range of platforms, as well as being available as part of MiKTeX. XeTeX supports Unicode character sets and bidirectional typesetting (via __e-TeX__ primitives). It is popular among linguists and scholars in the humanities, as well as an increasing range of people working in other fields. Support for mathematical Unicode fonts (such as Asana Math and Cambria) is progressing.
The project has an active mailing list; a collection of other information is to be found in a set of links on the TUG web site.

View File

@@ -0,0 +1,24 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:32:49+08:00
====== What is e-TeX ======
Created Wednesday 07 September 2011
While Knuth has declared that __TeX will never change__ in any substantial way, there remain things that one might wish had been done differently, or indeed implemented at all.
The NTS project set out to produce an __advanced replacement for TeX__, to provide a basis for developing such modifications: this “New Typesetting System” would share Knuths aims, but would implement the work in a modern way taking account of the lessons learned with TeX. While a first demonstrator NTS did appear, it wasnt practically useful, and the project seems no longer active.
In parallel with its work on NTS itself, the project developed __a set of extensions__ that can be used with a (“true”) TeX system. Such a modified system is known as an__ e-TeX__ system, and the concept has proved widely successful.
Indeed, current TeX distributions are delivered with __most formats built with an e-TeX-based system__ (for those who dont want them, e-TeXs extensions can be disabled, leaving a functionally standard TeX system).
当前的发行版使用的主要就是e-Tex
The extensions range from the seemingly simple (increasing the number of available registers from 256 to 32768) through to extremely subtle programming support.
ConTeXt has required e-TeX for its operation for some time, though development is now focused on the use of LuaTeX.
Some LaTeX packages already specify the use of **e-TeX**. Some such packages may not work at all on a non-e-TeX system; others will work, but not as well as on an e-TeX system. The LaTeX team has announced that future LaTeX packages (specifically those from the team, as opposed to those individually contributed) may require e-TeX for optimum performance.
e-TeX

View File

@@ -0,0 +1,22 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:08:39+08:00
====== What is TeX(宏包,利用引擎提供高级抽象) ======
Created Wednesday 07 September 2011
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=whatTeX
TeX is a **typesetting system(排版系统)** written by Donald E. Knuth, who says in the Preface to his book on TeX (see books about TeX) that it is “intended for the creation of **beautiful books** — and especially for books that contain a lot of mathematics”. (If TeX were only good for mathematical books, much of its use nowadays would not happen: its actually a pretty good general typesetting system.)
Knuth is Emeritus Professor of the Art of Computer Programming at Stanford University in California, USA. Knuth developed the first version of TeX in 1978 to deal with revisions to his series “the Art of Computer Programming”. The idea proved popular and Knuth produced a second version (in 1982) which is the basis of what we use today.
Knuth developed a system of __literate programming __to write TeX, and he provides the literate (WEB) source of TeX free of charge, together with tools for processing the web source into something that can be compiled and something that can be printed; there is (in principle) never any mystery about what TeX does. Furthermore, the WEB system provides mechanisms to port TeX to new operating systems and computers; and in order that one may have some confidence in the ports, Knuth supplied a test by means of which one may judge the fidelity of a TeX system. TeX and its documents are therefore highly portable.
For the interested programmer, the distribution of TeX has some fascination: its nothing like the way one would construct such a program nowadays, yet it has lasted better than most, and has been ported to many different computer architectures and operating systems — the sorts of attributes that much modern programming practice aims for. The processed readable source of TeX the program may be found in the TDS structured version of the distribution.
Knuths source distribution
systems/knuth/dist (or browse the directory); catalogue entry
Knuths sources in TDS layout
macros/latex/contrib/latex-tds/knuth.tds.zip
This answer last edited: 2011-06-01

View File

@@ -0,0 +1,17 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:11:09+08:00
====== What is ConTeXt ======
Created Wednesday 07 September 2011
===== ConTeXt =====
is a **macro package(注意,不是引擎)** developed by Hans Hagen of Pragma-Ade; it started as a production tool for //Pragma// (which is a publishing company). ConTeXt is a document-production system based, like LaTeX, on the TeX typesetting system. Whereas LaTeX insulates the writer from **typographical details**, ConTeXt takes a complementary approach by providing structured interfaces for handling __typography__, including extensive support for** colors, backgrounds, hyperlinks, presentations, figure-text integration, and conditional compilation**. It gives the user extensive control over formatting while making it easy to create new layouts and styles without learning the TeX macro language. ConTeXts **unified design** avoids the package clashes that can happen with LaTeX.
ConTeXt also integrates **MetaFun**, a superset of MetaPost and a powerful system for **vector graphics**. MetaFun can be used as a stand-alone system to produce figures, but its strength lies in enhancing ConTeXt documents with accurate graphic elements.
ConTeXt allows the users to specify **formatting commands** in English, Dutch, German, French, or Italian, and to use different **typesetting engines** (PDFTeX, XeTeX, Aleph and LuaTeX) without changing the user interface. ConTeXt continues to develop, often in response to requests from the user community.
ConTeXt has been bound to the development of** LuaTeX(引擎)**, almost from the start of that project. Nowadays, it is distributed in two versions — mark two (files with extension .mkii (which runs on PDFTeX but is not under active development) and mark four files with extension .mkiv (which runs on LuaTeX and is where development happens).
ConTeXt has a large developer community (though possibly not as large as that of latex), but those developers who are active seem to have prodigious energy. Support is available via a WIKI site and via the mailing list.

View File

@@ -0,0 +1,12 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:38:04+08:00
====== What is LaTeX2e ======
Created Wednesday 07 September 2011
Lamports last version of LaTeX (LaTeX 2.09, last updated in 1992) was superseded in 1994 by a new version (LaTeX2e) provided by the LaTeX team. LaTeX2e is now the only readily-available version of LaTeX, and draws together several threads of LaTeX development from the later days of LaTeX 2.09. The “e” of the name is (in the official logo) a single-stroke epsilon (ε, supposedly indicative of no more than a small change).
LaTeX2e has several enhancements over LaTeX 2.09, but they were all rather minor, with a view to continuity and stability rather than the “big push” that some had expected from the team. LaTeX2e continues to this day to offer a compatibility mode in which most files prepared for use with LaTeX 2.09 will run (albeit with somewhat reduced performance, and subject to voluminous complaints in the log file). Differences between LaTeX2e and LaTeX 2.09 are outlined in a series of guide files that are available in every LaTeX distribution (the same directory also contains “news” about each new release of LaTeX2e).
Note that, now, LaTeX2e is “__feature frozen__” (the only allowed changes come from bug reports); this, too, is in pursuit of stability, and is a driving force for many of the efforts to contribute LaTeX packages.

View File

@@ -0,0 +1,15 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T21:15:05+08:00
====== What is Texinfo ======
Created Wednesday 07 September 2011
===== Texinfo =====
is a documentation system that uses** one source file to produce both on-line information and printed output.** So instead of writing two different documents, one for the on-line help and the other for a typeset manual, you need write __only one__ document source file. When the work is revised, you need only revise one document. By convention, Texinfo source file names end with a **.texi or .texinfo** extension.
Texinfo is a __macro language__, somewhat similar to LaTeX, but with slightly less expressive power. Its appearance is of course rather similar to any TeX-based macro language, except that its** macros start with @** rather than the \ thats more commonly used in TeX systems.
You can write and format Texinfo files into __Info__ files within GNU emacs, and read them using the emacs Info reader. You can also format Texinfo files into Info files using **makeinfo** and read them using info, so youre not dependent on emacs. The distribution includes a Perl script,** texi2html**, that will convert Texinfo sources into HTML: the language is a far better fit to HTML than is LaTeX, so that the breast-beating agonies of converting LaTeX to HTML are largely avoided.
Finally, of course, you can also print the files, or convert them to PDF using PDFTeX.

63
Zim/LaTex/ctex_宏包.txt Normal file
View File

@@ -0,0 +1,63 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-01T14:06:06+08:00
====== ctex 宏包 ======
Created Sunday 01 January 2012
https://code.google.com/p/ctex-kit/wiki/UnixFonts
===== ctex 宏包为什么(目前)没有为 Linux 系统设置字体选项? =====
ctex 宏包在使用 XeTeX 为引擎编译时,提供了 __winfonts, adobefonts, nofonts __等不同选项在最新的 svn 版本中还给 Mac OS X 用户提供了 macfonts 选项。
来自 Linux 社区的用户曾多次在不同场合要求为其系统增加免费中文字体的配置选项,如 issue 41 , issue 54 都曾要求增加 unixfonts 选项,并给出代码。不过,这样的建议未予采纳,原因如下:
* 类 Unix 平台是一个宽泛的平台__没有统一的中文字体预装方案__。
除 Mac 系统相对统一,类 Unix 平台的用户主要来自各个 Linux 发行版。尽管开源社区主要的免费字体来源单一__文鼎公司__捐助的报宋、楷体__文泉驿项目__的黑体以及类似 Cyberbit.ttf 这样的字体;但是,各个发行版/桌面预装的中文字体版本及字体名则极不统一,难以用一个字体选项表示。
仅以文鼎的宋体(或明体)为例,就有 AR PL SungtiL GB, AR PL New Sung, AR PL ShanHeiSun Uni, AR PLBaosong2GBK Light, AR PL UMing CN, AR PLMingU20 Light 等许多变体。在不同的 Linux 发行版中其配置确有不同,因而配置文件难以统一。
* XeTeX 没有字体检测机制,在配置文件中写入系统中不存在的字体会产生编译错误。
不过尽管存在兼容性问题但多出若干选项通常也是无害的。Mac OS X 有一个__标准的华文字体集__因此可以新建 macfonts 字体选项。如果 Linux 社区在统计现有的多种发行版后,能给出相对一致的预装字体的一个交集,那么也可以据此增加选项。
===== 为什么 winfonts 选项在 Linux 下面编译错误? =====
XeTeX 引擎下winfonts 选项是面向 Windows 用户设计的字体选项。其中经常被类 Uniux 平台用户误认为有错误的是楷体和仿宋体的设置:
\setCJKfamilyfont{zhkai}{[simkai.ttf]}
\setCJKfamilyfont{zhfs}{[simfang.ttf]}
这段代码其实并没有问题。这里没有使用 fontconfig 库读取的**字体族名**而是使用方括号外的__字体文件名__设置字体这是符合 XeTeX 的字体语法的;对较新版本 fontspec 宏包,方括号可以省略,但旧版本仍需要保留。
采用字体文件名的原因是,在 Windows XP 及之前的 Windows 版本中,楷体和仿宋体为 GB_2312 字符集,其字体名分别是 KaiTi_GB2312 与 FangSong_GB2312而在 Windows Vista 及之后的 Windows 版本中楷体和仿宋体则改为__强制标准 GB18030 字符集__其字体名分别是 KaiTi 与 FangSong。这两种版本的字体名称不同为保证不同版本 Windows 用户的**兼容性**,只能采用字体文件名的方式。
这一设置在部分类 Unix 平台下编译会产生找不到字体的错误,即使用户已经在其类 Unix 系统中安装了来自 Windows 的字体。其原因是Windows 不区分文件名的大小写,而其他系统一般是大小写敏感的。在不同 Windows 版本中字体文件名的大小写也各有不同,同时 ctex 宏包的字体文件名大小写也几经修改,难以统一。统一文件名大小写后即可正常编译。
===== 解决方案 =====
* **使用 nofonts 选项设置字体**
示例:
\documentclass[UTF8,__nofonts__]{ctexart}
\setCJKmainfont[ItalicFont={AR PL KaitiM GB}]{AR PL SungtiL GB}% 文鼎宋体和楷书
\setCJKsansfont{WenQuanYi Zen Hei}% 文泉驿的黑体
\begin{document}
文章内容
\end{document}
如果设置的字体较多为方便使用可以把相关代码作为__单独的 .sty 文件__保存。
* **使用来自 Windows 系统的字体,同时统一字体文件名大小写**
* 在类 Unix 系统中安装从 Windows 系统中复制来的字体时请注意将所有字体都设置为相同的大小写这里__建议为小写__。
* __ctex-xecjk-winfonts.def__ 文件中,确保楷体与仿宋体的大小写与**系统安装**的相同也可以根据具体版本改为字体族名。这将影响__ xelatex__ 编译 ctex 宏包的效果。
在 ctex 宏包的 * 在 TeX Live 的 texmf-dist/tex/generic/**zhmetrics**/ 目录下的** zhwinfonts.tex** 文件中,确保各个中文字体的大小写与系统一致。这将影响 pdflatex 和 latex+dvipdfmx 编译 ctex 宏包的效果。
* (可选)在 TeX Live 的 texmf-dist/source/fonts/zhmetrics/ 目录下的 ttfonts.map 文件中,确保各个中文字体的大小写与系统一致,然后用它代替或合并于原有生效的 ttfonts.map。这将影响 ttf2pk、dvi2png 等程序的效果。
* **使用 ctex 宏包的配置文件设置默认行为**
CTeXPackage 页面介绍了 ctex 宏包的两个配置文件,可以使用 ctexopts.cfg 修改宏包的默认字体选项为 nofonts然后使用 ctex.cfg 探测宏包选项,在默认选项时引入自定义的字体设置。

View File

@@ -0,0 +1,144 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-01T14:20:30+08:00
====== CTeXPackage ======
Created Sunday 01 January 2012
https://code.google.com/p/ctex-kit/wiki/CTeXPackage
===== 安装或更新 =====
=== 发布版本 ===
一般用户请使用稳定的发布版本。
常见的 TeX 发行版应该已经安装了 ctex 宏包。请检查使用的最新的发行版。如果你在安装发行版时没有选择安装全部的宏包,请使用 MiKTeX Package Manager 或 TeX Live Manager 来安装 CTAN 上面的发布版本。
如果你使用的发行版没有 ctex 宏包,可以在 CTAN 的镜象服务器上找到当前的发行版本(这里使用 CTeX 网站的镜象):
ftp://ftp.ctex.org/CTAN/language/chinese/ctex.zip
但手工安装通常需要检查 ctex 宏包的依赖项,重要的包括 CJK 宏包、CJKpunct 宏包、xeCJK 宏包、zhwinfonts.tex、zhmetrics 字体包等等。
=== 开发版本 ===
可以从本网站的 SVN 仓库中获取开发中的版本。开发版本可能带有一些新的特性,修正了一些新的错误,但也可能带来不稳定的情况。
使用 http://code.google.com/p/ctex-kit/source/checkout 中说明的方式从仓库中获取源代码。
获取源代码后需要按照__ TDS 目录结构__重新组织源代码然后按目录结构复制到发行版中的**本地 TEXMF 目录**。例如,在 TeX Live 系统中,本地的 TEXMF 目录一般是
安装目录/texmf-local/
将 ctex 源码目录下的 doc 和 test 目录内容放在 TDS 的 __TEXMF/doc/latex/ctex/ __目录下将其他目录放在 TDS 结构的 __TEXMF/tex/latex/ctex/__ 目录下;然后运行
texhash
刷新文件名数据库。
===== 一般配置 =====
一般情况下,安装后的 ctex 宏包不需要进一步的配置即可正常使用。
=== 字体依赖 ===
ctex 宏包__默认使用 winfonts 选项__如果不使用其他选项修改字体配置则需要操作系统中安装有中文 Windows 操作系统自带的四种 TrueType 字体:宋体、黑体、仿宋体、楷体。字体文件名为 sinsun.ttc, sinhei.ttf, simfang.ttf, simkai.ttf字体名随不同 Windows 版本可能会有区别。
* 英文 Windows 操作系统中只有宋体和黑体,需要自行安装仿宋和楷体才能使用。
* 非 Windows 操作系统如果需要使用此选项,参看页面 UnixFonts 中的说明。
如果使用 adobefonts 选项(目前仅支持 xelatex则需要操作系统中安装有 Adobe 公司的四款 __OpenType__ 字体Adobe 宋体 StdAdobe 黑体 StdAdobe 仿宋 StdAdobe 楷体 Std。
=== 中文相关配置 ===
尽管 ctex 宏包本身不需要配置,但在特定环境中可能需要对系统字体做简单配置。这里对 Linux 下的 TeX Live 进行简单说明(严格地说这是 TeX Live 的论题)。
TeX Live这里描述 TeX Live 2010安装在 Linux 系统上时,需要设置 TeX Live 的 __texmf.cnf __配置文件中的 OSFONTDIR 变量,才能使相关程序找到系统中的字体,特别是中文字体。用 pdflatex 或 latex + dvipdfmx 编译时需要这一设置以找到操作系统中的中文字体。XeLaTeX 编译__不需要__这种设置。
=== 可能改变兼容性的配置 ===
请有经验的用户仔细浏览过 ctex 宏包的源代码后再考虑下面的内容。
本地修改配置文件可能改变 ctex 宏包的兼容性字体等格式上的改变应该__做成独立的文件__另外使用。因此如果需要安装用于某特定操作系统的字体或是让章节标题的格式变化不应该使用 ctex 宏包的配置文件达到此目的。例如,可以编写 myfontset.sty 文件设置用户 Linux 的字体:
% myfontset.sty
\ProvidesPackage{myfontset}[2011/01/01 ver 1.0 My local font settings of ctex]
\setCJKmainfont[ItalicFont={AR PL KaitiM GB}]{AR PL SungtiL GB}% 文鼎宋体和楷书
\setCJKsansfont{WenQuanYi Zen Hei}% 文泉驿的黑体
\setCJKmonofont{WenQuanYi Zen Hei}
\endinput
然后在文档中设置 ctex 宏包的** nofonts **选项,以 \usepackage{myfontset} 使用此配置。
ctex 宏包提供了两个额外的配置文件:
__ctex.cfg __中的代码将在 ctex 宏包末尾执行。可以使用此配置文件增加任意自定义配置,但建议只使用它解决错误。例如某些版本的 ctex 宏包中因 xunicode 造成的符号冲突问题。
__ ctexopts.cfg__ 中的代码将在 ctex 宏包的开头(选项定义后面)执行。请只使用此配置文件改变 ctex 宏包的缺省选项。例如,可以使用:
\ExecuteOptions{adobefonts}
\ExecuteOptions{fntef}
将 XeTeX 下默认的字体选项更改为 Adobe 的字体配置,并调用 CJKfntef 宏包。
===== 使用 =====
关于 ctex 宏包的详细使用说明请参考宏包所附的 PDF 文档。这里只对个别兼容性问题做一说明。
=== 源文件编码 ===
* 使用 CCT 方式处理汉字支持 GBK 文件编码。
* 使用 CJK 方式处理汉字latex 或 pdflatex 编译自动选择),支持 GBK 和 UTF-8 两种文件编码。缺省的编码是 GBK。可以使用宏包选项 GBK 和 UTF8 进行选择;也可以使用 ctexutf8 等宏包名。
* 使用 xeCJK 方式处理汉字xelatex 编译__自动选择__可以使用 GBK 和 UTF-8 两种文件编码,但只有 UTF-8 编码是原生支持的。如果需要使用 GBK 编码,需要在源文档前面增加 XeTeX 原语:
\XeTeXinputencoding "GBK"
===== 基本测试文件 =====
XeTeX (xeCJK) 模式: (__推荐__使用的模式)
% 使用 UTF-8 编码
\documentclass{ctexart}
\begin{document}
你好 CTeX 文档类
\end{document}
用 xelatex 编译时会__自动使用__ XeTeX 相关配置。
传统 CJK 模式:
% 默认使用 GBK 编码,如需要 UTF-8 编码需加 UTF8 选项
\documentclass{ctexart}
\begin{document}
你好~CTeX~文档类
\end{document}
传统 CCT 模式: (不建议使用,仅为个别历史文档保留)
\documentclass[cct]{ctexart}
\begin{document}
你好 CTeX 文档类
\end{document}
===== 复杂的测试 =====
测试使用 XeTeX (xeCJK) 版本:
cd ~/texmf/tex/latex/ctex/test
xelatex test-xetex.tex
检查输出信息是否有异常,生成的 test-xetex.pdf 内容是否正确。
测试使用 CJK 版本:
cd ~/texmf/tex/latex/ctex/test
pdflatex test-cjk.tex
检查输出信息是否有异常,生成的 test-cjk.pdf 内容是否正确。
great work!
Comment by song.opp...@gmail.com, Jan 17, 2010
xetex下使用xecjk修改字体配置应该在~/texmf/__tex/latex/ctex/fontset/xecjk-adobefonts.def__ 和xecjk-winfonts.def中修改吧是不是需要更新一下当前的文档了
Comment by project member LeoLiu....@gmail.com, Jan 13, 2011
最好不要修改字体配置文件,这会造成不兼容。个人的字体配置在单独的包中写就行了。
Comment by xiaohany...@gmail.com, May 29, 2011

View File

@@ -0,0 +1,218 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-01T14:35:52+08:00
====== SimpleChineseTemplates ======
Created Sunday 01 January 2012
SimpleChineseTemplates
各种工具链下最简单的中文文档模板
目的
LaTeX
xelatex (推荐)
latex + dvipdfmx
pdflatex
latex + dvips + ps2pdf (过时,不推荐,仅供参考)
ConTeXt
MkIV (推荐)
MkII
v0.3, 2010-03-06
===== 目的 =====
希望 google code 上的 ctex-kit 和 ctex-doc 成为 TeX 中文支持信息的权威集中点,为中文用户使用 TeX 排版中文文档提供__最基本的模板__解决如下问题
* 可以生成中文显示正常的 PDF 文件;
* 复制 PDF 中的中文文字不会乱码;
* PDF 中的中文书签不乱码;
* PDF 可以搜索中文。
**更细致**的符合中文排版习惯的模板不在此页面考虑范围之内,请参考 cjk、xecjk、ctex 宏包的文档以及 Li Yanrui 的 ConTeXt 笔记。
使用的 TeX 发行版为 T__eX Live__ 和 ConTeXt Minimals因为这俩能在多个 OS 上使用,使用人数众多。
页面中的模板来自各种角落的收集:
* http://tex.board.newsmth.net/
* http://www.ctex.org
* CTeXLive ISO 镜像文件中的例子
* CJK、xeCJK、ctex 宏包的例子
* Li Yanrui 的 ConTeXt 笔记等等。
====== LaTeX ======
文档参考:
* lshort - http://ctex-doc.googlecode.com/svn/trunk/lshort-zh-cn/
* lnotes - http://ctex-doc.googlecode.com/svn/trunk/latex-notes-zh-cn/
* ctex-faq - http://ctex-doc.googlecode.com/svn/trunk/ctex-faq/
* texlive-zh-cn - http://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf
* xetex-about-fonts - http://bbs.ctex.org/viewthread.php?tid=43244
* milksea-readme - http://www.newsmth.net/bbscon.php?bid=460&id=282515
* tl2007-cjk-howto(old??) - http://mailboxpublic.googlepages.com/texlive2007cjkchinesehowto
由于 __xelatex 使用的是近来开发的 XeTeX 引擎__能容易的使用字体所以推荐使用。下面__后三种__工具链使用的都是 __pdftex 引擎加 CJK 宏包__它们间的区别只是得到 PDF 文件的方式不一样,各有一些细微的优缺点,参考 ctex-faq 第 32 个问题“在 CJK 中都可以使用哪些矢量字库?”。
模板文件http://ctex-kit.googlecode.com/svn/trunk/templates/LaTeX ,在 Linux 下可以用 make TOOLCHAINS=xxx gbk utf8 来编译 gbk.tex 和 utf8.texTOOLCHAINS 可以是 __xelatex、pdflatex、dvipdfmx、dvips__ 的一种或者组合(**前两种是直接从源文件生成pdf文档而后两者是先生成dvi文件然后再转换为pdf文档**。),以逗号或者空格分隔。当使用**后三者**并且使用 winfonts 时,需要把 C:\WINDOWS\Fonts\ 目录下的 sim*.ttf、sim*.ttc 复制到TEXMFHOME/fonts/truetype/sim/ 目录下没有此目录则新建之TEXMFHOME 指 kpsexpand '$TEXMFHOME' 命令的输出。
测试环境如下,更详细的软件包信息见模板文件末尾的注释:
* Debian GNU/Linux Squeeze
* TeXLive 20090910
* ctex r167 at http://ctex-kit.googlecode.com (ctex r189 对 hyperref 支持做了修改,可以使用 ctex 宏包的 hyperref 选项,不再需要模板中繁琐的 hyperref 设置)
* zhwinfonts r167 at http://ctex-kit.googlecode.com
* xecjk r167 at http://ctex-kit.googlecode.com
* evince 2.26.2-2
* libpoppler4 0.10.6-1
* poppler-data 0.2.1-5
==== xelatex (推荐的工具链) ====
编译方式:
xelatex a.tex
xelatex a.tex # 使用交叉引用信息,书签需要这个
编译结果:
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
gbk.tex adobefonts Adobe 22118 极好 正常 正常 正常 正常 正常 正常
gbk.tex winfonts 中易 20903 极好 正常 正常 正常 正常 正常 正常
utf8.tex adobefonts Adobe 22120 极好 正常 正常 正常 正常 正常 正常
utf8.tex winfonts 中易 20904 极好 正常 正常 正常 正常 正常 正常
此方式编译时 ctex __基于 xecjk 宏包__cjkfonts 等价于 adobefonts。
==== latex + dvipdfmx ====
如果没有 GBK-EUC-UCS2 文件,则需要 gbk2uni参见下一节 pdflatex。 Debian 上 cmap-adobe-gb1 和 poppler-data 中都有 GBK-EUC-UCS2也可以从 Adobe Reader 简体中文版中获取,复制到 TEXMFHOME/fonts/cmap/dvipdfmx/ 目录下。
编译方式:
latex a.tex
latex a.tex # 使用交叉引用信息,书签需要这个
gbk2uni a.out # 如果是 GBK 编码,并且没有 GBK-EUC-UCS2 文件
latex a.tex # 如果是 GBK 编码,并且没有 GBK-EUC-UCS2 文件。使用正确编码的交叉引用信息。
__dvipdfmx__ a.dvi
编译结果:
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
gbk.tex cjkfonts 文鼎 失败
gbk.tex winfonts 中易 17051 很好 正常 正常 正常 正常 正常 正常
utf8.tex cjkfonts 文鼎 27615 很好 正常 正常 正常 正常 正常 正常
utf8.tex winfonts 中易 17049 很好 正常 正常 正常 正常 正常 正常
此方式编译时** ctex 基于 cjk 宏包**adobefonts 等价于 winfonts。
==== pdflatex ====
需要 gbk2uni : ftp://ftp.cc.ac.cn/pub/cct/src/ ,下载 cct 源码包,取出其中的 gbk2uni.h 和 gbk2uni.c编译
gcc -o gbk2uni gbk2uni.c
mv gbk2uni `kpsexpand '$TEXMFMAIN'`/../bin/i386-linux/
为了使 GBK 编码的文件被 pdflatex 编译后可以搜索中文,需要取出 cct 源码中 ccmap 目录,复制到 TEXMFHOME/tex/latex/ccmap/ 目录,然后执行:
mkdir t.$$ && cd t.$$ && latex "\def\cmapEnc{GBK} \input{makecmap.tex}"
todir=`kpsexpand '$TEXMFMAIN'`/tex/latex/ccmap
mkdir -p $todir
mv *.cmap $todir
cd - && rm -rf t.$$
编译方式:
pdflatex a.tex
pdflatex a.tex # 使用交叉引用信息,书签需要这个
gbk2uni a.out # 如果是 GBK 编码
pdflatex a.tex # 如果是 GBK 编码。使用正确编码的交叉引用信息。
!!! 注pdftex <= 1.40.9 对 simsun.ttc 支持有问题,导致 winfonts 下没能嵌入 truetype 字体使得显示效果一般TeXLive 2009 最新版已经包含 pdftex 1.40.10 (2009-11-30 发布),支持 .ttc 字体文件,因此显示效果很好。
编译结果:
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
gbk.tex cjkfonts 文鼎 失败
gbk.tex winfonts 中易 102851 很好 正常 正常 乱码 正常 正常 正常
utf8.tex cjkfonts 文鼎 873447 一般 正常 正常 乱码 正常 正常 正常
utf8.tex winfonts 中易 73237 很好 正常 正常 乱码 正常 正常 正常
此方式编译时 ctex 基于 cjk 宏包adobefonts 等价于 winfonts。
==== latex + dvips + ps2pdf (过时,不推荐,仅供参考) ====
ps2pdf 需要安装 ghostscript另外 Debian 上 texlive-extra-utils 包有 epstopdf context 包有 pstopdf但这两个程序在 TeXLive 2009 都没有。
dvips 方式不能嵌入 truetype 字体,生成的 pdf 里中文不能搜索,因此建议不要使用。
为了使书签不乱码,需要把模板中 hyperref 的 dvipdfmx 选项改成 ps2pdf并使用 gbk2uni见下面小节 pdflatex。
编译方式:
latex a.tex
latex a.tex # 使用交叉引用信息,书签需要这个
gbk2uni a.out # 如果是 GBK 编码
latex a.tex # 如果是 GBK 编码,使用正确编码的交叉引用信息
dvips a.dvi
ps2pdf a.ps
编译结果:
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
gbk.tex cjkfonts 文鼎 失败
gbk.tex winfonts 中易 36979 一般 正常 丢失 乱码 乱码 正常 不支持
utf8.tex cjkfonts 文鼎 42573 一般 正常 正常 乱码 乱码 正常 不支持
utf8.tex winfonts 中易 36800 一般 正常 丢失 乱码 乱码 正常 不支持
此方式编译时 ctex 基于 cjk 宏包adobefonts 等价于 winfonts。
后注snoopyzhao@newsmth 指出 dvips 方式制作出的中文 PDF 也是可以正常搜索复制的,我实验了下,发现使用 Type 1 字体就可以TeXLive 2009 默认只配备了文鼎几款覆盖 GB2312 字符集的 Type 1 中文字体,上面表格的结果是从 truetype 自动生成的 Type 3 字体,而如果用 Type 1 字体GB 编码下字体信息、选择、复制、搜索都正常,显示效果也很好,例子如下,编译方式同上。
\documentclass{article}
\usepackage{CJK} % 如果文档内容用 UTF-8 编码,把 CJK 换成 CJKutf8
\usepackage[CJKbookmarks,ps2pdf]{hyperref} % 如果文档内容用 UTF-8 编码,把 CJKbookmarks 改成 unicode
\begin{document}
\begin{CJK*}{GB}{gbsn} % 如果文档内容用 UTF-8 编码,把 GB 改成 UTF8
\title{latex + dvips + ps2pdf 编译方式的中文支持}
\author{作者}
\maketitle
\tableofcontents
\section{第一段}
我来试试复制与搜索……
\section{第二段}
我来试试复制与搜索……
\section{第三段}
我来试试复制与搜索……
% See http://lists.ffii.org/pipermail/cjk/2008-April/002218.html
% "CJKutf8 results in error in TOC": This is documented in CJK.txt, section 'Possible errors'
%\clearpage % UTF-8 编码时打开, 否则第二遍 latex 时报告章节标题错误,感谢 snoopyzhao@newsmth 指出
\end{CJK*}
\end{document}
====== ConTeXt ======
文档参考:
ctx-notes - http://ctex-doc.googlecode.com/svn/trunk/context-notes-zh-cn/
way2ctx - http://code.google.com/p/way2ctx/downloads/list
ctx-top10 - http://ctex-doc.googlecode.com/svn/trunk/context-top-ten/
ctx-tutor - http://meeting.contextgarden.net/2008/talks/2008-08-21-willi-aditya-beginners/
特别注意: ctex 论坛有人说 2008 年以前的 ConTeXt 文档大多不适用于 ConTeXt MkIV阅读时需要小心。
由于 ConTeXt MkIV 使用近来开发的 LuaTeX 引擎,能容易的使用字体,所以推荐使用。 ConTeXt MkII 使用 pdftex 引擎排版。
==== MkIV (推荐) ====
所有模板都是 UTF-8 编码,参照 way2ctx 安装好 ConTeXt Minimals 后,找到 Adobe 的四款字体(AdobeFangsongStd-Regular.otf AdobeHeitiStd-Regular.otf AdobeKaitiStd-Regular.otf AdobeSongStd-Light.otf) 放到某个目录下并设置 好 OSFONTDIR编译方法见 way2ctx 文档。
所有模板都在 ConTeXt Minimals 2009-09-02 Linux 版编译通过。
使用 Li Yanrui 的 zhfonts.tex - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/zhfonts/
使用 Li Yanrui 的新 zhfonts.tex - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/zhfonts-new/
使用 Li Yanrui 的 t-zhfonts - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/t-zhfonts/
使用 t-simplefonts - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/t-simplefonts/
!!! Sorry, I'm stupid, I have no idea which one is better...

View File

@@ -0,0 +1,16 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-26T20:07:19+08:00
====== latex中的盒子 ======
http://blog.sina.com.cn/s/blog_5e16f1770100gwkw.htmltop
Created Monday 26 September 2011
任何 LATEX 对象(字符,图形等)都把盒子作为单位, 每个盒子在它的左侧均有一参考点 Reference point。盒子的基线baseline见图 )是通过参考点的一条水平线。当 LATEX 排列文本时这些字符的参考点被从左到右的排成一条直线称为当前基线current baseline并使它与字符的基线对齐。 LATEX 也用同样的方法来处理图形和其它对象,每个对象的参考点都被放置于当前基线上。
{{./1.gif}}
每个 LATEX 盒子的大小由高度、深度、宽度( height,depth,width来决定。高度是参考点到盒子顶部的距离深度是参考点到盒子底部的距离宽度则是盒子的宽度。全部高度totalheight被定义为从盒子底部到顶部的距离
全部高度=高度+深度
所有未曾旋转的 EPS 图形的参考点都是它的左下角(见下图的左边的盒子),它的深度为零,高度就等于全部高度。图中间的盒子则是将图形旋转后,它的高度就不等于全部高度了。右边的盒子则展示可将图形旋转使其高度为零。
{{./2.gif}}
地址http://www.ctex.org/documents/latex/graphics/node6.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -0,0 +1,30 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-07T20:35:20+08:00
====== tex系统概述 ======
Created Wednesday 07 September 2011
http://bbs.ctex.org/viewthread.php?tid=49647
语言层面:
TeX 是一种宏语言。就像别的语言有库一样TeX 语言有宏的集合。这些宏就是用这个语言写出来的东西供大家共用的。TeX 有个最基本的宏集合,与基础语言一起构成一种“格式”,就是 Plain TeX。基本的 TeX 语言和 Plain TeX 的宏,都是 Knuth 完成的。
后来有了 LaTeX就是 Lamport TeX。LaTeX 也是宏的集合,也构成一种与 Plain TeX 不一样的格式。这种格式提供了不少方便的功能,并强调结构化的文档,因而很快风行起来。
世界在发展LaTeX 这个格式提供的基本功能并不能满足所有人的需要,就有人接着写宏。这些宏可能就是在 LaTeX 这个格式的框架下面编写的,也就是说是依赖于 LaTeX 宏的宏。一些有能力有精力的人把他觉得有用的宏打成包,公开发布,就成为了 LaTeX 的宏包。换言之,宏包就是基本的格式的扩展。当然它是人人可写的,特别有名的,比如美国数学会官方定制的 AMSTeX/AMSLaTeX就是一套 TeX/LaTeX 格式下面的宏包。
再来说软件层面:
一个语言是抽象的,不能运行就没有结果。因此 Knuth 在设计这个语言的同时也给出了一个程序用来把 TeX 语言的代码转换为排版的结果——这个程序当然也叫 TeX。嗯可以把这个程序看做编译器。直接运行 tex 命令(我用小写字母表示你实际使用的命令),默认就是用 Plain TeX 这种格式进行排版。为示区别,我们可以把 Knuth 的这个 TeX 程序叫 Knuth TeX。
用 tex 加上一个选择格式的命令行编译选项,就可以改用 LaTeX 这种格式进行排版了。但这很麻烦,于是就把 tex 命令与对应编译选项合成为一个命令,叫 latex。简言之latex 命令就是 tex 命令加一个选项的简写方式。
Knuth TeX 这个程序有一些功能不好实现,后面就有人进行扩展,得到 ε-TeX 这个程序,一般写成 eTeX。eTeX 程序和 Knuth TeX 都是 TeX 语言的一个实现eTeX 增加了少量的几个命令,但一般来说是没有太多区别的。
Knuth TeX 输出的格式是 DVIDeVice Independent文件但后来电子出版业和电子文档交换中常用的格式是 Adobe 公司开发的 PostScript 格式PS和 Portable Document Format 格式PDF。因此就需要有一些工具完成这样的转换一些转换程序应运而生Dvips把 DVI 转换为 PSDVIPDF、DVIPDFM、DVIPDFMx把 DVI 转换为 PDF可以认为后面的是前面的改进版
转换的过程令人不爽,于是就又有了 TeX 语言的又一个实现pdfTeX。它会把 TeX 语言写的代码直接编译成 PDF 文件。当然,不难理解 pdftex 命令就是用 pdfTeX 这个程序和 Plain TeX 这个格式进行排版,而 pdflatex 这个命令就是用 pdfTeX 这个程序和 LaTeX 格式进行排版。不过 pdfTeX 程序也保留了输出 DVI 格式的能力。
时代在发展,多字节的编码渐渐代替 ASCII 成为主流。为了支持 Unicode 编码和直接访问操作系统字体,又出现了 TeX 语言的新的实现,即 XeTeX。作为一个现代的程序XeTeX 也直接输出 PDF 文件(我们暂不去管它内部有格式转换的实现方式)。于是,不难理解 xetex 命令就是使用 XeTeX 程序以 Plain TeX 格式排版,而 xelatex 命令就是用 XeTeX 程序以 LaTeX 格式排版。
哦,人们的要求总是在发展,现在又想在 TeX 中嵌入其他语言进行更强有力的扩展了。于是 Lua 脚本语言和 TeX 语言的结合体LuaTeX 应运而生。LuaTeX 程序也是 TeX 语言的一个完整的有扩展的实现。LuaTeX 支持 Unicode、系统字体和内嵌语言扩展能直接输出 PDF 格式文件,也可以仍然输出 DVI 格式。于是 LuaTeX 程序又对应了许多命令luatex 使用 Plain TeX 格式,输出 DVIlualatex 使用 LaTeX 格式,输出 DVIpdfluatex 使用 Plain TeX 格式,输出 PDFpdflualatex 使用 LaTeX 格式,输出 PDF。
瞧,语言的脉络是简单的,但软件程序总是层出不穷。
故事还没有完,前面我遗漏了一个重要的格式,叫做 ConTeXt。这个格式从一开始就很强调与脚本语言也就是具体实现程序的结合。过去旧版本的 ConTeXt 是使用 pdfTeX 程序作为它的排版引擎的,用来扩展的脚本语言是 ruby编译文件使用的命令一般是 texexec新版本的 ConTeXt 则使用 LuaTeX 作为它的排版引擎,脚本也都直接使用 Lua编译时使用的命令是 context。那么不难猜所谓“XeConTeXt”是什么东西它事实上是 ConTeXt 改用 XeTeX 程序作为它的排版引擎的一种编译方式,实际的命令则是 texexec 或 context 加上适当的命令行选项。
最后说一下 BibTeX 和 MakeIndex。这两个都是与 TeX 相关联的工具程序,一般用在 LaTeX 格式上。BibTeX 处理 .tex 文件,根据其中的引用,从文献数据库中提取生成参考文献列表;而 MakeIndex 处理 LaTeX 格式编译时输出的 .idx 文件(里面是索引条目),生成 .ind 文件(里面是排序整理好的索引条目)。

View File

@@ -0,0 +1,95 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-10T23:44:02+08:00
====== 一些常见的字体示例 ======
Created Saturday 10 September 2011
http://www.hopestudio.cn/Item/52938.aspx
作者:周梦蕾 
做设计的时候,我们除了要和颜色、图片等要素打交道之外,文字也是另一个不可或缺的元素。要想将文字运用得当、使之最大限度地发挥出它的效果,就有必要掌握一些字体知识,就让我们从认识一些常规字体开始吧,这一篇先介绍一些常见中文字体,在下一篇会有一些英文字体的介绍。
(注:所有截图中字的字号均统一为初号)
xp 下主要字体为宋体simsun.ttc、黑体simhei.ttc、仿宋simfang.ttf、楷体simkai.ttf、隶书simli.ttf、幼圆simyou.ttf,另外推荐大家安装微软雅黑字体以便用来美化fedora 的显示图1 就是使用雅黑字体的效果,挺养眼的。
字体是不分什么Windows、Linux的只有是否有字体的授权以及字体的授权是否许可的问题我在Linux上主要用文泉驿不过也用一些方正的字体因为以前买过iwps里面含有88套方正字体所以也是合法使用。
===== 宋体 =====
想必大家对它都不陌生了在Vista发布之前它一直都是Windows简体中文版的系统默认字体也常用于书籍、杂志、报纸印刷的正文排版。宋体的笔画__有粗细变化__而且一般是横细竖粗__末端有装饰部分__即“字脚”或称“衬线”点、撇、捺、钩等笔画有尖端。
{{./宋体.jpg}}
===== 仿宋 =====
人们模仿宋体字的结构、笔意改成笔画__粗细一致__、秀丽狭长的印刷字体这就是仿宋体。
{{./仿宋.jpg}}
===== 微软雅黑 =====
虽然宋体长期以来一直作为Windows的默认字体但对于电脑显示器来说应该选择无衬线字体作为__显示器字体__才有助于显示和阅读因为笔划上过多的点缀笔划末端的小三角很容易造成视觉疲劳当显示在屏幕上时尤甚。微软已经随着Windows Vista的推出而改用“微软雅黑”作为系统的默认字体。这款字体是一种全新的无衬线黑体它的字形略呈扁方而饱满笔画简洁而舒展易于阅读清新优美。雅黑还有一个与众不同的特点它的粗体字不像大多数字体那样通过内嵌点阵或者字体引擎渲染而是重新进行设计几乎相当于另外设计一套字体。当然收到的效果也相当不错。想更详细地了解雅黑请点击这里查阅工作室网站里的相关文章。
{{./微软雅黑.jpg}}
===== 黑体 =====
黑体同样也是没有衬线装饰的字体字形端庄笔画横平竖直笔迹全部__一样粗细__。由于汉字笔划多**小字黑体清晰度较差**,所以一开始主要用于文章标题,但随着制字技术的精进,已有许多适用于正文的黑体字型。
{{./黑体.jpg}}
(注:粗体在不正式的的场合里常常也被叫做“黑体”,造成了中文指称的混乱。这里所介绍的黑体只是一种字体而不是一类字体的统称。)
===== 幼圆 =====
:幼圆是圆体的变体。由于圆体是黑体的变体,所以幼圆体也源自黑体。幼圆体的主要特点有三:一是笔划更加细长,便于阅读;二是拐弯处笔划处理尤为细腻;三是在旧版本的幼圆体中,对旧字形的处理比较到位。
{{./幼圆.jpg}}
===== 隶书 =====
亦称汉隶是汉字中常见的一种__庄重的字体__书写效果略微宽扁横画长而直画短呈长方形状讲究“蚕头雁尾”、“一波三折”。隶书以后的汉字为“今汉字”今汉字的特点为符号性强定型性强字由有限种类的笔画构成。正是由于有了今汉字的这些特点隶书仍大量地用在包装设计的文字应用中。
{{./隶书.jpg}}
===== 楷体 =====
:较为正式严谨。
{{./楷体.jpg}}
====== 常见的英文字体。 ======
  
===== Helvetica =====
Helvetica在拉丁文中意为“瑞士的”是一种非常经典的英文字体甚至还有一部为纪念它诞生50周年而产生的纪录片关于此纪录片请点击这里。Helvetica被大量使用在标志、电视、新闻标题以及无数的商标上如BASF、美国航空、BMW、Epson、英特尔、无印良品、雀巢、松下、Microsoft、三菱电机、摩托罗拉、渣打银行等数百间大企业的标志都使用了Helvetica字体。另外Helvetica也是Mac OS系统的默认字体。Helvetica出自瑞士字体设计师Eduard Hoffmannh和Max Miedinger之手体现了瑞士设计的理性主义精神同时被认为是现代主义设计理念的典范。
{{./Helvetica.jpg}}
===== Arial =====
Arial字体是由美国著名字体公司Monotype于1982年发表的一款无衬线字体据称Monotype设计这套字体是要以其作为一个较便宜的替代品与Helvetica竞争。它已经是全世界使用范围最广的一款字体之一了。它已经可以和鼎鼎大名的Times相媲美不仅在传统媒体即使在新媒体的WEB网页中也同样具有压倒性的高占有率。
{{./Arial.jpg}}
===== Times New Roman =====
它在字体设计上属于__过渡型衬线__对后来的字型产生了很深远的影响。另外由于其中规中矩、四平八稳的经典外观所以常被选为__标准字体__之一。 Times New Roman为Stanley Morison、Starling Burgess和Victor Lardent共同创造由Monotype公司于1932年发表并为英国的《泰晤士报》首次采用。在电脑方面现在很多应用程序还有网页浏览器和文字处理软件都是用它作为默认字体。
{{./Times-New-Roman.jpg}}
  
===== Cambria =====
它是搭载于微软Windows Vista、Microsoft Office 2007和Microsoft Office 2008 for Mac等软件的一个__衬线字体__。其字符间距和比例相当的平均对角和垂直方向的笔画和衬线比较粗而水平向的衬线比较细强调笔画的末笔。当Cambria使用在大小超过20点的标题时其字体间的间距会些微的缩小以求美观但这样的设计并不适用于商业文件。
{{./Cambria.jpg}}
  
===== Verdana =====
一套无衬线字体它在__小字上有结构清晰端整__、阅读辨识容易等高品质表现成为许多领域爱用的标准字型之一。微软将Verdana纳入网页核心字体之一。
{{./Verdana.jpg}}
  
===== Tahoma =====
Tahoma是一个十分常见的无衬线字体字体结构和Verdana很相似其字符间距较小而且对Unicode字集的支援范围较大。Tahoma和Verdana师出同门同为名设计师Matthew Carter的作品由微软在1999年推出。Tahoma是种非常圆滑的字体该字体比较均衡显示中英文混排会不会出现中英文不对齐的状态。
{{./Tahoma.jpg}}
  
===== Calibri =====
一种无衬线字体为微软Microsoft Office 2007套装软件的默认字体也是Microsoft Word默认字体的第一个无衬线字体。Calibri为字型设计师Lucas de Groot替微软开发的字型曾于2005年字型设计竞赛Type Design Competition中获得系统字型Type System类的奖项。
{{./Calibri.jpg}}  
===== Georgia =====
一种衬线字体为著名字型设计师Matthew Carter于1993年为微软所设计的作品具有在小字下仍能清晰辨识的特性可读性十分优良。乍看之下Georgia与Times New Roman相当类似但它们有多处不同。首先在相同的字号下Georgia的字符比Times New Roman的字符略大其次Georgia的字符线条较粗衬线部份也比较钝而平。另外在数字部份也非常不同Georgia采用称为“不齐线数字”的数字特色在于数字会像西文字母般有高矮大小之别。
{{./Georgia.jpg}}
__Comic Sans MS__Comic Sans是一个似手写的字体由Vincent Connare设计并在1994年由微软发布。其被分类为一种随性且不连续的字体设计基础来自于漫画书里的字体可使用在非正式的文件里。从Windows 95之后此字体就一直附带在微软的视窗系统里已变成微软系统内最常用的字体之一。
{{./Comic-Sans-MS.jpg}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-01T13:55:21+08:00
====== 中文处理 ======
Created Sunday 01 January 2012

View File

@@ -0,0 +1,180 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T19:53:11+08:00
====== LaTex ======
Created Sunday 27 March 2011
~~Ubuntu 下配置texlive + CJK 中文环境 ~~**(过时)**
~~在ubuntu10.10上试验出来的,效果挺好。跟其他的配置不同的是,本配置方法力求简单,易用。所以,步骤很少,也不要下载一大堆的东西。~~
~~1、apt-get install texlive-base-bin latex-cjk-chinese~~
~~2、生成字体Type1字体~~
~~2.1 mkdir $HOME/texmf~~
~~2.2 下载gbkfonts程序保存到$HOME/texmf下。~~
~~2.3 复制 simsun.ttf, simli.ttf, simhei.ttf, simkai.ttf 到$HOME/texmf 下。~~
~~2.4 运行命令 ./gbkfonts simsun.ttf song~~
~~./gbkfonts simkai.ttf kai~~
~~./gbkfonts simli.ttf li~~
~~./gbkfonts simhei.ttf hei~~
~~…~~
~~3、更新系统的搜索路径~~
~~3.1 mktexlsr~~
~~3.2 编辑 /etc/texmf/updmap.d/00updmap.cfg 在文件最后面添加一行Map cjk.map~~
~~3.3 sudo update-updmap~~
~~3.4 updmap~~
~~差不多就好了。效果和Windows下用LaTeX没什么区别。按照这些步骤配出来的可以直接编译使用GBK编码的中文tex档。而且xdvipdflatex都可以直接用。~~
~~测试文件~~
~~view plaincopy to clipboardprint?~~
~~ 1 \documentclass{article} ~~
~~ 2 \usepackage{CJK} ~~
~~ 3 ~~
~~ 4 \begin{CJK*}{GBK}{song} ~~
~~ 5 \title{测试} ~~
~~ 6 \author{tayoto} ~~
~~ 7 \end{CJK*} ~~
~~ 8 ~~
~~ 9 \begin{document} ~~
~~ 10 \begin{CJK*}{GBK}{song} ~~
~~ 11 \maketitle ~~
~~ 12 中文测试 ~~
~~ 13 \end{CJK*} ~~
~~ 14 \end{document} ~~
~~[TeX Live] TeX Live 2009/2010 的 LaTeX 中文支持~~
~~本帖最后由 LiYanrui 于 2010-9-21 21:46 编辑~~
发信人: jjgod (while(!asleep()) sheep++;), 信区: TeX
标 题: TeX Live 2009 的 LaTeX 中文支持
发信站: 水木社区 (Sat Nov 21 22:38:11 2009), 站内
最近刚发布的 TeX Live 2009 [1] 是对中文支持有较大改进的一个版本,这里简单介绍一下。
首先,一如 2007, 2008 版本TeX Live 2009 有中文版本的安装使用指南 [2],强烈建议在提问前把相关章节好好看看,这份指南主要叙述的是和中文无关的一些通用的问题。
然后 TeX Live 2009 的中文支持主要分为两部分**,基于 XeTeX 的,和基于传统 CJK 宏包**的。(我这里只讨论 LaTeX的如果你希望尝试 ConTeXt 和 luatex可以参考 Li Yanrui 的 blog [3],他有很详细的介绍。)
===== 基于 XeTeX 的方案 =====
-----------------
这是我们推荐的方案,又可分为高层与低层两种,分别适用于不同需求的用户。
首先,安装所需的宏包:
sudo tlmgr install** xecjk ctex**
高层的方案是使用 __ctex 宏包自带的文档类__例如原来用 article 文档类的就改用 ctexart 文档类,原来用 book文档类的就改用 ctexbook 文档类这样绝大部分你会遇到的中文问题比如字体设置、hyperref的调用、章节标题的设置等等都自动为你解决了。详情可以看 ctex 宏包的文档 [4]。下面是一个小例子:
\documentclass{ctexart}
\begin{document}
你好TeX Live 2009
\end{document}
默认情况 (winfonts) 下,你需要宋体 (SimSun)、仿宋 (simfang)、黑体 (simhei)、楷体 (simkai)、隶书(LiSu)、幼圆 (YouYuan) 这六套 Windows 字体如果你的字体不全可以编辑ctex-xecjk-winfonts.def 文件 (用 kpsewhich 来找) 来修改设置,也可以选择 Adobe Reader等软件所带的 Adobe Song Std, Adobe Heiti Std, Adobe Kaiti Std, Adobe FangsongStd 四款字体,这时需要给 ctexart 加上__ [adobefonts] __选项。又或者你可以不用这些预置的字体使用__ [nofonts]__选项然后参考 ctex-xecjk-winfonts.def 文件,自己定义对应各个 CJK 字体族的字体。
低层的方案则是__用原来__你自己的宏包结合__ xeCJK 宏包来配置字体__下面是一个小例子
\documentclass__{article}__
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document}
你好TeX Live 2009
\end{document}
当然,你得有 SimSun 这个字体。不管选用高层的还是低层的,都可以直接用 xelatex 命令直接编译你的文档。
===== 安装字体: =====
在个人主目录先创建__.fonts文件夹__把自己需要的字体复制进去就可以了。我安装了Adobe的4种字体微软的6种还有文泉驿的.
$fc-list :lang=zh-cn | sort
查看已经安装的中文字体
到现在为止,中文的显示应该没有问题了。高层的方案比较好写,只是在很多场合**中英文要求不同字体显示**我采用__低层xeCJK宏包__来解决的。
下面是一个采用xeCJK处理的例子简明易懂
==============================================================================================
% !Mode:: "TeX:UTF-8"
\documentclass[12pt,a4paper]__{article}__
\usepackage{xltxtra,fontspec,xunicode}
\usepackage[slantfont,boldfont]__{xeCJK}__ % 允许斜体和粗体
\setCJKmainfont{FZJingLeiS-R-GB} % 设置缺省中文字体 徐静蕾字体
\setCJKmonofont{SimSun} % 设置等宽字体
\setmainfont{TeX Gyre Pagella} % 英文衬线字体
\setmonofont{Monaco} % 英文等宽字体
\setsansfont{Trebuchet MS} % 英文无衬线字体
\begin{document}
\begin{verse}
Stray birds of summer come to my window to sing and fly away. \\
And yellow leaves of autumn, which have no songs, \\
flutter and fall there with a sign.\\
\hfill \emph{Rabindranath Tagore}
\end{verse}
\begin{verse}
夏天的飞鸟,飞到我的窗前唱歌,又飞去了。\\
秋天的黄叶,它们没有什么可唱,只叹息一声,飞落在那里。\\
\hfill \emph{罗宾德拉纳特·泰戈尔}
\end{verse}
\end{document}
========================================================================
~~传统 CJK 方案(过时)~~
~~-------------~~
~~传统 CJK 方案主要是为了方便使用以前的文档存在的。也分为两种,高层方案也是使用 ctex 宏包,低层方案和原来的文档一样,直接用 CJK 宏包。~~
~~使用 ctex 宏包的例子和前面用 ctexart 的那个完全一样:~~
~~\documentclass{ctexart}~~
~~\begin{document}~~
~~你好TeX Live 2009~~
~~\end{document}~~
~~不过需要注意的是,你还得安装 zhmetrics 宏包。另外,如果文档保存的编码是 GBK必须添加 [GBK] 选项,否则用 UTF-8 编码的也建议用 [UTF8] 选项。~~
~~可以看出,用高层方案最大的好处是文档代码可以最大限度地不修改就能换用不同的 TeX 引擎。~~
~~低层方案与原来的做法的区别是,需要载入 zhwinfonts使用 zhwinfonts 定义的字体,而不是原来自己去生成字体的映射文件,这样要简便很多:~~
~~\documentclass{article}~~
~~\usepackage{CJK}~~
~~\input zhwinfonts~~
~~\begin{document}~~
~~\begin{CJK}{zhsong}~~
~~你好TeX Live 2009~~
~~\end{CJK}~~
~~\end{document}~~
~~注意,这里用了 zhsong 这个字体族而不是 song为了避免和 CJK 宏包原来定义的冲突,我们定义的所有字体族都带 zh 前缀。~~
~~对于上述这两种情况,你都可以使用 latex 编译,用 dvipdfmx 生成 pdf。~~
~~除了上述的 zhmetrics, ctex, xeCJK 宏包以外,我们还在 CTAN/TeX Live 中提交了 zhspacing,CJKpunct, zh-luatex 等宏包ctex-faq, lshort 中文翻译等文档,以上工作都需要感谢参与维护 ctex-kit[5] 的全体开发者,为 ctex-doc [6] 贡献内容的全体作者,也欢迎你参加到我们的工作中来,帮助进一步改进 TeX 的中文支持。~~
~~[1] http://www.tug.org/texlive~~
~~[2] http://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf~~
~~[3] http://liyanrui.is-programmer.com/~~
~~[4] http://tug.ctan.org/tex-archive/language/chinese/ctex/doc/ctex.pdf~~
~~[5] http://code.google.com/p/ctex-kit~~
~~[6] http://code.google.com/p/ctex-doc~~

View File

@@ -0,0 +1,160 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-01T12:12:59+08:00
====== Linux下的中文LATEX解决方案 ======
Created Sunday 01 January 2012
http://www.cnblogs.com/rockcode/archive/2011/08/06/2129561.html
真正的Linux下的中文LATEX解决方案:** CTeX + xeCJK + XeTEX**
lins05
mysnowls@163.com
August 6, 2011
===== 摘要 =====
Linux下用LaTeX很方便但是要解决中文的问题就不怎么方便因 为TeX的字体系统很难自己解决。
Windows下可以使用配置好的CTeX套装1 现在本文中就简介如何在Linux下配置CTeX以方便写中文文档。
===== 目录 =====
1 老的方法
1.1 缺乏可用的字体
1.2 默认的格式不符合中文排版要求
1.3 不能满足中文的其他要求
2 CTeX和xeCJK
2.1 字体
2.2 中文版式
2.3 CTeX和xeCJK的关系
3 简单的例子
4 注意事项
4.1 如何安装
4.2 推荐字体
4.3 其他设置
1 老的方法
LATEX的**CJK宏包**经过实践证明确实是一个可行且实用的中文LATEX解决方 案。但是它有几点不足:
1.1 缺乏可用的字体
LATEX下的中文字体很少Linux下的字体更少。因为TEX的字体系统比较复杂使得用户想自己生成字体非难困难门槛很高并且管理不方便。
1.2 默认的格式不符合中文排版要求
CJK宏包__仅仅解决了中文字体的问题__但是它默认的格式是__英文的排版方式__CJK的 作者是德国人)。
因此,一般用户都需要自己设置种种版式:首行缩进,行距和段距。中英文混排时的字距,等等。
1.3 不能满足中文的其他要求
比如生成目录时中文文档应该叫“目录”而不是”CONTENTS”。类似的还有“ 附录”、“表格索引”等等。
CTeX宏包和xeCJK宏包的__组合__相当完美的解决了这些问题。
====== 2 CTeX和xeCJK ======
2.1 字体
xeCJK宏包所使用的XeTeX引擎是从MacOS移植到Linux和Windows上的。它最大的特点是__从底层就具备对unicode的支持__以及可以**直接调用系统中已有的字体**。
这意味着将LaTeX用户从和字体相关的一大推问题中解决出来了。只要系统中安装了中文字体那么使用XeTeX就能使用这些字体。
xeCJK是必须__使用XeTeX引擎__的这也是为什么标题叫做CTeX + xeCJK + XeTeX的原因。
2.2 中文版式
CTeX的开发者们是值得所有的LaTeX用户感激的。__使用CTeX的各个documentclass__ 我们就无须再手动地设置版式因为CTeX的默认设置就是__最适合中文文档__的行首缩进两个汉字; 行距和段距的适当调整,中英文的混排时的字距,都是适合中文版式 的。
此外CTeX将其他应该为中文文档考虑的地方大都包括了进去”CONTENTS”改为 了“目录”,”Index”改为了”索引“等等。
2.3 CTeX和xeCJK的关系
二者都是宏包但是CTeX是一个__上层的中文LaTeX宏包__。它的**下层是可选**的,可 以__支持xeCJK、CJK__甚至更老的CCT宏包。对于不同的下层宏包它进行不同的设置。xeCJK完全可以脱离CTeX使用但是这样你虽然不用担心字体同样也**不能享受到CTeX的中文版式**。
总的来说__xeCJK完美地解决了中英文字体的问题而CTeX完美地解决了中文版式的问题__因此两者结合起来就可以完美地解决用TeX写作、排版中文文档的问题。
====== 3 简单的例子 ======
例子总是最直观的。我们以一个最简单的例子来说明。
%---------------------------------------
\documentclass[a4paper]{article}
\usepackage[**adobefonts**]{ctex}
\setCJKmainfont{SimSun}
%---------------------------------------
\author{小明}
\title{记一次春游}
\date{\today}
%---------------------------------------
\begin{document}
\pagestyle{plain}
\maketitle
%---------------------------------------
昨天,老师带我们三年级二班的小朋友们全体去郊外春游。我非常高兴。
我们在郊外看到了\textbf{老虎、狮子和熊猫}。
我长大了要\textsl{保护动物}。
那天,老师要教我们学习\LaTeX 了,大家都非常激动。
\end{document}
====== 4 注意事项 ======
4.1 如何安装
Linux下安装这三者的最方便的方法是安装__texlive系列__。texlive是一整套TEX__工具和引擎的集合__包括了LaTeX等种种工具和一些相关的程序、宏包不同的发行版里会把整个texlive分为**不同的软件包**诸如__texlive-xetex、texlive-xecjk、texlive-ctex__。用包管理软件进行搜索不难找到应该安装的软件包。
当然另一种方式是使用texlive的安装DVD或者在线安装 工具。笔者使用的slackware发行版里没有提供texlive的软件包2 因此是从中科大的CTAN镜像3 下 载的texlive2011DVD进行安装的。具体的安装过程可以读光盘里的README文 件。
由于texlive是一个TeX软件的大集合。因此它有一个__专门的包管理程序tlmgr__。 这个程序类似debian下的apt-get提供了搜索、查询、安装、卸载、升级各个tex软件包的功能。在DVD安装版中有这个软件一般的发行版应该不会提供这个程序4 。
4.2 推荐字体
一般使用的字体有三套。
* 一是在Linux下常用的文泉驿字体但它__不适合__写正式的文档。
* 二是在网上下载__Adobe的四套字体__分别是宋体、仿宋、黑体和楷体。
* 三是可以拷贝Window下的字体。但是这涉及到版权问题。如果确实想用可以在百度上搜索**“方正楷体”、“方正宋体”**,等等。
使用字体的方法如下:
先拷贝字体到**/usr/share/fonts/**下的相应的子目录中然后运行__"fc-cache"__更新系统的字体缓存。
在xeCJK中设置主字体是使用\setCJKmainfont命令因为我们的CTeX会调 用xeCJK因此可以使用xeCJK中的命令)。
具体的字体名字可以用__"fc-list :zh-cn"__命令来查看。
4.3 其他设置
1 如果你的系统中**没有CTeX要求的全套六种字体**5 那么,一定要在\usepackage{ctex}的选项中加上__adobefonts__这一条。
这样一来CTeX会用相应的Adobe字体去代替它要求的六套字体。不然有时会出现 找不到字体的现象尤其是使用特殊字体的时候比如在verbtim环境中。
2 一般情况下,**中文文档中是不使用斜体**的。因此在CTeX调用xeCJK时__默认是不使用斜体__的所以你就算在文档中使用\textsl{},最终也不会产生任何斜体效 果。
如果你真的要用,就要修 改/ctex/engine/__ctex-xecjk-engine__.def6 中 的一行:
\RequirePackage[BoldFont,normalindentfirst]{xeCJK}
改为:
\RequirePackage[BoldFont,slantfont,normalindentfirst]{xeCJK}
====== 5 使用CTeX的两种方法 ======
第一种是__直接使用CTeX的文档类CTex自动调用底层的xeCJK宏包设置中英文字体和中文文档格式__。
\documentclass[adobefonts]{ctexart}
第二种是__使用CTeX包__。这时可以手动导入xeCJK宏包设置中文。
\usepackage[adobefonts]{ctex}
二者的区别是:当通过\usepackage来使用CTeX包时产生的仍然 是”CONTENTS”、”INDEX”而不是“目录”、“索引”。
当然如果要用__其他类__作为文档类就必须使用第二种方式了最典型就是 用beamer类做幻灯片的时候了。
这时,如果要使用中文的“目录”、“摘要”等样式,可以使用这两条命 令:
**\renewcommand*\contentsname{目录} **
**\renewcommand*\abstractname{摘要}**
还有一个更折腾的方法。修改一下ctex/ctex.sty文件在其中添加一 句
\input{ctex-caption.def}
这样就一直保持中文的名称了。

View File

@@ -0,0 +1,66 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T09:48:41+08:00
====== XeLaTeX---完美支持中文的TeX系统 ======
Created Saturday 24 September 2011
http://forum.ubuntu.org.cn/viewtopic.php?f=35&t=247476&start=0
要做毕业论文了遂打算用LaTeX写个模板虽然成功配置了中文环境却始终对其编译生成的PDF文档不满意,尤其是在在中文字号的处理上。在网上搜索了一段时间发现XeLaTeX对中文的支持很好几乎不需要任何配置就可以轻松使用中文环境而且支持调用外部字体相当方便。由于 Texlive08套装集成了所以可以直接使用了为了更好的发挥作用一般还需如下配置
新建一个zhfontcfg.sty文件文件名无所谓了内容如下
代码:
% xetex/xelatex 字体设定宏包
\ProvidesPackage{zhfontcfg}
\usepackage[cm-default]{fontspec} %[cm-default]选项主要用来解决使用数学环境时数学符号不能正常显示的问题
\usepackage{xunicode,xltxtra}
\defaultfontfeatures{Mapping=tex-text} %如果没有它,会有一些 tex 特殊字符无法正常使用,比如连字符。
% 中文断行
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
%将系统字体名映射为逻辑字体名称,主要是为了维护的方便
\newcommand\fontnamehei{文泉驿正黑}
\newcommand\fontnamesong{SimSun}
\newcommand\fontnamekai{AR PL KaitiM GB}
\newcommand\fontnamemono{FreeMono}
\newcommand\fontnameroman{Times New Roman}
%%设置常用中文字号,方便调用
\newcommand{\erhao}{\fontsize{22pt}{\baselineskip}\selectfont}
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{16pt}{\baselineskip}\selectfont}
\newcommand{\xiaosanhao}{\fontsize{15pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.5pt}{\baselineskip}\selectfont}
%设置文档正文字体为宋体
\setmainfont[BoldFont=\fontnamehei]{\fontnamesong}
\setsansfont[BoldFont=\fontnamehei]{\fontnamekai}
\setmonofont{\fontnamemono}
%楷体
\newfontinstance\KAI {\fontnamekai}
\newcommand{\kai}[1]{{\KAI#1}}
%黑体
\newfontinstance\HEI{\fontnamehei}
\newcommand{\hei}[1]{{\HEI#1}}
%英文
\newfontinstance\ENF{\fontnameroman}
\newcommand{\en}[1]{\,{\ENF#1}\,}
保存后放在Xelatex文件夹下的fontspec(xelatex下的任意位置都可以)下并sudo texhash 刷新。之后,就可以通过调用该包(\usepackage{zhfontcfg})实现应用。继续发现,开始享受吧!!
几个需要说明的问题:
1映射逻辑字体时请确认系统中已经安装了相应字体如不确定可以通过如下命令查看
代码:
fc-list %查看系统安装的所有字体
__fc-list :lang=zh-cn __%查看系统安装的中文字体注意list后面有一个空格
2要添加新字体可参考已有命令; 其中:
\HEI 作用范围:{\HEI 内容}\HEI 内容,则“内容”都会是黑体;
\hei 作用范围: \hei{内容}
目前为止使用中文环境比较舒服了。而且经过两天的努力成功按照学校要求编写了学士论文的LaTeX+CJK 模板和XeLaTeX模板并得到了精华鼓励。呵呵以后就用它工作了。

View File

@@ -0,0 +1,80 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T09:51:47+08:00
====== 2 ======
Created Saturday 24 September 2011
摸索的两个月终于知道如何让latex完美支持中文了那就是Xetex。
配置:
从源中安装xetex.....ok。
xetex将使用你系统的字体也就是说你不用自己去编译字体了。
使用 $ fc-list :lang=zh-cn 可以看到你的中文字体。
使用 $ fc-list 可以看到你的所有字体。
# su
# mkdir /usr/share/texmf/tex/xelatex/zhfontcfg
在zhfontcfg文件夹中创建一个“zhfontcfg.sty” 文件如下:
% xetex/xelatex 字体设定宏包
\ProvidesPackage{zhfontcfg}
\usepackage{fontspec,xunicode}
\defaultfontfeatures{Mapping=tex-text} %如果没有它,会有一些 tex 特殊字符无法正常使用,比如连字符。
% 中文断行
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
%将系统字体名映射为逻辑字体名称,主要是为了维护的方便
\newcommand\fontnamehei{FZHeiTi}
\newcommand\fontnamesong{Adobe Song Std}
\newcommand\fontnamekai{FZKaiTi}
\newcommand\fontnamemono{DejaVu Sans Mono}
\newcommand\fontnameroman{Dustismo Roman}
%设置文档正文字体为宋体
\setmainfont[BoldFont=\fontnamehei]{\fontnamesong}
\setsansfont[BoldFont=\fontnamehei]{\fontnamekai}
\setmonofont{\fontnamemono}
%楷体
\newfontinstance\KAI{\fontnamekai}
\newcommand{\kai}[1]
%黑体
\newfontinstance\HEI{\fontnamehei}
\newcommand{\hei}[1]
%英文
\newfontinstance\ENF{\fontnameroman}
\newcommand{\en}[1]{\,{\ENF #1}\,}
\newcommand{\EN}{\,\ENF\,}
注意你可以选择你想要的字体。我是使用了Adobe Song Std作为song体这样文档可以在adobe reader墨色均匀。
运行:
#sudo mktexlsr
一切ok.用xelatex编译你的文档将不含任何乱码包括书签呵呵。
例子test.tex
\documentclass{article}
\usepackage{zhfontcfg}
\usepackage[colorlinks,linkcolor=black]{hyperref}
%opening
\title{latex多字体简易示例}
\author{颜开}
\begin{document}
\maketitle
\section{楷体}
\kai{楷体}
\section{黑体}
\hei{黑体}
\end{document}
哈哈,搞定了吧

View File

@@ -0,0 +1,133 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2012-01-01T13:29:51+08:00
====== 如何在 LaTeX 中处理中文 ======
Created Sunday 01 January 2012
===== 我该安装什么发行版? =====
* 我什么都不知道/大多数人: TeX Live 2011 或 CTeX 套装 2.9 以后版本
* 我使用 ConTeXt ConTeXt Minimals
* 我还听说有XXX 不妨自己试试
注:
安装后建议使用 __TeX Live Manager__ 或 MiKTeX Maintenance 连接 CTAN 在线更新。部分中文支持的宏包可能需要更新后才能确保正常使用。
===== 我该用什么编辑器? =====
  编辑器功能有简有繁,特色不一,从简单的纯文本编辑器到繁复的 Emacs__因人而易__。基本功能有语法高亮、方便编译预览就很好了扩充功能和定制有无限的可能。既可以使用界面友好、使用方便的专用编辑器如 TeXWorks、Kile、WinEdt 等,或者接近所见即所得功能的 LyX也可以使用定制性强的通用编辑器如 Notepad++、SciTE、Vim、Emacs 等。这方面的介绍很多,一开始不妨多试几种,找到最适合自己的才是最好的。
  另外提醒一句,编辑器只是工作的助力,不必把它看得太重。一些编辑器有极为繁杂的功能,一些编辑器常常会引来黑客们的论战(如 Emacs 与 Vim。为工作别为这些浪费太多精力适用即可。
===== 我该去哪里寻找答案? =====
0、绝对的新手先读完一本入门读物了解基本的知识。
1、__无论如何先读文档__绝大部分问题都是文档可以解决的。
2、再利用 Google 搜索,利用版面搜索。
3、清楚、聪明地提出你的问题。
===== 我应该看什么 LaTeX 读物? =====
 这不是一个容易回答的问题,因为有许多选择,也同样有许多不合适的选择。这里只是选出一个比较好的答案。更多更详细的介绍可以在版面和网上寻找(注意时效)。近两年 TeX 的中文处理发展很快,目前没有哪本书在中文处理方面给出一个最新进展的合适综述,因而下面的介绍也不主要考虑中文处理。
一、我可以阅读英文
    1、我要迅速入门ltxprimer.pdf (LaTeX Tutorials: A Primer, India TUG)
    2、我要系统学习A Guide to LaTeX, 4th Edition, Addison-Wesley 有机械工业出版社的影印版《LaTeX 实用教程》e
    3、我要深入学习要读许多书和文档__TeXbook __是必读的
    4、还有呢   去读__你使用的每一个宏包__的说明文档。还有许多专题文档如讲数学公式、图形、表格、字体等
二、我更愿意阅读中文
    1、我要迅速入门lnotes.pdf (LaTeX Notes, 1.20, Alpha Huang)
    2、我要系统学习《LaTeX2ε 完全学习手册》,胡伟
《LaTeX2ε 科技排版指南》邓建松e
      《LaTeX 入门与提高》第二版,陈志杰等
    3、我要深入学习《特可爱原本》TeXbook 的中译by xianxian。e)
    4、还有呢   英语绝大多数 TeX 资料还是英文的
===== 从哪里得到各种书籍和文档? =====
 书籍需要自己买。已出版的书籍通常都比网上流传的教程质量为高。部分经典和常用的书籍可以在网上找到电子版,包括本版的保留区和精华区一些。
  诸宏包和一些常用的电子文档都会在 TeX 发行版里__默认安装__除非特别指定不安装或使用的是精简文档的版本。MiKTeX 安装目录的 doc 路径TeX Live 的 **texmf-doc** 以及** texmf-???/doc **目录都分类存放着各种文档。一般地MiKTeX 和 TeX Live 都提供了一个叫做__ texdoc__ 的命令来直接调出文档,如在命令行下运行
texdoc amsldoc
将得到 AMS LaTeX包括 amsmath 等宏包)的文档;而
texdoc symbols-a4
将得到著名的 The Comprehensive LaTeX Symbol List一个符号大全。进一步的用法可以通过
texdoc texdoc
查看。此外TeX Live 发行版还有图形界面的 texdoc GUI (texdoctk) 列出常用的部分文档,安装主目录下的 doc.html 中则包括一个所有 pdf 和 html 格式文档的列表。如果在发行版里没有安装相应的文档,可以去 CTAN 寻找下载(后详)。
  由第三方发布的一些不大常见的文档,如印度 TUG 组织编写的 LaTeX Tutorials__中文翻译的 beamer 文档__等就需要自己在网络上搜索了事实上本站就有许多。在中文资源版、各版精华区和一些专门的 FTP 中,常常会留有许多文档。
LaTeX 自身的一个很大的问题是__不知道用什么宏包__。而且许多人都在找大量例子-代码的对比、大而全的问题库。这里有两个常见的来源,都是英文的:
1、UK-FAQ在系统中通常可以 newfaq 的名字用 texdoc 调出)。讲了许多常见的问题,给了许多解决问题的代码,介绍了许多实用的宏包。
2、书籍 LaTeX Companion 第二版。这是一本篇幅宏大的书,似乎没有引进到国内,只在一些图书馆内找到,但或许在网上能找到电子版(请不要向我索要)。
===== 如何使用 CTAN =====
CTAN 就是 the Comprehensive TeX Archive Network它以 HTTP 或 FTP 的形式提供大量 TeX 相关资源的下载。在 CTAN 上可以下载到最新版本的主要 TeX 发行版,如 TeX Live、MiKTeX可以下载免费的 TeX 相关编辑器、支持工具、附件,如 LyX、WinEdt、GhostScript、TpX 等,也可以下载各种最新的 TeX 宏包。
  CTAN 的 HTTP 主站是 http://www.ctan.org/%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%9C%A8%E7%BA%BF%E8%BF%9B%E8%A1%8C%E6%90%9C%E7%B4%A2%EF%BC%9BCTAN 在世界各地有许多镜象服务器,处于教育网内的有北京交通大学和厦门大学的 CTAN 镜象:
http://mirror.bjtu.edu.cn/CTAN/
http://mirrors.xmu.edu.cn/CTAN/
ftp://mirrors.xmu.edu.cn/CTAN/
国内公网则有 CTeX 网站的镜象:
ftp://ftp.ctex.org/CTAN/
http://ftp.ctex.org/mirrors/CTAN/
此外还有许多国外的镜象服务器,列表可以在 CTAN 主站找到。
===== 如何在 LaTeX 中处理中文?请举一个例子。 =====
LaTeX 本身虽然变化不大但中文处理的技术近两年发展飞快。现在2011 年底我们推荐使用__ XeTeX 引擎处理中文__使用支持 XeLaTeX 的** ctex 宏包和文档类**(版本 0.9 以上解决__中文版式__习惯的问题。在系统配置方面使用 TeX Live 2011 或 CTeX 套装 2.9 以上版本。
使用上述 __XeLaTeX + xeCJK + ctex__ 的方式处理中文,可参考的文档包括:
*   fontspec 宏包文档XeLaTeX 下的一般字体选择机制)
*   xeCJK 宏包文档fontspec 字体选择机制的中文实现和标点特殊处理等)
*   ctex 宏包文档(中文版式的解决方案)
一个典型的中文支持例子Windows 系统,用 xelatex 命令编译):
% 使用 Windows 六套字体(缺省的 __winfonts __选项UTF-8 编码
\documentclass[UTF8]{__ctexart__}
\begin{document}
文章内容。
\end{document}
如果没有win字体可以使用adobefonts选项。
注:即使不使用 xelatex 命令编译,上述代码也是一样可以用 latex 或 pdflatex 命令编译的。在使用 latex 或 pdflatex 编译时,**编码的选项**是重要的UTF8 或 GBK
不使用商业中文字体的例子Linux 系统,使用 xelatex 编译):
% -*- coding: utf-8 -*-
\documentclass[UTF8,__nofonts__]{ctexart}
\setCJKmainfont[ItalicFont={AR PL KaitiM GB}]{AR PL SungtiL GB}% 文鼎宋体和楷书
\setCJKsansfont{WenQuanYi Zen Hei}% 文泉驿的黑体
\begin{document}
文章内容
\end{document}
ctex 宏包及文档类在 Linux 系统下字体难以统一设置,进一步的信息参见:
https://code.google.com/p/ctex-kit/wiki/UnixFonts
===== 新手不建议做的几件事情: =====
* 不了解情况下复制他人代码__代码最好都是自己写__每句话啥意思要自己清楚同时我也建议各位同学给别人解决问题的时候不要从自己文档里面咔嚓一段代码上来最好是说明**用哪个宏包,有啥用处**,剩下的是提问者看文档,相信各位在每次帮助他人的同时更巩固了对某些常用宏包的理解。
* 有一点是特别让人不爽的,就是用 mathtype 还是什么然后生成 tex 代码,忽然有啥问题了,就划拉下来问怎么办。怎么说呢,一般有能力解决的人是不会痴迷这种代码的,好心的就让你看看 mathmode 好好学学普通点的就直接看下一篇。在此忠告__公式一定要自己手敲__。
* 求助模板相关问题除了投稿__尽量不要用现成的模板__因为模板千差万别良莠不齐出了什么问题也较难定位。如果真的喜欢某个文档格式而用该模板请确保你知道模板作者的联系方式__直接向他提问__是最有效的解决途径他人用这个模板而又这么巧看到了你的问题又那么巧知道问题在哪里又这么巧有空帮你这就不是自己能控制的了。不用该模板的用户一般对这种问题是没有兴趣看一看的。
* __毫无基础就开始写文章__我不是吓唬大家不过不看点书、做点练习就想直接写书呢不是一种主流做法。花个个把礼拜学习未必使你的文章结束得晚。我经常看到一些代码中充斥着 \hskip, \quad, ~~~~, \indent 甚至无数的 \\ 等用来对齐或者换行,嗯,当时的情况就是这样的。这样写文章难道不累吗。我这里就不介绍应该如何写简练又有意义容易掌控的代码,看书吧。
* __试图修改 LaTeX 的默认表现__比较有代表性的是浮动体等的标题等一会儿说不要浮动了一会儿说 figure 1.2 要改成中英文双语版而且后面的冒号要改成五角星,最麻烦的还是双栏下面一浮动咋跑下一页去了……,等等等等,不要管它们,随它们的便,这是最好的处理方式。
===== 什么知识会过时?什么不会? =====
TeX 是**排版**__语言__也是广泛使用的软件并且不断在发展中因此总有一些东西会很快过时。作为学习 TeX 的人,免不了要看各种各样的书籍、电子文档和网络论坛上的只言片语,因此了解什么知识会迅速过时,什么知识不会是十分重要的。
最稳定的是关于 __Primitive TeX 和 Plain TeX__ 的知识,也就是 Knuth 在他的《The TeXbook 》中介绍的内容。因为 TeX 系统开发的__初衷就是稳定性__要求今天的文档到很久以后仍可以得到完全相同的结果因此 Knuth 限定了他的 TeX 语言和相关实现的命令、语法。这些内容许多年来就没有多少变化在未来的一些年里也不会有什么变化。Primitive TeX 和 Plain TeX 的知识主要包括 TeX** 排版的基本算法和原理,盒子的原理,底层的 TeX 命令**等。其中技巧性的东西大多在__宏包设计__中初学者一般不会接触到很多而基本原理则是常常被提到的譬如TeX 把一切排版内容作为盒子box处理。
相对稳定的是关于__基本 LaTeX 2ε __的知识也包括围绕 LaTeX 2ε 的一些__核心宏包__的知识。LaTeX 2ε 是自 1993 年以来的一个稳定的 LaTeX 版本直到最近的一次修订2005 年都没有大的变动。LaTeX 的下一个计划中的版本 LaTeX 3 遥遥无期在可预见的将来LaTeX 2ε 不会过时。LaTeX 2ε 的知识是目前大部分 LaTeX 书籍的主体内容。关于 LaTeX 的__标准文档类__article、report、book、letter、slide 等关于__基本数学公式__的输入文档的__章节层次____表格__和矩阵图表__浮动体__LR __盒子__与段落盒子……这些 LaTeX 的核心内容都是最常用的,相对稳定的。与 LaTeX 2ε 相匹配的核心宏包,如 graphics(x)、ifthen、fontenc、doc 等,也同样是相对稳定的。还有一些被非常广泛应用的宏包,如 amsmath 系列,也可以看作是相对稳定的。
简单地说,关于基本 TeX/LaTeX 的语言,都是比较稳定的。与之对应,实现或者支持 TeX/LaTeX 语言的软件,包括在 TeX/LaTeX 基础上建立的新的宏,都不大稳定。
容易过时的是关于__第三方__ LaTeX 宏包的知识、第三方 TeX 工具的知识,以及新兴 TeX 相关软件的知识等。TeX 和 LaTeX 语言是追求稳定的;但无论是宏包还是工具,作为不断更新软件,它们是不稳定的。容易过时的技术很多,而且现在广泛地出现在几乎所有 LaTeX 文档之中,因此需要特别引起注意:
  **宏包的过时**的原因可能是宏包本身的升级换代带来了新功能或不兼容也可能是同一功能的更新更好的宏包代替了旧的宏包。前者的典型例子比如__绘图宏包 PGF/TikZ__现在的 2.00 版功能十分强大,和旧的 1.1x 版相差很大,和更旧的 0.x 版本则几乎完全不同;后者的典型例子比如 caption 宏包先是被更新的 caption2 宏包代替,后来 caption 宏包更新又使得 caption2 宏包完全过时。——安装更新的发行版可以避免使用过旧的宏包__认真阅读宏包自带的文档__而不是搜索得到的陈旧片断可以避免采用过时的代码。
  **工具过时**的主要原因也是升级换代和被其他工具替换。前者的典型例子是编辑器 WinEdt 在 5.5 以后的版本支持 UTF-8 编码,而旧版本不支持;后者的典型例子是中文字体安装工具从 GBKFonts 到 xGBKFonts 到 FontsGen 不断被取代。
  **图形插入**是一个在 TeX 实现、宏包与外围工具方面都更新很快的东西。在过去,最常用的输出格式是 PSPostScript格式因此插入的图像以 EPS 为主流。使用 Dvips 为主要输出工具,外围工具有 GhostScript、bmeps 等等,相关宏包有 graphics 等相关文档如《LaTeX2e 插图指南》。但凡提及“LaTeX 只支持 EPS 图形”的,就是这个过时的时代的产物。事实上 TeX/LaTeX __并不限定任何图形格式__只不过是当时的输出格式PS和工具Dvips对 EPS 情有独钟而已。后来 PDF 格式成为主流pdfTeX、DVIPDFM、DVIPDFMx、XeTeX 等工具则主要支持 PDF、PNG、JPG 格式的图形,涉及一系列工具如 ImageMagick、ebb 等。
  值得特别提出注意的就是__中文处理__也一起是更新迅速、容易过时的部分。而且因为中文处理一直没有一个“官方”的“标准”做法软件、工具、文档以及网上纷繁的笔记也就显得相当混乱。从八十年代开始的 CCT 系统、天元系统,到后来的 CJK 方式到__近来的 XeTeX、LuaTeX 方式__中文处理的原理、软件、宏包、配置方式等都在不断变化中。曾几何时天元、CCT 是中文 TeX 软件的代名词;五六年前的书籍尚在说 CJK 不成熟CCT 是主流;两三年前出版的书籍却在说 CCT 已成为过去CJK 成为主流;现在我们推荐却是 XeTeX或许过不久又成为 LuaTeX 处理中文的天下……而且新方法确实也越来越简单、越来越直接了。是的,对此我们毫无办法,只有跟随潮流。

View File

@@ -0,0 +1,47 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T11:02:50+08:00
====== 参考字体 ======
Created Saturday 24 September 2011
中文:
衬线字体(用于正文):
Regular: Adobe Song Std
Bold: Adobe Heiti Std //有的字体提供了加粗的类型但是Adobe Song Std没有。
Italic: Adobe Kaiti Std //中文根本没有斜体字型(一般都字体渲染引擎是把正常字体倾斜获得的)。
无衬线字体(用于章节标题)
Regular Adobe Heiti Std
等宽字体(用于代码等原文输出)
WenQuanYi ZenHei Mono
英文:
衬线字体:
Apple Garamond (有各种样式输出)
无衬线字体:
Arial
等宽字体:
Consolas
#yaourt -Ql __ttf-mac-fonts__
ttf-mac-fonts /usr/share/fonts/TTF/
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Bold.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-BoldItalic.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Italic.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Light.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-LightItalic.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond.ttf
ttf-mac-fonts /usr/share/fonts/TTF/HardGothicNormal.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Console.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Grande Bold.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Grande.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida MAC.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Sans Unicode.ttf
ttf-mac-fonts /usr/share/fonts/Type1/
ttf-mac-fonts /usr/share/fonts/Type1/Lucida G.pfb
ttf-mac-fonts /usr/share/fonts/Type1/Lucida Gr Regular.pfb
ttf-mac-fonts /usr/share/fonts/Type1/Lucida MAC Bold.pfb
ttf-mac-fonts /usr/share/fonts/Type1/Lucida MAC.pfb
ttf-mac-fonts /usr/share/fonts/Type1/MACGrande.pfb
ttf-mac-fonts /usr/share/licenses/
ttf-mac-fonts /usr/share/licenses/ttf-mac-fonts/
ttf-mac-fonts /usr/share/licenses/ttf-mac-fonts/SafariWindows.pdf

108
Zim/LaTex/安装.txt Normal file
View File

@@ -0,0 +1,108 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-08-21T14:59:51+08:00
====== 安装 ======
Created Sunday 21 August 2011
接下来安装中文支持首先上网下载AdobeFonts 共有四种,宋体,仿宋,楷体,黑体。
解压出来复制到:/usr/share/fonts
然后执行fc-cache -fsv 更新字体缓存
然后查看以下fc-list :lang=zh-cn >> zhcn.txt
看看zhcn中有没有adobe字体
Adobe 楷体 Std,Adobe Kaiti Std,Adobe Kaiti Std R,Adobe 楷体 Std R:style=R,Regular
Adobe 黑体 Std,Adobe Heiti Std,Adobe Heiti Std R,Adobe 黑体 Std R:style=R,Regular
Adobe 宋体 Std,Adobe Song Std,Adobe Song Std L,Adobe 宋体 Std L:style=L,Regular
Adobe 仿宋 Std,Adobe Fangsong Std,Adobe Fangsong Std R,Adobe 仿宋 Std R:style=R,Regular
如果安装成功就会显示上面的内容。
下面是编辑latex如何使用Adobe字体。按照下面的做法不会出错字体也很漂亮
\documentclass[11pt, a4paper]{article}
\usepackage{__fontspec__}
\setmainfont{Adobe Fangsong Std} %这里Fangsong 可以换成Adobe其他三种的任何一种Song, Heiti,Kaiti
\begin{document}
你好Tex
\end{document}
记住最后用 xelatex 进行编译直接生成的是一个pdf文件打开看看就知道字体使用对了没有。
===== texlive安装和中文支持 =====
有两种方法设置latex的中文支持
1.
==== 利用系统自带的字体 ====
——xelatex 命令直接生成PDF
1.1 系统字体目录:/usr/share/fonts
添加Adobefonts——Fangsong,Song,Kaiti, Hei (google搜索之)于一个新文件夹adobe-fonts中运行 fc-list 查看是否安装成功。
1.2 在tex文件 可利用命令\setmainfont{} / \setromanfont{} / \setsanfont{}调用新建的系统字体。
eg.
\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\setmainfont{Adobe Kaiti Std}
%括号里的字符应是fc-list中的
\begin{document}
{\setromanfont{Adobe Fangsong Std}不需要安装字体,仿宋 GB2312 \\}
\end{document}
然后终端运行xelatex.
2
==== 安装tex 系统的中文字体 ====
有一个简便的方法
2.1 直接下载 YWang-zhfonts (http://bj.soulinfo.com/~hugang/tex/tex2007/) ,解压——tar -jxf *.bz2 它是个隐藏文件。
查找texmf-local目录——利用配置文件texmf.cnf(/usr/share/texmf/web2c/texmf.cnf),如目录不存在则建立一个。
2.2 把刚解压的文件夹tex-var下的文件复制到/usr/local/share/texmf
2.3 运行 texhash/ __mktexlsr__ 刷新tex系统
eg.
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{hei}
I make it!
我成功了!
\end{CJK}
\end{document}
===== 附录: =====
字体主要格式http://www.ztxz.cn/ziti/11696.html
1.光栅字体(.FON 这种字体是针对特定的显示分辨率以不同大小存储的位图用于Windows系统中屏幕上的菜单、按钮等处文字的显示。它并不是 以矢量描述的放大以后会出现锯齿只适合屏幕描述。不过它的显示速度非常快所以作为系统字体而在Windows中使用。
  2.矢量字体(.FON
  虽然扩展名和光栅字体一样但是这种字体却是由基于矢量的数学模型定义的是Windows系统字体的一类一些windows应用程序会在较大尺寸的屏幕显示中自动使用矢量字体来代替光栅字体的显示。
  3.PostScript字体(.PFM)
  这种字体基于另一种矢量语言Adobe PostScript的描述常用于PostScript打印机中不过Windows并不直接支持这类字体要在Windows使用这类字体需要安装"Adobe Type Manger"(ATM)软件来进行协调。
  4.TrueType字体.TTF
   这是我们日常操作中接触得最多的一种类型的字体,其最大的特点就是它是由一种数学模式来进行定义的基于轮廓技术的字体,这使得它们比基于矢量的字体更容 易处理,保证了屏幕与打印输出的一致性。同时,这类字体和矢量字体一样可以随意缩放、旋转而不必担心会出现锯齿。我们下面要制作的字体就属于这一类型。
  5.OpenType字体(.OTF)
   __OpenType__是一种可缩放字型scalable font电脑字体类型采用PostScript格式是美国微软公司与Adobe公司联合开发用来替代TrueType字型的新字型。这类字体的文 件扩展名为.otf类型代码是OTTO现行标准为OpenType 1.4。
  OpenType最初发表于1996年并在 2000年之后出现大量字体。它源于微软公司的TrueType Open字型TrueType Open字型又源于TrueType字型。OpenType font包括了Adobe CID-Keyed font技术。Adobe公司已经在2002年末将其字体库全部改用OpenType格式。到2005年大概有一万多种OpenType字体Adobe 产品占了三分之一。
汉字字符集http://www.ztxz.cn/ziti/11212.html
①GB-2313字符集 6763个简体汉字715个符号总计7478个字符
②GBK字符集 21003个简繁体汉字882个符号共计21885个字符(包含BIG-5字符集13060个繁体汉字 + 808个符号 =13868个字符
③GB18030字符集GBK字符集 + CJK Ext-A = 27533个汉字(CJK-A中有52字与GBK中的汉字重复但内码不同在计总数时不算在内)
④UnicodeCJK20902个汉字 (包含在GBK字符集中)
⑤UnicodeCJK Ext-A 6582个汉字 (包含在GB18030字符集中)
⑥UnicodeCJK Ext-B 42711个汉字
⑦全部70244个汉字下载 ( 27533 + 42711 = 70244 )
⑧古难字索引 ( CJK+Ext-A+Ext-B ) ★ 部首检字表
字体名后面的数字是指能显示的GBK + CJK-Ext-A + CJK-Ext-B汉字的个数。

View File

@@ -0,0 +1,76 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-08-21T15:16:51+08:00
====== TeXlive 2011安装使用 ======
Created Sunday 21 August 2011
代码链接:
https://github.com/live5156go51/code/blob/master/Tex/xetexzh-cn.tex
===== 1 简介 =====
TEX Live 是一个完整的 TEX 系统,它的主页在 http://tug.org/texlive/
==== 2 下载TeXlive2011 ====
厦门大学开源软件镜像:http://mirrors.xmu.edu.cn/CTAN/systems/texlive/Images/
===== 3 安装 =====
命令挂载到本地磁盘: sudo mount -t iso9660 -o loop /pathto/texlive2011-
20110705.iso /mnt/
图形介面安装:sudo ./install-tl -gui
==== 4 关于环境变量设置 ====
如果安装时候选择了在标准路径下创建符号连接,那就不需要设置环境变量了。否
则,应该将使用的平台下TeX二进制程序的目录加入搜索路径,编辑用户目录 /̃.bash_profile
PATH=/usr/local/texlive/2011/bin/i386-linux:$PATH; export PATH
MANPATH=/usr/local/texlive/2011/texmf/doc/man:$MANPATH; export MANPATH
INFOPATH=/usr/local/texlive/2011/texmf/doc/info:$INFOPATH; export IN-
FOPATH
==== 5 解决XeTeX中文配置 ====
参照TEX Live 指南 TEX Live 2011:
1. 将 texlive-fontconfig.conf 文件复制到 /etc/fonts/conf.d/09-texlive.conf。
2. 运行 __fc-cache -fsv__。
以下是测试XeTeX中文环境代码。
\ documentclass { article }
\ usepackage { fontspec }
\ setmainfont { WenQuanYi Zen Hei Sharp }
\ begin { document }
Hello 中文,
\ end { document }
第2行使用fontspec宏包以使用setmainfont命令设置导言区字体。
linux 系统用命令:__fc-list :lang=zh-cn__ 查看setmainfont可设置的中文字体。
另外可以从Windows/Fonts/里复制些中文字体到/usr/share/fonts, 然后再用命令fc-cache更新字体系统,这样fc-list就可以识别了。
===== 6 XeTex beamer做slide =====
\ documentclass { beamer } 幻灯片宏包
\ usepackage { beamerthemesplit } 主题风格
\ usepackage { fontspec }
\ setmainfont { AR PL UKai CN }
__\ setsansfont { WenQuanYi Zen Hei Sharp }__
\ usepackage { graphics }
\ begin { document }
\ title{ 创建slide } %添加标题
\ subtitle{副标题}% 附标题
\ author{李俊鹏} %添加作者
\ institute{hello}
\ date {\ today {}} %添加日期
\ frame {\ titlepage {}} %添加主题幻灯片
\ frame {\ frametitle第一张幻灯片标题{}
\ pause {}
\ begin { itemize }
\ item 第一名
\ end { itemize }
}
\ end { document }
很多时候排Beamer幻灯片时,中文汉字显示为空白,是因为因为 __beamer 默认使用sans 字体__。所以加上第五行setsansfont字体即可解决中文beamer。

View File

@@ -0,0 +1,114 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-08-21T15:38:10+08:00
====== texlive2009 及 中文配置教程总结 ======
Created Sunday 21 August 2011
===== 1. 安装xetex及相关 =====
sudo apt-get install texlive-xetex
至此你已经有了基本的texlive完全可以编译英文。
鉴于基本的tex功能有限再装上额外和推荐的包
sudo apt-get install texlive-latex-extra texlive-latex-recommended
===== 2. 让xeCJK调用系统字体 =====
打开文本编辑器geditkate等
输入文本:
\documentclass{article}
\usepackage{xeCJK} %使用xeCJK
\setCJKmainfont{WenQuanYi Micro Hei} %使用系统自带的字体
\begin{document}
xeCJK 调用微米黑
\end{document}
保存为test.tex。然后在当前目录输入命令
**xelatex test.tex**
记住哦xetex的编译口令是xelatex。然后就会编译出一份pdf文件。
想换个字体,修改\setCJKmainfont{……},替换上系统里有的字体即可。
===== 3. 关于 CJK 原始方案的错误 =====
看过帖子 “texlive2010安装与中文设置” 的同学知道一种CJK只处理宋体与楷体的原始方案
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{gkai}
我是楷体
\end{CJK}
\begin{CJK}{UTF8}{gbsn}
我是宋体
\end{CJK}
\end{document}
编译命令是
引用:
latex test.tex
是latex哦。
但是,编译会出现错误:(我已经试过了)
LaTeX Error: File `CJKutf8.sty' not found.
为什么因为源安装2009不像镜像安装2010那样大包大揽什么都有。我们之前安装的__xeCJK不是传统的CJK__传统CJK根本没有安装所以没有CJKutf8.sty也没有 gbsn 和 gkai 字体。
安装很简单
sudo apt-get install latex-cjk-*
但是如果用传统的CJK也没有必要用xetex只需普通的latex套件就够了。所以这里说的东西意义不大。
ps. latex命令编译出来的文件不是pdf是dvi。
===== 字体的小贴士>> =====
猜测xeCJK是不能调用CJK之下的gbsn和gkai因为gbsn和gkai在texmf的目录里而不是系统的字体目录。不要问我怎么拷贝windows下的字体并安装到linux我不知道。我连windows都没有更不懂怎么去搞SimSun。
不过我们有开源字体。而且11.04的源里面就有宋体(港台叫“明体”)和楷体。你可以在软件包管理器里搜索 ttf-arphic ,装一两个喜欢或者需要的就行了。
===== 4. 安装 ctex 宏包 =====
为什么要装 ctex 宏包ctex 宏包可以使中国人更方便地写中文论文比如自动编译的章节标题是“第一章”而非“Chapter 1”。
先下载 ctex 宏包ftp://ftp.ctex.org/CTAN/language/chinese/ctex.zip
源自 ctex 主页http://code.google.com/p/ctex-kit/wiki/CTeXPackage
解压 zip ,然后以超级用户的身份把解压出来的 ctex 文件夹放至 /usr/share/texmf/tex/latex/ 内。
接着运行
__sudo texhash__
为了运行 ctex ,确保已经安装了 texlive-latex-extra见2否则会出现错误 etoolbox.sty not found
然后测试:
引用:
\documentclass[__nofonts__]{ctexart}
\setCJKmainfont{WenQuanYi Micro Hei}
\begin{document}
你好 CTeX 文档类
\end{document}
!看见红色部分的[nofonts]了吗?一定一定要加上这个选项,否则 ctex 会默认去调用windows或者Adobe字体然后你的中文就编译不成了。
另外 __ctex 封装了 xeCJK__ ,意思是,你不用\usepackage{xeCJK},可以直接\setCJKmainfont{WenQuanYi Micro Hei}
编译的口令依然是 xelatex 中间会有停顿提示错误什么的不用管它一路Enter到底最后可以编译出中文的pdf。
===== 5. 给新手的提示 =====
1 手动安装或者更新了宏包之后必须 sudo texhash 才能生效;
2 看到错误不要怕,冷静,看看错误是什么,有可能只是个小小的拼写错误;
3 如果手动安装了字体一般需要__刷新字体映射__才能在 xetex 里使用;如果出现了错误“ ! Font 等等等等 at 10.0pt(或者别的字号) not loadable ”,解决的办法也是刷新字体映射。更新映射的命令是
sudo updmap-sys
4 宏包不会使用,多看文档。看文档的命令是 texdoc 要看的宏包名比如看xeCJK文档
texdoc xecjk

View File

@@ -0,0 +1,261 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-08-21T15:24:59+08:00
====== xelatex ======
Created Sunday 21 August 2011
在 Debian GNU/Linux 中安装 TeXLive lj605 [at] bbs.ctex.org
视频教程 http://v.youku.com/v_show/id_XMTc0NjIxNDk2.htm
Debian GNU/Linux 中 TeXLive 的中文支持 (见2楼)
视频教程 http://v.youku.com/v_show/id_XMTc1MDc3MTI4.html
===== 环境介绍 =====
系统: Debian GNU/Linux sid
版本: TeXLive 2009
字体: 文泉驿正黑
==== 安装 TeXLive ====
安装步骤:
准备. 安装 perl-tk.
$sudo aptitude install perl-tk
下载安装程序
$wget http://mirrors.xmu.edu.cn/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz
安装
$tar -zxvf install-tl-unx.tar.gz
$cd install-tl*
$sudo ./install-tl --gui -location http://mirrors.xmu.edu.cn/CTAN/systems/texlive/tlnet/
安装 TeXworks.
$sudo aptitude install texworks --without-recommends
==== 测试 ====
例子: helloword.tex, 使用 XeLaTeX 编译
\documentclass[UTF8,__nofonts__]{__ctexart__}
\setCJKmainfont{W\enQuanYi Zen Hei}
\begin{document}
Hello world! I am using \TeX.
大家好! 我在使用 \TeX.
\end{document}
提示: 使用 \$fc-list :lang=zh-cn 查看系统安装的中文字体.
注意选项nofonts使ctexart使用系统字体
例子: mathexample.tex, 使用 LaTeX 编译
源文件:
\documentclass{article}
\begin{document}
Let $H$ be a Hilbert space, $C$ a closed bounded
conver subset of $H$, $T$ is nonexpansive self map
of $C$. Suppose that as $n\to\infty$, $a_{n,k}\to0$
for each $k$, and $\gamma_n=
\sum_{k=0}^\infty(a_{n,k+1}-a_{n,k})^+\to0$.
Then for each $x$ in $C$, $A_nx=\sum_{k=0}^\infty
a_{n,k}T^kx$ converges weakly to a fixed point of $T$.
$$\lim_{n\to\infty}x_n\ {\rm\exists}\iff
\limsup_{n\to\infty}x_n=\liminf_{n\to\infty}x_n.$$
\end{document}
===== 管理宏包 =====
$sudo tlmgr --gui
The Comprehensive TeX Archive Network (CTAN) 镜像
http://tug.ctan.org/tex-archive/
http://ftp.ctex.org/mirrors/CTAN/
http://mirrors.xmu.edu.cn/CTAN/
http://oss.ustc.edu.cn/CTAN/
===== 常用网站: =====
TUG (the TeX user group) http://www.tug.org
CTeX 论坛 http://bbs.ctex.org
华东师范大学数学系 LaTeX 科技排版网页http://www.math.ecnu.edu.cn/~latex/
LaTeX 编辑部http://zzg34b.w3.c361.com/index.html
===== Debian GNU/Linux 中 TeXLive 的中文支持 =====
===== 环境介绍 =====
系统: Debian GNU/Linux sid
版本: TeXLive 2009
演示文稿: beamer 宏包
字体: 文泉驿正黑
locale: LANG=zh\_CN.UTF-8
===== 管理: =====
$sudo tlmgr --gui
确保已经安装: collection-langcjk, collection-xetex, ctex, xecjk
==== LaTeX 的中文支持 ====
CCT, 天元TeX
CJK
XeTeX XeLaTeX
ctex, xeCJK 宏包
例子: helloword.tex, __使用 XeLaTeX 编译__.
\documentclass{article}
\usepackage{fontspec}
\XeTeXlinebreaklocale "zh" % 针对中文进行断行
\setmainfont{WenQuanYi Zen Hei}
\begin{document}
Hello world! I am using \TeX.
大家好! 我在使用 \TeX.
\end{document}
提示: 使用
$fc-list :lang=zh-cn
查看系统安装的中文字体.
http://wiki.ubuntu.org.cn/免费中文字体
例子: ctex.tex 使用 XeLaTeX 编译.
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont{WenQuanYi Zen Hei}
\begin{document}
Hello world! I am using \TeX.
大家好! 我在使用 \TeX.
\zihao{1} 一号字体: \TeX 是一种排版工具
\end{document}
===== Adobe 字体 =====
AdobeSongStd-Light.otf
AdobeFangsongStd-Regular.otf
AdobeHeitiStd-Regular.otf
AdobeKaitiStd-Regular.otf
下载: Adobe Reader 9.1 Font Packs - Chinese Simplified
里面有宋体和黑体.
$sudo mkdir /usr/share/fonts/adobe
把otf字体文件复制到 /usr/share/fonts/adobe
$sudo cp Adobe*.otf /usr/share/fonts/adobe/
$sudo fc-cache -fsv
$ fc-list | grep Adobe
例子: adobefont.tex, 使用 XeLaTeX 编译.
\documentclass[UTF8,adobefonts]{ctexart}
\begin{document}
默认字体 default fonts \TeX 是一种排版工具 \\
{\bfseries 粗体 bold \TeX 是一种排版工具}\\
{\songti 宋体 songti \TeX 是一种排版工具}\\
{\heiti 黑体 heiti \TeX 是一种排版工具}\\
{\kaishu 楷书 kaishu \TeX 是一种排版工具}\\
{\fangsong 仿宋 fangsong \TeX 是一种排版工具}\\
\end{document}
安装 CJK 字体 uming ukai (明体是__港台__字体)
$wget ftp://cle.linux.org.tw/pub2/tex/cjk/fonts/nsungt1/nsungt1-1.4.2.tar.gz
$wget ftp://cle.linux.org.tw/pub2/tex/cjk/fonts/nkait1/nkait1-1.4.2.tar.gz
$tar -jxvf nsungt1-1.4.2.tar.gz
$tar -jxvf nkait1-1.4.2.tar.gz
$./nsungt1-1.4.2/install.sh
$./nkait1-1.4.2/install.sh
注意: 普通用户安装, 而不是使用 root 用户安装.
例子: nsung.tex, 使用 pdflatex 编译
\documentclass[12pt,a4paper]{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{nsung}
\section{New Sung 新宋字型 \LaTeX\ CJK 測試}
晉太元中,武陵人,捕魚為業,緣溪行,忘路之遠近;忽逢桃
花林,夾岸數百步,中無雜樹,芳草鮮美,落英繽紛,漁人甚
異之。復前行,欲窮其林。林盡水源,便得一山。山有小口,
彷彿若有光,便捨船,從口入。
. . . . . .碁嫺。凃凉双崐喆峯酶酞肽脲腚釟迌堃韮。
角觸過骨。許功蓋測試。这里是简体字。许功盖测试。
這裡是日文:こんにちは 世界。
\end{CJK}
\end{document}
例子: nkai.tex, 使用 pdflatex 编译
\documentclass[12pt,a4paper]{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{nkai}
\section{New Kai 新中楷字型 \LaTeX\ CJK測試}
晉太元中,武陵人,捕魚為業,緣溪行,忘路之遠近;忽逢桃
花林,夾岸數百步,中無雜樹,芳草鮮美,落英繽紛,漁人甚
異之。復前行,欲窮其林。林盡水源,便得一山。山有小口,
彷彿若有光,便捨船,從口入。
. . . . . .碁嫺。凃凉双崐喆峯酶酞肽脲腚釟迌堃韮。
角觸過骨。許功蓋測試。这里是简体字。许功盖测试。
這裡是日文:こんにちは 世界。
\end{CJK}
\end{document}
1,其余的adobe字体下载看这里
http://bbs.ctex.org/viewthread.php?tid=47618&extra=page%3D2
2,除参考ctex.pdf xecjk.pdf
外还可以参考xetexmain.pdf 的 Typesetting Chinese
还有这里 http://bbs.ctex.org/viewthread.php?tid=54661&extra=page%3D1
3, 以 \setCJKmainfont{WenQuanYi Zen Hei} 正黑为默认字体有点怪.
如果不用adobe的字体, 只用__文鼎和文泉驿__的字体, 那么简体字只有__宋, 楷, 黑__可用. 可以设置为
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont{AR PL SungtiL GB}
\setCJKfamilyfont{song}{AR PL SungtiL GB}
\setCJKfamilyfont{kai}{AR PL KaitiM GB}
\setCJKfamilyfont{hei}{WenQuanYi Zen Hei}
\begin{document}
Hello world! I am using \TeX.
默认字体 default fonts \TeX 是一种排版工具
{\bfseries 粗体 bold \TeX 是一种排版工具}
\CJKfamily{song}
宋体 songti \TeX 是一种排版工具
\CJKfamily{kai}
楷书 kaishu \TeX 是一种排版工具
\CJKfamily{hei}
黑体 heiti \TeX 是一种排版工具
\end{document}
复制代码
这时ctex宏包里的
\songti
\heiti
\kaishu
都无法使用,
只能用相应的 \CJKfamily{}来设置字体. 这属于ctex帮助文档 ctex.pdf 版本号:v0.99b里说的
上面的字体在不同的字体选项下有不同的设置,不一定都有定义。
4, 3中字体名称在其它发行版中可能不同, 请 fc-list :lang=zh-cn 查看相应的名称.

7
Zim/Linux.txt Normal file
View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T19:00:32+08:00
====== Linux ======
Created Sunday 27 March 2011

7
Zim/Linux/Archlinux.txt Normal file
View File

@@ -0,0 +1,7 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T19:00:45+08:00
====== Archlinux ======
Created Sunday 27 March 2011

View File

@@ -0,0 +1,56 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-03-27T19:03:01+08:00
====== main chinese fonts ======
Created Sunday 27 March 2011
http://hivelogic.com/articles/top-10-programming-fonts
Chinese, Japanese, Korean, Vietnamese
(Mainly) Chinese
** ttf-arphic-ukai **- Kaiti (brush stroke) Unicode font (enabling anti-aliasing is suggested)
**ttf-arphic-uming **- Mingti (printed) Unicode font
**ttf-fireflysung** - New Sung font
**wqy-zenhei **- Hei Ti Style (sans-serif) Chinese Outline font embedded with bitmapped Song Ti (also supporting Japanese (partial) and Korean characters).
** wqy-bitmapfont** - Bitmapped Song Ti (serif) Chinese font
**ttf-hannom-usong **- Song Ti quality TrueType fonts for Unicode Han and Nom (Chinese and Vietnamese) characters (AUR)
**ttf-dejavu **-Font family based on BItstream Vera Fonts
**ttf-fireflysung** --firefly embedded bitmap font
**ttf-freefont** --A set of free high quality TrueType fonts
**ttf-inconsolata-g** --monospace font for pretty code listings and for the terminal
**ttf-ms-fonts**
ttf-vista-fonts — Consolas a best coding fonts
monaco-linux-font -- 苹果提供的字体和inconsolata、consolas一样比较适合编程
**ttf-mac-fonts — apple fonts:**
ttf-mac-fonts /usr/
ttf-mac-fonts /usr/share/
ttf-mac-fonts /usr/share/fonts/
ttf-mac-fonts /usr/share/fonts/TTF/
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Bold.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-BoldItalic.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Italic.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Light.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-LightItalic.ttf
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond.ttf
ttf-mac-fonts /usr/share/fonts/TTF/HardGothicNormal.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Console.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Grande Bold.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Grande.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida MAC.ttf
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Sans Unicode.ttf
ttf-mac-fonts /usr/share/fonts/Type1/
ttf-mac-fonts /usr/share/fonts/Type1/Lucida G.pfb
ttf-mac-fonts /usr/share/fonts/Type1/Lucida Gr Regular.pfb
ttf-mac-fonts /usr/share/fonts/Type1/Lucida MAC Bold.pfb
ttf-mac-fonts /usr/share/fonts/Type1/Lucida MAC.pfb
ttf-mac-fonts /usr/share/fonts/Type1/MACGrande.pfb
ttf-mac-fonts /usr/share/licenses/
ttf-mac-fonts /usr/share/licenses/ttf-mac-fonts/
ttf-mac-fonts /usr/share/licenses/ttf-mac-fonts/SafariWindows.pdf

View File

@@ -0,0 +1,119 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-10-15T19:51:41+08:00
====== Font config for archlinux ======
Created Saturday 15 October 2011
write fellow content in [[/etc/fonts/local.conf]]
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>Times New Roman</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Times</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL New Sung</family>
<family>AR PL ZenKai Uni</family>
<family>Ming(ISO10646)</family>
<family>Kochi Mincho</family>
<family>Baekmuk Batung</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>Verdana</family>
<family>Arial</family>
<family>Tahoma</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL New Sung</family>
<family>AR PL ZenKai Uni</family>
<family>Helvetica</family>
<family>Ming(ISO10646)</family>
<family>Kochi Gothic</family>
<family>Baekmuk Dotum</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>Courier</family>
<family>Courier New</family>
<family>Andale Mono</family>
<family>Luxi Mono</family>
<family>Nimbus Mono L</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL New Sung</family>
<family>AR PL ZenKai Uni</family>
<family>Ming(ISO10646)</family>
<family>Kochi Mincho</family>
<family>Baekmuk Batung</family>
</prefer>
</alias>
<match target="font" >
<test compare="eq" name="family" qual="any" >
<string>AR PL New Sung</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL ZenKai Uni</string>
<string>AR PL Mingti2L Big5</string>
<string>AR PL SungtiL Big5</string>
<string>MingLiu</string>
<string>PMingLiu</string>
</test>
<test compare="more_eq" name="pixelsize" >
<double>8</double>
</test>
<test compare="less_eq" name="pixelsize" >
<double>15</double>
</test>
<edit name="antialias" >
<bool>false</bool>
</edit>
<edit name="hinting" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="autohint"> <bool>true</bool></edit>
<edit mode="assign" name="hinting"> <bool>false</bool></edit>
<edit mode="assign" name="lcdfilter"> <const>lcddefault</const></edit>
<edit mode="assign" name="hintstyle"> <const>hintslight</const></edit>
<edit mode="assign" name="antialias"> <bool>true</bool></edit>
<edit mode="assign" name="rgba"> <const>rgb</const></edit>
</match>
<match target="font">
<test name="pixelsize" qual="any" compare="more"><double>15</double></test>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit></match>
<match target="font">
<test name="weight" compare="more"><const>medium</const></test>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit></match>
<match target="font">
<test name="slant" compare="not_eq"><double>0</double></test>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit></match>
</fontconfig>

View File

@@ -0,0 +1,252 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-05-28T14:11:25+08:00
====== linux字体详解 ======
Created Saturday 28 May 2011
http://blogold.chinaunix.net/u2/63996/showart_702667.html
警告
万一本文有更新的版本, 也许可以在 http://fractal.csie.org/~eric/fontconfig 找到,任何使用本文中提及的方法所造成之社会成本损失将不会被负责。
引言
「为什么我把 xxx 升了之后字就变难看了?」
「X 的字真是又丑又难设」
「Fontconfig Xft Freetype 到底是什么关系啊!?!?」
屏幕上的字是用计算机的人整天会看到的,而用屏幕上有限的像素来有效显示文字,又要提高文字的可读性一直不容易。除了点阵字外,早在 80 年代就有的 anti-alias 也使得情况变得很复杂,即使已经过了 20 年,由于
1、各人的视觉喜好不同 - 没有一种样式可以使每一个人都满意
2、不同的操作环境与平台以及显示用的装置 (CRT || LCD)
3、多国语言文字的同时显示
所以能够随着自己的喜好而设定的字型是挺重要的。在各家 X desktop, toolkit 与浏览器的战国时代,前后出现了许多解决方案,而 Fontconfig 是到目前为止,算是广为被支持的一种新的不错的方式,姑且一试,也许它还不能完全令你满意,不过比起从前是来得有弹性多了。
Fontconfig
晚近的 XFree86 除了有了 freetype 的内建,加强了对于 TrueType 等向量字型的支持外,最近 Keith Packard 的 Xft 与 Fontconfig 也是一个对于字型整合所做的尝试,在最新的 XFree86 4.3.x 与 freetype/Xft2/Fontconfig 的支持下X 下的程序对于一个统一的字型选择与绘制接口又进了一步。
虽然 XFree86 本身包含 Fontconfig, Fontconfig 事实上是一个可以独立出来的接口,它是一个 library 不是一套 user app, 它所做的就是提供一套 font matching 的机制,让使用 Fontconfig 的程序可以不必自己实作一套字型的选取方法。如此只要使用 Fontconfig 的程序愈多,单一的一套设定档就可以被用在愈多的应用程序,应用程序本身可以利用 Fontconfig 所得到的字型名称去画字,也可以架构在自己原先的字型选择架构之上 (如 Qt), 以达成对旧的设定的一定的向后兼容性。
Fontconfig 有许多好处,例如:
字型的安装。与其把要用的字型拿来放在一个目录, 然后用 ttfmkdir / defoma / ttfm 等东西生出 fonts.dir 再指给 xtt/freetype, 再重新启动 X font server 或 xset fp rehash, 现在只要把字型丢或 symlink 到 ~/.fonts 或任何其它经过指定的目录, 就可以 _立即_ 开始使用了。当然在使用没有支持 Fontconfig 的程序时, 仍然要用传统的方法。Fontconfig 除了可以吃 TrueType, 也可以吃 Type1 或 pcf 等等传统的点阵字。
字型 matching 的设定。虽然 Fontconfig 已经附上了一套不错的设定档让在未被设定的情况下也都能够有一个可以使用的系统,但其实对于个别字型的设定更有弹性。这个是透过 Fontconfig 所使用的 xml 设定档达成的。稍后再说。
Fontconfig 会尽可能找出一套字,可以满足显示不同语言的需求。
Xft
Xft 也是一套 library, 它使用 Fontconfig match 到了所要的字型之后, 来决定该如何画这些字。Xft 会看情况而决定要不要使用 core protocol 或 XRender 来画字。XRender 是 XFree86 4.x 新增的 extension, 我认为这是为了保留 X 的向后兼容性所新增的一个 hack, 不过因为它可以用来画 anti-aliased 的字,目前的使用愈来愈广泛。不过 anti-aliased text 只有在使用向量字型的时候有用, 绘制点阵字的时候就要使用 core lib. Core library以 x-truetype 或 freetype 作为 backend自然也是可以画向量字只不过画出来的就不能有 anti-aliased 的效果了。
有时当 XRender 不能使用时(如你是透过网络用一个旧的 X server 来执行 X apps, Xft 也可以使用 core lib 来画字。应用程序不必为这些问题操心,达到信息隐藏、各谋其政的目的。
Freetype
Freetype 是一个很棒的画字函式库XFree86 4.3 内含了 2.1.2. Freetype 提供 Xft 如何画字的信息,包括处理 anti-aliasing 或 hinting. 因此 freetype 的改变会影响到 Xft 画出来的字,而 Fontconfig 的改变会影响到 Xft 如何去选字来画。
fonts.conf
这里所讲的就是最新的 Fontconfig 与 Xft2 的设定。对于旧的 Xft1.0 的 ~/.xftconfig 就不提了。
如果你装了 fontconfig, 那么它应该已经附上了一套预设的设定档。可以到 /etc/fonts/ (一些 Linux distributions) 或 /usr/X11R6/etc/fonts (一些 BSD flavors) 底下找找看 fonts.conf 这个档案。
fonts.conf 是简单的 xml 格式,在 etc/ 里面的 fonts.conf 是 system-wide 的设定,一般不建议直接更改它,可以更改 local.conf 或是自己家目录下面的 ~/.fonts.conf . 关于 fonts.conf 的各种语法,由于 manpage 里头已经写得很详尽,所以这里只是提及比较重要的一些部份,有兴趣者可以 man fonts-conf. 所有的设定都放在 <fontconfig> 与 </fontconfig> 之间,而其中可以包含许多 tags, 详细的 tags 可以参照 fonts.dtd 或者是 manpage.
<dir> 里面是一个路径fontconfig 会自己递归地去找这个路径里头的所有字型,如: <dir>/foo/bar/myfonts</dir>
可以把其它的设定档引进来,它们的格式是一样的。
其中最重要的 element 应该是 <match> 了。match 主要有两种用法, 一种是 pattern match, 另一种是 font match. 前者会把所有的字型 match 出来,所以针对它的更改会套用到所有的字型的选择方式上。为什么要更改字型的属性? 因为这样可以针对个别的字型告诉 Fontconfig 该如何去处理这些字型,或是告诉 renderer 该如何去画这些字型。这里是一些常用到属性的列表,关于所有的属性请洽 manpage
family - String - 就是一般所看到的字型的名称了, 如 Arial
style - String - 字型的 style, 像是 Regular, Bold, Italic...
spacing - Int - 字型的宽度, Proportional 是有不同的宽度, monospace 是单一的宽度 (如 terminal 的字型)
antialias - Bool - 决定该字型是否要被 anti-alias 绘制; 只能用在向量字型上
hinting - Bool - 决定该字型是否要打开 hinting
autohint - Bool - 决定是否要用 Freetype 自己的 hint 方法来 hint 字型, 还是用预设的方法来 hint
rgba - Bool - 决定是否要用 subpixel 的方式来画字, 可以是 none (只用灰阶), rgb, bgr, vrgb, vbgr
Hinting 用来最佳化字型显示的方法。由于屏幕的像素有限,向量字型的缩放需要有更多的考虑, 例如当一条线位在两个像素格子中间时, 该取左边的格子还是右边的格子? 如果这方面的控制没有做好,就常常会出现字型的衬线没有对齐,或是小字歪七扭八的情况。 Hinting 是额外的信息, 它告诉 renderer 该如何处理这些细节的部份,使得向量字在小字的时候能够好看。也因此 Hinting 是非常费时费人力的工作TrueType 字型很多,但是有良好 Hinting 的字型不多。拙劣的 Hinting 就会让字变得很难看。
为了稍微改善这个问题freetype 有 autohint 的功能,可以自动为没有 hint 的字型做 hinting 的工作。另外由于 TrueType 的 hinting 是有专利的,不能完全自由地使用, autohint 就不受这个限制。autohint 自然无法做得像人力的 hint 一样好,不过至少比没有 hint 要好些。话虽如此,对于许多笔划复杂的文字 (如中文) 目前 freetype 的 autohint 还做得不甚完美,而因为建立完整的 hinting 的难度,即使是英文字,原本就很高,内建有 hinting 的中文字型就少之又少了。所以常常有人抱怨中文字在屏幕上很难看,就是没有理想 hinting, 或者是使用了 autohinter 所造成的一些反效果。
Anti-alias 是将字型在幕后先以数倍的大小来绘制,然后再缩成想要的大小,未满一格的格子用灰阶补点。由于原本 X 所支持的 logic 运算不敷使用,所以才用 XRender 的 extension 来达成目的。除了一般的 Anti-alias 之外Xft 还支持了为 LCD 所设计的 subpixel rendering.
什么是 subpixel rendering? 如果你用放大镜去看 LCD, 会发现一个正方形的像素是由三个长方形小像素构成的。这排列通常是红绿蓝,也就代表如果液晶屏幕的水平分辨率是 1024 个像素,它其实有 1024x3 = 3072 个点,只不过这些点是 rgbrgbrgb... 依序排列的。以白底黑字为例如果需要满格的像素rgb 三格就需是全关 (0,0,0), 如果只是右边三分之二部份, 就关掉 g 和 b, 留下最左边的 r 开着。这样子理论上就会有原来三倍的水平像素可以使用,大幅增加了液晶屏幕的分辨率。但由于只开着红色或黄色或其它颜色,会有很明显的光晕,所以一般会采用 filtering 的方式,把一个次像素的值往左右两格分散(因为无论对哪一格次像素来说,它的左右两格的颜色和本身都是不同的,所以往左右两格分散可以均匀影响亮度),成为 1/3, 1/3, 1/3 分布;但这样的坏处是会显得太模糊了一点,于是再多一层,把原先三格分成 5 格,但权重改为 1/9 2/9 3/9 2/9 1/9。3/9 那一格就是原本的次像素而邻近的格子就用这样的方法分散后和原来该次像素格子的光度值相加达到像素往中央集中却又不太模糊的效果。Windows XP 有个 ClearType 选项可以打开对液晶屏幕显示最佳化,其基本原理就是 subpixel rendering. Xft 也有这样的功能,不过 Xft 做得更多,除了 subpixel 外,还加上了 anti-aliasing。Fontconfig 的 rgba 选项就是设定液晶屏幕次像素的排列方式,一般都是 rgb, v 开头的表示三种颜色是纵向排列。如果好奇的话可以拿放大镜仔细瞧瞧,或用数字相机近拍下来放大观察。
很多问题是出在 hinting, 因为许多时候, distribution 会把 freetype 的 bytecode hinting 打开,代表使用字型内部的 bytecode 来做 hinting 修正,如果像 freetype 预设没有打开或是使用 freetype 里头的 autohinter, 有时效果不错,有时却不尽人意。另外 hinting 费时费力,大部分的字型设计师在做 hinting 的时候都只有针对点阵字的显示做 hinting 的工作,这表示如果我们在显示小字又用 anti-aliasing 的话,通常是不在字型设计师最佳化的范围内的; 当 hinting 不当的时候,小字 anti-aliasing 就会显得非常难看(如歪七扭八或挤成一团)。关于这方面 freetype 做了很多的努力, autohinter 也就是让程序自己做 hinting 的算法。由于 hinting 实在是个很棘手的问题Mac OS X 对于 anti-aliasing 字型就都不使用 hinting. 好在 fontconfig 可以让我们调整这些细部的设定,让我们针对个别的字型做不同的处理。
话题回到 pattern match: 要使用 pattern match, 只需要加入如下的 pattern, 它就会对所有的字型作用:
<match target="pattern">
...
</match>
中间放的可以是一连串的 test, 然后是一连串的 edit. test 的用法是:
<test qual="any|all|first|not_first"
name="属性"
compare="eq|not_eq|less|less_eq|more|more_eq|contains|not_contains">
</test>
any 指的是说, 只要字型的该属性 list 之中有一项有符合要 test 的值, test 就会成立。all 的话要 list 之中所有的都符合first 要第一个符合, not_first 要除了第一个以外有符合的。通常只会用到 any, 预设也是 any. name 里面填的就是前面所提的属性, 如 name="family". compare 是比较的条件, eq 是相等, less 是小于, 以此类推。 <test> 所包住的那个值就是要用来比较的值,包括: int, double, string, matrix, bool 等等。一旦 test 的条件都成立, 就会进行到 edit 的阶段,代表编辑符合条件上述 test 条件的属性:
<edit name="属性"
mode="assign|assign_replace|prepend|append|prepend_first|append_last">
</edit>
注意在 fontconfig 中, 属性 (property) 可以是一个 list, 亦即一个属性可有许多的值。 assign 是说把 match 到的值取代掉, assign_replace 是说把该 list 的所有值取代成指定的值, prepend 则是插在 list 中被 match 到的那个值的前头, 以此类推。
fonts.conf 里面有一个范例:
<match target="pattern">
<test name="prefer_outline">
true
</test>
<test name="family">
<string>Times</string>
</test>
<edit name="family" mode="prepend" binding="same">
<string>Times New Roman</string>
</edit>
</match>
这个 pattern match 是说, 当 prefer_outline 的值是 true 的时候, 而且字型的 family 又叫做 Times, 那么就把它的 family list 前面加入 Times New Roman。这样做的原因是, Times 本身是点阵字, 如果希望在许多应用程序指定用 Times 显示时, 不要用点阵字显示, 而要用 Times New Roman 这个 TrueType 字型显示, 这样可以把 Times New Roman 的优先权提在 Times 的前面。 Family matching 是另一种 match 方法,它的用法和 pattern matching 差不多,只是它是针对个别字型的属性作修改,用法是:
<match target="font">
...
</match>
举个例子,如果我想让所有字型预设能够打开 anti-aliasing, hinting 并且使用 subpixel rendering, 我就写:
<match target="font">
<edit name="antialias">true</edit>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
<edit name="hinting">true</edit>
</match>
但是我可能觉得 Luxi Mono 这个字型在某些时候, subpixel 不太好看, 我就写:
<match target="font">
<test name="family"><string>Luxi Mono</string></test>
<edit name="rgba"><const>none</const></edit>
</match>
FAQ
Q. 我手上有很多 ttf, 我要怎么装它们?
前面说过啦, 把它们全部丢到 ~/.fonts/ 里头去吧。做 symbolic link 也可以。丢完之后就跑一下 fc-list 列出所有已安装的字型看看有没有在里面。
Q. 我装好了字型, 可是我的程序 (rxvt, aterm, gtk1.x) 却不能使用它们?
因为这些程序是使用 X 的 core fonts, 不是使用 fontconfig 也没有支持 Xft, 就没有办法享受这样的便利,不过还是可以透过传统的方式来装这些字型。新的 gtk2, Gnome2, mlterm, Mozilla (Firebird), Qt3.x 都支援了 fontconfig。
Q. 我想要使用新细明体,可以吗?
可以, 把 mingliu.ttc 丢到 ~/.fonts 就行了。
Q. 我想要像 Windows 上小字那样的新细明体,那是怎样办到的呢?为什么在一些大小,新细明体的笔划会破碎呢?
(新) 细明体在 11, 12, 13, 15, 16, 20 点的大小有特别做内嵌的点阵字,换句话说,由于中文字的 hinting 不易,有时点阵字会比较有效。又因为新细明体使用了 bytecode 来组合笔划, 没有编进 bytecode interpreter 的 freetype 版本在 render 的时候,就会碎掉。请确定您系统上 freetype2 的 source 之中, include/freetype/config/ftoption.h 里面的 #defineTT_CONFIG_OPTION_BYTECODE_INTERPRETER 是不是有打开。也不可以使用内建的 autohinter. 由于是上述几个特定的大小是内建点阵字型,所以没有被 bytecode interpreter 影响。
确定了 freetype 有编进 bytecode interpreter 之后, 设定让新细明体在这些大小时显示内建的点阵字而不要用 anti-aliased, 可以在 ~/.fonts.conf 加入:
<match target="font">
<test name="family"><string>PMingLiU</string></test>
<edit name="antialias">true</edit>
<edit name="hinting">true</edit>
<edit name="autohint">false</edit>
</match>
<match target="font">
<test name="family"><string>PMingLiU</string></test>
<test name="size" compare="less_eq">12</test>
<edit name="antialias" mode="assign">false</edit>
<edit name="hinting" mode="assign">true</edit>
</match>
Q. 我的细明体 (MingLiU) 的英文字和中文字会等宽?
因为 MingLiU 宣称自己是 monospaced 字型,但实际上它有两种宽度:中文的全角以及英文的半角。于是 freetype 就被骗了; 同样的事情也发生在其它华康的一些字型上。Freetype 有个 globaladvance 的 flag:
<match target="font">
<test name="family"><string>MingLiU</string></test>
<edit name="globaladvance">false</edit>
</match>
万一因为不明的原因, 这样做没有用, 那么还可以改 spacing:
<match target="font">
<test name="family"><string>MingLiU</string></test>
<edit name="spacing">0</edit>
</match>
0 是 proportional 的 spacing, 100 是 mono, 110 是 charcell.
Q. 我想要把 Gnome2 选单的中英文字型分开设。
Gtk2 可以使用两组特殊的 alias: Sans 和 Serif. Sans 是无衬线的意思,也就是如 Arial, Verdana 等等边缘是方的字。Serif 则是有衬线的字,如 Times. 由于 fontconfig 有字型取代的机制, 可以修改 /etc/fonts/fonts.conf 里面的这一段:
相关:
Screenshot
<alias>
<family>Bitstream Vera Sans</family>
<family>Helvetica</family>
<family>Arial</family>
<family>Verdana</family>
<family>Nimbus Sans L</family>
<family>Luxi Sans</family>
<family>Kochi Gothic</family>
<family>PMingLiU</family>
<family>AR PL KaitiM GB</family>
<family>AR PL KaitiM Big5</family>
<family>Baekmuk Dotum</family>
<family>SimSun</family>
<default><family>sans-serif</family></default>
</alias>
与这一段:
<alias>
<family>sans-serif</family>
<family>Bitstream Vera Sans</family>
<family>Verdana</family>
<family>Nimbus Sans L</family>
<family>Luxi Sans</family>
<family>Arial</family>
<family>Helvetica</family>
<family>Kochi Gothic</family>
<family>PMingLiU</family>
<family>AR PL KaitiM GB</family>
<family>AR PL KaitiM Big5</family>
<family>Baekmuk Dotum</family>
<family>SimSun</family>
</alias>
把想要加入替换 list 的字型加进去。排愈前面的字型, 在当他有符合要显示的语言的文字的时候就会被用上,如我把 PMingLiU 设在文鼎字型前面PMingLiU 就会在需要显示中文的时候优先被选到。当然严格来说PMingLiU 并不能算是 Sans-serif 而要算是 serif, 但因为我要跟 Bitstream Vera Sans 搭配,故放在一起。
Q. 我遇到了奇怪的问题,可是不知从何找起,怎么办?
XFT_DEBUG 这个环境变量可以显示不同的侦错信息,打开一个 terminal, 把 XFT_DEBUG 设在要执行的程序之前,也许它可以帮助你找到问题。其中可以设的数值有:
XFT_DBG_OPEN 1
XFT_DBG_OPENV 2
XFT_DBG_RENDER 4
XFT_DBG_DRAW 8
XFT_DBG_REF 16
XFT_DBG_GLYPH 32
XFT_DBG_GLYPHV 64
XFT_DBG_CACHE 128
XFT_DBG_CACHEV 256
XFT_DBG_MEMORY 512
要同时开启某几个侦错选项,就把它们的值相加就可以了。如 XFT_DEBUG=3 mozilla 就是以开启第一和第二选项的模式来开启 mozilla. 有趣的是,当 GLYPH 和 GLYPHV 同时开启时, Xft 会在 console 用 ascii art 印出它所画的字
Q. 我手上的字型都很难看。有什么比较不错的字型?
英文字型来说, Bitstream Vera Sans, Bitstream Vera Serif, Bitstream Vera Mono 都是高质量又是 free 的字型。Bitstream Cyberbit 可以免费取得(现在已经不是免费的了),又有颇完整的 Unicode coverage, 包含中日韩等等的字集。另外 Microsoft 和 Monotype 买的 Verdana, Times New Roman 等等也都具有漂亮的 hinting; Kochi Gothic 和 Kochi Mincho 是高质量的 free 日文字型。Arial Unicode MS 的 Unicode coverage 也很大,只是这套字型为了这么大的 coverage, 相对地在许多地方,如笔划与外观,就必须做出一些牺牲。如果要拿来看中文的小字的话,目前最好把 hinting 关掉(中文字型大部分把 hinting 关掉会有比较令人高兴的外观,除了新细明体是一定要打开以外)
Q. 这份 FAQ 实在太没有帮助了。我要找的问题都找不到。很多地方都写错了。
如果有写错的地方,为免再造成误导,也请不吝指正。这里是 wiki, 也可以直接点上面的 Edit this page 来加入自己的修改。
Q. 我照着这些方法设却不能动。一切都太麻烦了!
要让一切合自己的意要付出一定的代价。或许你可以找到一个会设的人,请他吃一顿饭或什么的,然后找他来帮你照你的意思设。

View File

@@ -0,0 +1,53 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T14:24:06+08:00
====== 也谈编程等宽字体 ======
Created Saturday 24 September 2011
http://be-evil.org/post-42.html
作为程序开发者,每天打交道最多的就是程序代码了,而每天读写几千行的代码让眼睛很容易产生疲劳,我自己对此已经是深恶痛绝了.为了保护自己眼睛同时提高自己的代码读写效率,显然是要从显示程序代码的字体入手.下面讲讲我编程多年以来代码字体的选择之路
目前很多人都还在使用宋体作为自己IDE的程序显示字体,这个字体英文和数字的显示显然让我不敢恭维,看上十五分钟眼睛都酸胀到不行...
{{./宋体.gif.bmp}}
宋体代码显示样子,单独看估计也看不出什么效果
我对编程字体的要求比较高:字体大小要适中、字体必须是等宽能轻松的分辨0O间距适中才方便识别的条件下尽可能的显示更多的代码行数下面就是我的个人比较推荐的等宽编程字体
首先出场Courier New
{{./courier-new.gif}}
Courier New 是老牌的经典等宽编程字体了Windows系统自带很多代码编辑器默认的字体都是它程序的教科书上也能经常看到它的身影。经典归经典但是我却不太喜欢它用10px的吧无论是液晶还是CRT显示器下都显的毛呼呼的辨认起来很困难眼睛容易疲劳用11px吧字体几乎大了50%,本来字体间距就很宽,一变大,屏幕可视范围内无论是横向还是纵向就没有多少代码能看到了。没办法,用了一段时间后淘汰了它。
Fixedsys
{{./fixedsys.bmp}}
Fixedsys是和Courier New一样经典的字体Windows系统自带很多开发者都在用它它属于点阵型字体方方正正。但是由于是点阵字体字体很粗且符号显示很难看特别是复杂点的正则表达式读起来真是要我命3000.用了一段时间后淘汰...继续寻找。。
Consolas
{{./consolas.bmp}}
Consolas是2005年微软随着VS.NET 2005发布的一款专用编程字体凭着“专用”这2个字就让我使用了它很久等宽字体粗细均匀用起来的确很不错。不过很可惜它也没让我坚持下来原因有下11px大小下__粗体爆丑__完全和不粗的时候是2个样子感觉就像发福了的美女。然后括号过高多行代码开起来没有整齐的美感天哪我太完美主义了。。在我变态的要求下Consolas也被我pass了
Lucida Console
{{./lucida-console.bmp}}
Lucida Console也是Windows自带的一款经典等宽字体字体大小适中字形美观大方我看到时非常喜欢但是使用一段时间后发现一个严重的问题__字行距太紧__2行代码之间几乎只有1px的距离看多行代码时感觉一堆字符挤在一起十分难受没办法淘汰。。。
Monaco
{{./monaco.bmp}}
Monaco据说是来自Mac的一位美女认识她时我就深深的喜欢上了它优雅的字体和符号让我使用了很久但是用久了以后苛刻的我又挑出2个理由淘汰了它__字体过于细长__比起其他的字体识别起来要长长时间阅读容易疲劳。__字体行距距过长__与Lucida Console相反Monaco行距相当高加上字体本身就是细长的导致一个页面显示行数比其他字体最多少出10行之多,每天我就不知道要多转多少次鼠标滚轮,所以。。淘汰。。(但是archlinux中有修正的版本。)
最后 Lucida Sans Typewriter
{{./lucida-sans-typewriter.bmp}}
它与Lucida Console本是同根生拥有着Lucida家族的所有长处而且最好的地方就是解决了Lucida Console行距过短的问题它无论是大小可读性美观我都无可挑剔而且先前那些字体的不足它全部都没有。目前我将所有的编辑器的字体都设置为 Lucida Sans Typewriter ,不知道在未来我是否能够在它身上找出问题,但是至少它是我觉得最好的编程字体,现在我会一直使用它的。。
附录:
编程用字体选择标准:
1. 所有字符等宽
2. 简洁、清晰、规范的字符形体
3. 支持ASCII码为128以上的扩展字符集
4. 空白字符(ASCII: 0x20)与其他字符等宽
5. '1'、'l'和'i'等三个字符易于区分
6. '0'、'o'和'O'等三个字符易于区分
7. 双引号、单引号的前后部分易于区分,最好是镜像对称的
8. 清晰的标点符号外形,尤其是大括符、圆括符和方括符
Monospace/Fixed Width Programmer's Fonts: http://www.lowing.org/fonts/

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

View File

@@ -0,0 +1,31 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T15:09:41+08:00
====== 字体名历史 ======
Created Saturday 24 September 2011
Lucida
Lucida是一个西文字体家族名由查尔斯·毕格罗Charles Bigelow和克里斯·霍尔姆斯Kris Holmes于1985年设计。
这个家族由很多变体,包括黑体 (Blackletter)艺术体Calligraphy手写体Handwriting衬线 (Fax, Bright)和无衬线体Sans, Lucida Sans UnicodeLucida GrandeSans Typewriter等等
Bigelow&Holmes公司于TeX的厂商Y&Y合作制作了一套完整的TeX用数学符号因此这个字体也是少数TeX数学公式排版能使用的字体之一。
Lucida Console也是英文版Windows XP和Windows CE中蓝屏死机和 Windows記事本的默认字体。Lucida Sans Demibold轮廓和Lucida Grande Bold体完全一样但是数字间距较紧被用于苹果公司的Mac OS X操作系统以及其他众多程序包括Front Row。
Arphic
arphicttf 是由文鼎科技提供, 包含文鼎PL細上海宋文鼎PL中楷BIG-5碼和文鼎PL簡報宋、文鼎PL簡中楷GB碼。它可以被用來 作為 X Window 系統或是排版軟體例如 CJK。感謝文鼎科技您可以 在 GPL-base 版權下自由散佈這些高品質的字型。
文鼎字體速查表
檔名 PostScript name Font Family Font Family
bkai00mp.ttf ZenKai-Medium AR PL KaitiM Big5 文鼎PL中楷
bsmi00lp.ttf ShanHeiSun-Light AR PL Mingti2L Big5 文鼎PL細上海宋
gkai00mp.ttf GBZenKai-Medium AR PL KaitiM GB 文鼎PL簡中楷
gbsn00lp.ttf BousungEG-Light-GB AR PL SungtiL GB 文鼎PL簡報宋
微软雅黑
微软雅黑是美国微软公司委托中国方正集团设计的一款全面支持ClearType技术的字体。蒙纳公司Monotype Corporation负责了字体的修饰Hinting工作。它属于OpenType类型文件名是MSYH.TTF在字体设计上属于无衬线字体和黑体。
该字体家族还包括“微软雅黑Bold”粗体文件名为MSYHBD.TTF。这个粗体不是单纯的将普通字符加粗而是在具体笔画上分别进行处理因此是独立的一个字体。
微软雅黑是随着简体中文版Windows Vista一起发布的字体也是Windows Vista和Windows 7默认的字体。在使用ClearType功能的液晶显示器中微软雅黑比以前Windows XP默认的中易宋体更加的清晰易读。另外Microsoft Office 2007简体中文版也附带这个字体。2008年5月6日微软发布了适用于Windows XP的雅黑字体版本。[1]
在涵盖的字库上微软雅黑支持GBK字符集包含了Unicode的所有 20902个中文字符以及中国国家标准化组织添加的大约 80个中文字符还包含了Big5的繁体中文字符和GB2312中的简体中文字符。
当使用于不能显示中文字体名称的系统和繁体中文的系统时会显示为Microsoft YaHei。
缺点
微软雅黑Bold中的“·”这个符号被误植成一个大方框。此问题在最初的0.70版中就存在之后直至6.02版才被修正。
汉字“一”在左右两端没有预留足够空间,使用时很难与破折号区别开来。如“一一说明”。
直排时,部分文字会与下一个字重叠。

View File

@@ -0,0 +1,42 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T09:53:01+08:00
====== 常用英文字体 ======
Created Saturday 24 September 2011
今天向大家介绍一些英文字体,希望在今后的字体设置中,对您的编码有所帮助。
Arial(微软自带)
  Arial是一套随同多套微软应用软件所分发的**无衬线体**TrueType字型。虽然比例及字重weight和Helvetica极之相近但Arial其实是Monotype Grotesque系列的变种。设计Arial时考虑到会在电脑上面使用在字体及字距上都作了一些细微的调整和变动以增加它在电脑屏幕上不同分辨率下的可读性。 一般小字的英文就比较常用这个字体
Helvetica(苹果自带)
  Helvetica是一种广泛使用的西文**无衬线字体**,是瑞士图形设计师马克斯· 米耶丁格Max Miedinger于1957年设计的。Helvetica被视作现代主义在字体设计界的典型代表。按照现代主义的观点字体应该“像一个透明的容器一样”使得读者在阅读的时候专注于文字所表达的内容而不会关注文字本身所使用的字体。由于这种特点的存在使得Helvetica适合用于表达各种各样的信息并且在平面设计界获得了广泛的应用。
Tahoma
  Tahoma是一个十分常见的**无衬线字体**字体结构和Verdana很相似其字符间距较小而且对Unicode字集的支援范围较大。Tahoma和Verdana师出同门同为名设计师马修·卡特的作品由微软在1999 年推出。许多不喜欢Arial字体的人常常会改用Tahoma来代替除了是因为Tahoma很容易取得之外也是因为Tahoma没有一些Arial为人诟病的缺点例如大写“I”与小写“l”难以分辨等。Tahoma被采用为Windows 2000、Windows XP、Windows Server 2003及Sega游戏主机Dreamcast等系统的__默认字型__。
Verdana
  Verdana是一套**无衬线**字体由于它在小字上仍有结构清晰端整、阅读辨识容易等高品质的表现因而在1996年推出后即迅速成为许多领域所爱用的标准字型之一。“Verdana”一名是由“verdant”和“Ana”两字所组成的。“verdant”意为“苍翠”象征著“翡翠之城”西雅图及有“常青州”之称的华盛顿州。“Ana”则来自于维吉尼亚·惠烈大女儿的名字。
Lucida Grande
  Lucida Grande是一种西文无**衬线体**字体属于人文主义体。它是苹果公司Mac OS X操作系统的默认字体。作为Lucida字体家族的一员它的设计师是查尔斯·毕格罗Charles Bigelow和克里斯·霍尔姆斯Kris Holmes。它的数字版本属于TrueType并且贯穿了整个Mac OS X 图形用户界面。
Times New Roman
  Times New Roman泰晤士新罗马可能是最常见且广为人知的**衬线字体**之一在字体设计上属于过渡型衬线体对后来的字型产生了很深远的影响。另外由于其中规中矩、四平八稳的经典外观所以常被选为标准字体之一。更多的知识欢迎您浏览52CSS.com的更多文章。
Georgia
  Georgia是一种**衬线字体**为著名字型设计师马修·卡特Matthew Carter于1993年为微软所设计的作品具有在小字下仍能清晰辨识的特性可读性十分优良。其命名发想自一份小报报道在美国佐治亚州发现外星人头颅的测试性头条。微软将Georgia列入网页核心字型是Windows系统的内建字型之一。苹果电脑的麦金塔系统之后也跟进采用Georgia作为内建字型之一
Garamond
字体格式OpenType (适用于PC & Mac )
字族数量4 Style
该款字体被誉为最常用的四款字体之一,国外许多资料文献都使用该字体,所以被称为**最佳阅读字体**。Garamond是个用途广泛的字体苹果用它国外的高级餐厅Menu用它。Garamond的易读性非常高由于它适合大量且长时间的阅读几百年来西方文学著作常用Garamond来作内文的编辑。Garamond演绎出许多优美的字体1964年出现的Sabon是其中最流行的一种。高级餐厅的Menu和高档红酒的酒标上都常见到这个古典而优雅的字体。“教父”导演科波拉在Napa有个漂亮的葡萄酒庄Niebaum-Coppola它的网页可说是Sabon这个字体最好的使用范例了。

View File

@@ -0,0 +1,683 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T16:17:17+08:00
====== 文泉驿用户常见问题解答 ======
Created Saturday 24 September 2011
欢迎大家回复、添加与Linux下使用中文、字体、版权相关的常见问题解答参与“文泉驿”用户常见问题解答的编辑工作请选择页面上方的“编辑本页”谢谢
目录
1. 一般性问题
1.1. 不是已经有很多汉字字库了吗?为什么还要再做一个?
1.2. 为什么我的机器上的汉字显示为一个方块或者问号?
1.3. 为什么我屏幕上的汉字边界模糊不清?
1.4. 为什么起“文泉驿”这个名字?
1.5. 什么叫作开放源代码?
1.6. 什么叫作自由软件?与免费软件的区别是什么?
1.7. 什么是版权(Copyright)
1.8. 什么是使用授权(License)
1.9. 计算机字体的版权都包括哪些内容?为什么需要保护?
1.10. 我在我的工程中使用GPL的文泉驿字体那我的工程也会变成GPL吗
1.11. 怎么样可以支持这个项目?有汇款帐号或者什么其它方式的支付途径么?
1.12. 什么是字符集(Charset)
1.13. 什么是编码(Encoding)
1.14. 什么是GB2312, GB13000, GB18030, Unicode和UTF-8
1.15. 汉字有多少个?制作那么多汉字有必要吗?
1.16. 什么是字体(Font)?常见字体有那几种?
1.17. 什么叫字体的Hinting技术什么叫Autohint
1.18. 什么叫Wiki与Blog的区别是什么
1.19. 您们制作的字体可以在Windows/Mac/Unix/PalmOS上使用吗
1.20. 我参与这个计划我能够得到什么?
2. Linux系统中文安装和使用的常见问题
2.1. 如何安装新的字体(BDF/PCF/TTF)
2.2. 如何让XMMS的歌曲列表正确显示中文
2.3. 如何为Acrobat Reader安装中文支持
2.4. 如何为Xpdf安装中文支持
2.5. 如何让Emacs使用WenQuanYi Bitmap Song
2.6. 如何为Ghostview安装中文字体
2.7. 如何在OpenOffice中使用中文
2.8. 如何在Kylix中使用中文
2.9. 如何设置浏览器(Mozilla/Firefox)中的中文字体?
2.10. 如果没有管理员权限,如何安装字体?
2.11. 如果没有管理员权限,如何安装输入法?
2.12. Linux下如何书写latex中文文档
2.13. Linux上如何识别和搜索字体文件
2.14. 什么是xfs
2.15. 什么是fontconfig如何设置fontconfig
2.16. 在Linux下使用Windows下微软的字体和SimSun是否合法
2.17. 什么叫Locale
2.18. Linux下关于语言的环境变量有哪些相互关系
2.19. 如何设置系统语言为中文?
2.20. 如何在英文环境下显示和输入中文?
2.21. 为什么我的中文目录都是乱码?
2.22. 如何mount含有中文目录或文件名的FAT32 Windows分区
2.23. 如何mount含有中文目录或文件名的NTFS Windows分区
2.24. 如何让Linux下的java程序正确显示和处理中文
2.25. 如何让Linux下的Qt程序正确显示和处理中文
2.26. 如何让Linux下的GTK+/GTK+2.0程序正确显示和处理中文?
2.27. 如何让Linux下的Tcl/Tk程序正确显示和处理中文
2.28. 如何让Linux下的OpenMotif/Lesstif程序正确显示和处理中文
2.29. 如何在wine中运行中文windows程序
2.30. 用什么命令把GB2312/GBK/GB18030编码的文档转换为utf-8编码如何反向转换
2.31. perl程序中如何转换GB2312/GBK/GB18030编码为utf-8编码如何反向转换
2.32. C程序中如何转换GB2312/GBK/GB18030编码为utf-8编码如何反向转换
2.33. 如何让SCIM成为默认输入法
2.34. 如何让fcitx成为默认输入法
2.35. Linux下如何输入GBK汉字
3. 文泉驿点阵宋体用户常见问题
3.1. 我使用的是Debian(Ubuntu/ArchLinux)成功安装wqy后为什么无法选择这个字体
3.2. 使用Debian的用户为什么在fc-cache后fc-list不显示Wenquanyi的点阵字库
3.3. 我使用的是Debian(Ubuntu/ArchLinux)在安装了xfonts-wqy包之后发现firefox显示速度变慢请问应该怎么解决
3.4. 我觉得某个汉字点阵比较难看,我应该如何反馈给开发者?
3.5. 为什么我在term中使用wqy点阵字体英文很难看没有办法对齐
3.6. 我安装了TTF版本的文泉驿点阵宋体为何系统升级后字体就无法使用了
3.7. 文泉驿字体是否支持繁体字?
3.8. 文泉驿点阵宋体中是否使用了APL字体
3.9. 如果我们不喜欢GPL授权希望文泉驿字体重新授权为其他形式比如APL或者OFL请问应该怎么做
3.10. 文泉驿字体是否满足GB18030编码
3.11. 文泉驿字体是否能够在OpenOffice/Abiword/KOffice中使用
4. 文泉驿矢量中文字体常见问题
4.1. 文泉驿正黑体为什么不叫做ZhengHei而叫Zen Hei
4.2. 如何获得文泉驿汉字笔画数据库?数据库以什么样的方式授权?
5. 点阵中文制作常见问题
5.1. 在我的浏览器上不能编辑点阵,这是为什么?
5.2. 点阵预览不能自动更新怎么办?
5.3. 我想知道正在编辑的汉字的发音和意思应该怎么操作?
5.4. 如何升级和安装离线点阵制作工具?
5.5. 离线点阵工具在我的机器上无法启动,应该怎么办?
5.6. 离线点阵工具使用过程中异常退出,我应该怎么办?
5.7. 在线编辑时如何为自己设置一个用户名?
5.8. 如何给自己建立一个Wiki页面
5.9. 如何查看一个点阵汉字的编辑历史?
5.10. 为何有的页面显示“本页只读”?
6. 矢量中文制作常见问题
6.1. 能简单的说一下,怎么进行笔画分析吗?
6.2. 进行笔画分析有什么特别需要注意的吗?
6.3. 笔画分析程序上方的“笔画数”与真实笔画不符合怎么办?
7. 其它常见问题
7.1. 文泉驿的开源字体是不是没有版权?
7.2. 如何正确使用文泉驿Wiki排版格式
7.3. 在什么情况下我可以在我修改的文泉驿字体中添加我的copyright声明
正文
====== 1. 一般性问题 ======
===== 1.1. 不是已经有很多汉字字库了吗?为什么还要再做一个? =====
作者FangQ
从您购买的软件的光盘上特别是Windows或者Office或者购买的汉字艺术字体的光盘上甚至从一些软件公司、政府机构的网页上都可以找到或者下载到汉字字库于是很多人会问为什么我们还要再做一个新的字库这样作有必要吗
答案是肯定的。尽管您可以找到或者使用这些字库,但您需要注意使用这些字库一般需要您遵守一些使用规则:
您可能需要购买才能拥有使用权,非购买的拷贝不但得不到技术支持甚至随时可以被起诉,
您只能在规定的机器或者规定的操作系统上安装并使用比如Windows上自带的汉字字库是不能安装到其他操作系统比如Linux上使用的而Redhat上安装的ZYSong也是不允许安装在其他Linux版本上
您不能对字库进行任何形式的修改,对于字型、字体不满足用户个人需要的情况您只有“盼望”字体开发商在下一个版本会有所改进,除此之外,您没有更好的办法,
您不能随意将您从网络上或者软件光盘上获得的这些汉字字库拿出来打个包提供给别人使用,或者打包到您写的程序中交给客户,无论您赢利与否,这样作从法律上都是违反使用协议的做法。
简言之,您现在能够找到的大多数汉字字体,都不是“自由”的。这里的自由是“自由”软件中定义的自由,与“免费”软件是不能混淆的。
我们现在正在开发的字体将是一个“__自由”的字体__也就是说这个字体的拥有者将获得下述的自由1
您拥有使用这个字体的自由,而我们对您的使用目的没有任何限制
您除了字体文件,还可以同时获得生成这些字体的原始数据,从而您拥有学习字体开发过程的自由
您拥有把这个字体随意拷贝给需要的人,或者放入您的产品中,或者放到您的网页上散播的自由
您拥有随时改进这个字体,并把您改进的结果公布给大家使用的自由
而真正“自由”的汉字字体并不多我们所能够找到的包括台湾文鼎公司在1999年发布的四套字体(宋体两套,楷体两套)以及台湾王汉宗教授贡献的多种繁体字体。另一方面我们对于完整的汉字字库的需求是非常亟切的。不但中国日本韩国等国家的语言文字也都是基于汉字系统。特别是中国大陆、台湾、香港等地汉语用户数目非常庞大同时2000年实施的国家标准GB18030-2000中收录了Unicode中规定的CJK统一表意文字区以及CJK统一表意文字扩展A区中大约27000个汉字这个标准成为在大陆销售软件必须遵循的标准规范所以开发这个自由的汉字字库将对于“自由软件”在中国的健康发展以致于整个软件业的平衡都具有战略性的意义。
===== 1.2. 为什么我的机器上的汉字显示为一个方块或者问号? =====
作者FangQ
一个计算机系统上能够显示汉字大概需要两个基本条件1、操作系统需要能够识别这个汉字的编码并且有处理这种编码的能力2、操作系统需要有这些汉字的“图案”数据也就是字体需要的时候显示在屏幕上。
您浏览的文章也好书写的电子邮件也好实际上传输的并不是汉字本身或者传输的并不是汉字的图案而是汉字的某种编码。如果您的浏览器或者电子邮件软件上显示出乱码或者问号或者方块内四个数字在Linux上这说明您的计算机不能__正确识别__这种编码或者没有安装能够显示这种__编码的字体__。您需要安装能够识别汉语的相应模块并且安装汉字字库这样您的操作系统才能正确显示这些汉语信息。
===== 1.3. 为什么我屏幕上的汉字边界模糊不清? =====
作者FangQ
这种情况可能在Windows、Linux、Mac OS或者各种Unix下都有可能发生而当前最常见的是Linux下。这种情况可能有两个原因
您使用的矢量字体(True-Type,Type1等)内部没有提供__hinting运算__的数据(hinting是一种屏幕显示优化技术通过一定的数学运算根据特定字体的笔画特征来调整像素的显示强度从而达到字体边界清晰易于阅读的目的)
您使用的矢量字体中没有包含事先制作好的、已经经过屏幕优化过的__点阵汉字图形__数据。
对于Linux下常见的字体以及很多网络上能够免费下载的字体基本上都没有完美的解决汉字hinting的问题如果字体渲染器没有从字体文件中发现hinting数据并且没有找到嵌入的点阵汉字位图那么经过Anti-Aliasing(AA反锯齿技术)变换之后得到的就是一个边界模糊汉字。
我们开发点阵中文就是为了解决这个问题。
===== 1.4. 为什么起“文泉驿”这个名字? =====
作者FangQ
“文”即文字之意“泉”取“流通”之意古代“泉”为“钱”的代称也基于此意。最初的想法是将项目命名为“文泉社”google了一下发现是一个日本出版社的名字只好将最后一个字改为“驿”保留一点传统文化特色。
===== 1.5. 什么叫作开放源代码? =====
作者FangQ
开放源代码与自由软件通常是同时提及的。开放源代码是一种与传统上不提供源代码的商业软件开发不同但平行的商业软件开发模式。开放源代码的严格定义可以在OSIOpen Source Initiative的网站获得。
开放源代码是一种理念支持这种理念的是一组具有法律意义的开放源代码软件使用协议这些协议包括了常见的GNU公共使用授权Apache使用授权BSD使用授权MIT使用授权Mozilla公共使用授权等。OSI组织批准的使用授权可以浏览这个链接。
===== 1.6. 什么叫作自由软件?与免费软件的区别是什么? =====
作者FangQ
与英文不同“自由软件”和“免费软件”在中文中是很好区分的。正如我们在这个FAQ的第一个问题的解答中那样自由软件关心的是软件的拥有者拥有自由使用、自由散播、自由修改并发布的自由而对价格并没有规定一定是免费。也就是说自由软件要求您不但把您的二进制产品交给用户而且还要把生成这个产品的原材料(源代码或者数据)也要同时交给您的用户,从而使得您的用户能够通过注入他们新的劳动来改进这个产品。您的用户可以向您通过付费的形式来购买这个软件,但一旦他们拥有这个软件,他们可以在这个基础上进行改进,并将改进后的产品通过赢利或者不赢利的方式销售给他们的用户。一般的说,一个自由软件的所有衍生产品都必须同样满足这个协议,您不能将其中的部分或者全部在不经过软件版权人的许可的情况下变为商业软件。
免费软件是指您可以免费获得或者使用这个软件,但一般情况下您不会拥有源代码,从而没有上述的其他方面的自由。
===== 1.7. 什么是版权(Copyright) =====
作者FangQ
答:版权(copyright)表明了一种原创关系,是对文学、电影、音乐、绘画、软件、设计等的原始创作者的智力财富的一种认可和法律形式的保护。
版权一般不需要申请(当然您也可以申请),作者在作品创作完成的那一个时刻自动获得对这个作品的版权。作者可以在作品上声明这种原创关系。声明版权的方式为 Copyright 或 © 作品创作的年份(多个年份需要用逗号分割) 版权拥有者姓名 All rights reserved。
另外版权有一定的时限。关于版权的具体严格定义请参照【中华人民共和国著作权法】【伯尔尼公约】【世界版权公约】另外还可以参照Wikipedia中的定义和讨论以及Font Foundry Myths的讨论。
===== 1.8. 什么是使用授权(License) =====
作者FangQ
答:使用授权(license)是版权的拥有者对作品的使用者行为的一种约束和规定。使用授权一般规定了用户使用该作品的条件,是否能够修改或者重新发布。从法律意义上来讲(如果有学版权法的可以帮我纠正和改进),授权与契约类似,二者的不同在于契约的双方都必须共同同意契约中的规定,而授权仅需要版权人一方认可即可。
===== 1.9. 计算机字体的版权都包括哪些内容?为什么需要保护? =====
作者FangQ
我们需要重申字体中的“版权”这个概念的含义,以下为个人对这个问题的看法,希望大家讨论。
“版权”或者“著作权”主要在于“原创性”谁创造出新的东西、新的表现形式谁才拥有版权。而字体的版权与其他智力成果的版权一个显著区别在于字体的构形不是“原创”的。字型作为几千年文明的结晶是无数先人们的智慧创造的是属于公有领域public domain的智力财产。这里的“构形”是指汉字笔画的基本形状汉字的拓扑结构和单个汉字特有的几何特征。而开发一个计算机字体新创造的东西有哪些我认为包括1.文字的数字化表现形式2.笔画的特有的艺术装饰,3.字体的hinting以及其他与计算机应用相关的特有的信息。字体开发者对于上述的“原创” 的元素拥有版权。从而字体开发者通过使用授权(license)的形式来限制他们开发出来的字体也是完全合理和有效的。
当然上述的原则在美国理论上并不成立1988年美国版权局认为数字化西文字体不具有原创性所以是不可赋予版权的(uncopyrightable)。然而在现实生活中美国大量的字体开发商特别是adobe和MS通过其他相关的法律法规来对他们制作的数字化字体进行合法的保护而关于“开源”字体的版权和授权问题仍然是大家讨论的一个焦点参见FSF的讨论 http://www.fsf.org/blogs/licensing/20050425novalis )。
中国的版权法更倾向于把汉字字体作为一种艺术作品来进行法律保护(参见http://www.founder.com.cn/cn/news/nr.aspx?nid=297 )。个人来讲,我更倾向于支持这种观点。中文字体与西文字体有很大的差别,中文字体结构复杂,书写工具和书写习惯使得汉字书法的艺术成分远远高于西文字体,而这种艺术成分给汉字字型注入了大量的独立性和原创性。另外汉字数量繁多,完成一个字体需要付出的劳动和技巧要求比西文大很多。所以把汉字字体作为一种艺术形式进行保护是合理的。
从个人感受来看我相信参与了我们前面CJK点阵汉字开发的朋友都会体会到完成一个好的汉字字体的确需要付出非常辛苦的劳动不但需要成千上万小时的劳力还需要很好的技术和艺术处理。从这个角度我们更需要理解和尊重很多中文字体开发商的劳动成果对于他们制作的字体我们需要在版权人的授权允许的前提下进行合法的使用。
===== 1.10. 我在我的工程中使用GPL的文泉驿字体那我的工程也会变成GPL吗 =====
作者FangQ
对于具体的项目和软件是否能够包含GPL字体您需要资讯熟悉知识产权的律师来获得准确的答案。下面只代表个人理解而不代表法律意见。
GPL的软件和GPL的字体在GPL中并不作具体区分。也就是说这里将GPL字体看作代码或者软件来对待字体中包含了绘制曲线图形的数据包含了如何绘制这些图形的指令和参数这些角度上来说字体与软件具有相同的本质二者中可能较大的区别在于字体中的数据段按照比例来说可能相对多些而已。GPL要求如果一个程序需要动态连接(比如在同一个地址空间)一个GPL模块二者之间有非常紧密的联系和通讯或者前者的功能有必不可缺的部分是依靠后者来完成那么这时我们认为这个GPL模块和调用这个模块的程序是一个程序整体。这种情况下整个程序如果需要发布销售公开提供第三方使用等等按照 GPL的规定它必须以GPL授权来申明。如果调用程序与GPL模块之间的关系是松散的可有可无的二者的功能相互独立自恰的那么这时两个程序之间是简单的集合关系(mere aggregation)这时主体程序不会因为包含了这个GPL模块而必须以GPL发布。
上面的关系同样适用于GPL字体。如果主体程序hard code了字体信息比如将点阵数据转换为C代码然后编译在程序当中或者将字体作为程序初始化载入的数据等等凡是这种”紧密“依存关系存在则衍生程序如果发布必须以GPL作为授权申明。如果字体仅仅是程序可以使用的一种外部字体之一可有可无没有包含在程序的其他的数据当中那么在其他条件都满足的情况下合成的程序则可以有独立的授权声明。
不过一般商业软件开发商对GPL模块使用都十分小心一般首先需要咨询律师明确需要承担的责任。直接使用GPL字体的商业软件(除Linux发行版外)现在还很少见到。
其他相关讨论,参见 http://wenq.org/forum/viewtopic.php?f=5&t=715&p=3827#p3827
===== 1.11. 怎么样可以支持这个项目?有汇款帐号或者什么其它方式的支付途径么? =====
作者FangQ
答:虽然我们的组织和项目为非赢利性质的,但维持进行正常的开发,需要付出一定的费用(现在这些费用都是由组织者和参与者无偿地分担的),这些费用包括网站租用、对项目进行有效的宣传费用、对相关资料、必须的设备进行购买的费用等等。为了加快计划进度,我们需要有足够的经费来维持计划的高效运行,从而为开源社区作出有效的工作。
对于拥有信用卡的用户我们的计划可以通过sourceforge的“捐献”机制得到支持进行捐献的页面为 http://sourceforge.net/donate/index.php?group_id=128192 您需要免费注册一个Paypal账号然后从信用卡或者银行账号捐献适当的数额(Sourceforge收取5%的手续费Paypal也收取少量手续费)(这种渠道的安全性是有保证的使用paypal是非常经常的事情)。我们对您的的支持表示感谢对于在美国的朋友您还可以直接汇款给我我的地址可以在我的Wiki页面找到。我向您郑重承诺我们一定会将收到的每一笔捐款用于这个计划。我们也会将捐款的数额和使用状况在我们的主页及时贴出以便监督。
对于国内用户我们提供了中行和建行的捐款账号和支付宝捐款帐号具体信息参见Donation捐款页面。
===== 1.12. 什么是字符集(Charset) =====
作者FangQ
答:字符集(charset或者character repertoire)是一组抽象字符(abstract character)的集合。我们通常所说的字符一般是一个一维或者二维的符号,这个符号可能会具有一定的语义。对于一种语言,语言中常用的或者所有用以表达语义功能的符号构成该语言的字符集。比如所有汉字构成的字符集,所有日语的片假名、平假名构成的字符集,西欧语言字母构成的字符集等。字符集的子集也为字符集,比如所有日本汉字,或者所有繁体字。
===== 1.13. 什么是编码(Encoding) =====
作者FangQ
对于__一个给定字符集__为了在计算机内方便地进行表示我们需要对字符集内的抽象字符元素进行排序对每个元素赋予一个特定的标号用以区别其他字符。从数学角度编码(encoding)是一个从整数集子集到字符集抽象元素的映射。
对于字符集内字符的排序可以有各种各样的办法对于汉语来说可以按照笔画顺序可以按照拼音排序甚至任意顺序进行排列。字符的编码不一定从0或者1开始也不一定连续。这个映射不一定是1对1的映射。
字符的编码一般为一种__约定性__的行为。
===== 1.14. 什么是GB2312, GBKGB13000, GB18030, Unicode和UTF-8 =====
作者FangQ
这些都是__对字符集的编码(encoding)__。其中常见对汉语字符集的编码包括GB2312-1980, GBKGB13000, GB12345, GB18030—2000, Big5, Big5+, HKSCS, Big5+HKSCS, CNS 11643-1992等。
当前国际上__最为通用__的字符编码商业规范是Unicode编码。Unicode是由一个非赢利性组织“Unicode学术学会”建立和发展的涵盖世界大多数流行语言的字符编码形式。对于Unicode的详细解释请参见他们的主页以及中文说明。Unicode现有的标准版本为4.1,其中包含的所有语言符号(超过9万个其中汉字为7万多)列表可以从这个网页浏览。
UCS-2, UCS-4, UTF-32, UTF-16, __UTF-8__, UTF-EBCDIC和UTF-7都是Unicode编码的__具体形式__。他们的定义和相互关系可以参见Wikipedia的说明。
===== 1.15. 汉字有多少个?制作那么多汉字有必要吗? =====
作者FangQ
随着社会的发展历史的演变作为表意文字的汉字总体呈现逐步增多的趋势但常用汉字增加幅度相对比较缓慢。下表总结了一些主要辞书中收集汉字的数目23
辞书 成书年代 汉字总数
尔雅 汉 ??
说文解字 汉 9353
字林 晋 12824
玉篇 宋 22510
字汇 明 33179
康熙字典 清 47035
中华大字典 1915 48902
辞源 1915 12890
汉语大字典 1986 ~56000
中华字海 1994 87019
为了让计算机系统能够更好的处理汉字信息对汉字的编码工作在上世纪70年代就开始进行其中主要的几个汉字标准包含的汉字数目总结在下表中
**编码**类型 发布时间 汉字总数 **字符集**标准
GB2312 1980 6367 GB 12345-90繁体
CNS11643 1992 48027
CCCII 1989 75684
GBK 1995 20902 Unicode 2.0
GB13000 1993 20902 ISO 10646-2000
Big5 1984 13868
HKSCS 1999 4702
GB18030 2000 27484(+) Unicode 3.0
Unicode CJK 20902
Unicode CJK Ext. A 6582
Unicode CJK Ext. B 42711
Unicode CJK Ext. C1 ~24365
对于个人用户来说使用收录汉字较多的字库不一定是一件好事因为这样的字体一般会很大收录CJK Ext. B的True-Type字库一般为20M以上占用内存对系统性能有一定的影响。然而对于汉语学术研究和企业来讲这样的字库是非常有必要的。特别是对于从事古汉语研究古籍整理以及日本韩国文字研究的学者来说显示和编写不常见字甚至罕用字都是日常工作的一部分。而对于从事中文软件开发的企业让自己的汉语软件能够不依赖于其他企业的商业字体对于该企业来说是一个非常重要的战略。
对于开源用户来说,拥有一个能够免费获得的、开放的、完备的汉字库是及其有必要的。一般情况下,开源用户没有商业软件用户那样的企业级的支持,从个人用户的角度,拥有这样一个选择无疑将大大减轻使用中文交流的困难;而从开源软件开发的角度,这样一个字库将彻底解决用户端语言显示的问题,大大减少了作者为考虑用户语言显示以及字体版权而需要付出的疑虑,从而使程序开发和文件发布简化。
兼顾效率和开发难度,我们现在集中在**Unicode CJK Unified Ideograph**规定的20902个汉字的**矢量汉字和点阵汉字**的开发上。该字体的开发可以解决绝大多数自由软件用户的需求。当这个目标完成后,我们将继续开发其他分区的汉字,使得我们的字体成为开源软件中最完备的字库(这样并不意味着您一下子就安装一个很大的字库,相反的,我们开放的开发模式保证您可以通过您的需求,利用字库中的汉字子集制作对于您来说最为需要的字库)。
===== 1.16. 什么是字体(Font)?常见字体有那几种? =====
作者FangQ
字体一般来说需要包含两个要素__字符的图像信息__和__字符编码到这些图像信息的映射__。
字体的主要功能是将__字符的编码转换为一个图片__用以显示在屏幕或者用户界面上。从编码到字符的映射有很多中情况多个编码映射为一个图像(比如fi),一个编码映射到多个图像,但最常见的还是一个编码一个图像。(浏览器等应用程序__识别出字符编码__后根据配置或默认向X服务器的字体渲染引擎发送请求后者将图片返回。)
常见的字体有两大类一类称为__位图字体或者点阵字体__这类字体一般需要用一个二值(0-1)矩阵来表示一个符号0-1矩阵信息将在屏幕上转换为黑白图像这样的字体包括bdf,pcf,fnt,hbf等格式第二类称为__矢量字体__(outline font)这类字体中每一个符号是通过数学曲线来描述的字体中包含了符号边界上的关键点连线的导数信息等__字体的渲染引擎__通过读取这些数学曲线然后进行一定的数学运算来进行渲染。这类字体的好处是字体可以__无限放大__而不产生锯齿使用于高质量的打印和屏幕显示。矢量字体主要包括Type1和True-Type等几类其中Type1和True-Type比较可以从如下链接查看简言之True-Type使用了二次B样条(quadratic Bézier spline)而Type1使用了三次B样条曲线(cubic Bézier spline)来描述符号边界因而TrueType的数学相对简单易于hinting。
===== 1.17. 什么叫字体的Hinting技术什么叫Autohint =====
===== 1.18. 什么叫Wiki与Blog的区别是什么 =====
作者FangQ
答:说得简单一点(但不准确)Wiki就是一个人人都能够编辑的网站。普通的网站一般只允许浏览不让访问者编辑网页的内容而Wiki不同访问Wiki的用户拥有更大的权利他们不但可以修改网页的内容而且可以不断添加新的页面。
Wiki是为在线形式的协同式文档开发设计的。分布在网络上的用户可以通过浏览器来共同编写和维护一个开放式的文档这个文档可以是一本书可以是一个帮助文件或是一个备忘录不论内容是什么Wiki上的用户对于Wiki文档具有同等的权利――创建、编辑和不断修订直到所修订的文档接近完美4。
或许您会问那Wiki跟论坛有什么区别呢简单的说论坛是为了个人与个人之间的交流而Wiki是为一个群体进行创作。论坛上好的文章是一个人的劳动结晶而一个好的Wiki却是无数用户共同劳动的结果。Wiki为这个协作式的创作提供了很多强有力的工具比如说文档修订历史和版本的自动管理关键字的自动链接等等。
那Wiki和Blog有什么区别呢Blog是一个个人信息发布系统也就是说Blog是针对于个人用户的。Blog的拥有者可以通过他(她)的Blog发布新的信息修改已有的信息但浏览者却没有修改这些信息的权利。Wiki则是面向一个群体的这个群体的所有成员都可以平等地编写文档而他们对共同编写的文档平等地享受所有权。
其实Wiki的概念早在1995年就由Ward Cunningham提出来了而Wiki文档和网站的大量发展还是在近几年其中比较著名的包括
维基百科http://en.wikipedia.org/wiki/Main_Page
PlanetMathhttp://planetmath.org/
其他关于Wiki的详细解释可以参见如下地址 http://zh.wikipedia.org/wiki/WikiWiki
1.19. 您们制作的字体可以在Windows/Mac/Unix/PalmOS上使用吗
1.20. 我参与这个计划我能够得到什么?
2. Linux系统中文安装和使用的常见问题
===== 2.1. 如何安装新的字体(BDF/PCF/TTF) =====
关于在Linux下如何安装TTF字体我已整理了一篇文章计划放在我的个人站点上供大家学习。站点地址 http://lifeng.telebyte.com.cn
2.2. 如何让XMMS的歌曲列表正确显示中文
在正确安装中文字体以后进入XMMS的首选项的字体标签栏选中“使用字体集”并且在上面一个字体栏中选中一个中文字体。还需要写一个~/.gtkrc告诉xmms(gtk1.x)程序使用文泉驿的字体。内容如下:
style "gtk-default" {
fontset ="-wenquanyi-wenquanyi bitmap song-medium-r-normal-*-*-130-*-*-p-*-iso10646-1"
}
class "GtkWidget" style "gtk-default"
===== 2.3. 如何为Acrobat Reader安装中文支持 =====
Adobe官方已经推出了简体/繁体中文的Adobe reader 7软件安装后直接支持简/繁体中文的显示。下载页面是 http://www.adobe.com/cn/products/acrobat/readstep2.html 下载完之后解压缩,进入解压出来的目录,运行./INSTALL即可. 对于5.x的Acrobat Reader而言安装中文支持是相当容易用户只需要去Adobe的主页下载相应的支持包即可。解压缩后会发现里面有个安装的脚本执行它然后告诉它您的Acrobat Reader安装在了什么位置即可。对于版本7的Acrobat Reader一个解决方案是从Windows版的Acrobat7中拷贝相应的文件。或者从5.x的支持包拷贝只不过这时需要更改一些目录的名称。
===== 2.4. 如何为Xpdf安装中文支持 =====
对于debian用户非常方便如果您已经安装了xpdf的话
ailantian@vax:~/GNUworks/vecchinese$ apt-cache search xpdf-chinese
xpdf-chinese-simplified - Portable Document Format (PDF) suite -- simplified Chinese language support
xpdf-chinese-traditional - Portable Document Format (PDF) suite -- traditional Chinese language support
简体中文用户只需要再装一个xpdf-chinese-simplified就可以了
安装方法和普通软件安装一样
apt-get update
apt-get install xpdf-chinese-simplified
===== 2.5. 如何让Emacs使用WenQuanYi Bitmap Song =====
在 fedora 4/5 中emacs 的版本是 21.4,语言环境是 UTF-8。由于这时 emacs-21.4 无法正确为汉字选择 ISO10646-1 字体,因此需要设置。安装 wqy-bitmapfont-song.noarch RPM 后,数据文件目录 /usr/share/wqy-bitmapfont-song-%{version} 中包含了一份 emacs 的初始化文件 set-my-fonts.el。这份初始化文件包含的函数为 emacs 定义默认使用的字体集。在 $HOME/.emacs 初始化文件中引用这份文件,当 emacs 在 X 窗口系统中运行时,这份文件就会发挥作用。请将文件复制到 $HOME/.emacs.d/ 目录,然后在 $HOME/.emacs 中追加下面两句:
(add-to-list 'load-path "~/.emacs.d/")
(load "set-my-fonts")
默认使用的字体是 "wenquanyi",这是 wenquanyi 12 的别名。如果希望使用其它字体或字号请自行修改这份文件中set-my-font-if-in-x 函数的参数。这份文件还可以在 fedora-gro cvs 中找到。这个解决办法是 Hellwolf@seu 在 linuxsir.org 论坛 上给出的。
2.6. 如何为Ghostview安装中文字体
2.7. 如何在OpenOffice中使用中文
2.8. 如何在Kylix中使用中文
2.9. 如何设置浏览器(Mozilla/Firefox)中的中文字体?
如果是Firefox 1.0.x通过主菜单中的“编辑”“首选项”。打开“选项”窗口在其中的“基本信息”设置单击“字体和颜色”按钮打开“字体和颜色”设置窗口。选择“语言编码”为“简体中文”或者“繁体中文”然后选择下拉列表中的的字体。
2.10. 如果没有管理员权限,如何安装字体?
将字体复制到 ~/.fonts/ 重新启动Xwindow即可但是gtk1的程序(xmms,gmplayer等) 不能使用这些字体。
2.11. 如果没有管理员权限,如何安装输入法?
===== 2.12. Linux下如何书写latex中文文档 =====
有两个解决办法一个是使用CCT宏包该宏包目前在中国大陆的数学类杂志社中使用得较为广泛其工作原理是外挂式的一个是使用CJK宏包该宏包要年轻一些但是更加符合LaTeX的习惯各种TeX发行版中往往都配备了。
2.13. Linux上如何识别和搜索字体文件
2.14. 什么是xfs
2.15. 什么是fontconfig如何设置fontconfig
2.16. 在Linux下使用Windows下微软的字体和SimSun是否合法
2.17. 什么叫Locale
2.18. Linux下关于语言的环境变量有哪些相互关系
===== 2.19. 如何设置系统语言为中文? =====
作者cobranail
答:在大多数发行版的安装过程中,可以指定第一语言,通常指定的第一语言就是系统默认的语言。因此,若要设置系统语言为中文,在安装时,选择中文为第一语言即可。对于已经安装的系统,一种通用的方法是修改/etc/sysconfig/i18n文件LANG变量的值。若要设置为简体中文LANG变量的可选值如下:
zh_CN.GBK
zh_CN.GB18030
zh_CN.GB2312
zh_CN.UTF-8
zh_CN
然而各主要发行版都提供了简便的工具来修改系统语言。一个具体的例子是在Redhat/Fedora中可以使用system-config-language命令来修改系统的语言(需要root权限而且在较早期的Redhat系统中这个命令为redhat-config-language)。另外GNOME桌面环境的登录管理器GDM提供了一种在只改变某次会话的语言环境的功能可以临时改变系统语言。
===== 2.20. 如何在英文环境下显示和输入中文? =====
作者fundawang
答:在英文环境下使用中文对于很多人来说是一个非常有用的设置。特别对于留学生来说,在一个以英语作为主导语言的环境下,既需要能够与身边不讲中文的朋友、导师拥有一个共同的、良好的计算机交流的环境,又需要有效地处理中文电子邮件和浏览中文网页,在英文环境下设置中文对于创造一种没有语言隔阂和偏见的,适合国际交流的计算机环境是一个很好的选择。同时,很多操作系统在进行汉化的过程当中可能会造成某种形式上的性能降低,使用英文语言环境下的中文设置可以尽量减少这种情况造成的影响。
有一件很显然的事情如果想要显示中文您必须先在系统中__正确安装中文字体或者包含汉语字型的Unicode字体__。这个我们在上文已经说到了。这里我们着重说一下如何让系统显示出中文。
一个系统是否能够显示出中文和系__统所支持的字符集__是相关的。如果系统只能支持ASCII这个字符集那么就只能显示大小写英文字母、阿拉伯数字和一些半角的标点符号也就只能使用纯英语如果系统支持ISO-8859-1这个字符集那么就可以支持包括法语、德语、西班牙语等在内的多种欧洲语言。同样如果系统支持GB2312字符集就可以显示GB2312-80国标中的所有汉字如果支持GBK字符集就可以显示包含“镕”等汉字以及大多数**繁体字**在内的汉字。
如果系统有相关字符集的支持,当发现相关字符编码请求时会将特殊编码转为内部使用的编码(如utf8编码),然后用该内部编码查找系统中是否有相对应的字体。
英语环境下,系统的语言环境(locale)一般是 en_US。在大多数Linux发行版中这个 locale 只能支持 ASCII 字符集。为了扩大locale所支持的字符集我们必须对locale加以变形。比较常见的变形是__en_US.UTF-8__。这会使得系统的locale所使用的字符集变成UTF-8。
在更改完系统的locale之后您可以自己安装自己喜欢的输入法并按照该输入法的要求修改系统的配置文件。
===== 2.21. 为什么我的中文目录都是乱码? =====
===== 2.22. 如何mount含有中文目录或文件名的FAT32 Windows分区 =====
作者brep
答:使用如下命令:
mount -t vfat -o iocharset=**cp936** /dev/hdxx /path/to/mount_point
cp936是微软对中文字符集的称谓
作者:cobranail
对于某些使用utf8为默认字符编码的发行版比如Fedora Core系列Ubuntu等来说应该使用
mount -t vfat -o iocharset=__utf8 __/dev/hdxx /path/to/mount_point
系统会自动地将非utf8编码转为utf8编码然后在查找包含unicode字符集的中文字体用于显示。
===== 2.23. 如何mount含有中文目录或文件名的NTFS Windows分区 =====
作者brep
答:使用如下命令:
mount -t ntfs -o iocharset=cp936 /dev/hdxx /path/to/mount_point
作者:cobranail
对于某些使用utf8为默认字符编码的发行版比如Fedora Core系列Ubuntu等来说应该使用
mount -t ntfs -o iocharset=utf8 /dev/hdxx /path/to/mount_point
对于大部分发行版而言默认的内核配置是不支持向ntfs文件系统写入数据的。
===== 2.24. 如何让Linux下的java程序正确显示和处理中文 =====
在jre/lib/fonts/目录下建子目录fallback把simsun.ttf或者其他中文字体拷贝到此目录。
2.25. 如何让Linux下的Qt程序正确显示和处理中文
2.26. 如何让Linux下的GTK+/GTK+2.0程序正确显示和处理中文?
2.27. 如何让Linux下的Tcl/Tk程序正确显示和处理中文
2.28. 如何让Linux下的OpenMotif/Lesstif程序正确显示和处理中文
2.29. 如何在wine中运行中文windows程序
===== 2.30. 用什么命令把GB2312/GBK/GB18030编码的文档转换为utf-8编码如何反向转换 =====
作者notXX
gb2312/gbk/gb18030 to utf-8使用如下命令将编码为gb18030的file1转化为编码为utf-8的file2
iconv -f gb18030 -t utf-8 file1 > file2
有的系统没有gb18030字符集的支持这个时候可以用
iconv -f gbk -t utf-8 file1 > file2
或者:
iconv -f gb2312 -t utf-8 file1 > file2
iconv -f gb2312 -t utf-8 file1 -o file2
反之,可以这样转换:
iconv -f utf-8 -t gb18030 file2 > file1
或者:
iconv -f utf-8 -t gbk file2 > file1
或者:
iconv -f utf-8 -t gb2312 file2 > file1
更详细的用法请man iconv
===== 2.31. perl程序中如何转换GB2312/GBK/GB18030编码为utf-8编码如何反向转换 =====
=====作者: Yourway 答从Perl5.8开始可以使用Encode模块来完成这个操作。 use Encode;
$str_ust8 = encode("utf-8",decode("gbk",$str_gbk)); $str_gbk = encode("gbk", decode('utf-8',$str_utf8));
===== 2.32. C程序中如何转换GB2312/GBK/GB18030编码为utf-8编码如何反向转换 =====
作者notXX
答:参见如下的源代码:
FILE *fin, *fout;
char *encFrom, *encTo;
char bufin[1024], bufout[1024], *sin, *sout;
int mode, lenin, lenout, ret, nline;
iconv_t c_pt;
encFrom = "utf-8";
encTo = "gbk";
if ((c_pt = iconv_open(encTo, encFrom)) == (iconv_t)-1) {
printf("iconv_open false: %s ==> %s\n", encFrom, encTo);
return -1;
}
iconv(c_pt, NULL, NULL, NULL, NULL);
strcpy(bufin,"姝e父");
lenin = strlen(bufin) + 1;
lenout = 1024;
sin = bufin;
sout = bufout;
iconv(c_pt,
&sin,
(size_t*)&lenin,
&sout,
(size_t*)&lenout);
printf("%s -> %s: ret=%d, len_in=%d, len_out=%d\n",
encFrom, encTo, ret, lenin, lenout);
iconv_close(c_pt);
printf("out= %s\n",&sout);
更详细的用法请man 3 iconv
2.33. 如何让SCIM成为默认输入法
2.34. 如何让fcitx成为默认输入法
2.35. Linux下如何输入GBK汉字
===== 3. 文泉驿点阵宋体用户常见问题 =====
3.1. 我使用的是Debian(Ubuntu/ArchLinux)成功安装wqy后为什么无法选择这个字体
作者FangQ
Debian以及Debian-based的Linux系统上__默认不支持纯点阵字体__了不过在安装WQY字体时系统并不会报错。重新启用点阵字体您需要使用下面的命令
dpkg-reconfigure fontconfig
然后在回答第三个问题时选择yes即可。
您还可以通过下面命令
sudo unlink /etc/fonts/conf.d/30-debconf-no-bitmaps.conf
来实现同样的目的。如果您仅希望系统启用wqy点阵字体您还可以使用carlos的方法
sudo vi /etc/fonts/conf.d/50-xfonts-wqy.conf
然后拷贝粘贴下面的内容:
<selectfont>
<acceptfont>
<pattern>
<patelt name="family"><string>WenQuanYi Bitmap Song</string></patelt>
</pattern>
</acceptfont>
</selectfont>
===== 3.2. 使用Debian的用户为什么在fc-cache后fc-list不显示Wenquanyi的点阵字库 =====
作者RenYou
在安装文泉驿点阵字体后,使用 fc-cache -v -f 可以看到字体所在的目录被cache了但是 fc-list 却没有显示相应的字体。 这种情况很有可能是因为 fontconfig 的设置中禁用了点阵字体。 Debian用户可以用 dpkg-reconfigure fontconfig 重新配置。
或者您也可以这样,直接到/etc/fonts/conf.d/ 这个目录下面有一个链接文件unlink掉就可以了。debian默认的不使用点阵字体去掉链接就可以了
===== 3.3. 我使用的是Debian(Ubuntu/ArchLinux)在安装了xfonts-wqy包之后发现firefox显示速度变慢请问应该怎么解决 =====
作者FangQ
答:(如果您使用的是Debian Sid您可以直接安装最新版本的xfonts-wqy该字体包已经采用不压缩的pcf格式不会再出现上述问题)。xfonts-wqy是carlosliu和caiqian两个人维护的一个文泉驿字体deb安装包他们采用了压缩的pcf格式而pcf.gz格式的字体特别是在显示中文这样的大字符集时系统渲染速度比较慢。把字体文件解压可以大大提高显示速度方法为
cd /path/to/wqy/font/
sudo gunzip wenquanyi*pcf.gz
sudo rm fonts.dir fonts.scale fonts.cache*
sudo mkfontdir .
sudo cp fonts.dir fonts.scale
sudo fc-cache -fv
我们正在与xfonts-wqy包的维护者联系直接使用不压缩的字体格式。
===== 3.4. 我觉得某个汉字点阵比较难看,我应该如何反馈给开发者? =====
作者FangQ
答:你可以把你认为难看的汉字输入在“文泉半两”需要优化的字体列表页面中的规定地方,这样开发者就可以有针对性的进行点阵的优化,使得用户可以尽快使用到优化后的点阵。
当然对于一些书法基础比较好的朋友你们可以直接帮助我们优化这些点阵方法是首先安装我们提供的一个firefox搜索引擎然后通过这个搜索连接直接定位汉字点阵自行修改后保存即可。
===== 3.5. 为什么我在term中使用wqy点阵字体英文很难看没有办法对齐 =====
作者FangQ
英文字体有两大类一类叫等宽字体所有字母数字宽度相同一类叫非等宽字体字母数字宽度不同比如i和m两个字母。__文泉驿点阵宋体中的英文是非等宽__的而一般term中使用的英文字体要求是等宽的这样就造成了显示上的问题。我们的建议是在字体选择对话框中选择一个合适的等宽英文字体如果系统上正确安装了wqy字体那么term在显示中文时会自动使用wqy点阵字体来显示。
===== 3.6. 我安装了TTF版本的文泉驿点阵宋体为何系统升级后字体就无法使用了 =====
作者FangQ
TTF版本的文泉驿点阵宋体采用了一种比较特殊的TTF格式即SFNT TTF 格式。这种字体中只有点阵部分而没有矢量部分。幸运的是FreeType2支持这种格式不幸的是很多字体设置的工具却不能正确识别这种字体中的信息比如ttfmkdir和 fc-cache。我们在您下载的TTF安装包里面已经包含了手工编辑的字体设置文件即 fonts.dir/fonts.scale/fonts.cache-1。您通过如前所述的方法设置好字体路径之后如果你使用fc-cache -fv等命令(或者升级系统)之后这些手工书写的文件将会被错误信息覆盖。您所需要作的是进入字体安装的目录然后解压一个叫作font.config.tar.gz的文件这样将会将恢复曾经备份过的字体信息。有时候您在解压之后可能还需要touch *一下并重新启动X窗口。
===== 3.7. 文泉驿字体是否支持繁体字? =====
作者FangQ
支持文泉驿点阵宋体覆盖了Unicode CJK Basic,其中包含了BIG5和GB12345编码中的所有繁体字。
===== 3.8. 文泉驿点阵宋体中是否使用了APL字体 =====
作者FangQ
没有。APL与文泉驿点阵宋体的GPL授权是不兼容的二者不能在一个字体中共同使用。我们的确使用了Firefly发布的firefly点阵字体1.3.0中的部分点阵而这个字体是APL/GPL双重授权的。我们采用的是其中的GPL授权分支进行衍生的。
3.9. 如果我们不喜欢GPL授权希望文泉驿字体重新授权为其他形式比如APL或者OFL请问应该怎么做
作者FangQ
对软件授权形式的更改需要获得全体版权人的同意。文泉驿点阵字体的版权人为文泉驿信任委员会和firefly共同拥有。对授权形式变更的建议请写信给 admin <at> wenq.org 或FangQ
===== 3.10. 文泉驿字体是否满足GB18030编码 =====
作者FangQ
文泉驿字体与GB18030没有直接的关系.
如上所述, GB18030是一个编码的强制性国家标准. 这个标准规定了Unicode所收录的符号的一种与GBK/GB2312编码兼容的编码形式(也就是说某个unicode符号对应的编码值是多少.). __对GB18030的支持是通过一个unicode<->gb18030编码映射表实现的__. 也就是说, Linux之后中__只要locale信息中包含了这个映射表__, (可以用locale -a查看系统的locale表可以用在编辑相关的配置文件后用locale-gen生成相关的locale)并且glibc中定义了相应的编码registry之后,gb18030标准的支持已经实现, 与系统上使用的字体没有关系 (微软Windows GB18030补丁中真正起作用的也只是一个编码转换表和转换函数, 以及GB18030的系统registry,与附带的字体没有直接关系).
文泉驿字体与其他大多数国际通用字体一样, __使用ISO10646编码(unicode)作为字体内部编码__, 字体内部编码与操作系统支持的语言编码没有直接的关系. 直接采用GB18030作为字体编码的通用字体也非常少见.
另外,GB18030对应的字符集是全部Unicode符号, 即包括CJK Basic, CJK扩展A区和B区的所有汉字以及非汉字符号. GB18030并没有对字体对该字符集覆盖的完备性上做任何规定. 事实上, 不可能也完全没有必要要求字体必须全部覆盖GB18030字符集. 据本人所知, 迄今还尚未有完全覆盖GB18030字符集的字体.
我们在一些文档中提到文泉驿字体将支持GB18030字符集的说法只是一种简化的说法, 并不准确. 这里的"GB18030字符集"只是CJK Basic+CJK ExtA的一个替换称呼, 与真正的GB18030字符集不同.
===== 3.11. 文泉驿字体是否能够在OpenOffice/Abiword/KOffice中使用 =====
作者FangQ
文泉驿目前只发布了点阵字体这种字为屏幕汉字显示进行了特别优化但由于点阵字通常无法用于打印OpenOffice等常用__排版软件一般要求使用矢量字体__所以文泉驿的点阵字体暂时还无法用于排版软件当中。
我们建议用户安装__文鼎(包括unifonts,fireflysung)的矢量字体__来进行中文排版。文泉驿的新版本点阵包含了fontconfig配置允许点阵字与矢量汉字的共同显示。
文泉驿随后发布的矢量汉字字体将允许直接在Openoffice/Abiword/KOffice中使用。
====== 4. 文泉驿矢量中文字体常见问题 ======
===== 4.1. 文泉驿正黑体为什么不叫做ZhengHei而叫Zen Hei =====
作者FangQ
Zen Hei是正黑体的英文名称而并非拼音就像"联想"的英文名称是lenovo方正是founder一样。
===== 4.2. 如何获得文泉驿汉字笔画数据库?数据库以什么样的方式授权? =====
作者FangQ
答:文泉驿志愿者开发的汉字笔画数据库目前仅用来制作文泉驿矢量汉字字体,以及本计划其他开源汉字相关的开发。我们不对外公开该数据库,也不授权/许可任何企业或个人以任何目的使用。该数据库的版权所有者为文泉驿信任委员会和FangQ。任何不包含在上述范围内的使用方式必须获得版权人的书面许可否则将视为侵权行为。
文泉驿参与者仍然对其个人独立完成并发送的汉字笔画数据拥有使用权。如果第三方需要使用少量汉字笔画数据,请查阅这些汉字对应的历史修订页面,并与所有作者联系,获得使用权。
需要强调的是,如果汉字笔画数据中使用了其他人完成的偏旁部件(%BBXCOMP或%COMP),则该发送作者将不再拥有独立的版权,这些数据的版权将归属文泉驿信任委员会所有。
5. 点阵中文制作常见问题
5.1. 在我的浏览器上不能编辑点阵,这是为什么?
5.2. 点阵预览不能自动更新怎么办?
5.3. 我想知道正在编辑的汉字的发音和意思应该怎么操作?
5.4. 如何升级和安装离线点阵制作工具?
5.5. 离线点阵工具在我的机器上无法启动,应该怎么办?
5.6. 离线点阵工具使用过程中异常退出,我应该怎么办?
5.7. 在线编辑时如何为自己设置一个用户名?
5.8. 如何给自己建立一个Wiki页面
5.9. 如何查看一个点阵汉字的编辑历史?
5.10. 为何有的页面显示“本页只读”?
6. 矢量中文制作常见问题
6.1. 能简单的说一下,怎么进行笔画分析吗?
6.2. 进行笔画分析有什么特别需要注意的吗?
因为生成字体的时候需要笔画,和关键点的位置,所以首先是尽量保证笔画的正确性,然后就是关键点的位置要尽量接近给出的位置,
6.3. 笔画分析程序上方的“笔画数”与真实笔画不符合怎么办?
作者FangQ
这个笔画数中的数字是从Unicode学会网站上的unihan数据库中提取的。由于这个工作可能主要是台湾的学者参与并公布的所以里面大多数汉字是以繁体字或者台湾书写习惯来进行统计的。
同时另外一方面我们现在能够找到的简体中文的开源资源非常非常有限只有一个GB2312的48X48点阵字库包含6763个汉字而被unicode收录的汉字总数有7万多个。台湾拥有更多开源的资源他们这方面工作做得比较早其中CNS11643字库收录汉字5万多我们为了尽可能地利用这些已有的资源我采用了一个"quick and dirty"的办法就是把简体中文的GB2312字库和CNS11643字库合并这就是现在矢量笔画分析器显示的汉字图片总数约5万多个同时采用unihan中的笔画数目来进行校准这些笔画对于很多简体中文字来说是错的
当您点击“发送”的时候程序先检查当前汉字的图片是否是40X40如果是则说明汉字来源为台湾的CNS11643字库则检查笔画数是否与数据库中的吻合不吻合不允许发送数据库中的笔画数大多与这些繁体字是符合的如果图片大小是48X48说明是来自GB2312字库这样程序会绕过笔画校验直接发送尽管上面显示的笔画数可能与真实制作的不同
对于简体中文,现在我还没有找到任何开放授权的笔画数数据库,所以这方面我们没有别的更好的选择,同时,这也说明了我们现在的工作的意义和重要性。
在笔画分析程序1.0正式版本中,对于笔画数目,我将添加几个新功能:
“笔画数”改名为“推荐笔画数”,然后点击出现一个说明
用户可以对汉字添加注释,用户可以在其中说明汉字笔画数是否符合,对笔序的讨论、是否是台湾写法等等
强制发送功能如果您确信您录入的笔画是正确的则按Ctrl+发送键,此时会取消笔画数校验。
7. 其它常见问题
7.1. 文泉驿的开源字体是不是没有版权?
作者FangQ
答:错!文泉驿的开源字体是有版权的。“开源”是软件的授权方式,而并非版权形式。文泉驿的点阵字体版权所有者为房骞骞和文泉驿信任委员会。离线点阵和矢量开发软件的版权人为房骞骞。其实也正是因为文泉驿的软件(字体)有版权,版权人才可以对这些发布的软件定义使用授权方式(GPL)。
7.2. 如何正确使用文泉驿Wiki排版格式
参见WikiFormat
7.3. 在什么情况下我可以在我修改的文泉驿字体中添加我的copyright声明
作者FangQ
答:文泉驿现在已经发布的字体都是遵循开源授权的字体。这些字体的授权允许用户修改并再发布。但并不是所有的修改都可以添加修改者版权声明,这取决于这种修改是否足够创新并产生新的版权(或者说这些修改能够对软件产生质量的飞跃)。
对软件的修改不构成新的版权的例子非常多比如把两个GPL软件放在一起压缩成一个文件或者把一个点阵字体中修改一个像素然后重新发布等等。这些工作都是没有足够的创新性的工作对软件没有造成质的飞跃或者说是trivial的所以这些修改后修改者不应该把自己的copyright标识添加在软件中。
另外软件修改者的版权声明必须有年份才有效一般格式为copyright (c) 200x,200x...。一个开源软件可能是不同的人在不同的时间积累完成的。软件的版权声明必须明确你对于哪些年份中修改的这个软件的版本具有版权,而并非一概将所有版权都收于自己名下。

View File

@@ -0,0 +1,109 @@
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2011-09-24T11:36:57+08:00
====== 网页常用字体 ======
Created Saturday 24 September 2011
http://www.webjx.com/css/divcss-19285.html
在Web编码中CSS默认应用的Web字体是有限的虽然在新版本的CSS3我们可以通过新增的@font-face属性来引入特殊的浏览器加载字体但多数情况下考虑各个因素的影响我们还是在尽量充分利用这些默认调用的字体实现CSS的编写这里整理了19个Web安全字体让你无需任何顾虑的情况下畅快使用。
===== 1, Arial =====
微软公司的网页核心字体之一__最常用__的sans serif字体当字号很小时不容易阅读。但是大写的“I”和小写的“l”是无法区别的你可以考虑用Tahoma字体来替代。苹果系统没有这种字体但有一种对应于Arial的字体叫Helvetica它是MAC机上与Arial 字体最相似的WEB字体,是别一种非衬线字体.它是一种性能优良的打印字体,但在屏幕上表现不是很好说道Helvetica字体昨天发现了很多有意思的站点主要是纪念Helvetica字体诞生50年而设的。
{{./arial.png}}
CSS写法font-family: Arial, Helvetica, sans-serif;
===== 2, Arial Black =====
{{./arial-balck.png}}
CSS写法font-family: Arial Black, Gadget, sans-serif;
===== 3, Arial Narrow =====
{{./arial-narrow.png}}
CSS写法font-family: Arial Narrow, sans-serif;
===== 4, Verdana =====
微软公司的网页核心字体之一微软公司专门为屏幕显示而开发的。应用广泛。易于阅读。是__显示器中最清晰__的字体即使字号很小也很容易阅读。半肥猫比较喜欢采用10PX的Verdana来做英文正文字体也推荐大家使用但字号最好介于10~14像素之间超出这个范围就不好看了。
{{./verdana.png}}
CSS写法font-family: Verdana, Geneva, sans-serif;
===== 5, Georgia =====
微软公司的网页核心字体之一可用性好。可读性比Times New Roman强。是网站设计中__浏览效果最好的serif字体__因为它是专为网上阅读设计的。
{{./georgia.png}}
CSS写法font-family: Georgia, serif;
===== 6, Times New Roman =====
微软公司的网页核心字体之一,可能是最常用的**serif字体**是网站浏览器__默认的字体__12pt以上的字体容易阅读但小字号的字体易读性差。苹果系统没有这个字体有一个对应于Times New Roman的字体叫Times
{{./times-new-roman.png}}
CSS写法font-family: 'Times New Roman', Times, serif;
===== 7, Trebuchet MS =====
微软公司的网页核心字体之一与Arial相似半肥猫觉得Trebuchet MS比Arial看起来优雅、古典一点。可以用来做标题但小字号阅读起来会很困难低于13PIX阅读起来就很累了不太推荐用来做正文字体。在苹果系统上也可以用Helvetica做替代。
{{./trebuchet-ms.png}}
CSS写法font-family: 'Trebuchet MS', Helvetica, sans-serif;
===== 8 , Courier New =====
微软公司的网页核心字体之一__老式打印机字体__有一种独特的机械工整感觉。呈现计算机编码时还会用到这种字体。12 pt的Courier New字体曾是美国国务院的公文标准字体但于2004年1月停用改使用14 pt的Times New Roman因为其具“现代性”和“易读性”。
{{./courier-new.png}}
CSS写法font-family: 'Courier New', Courier, monospace;
===== 9, Impact =====
微软公司的网页核心字体之一Impact是1965年发表的一个**无衬线字体**,其特粗的笔画、紧缩的间距。半肥猫觉得:字体较为粗犷,适合使用在标题上,而不常用在内文。
{{./impact.png}}
CSS写法font-family: Impact, Charcoal, sans-serif;
===== 10, Comic Sans MS =====
微软公司的网页核心字体之一,手写体。这是一种争议很大的字体,讲实话,半肥猫也不喜欢这个字体,一点美感都没有,不过在一大堆规规矩矩的字体里面,有这么一个随意性比较的字体,可以变换一下口味,也算不错吧,建议不要用在正规的金融、政府、商业机构站点。
{{./comic-sans-ms.png}}
CSS写法font-family: 'Comic Sans MS', cursive;
===== 11, Tahoma =====
Tahoma是一个十分常见的**无衬线字体**Tahoma和Verdana师出同为名设计师马修·卡特的作品由微软在1999年推出被采用为Windows 2000、Windows XP、Windows Server 2003等系统的**默认字型**。半肥猫觉得它的字体结构和Verdana很相似其字符间距较小用来作为标题效果好过ArialTahoma的大写I 和小写l比Arial容易识别但如果作为正文他的字号不能小于13PIX否则很多笔画粘连到一起不利于阅读。
{{./tahoma.png}}
CSS写法font-family: Tahoma, Geneva, sans-serif;
===== 12, Courier =====
Courier是一个**等宽字体的粗衬线字体**主要是依据打字机所打印出来的字型来设计。原来Courier New的字体是IBM公司在1950年代设计给打印机使用的字体后来这个字型成为整个__打字机制造业的标准__。Courier New是Courier的变体比Courier更具机械味道。
{{./courier-new.png}}
CSS写法font-family: Courier, monospace;
===== 13, Lucida Sans Unicode =====
是一种OpenType型的无衬线字体 。1993年制作并随微软公司的Windows NT 3.1操作系统发布。有较大的x字高具有很好的可读性被广泛用于显示、出版等各种用途。它支持Unicode2.0版本的基本字符,包括拉丁字母,希腊字母,西里尔字母,希伯来字母,以及国际音标字符。该字体是首个 Unicode代码的字体 该字体从Windows 98开始一直作为系统预装字体发行。后来发布的 Lucida Grande字体作为苹果公司Mac OS X系统的默认字体发布。
CSS写法font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
===== 14, Lucida Console =====
同Lucida Sans Unicode类似。
{{./lucida-console.png}}
CSS写法font-family: 'Lucida Console', Monaco, monospace;
===== 15, Garamond =====
Garamond加拉蒙德是一类**西文衬线字体**的总称自16世纪40年代开始至今有很多家公司和很多设计师参与到Garamond字体设计 Adobe Garamond, Monotype Garamond, Sioncini Garamond和 Stempel Garamond等等。半肥猫觉得字体给人端庄典雅有些古典的感觉在博物馆和历史性悠久的项目中使用应该可以获得不错的效果。
{{./garamond.png}}
CSS写法font-family: Garamond, serif;
===== 16 , MS Sans Serif =====
微软系统自带字体。__屏幕显示的像素字体__。非衬线字体。
{{./ms-sans-serif.png}}
CSS写法font-family: 'MS Sans Serif', Geneva, sans-serif;
===== 17 , MS Serif =====
微软系统自带字体。屏幕显示的像素字体。衬线字体。
CSS写法font-family: 'MS Serif', 'New York', sans-serif;
===== 18, Palatino Linotype =====
{{./palatino-linotype.png}}
CSS写法font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
===== 19, Symbol =====
{{./symbol.png}}
CSS写法font-family: Symbol, sans-serif;
===== 20, Bookman Old Style =====
{{./bookman-old-style.png}}
CSS写法font-family: 'Bookman Old Style', serif;
本文参考了WEB安全字体希望在Web编写过程中这些核心的Web字体能对你有用。

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Some files were not shown because too many files have changed in this diff Show More