特殊:Badtitle/NS100:LaTeX:修订间差异
小 New page: {{From|https://help.ubuntu.com/community/LaTeX}} {{Languages|php5}} Latex is a language for describing a document. If you have used HTML, or edited a wiki then you will be familiar with ... |
小无编辑摘要 |
||
(未显示3个用户的14个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/LaTeX}} | {{From|https://help.ubuntu.com/community/LaTeX}} | ||
{{Languages| | {{Languages|UbuntuHelp:LaTeX}} | ||
LaTeX is a language for describing a document. If you have used HTML, or edited a wiki then you will be familiar with the idea of using symbols or commands within a text file to describe the layout of text. LaTeX is commonly used in scientific publishing. It helps you to make well formatted papers, with good looking formulae. It also helps keep track of figure and equation numbers. LaTeX files can be converted into a huge number of formats such as PDF, PostScript, DVI, and HTML. | |||
A LaTeX file is an ASCII file containing the text and markup commands. It can be written in a text editor such as Gedit or vim. It is converted into an output format using a LaTeX compiler. Some people like to write LaTeX files in a more integrated environment, with menus and buttons for formatting commands. There are also many add on packages that add features to LaTeX. | |||
A | |||
=== Installing === | === Installing === | ||
Like Linux, LaTeX is a collection of many interdependent tools and files. Rather than find and install them all you use a LaTeX distribution. LaTeX distributions in the Ubuntu repositories are: | |||
Like Linux, | * TeX Live | ||
* teTeX | |||
* | Note that since May 2006 teTeX is no longer supported. See this page for the official statement: [http://www.tug.org/teTeX/]. Some of the teTeX packages in Ubuntu's repositories are transitionary packages to TeX Live. | ||
==== TeX Live ==== | |||
One LaTeX distribution you can install is TeX Live. TeX Live has a more comprehensive selection of LaTeX tools than teTeX but takes up more space. It is also a newer addition to Ubuntu than teTeX. It is available for Ubuntu from version 6.10 and is in the Universe repository. | |||
To install TeX Live, install <code><nowiki>texlive</nowiki></code>. This will install a basic subset of TeX Live's functionality. To install the complete TeX Live distribution, install <code><nowiki>texlive-full</nowiki></code>. | |||
==== teTeX ==== | |||
teTeX was a common LaTeX distribution for Linux. This is in the Main and Universe Ubuntu repositories and can be installed with synaptic or apt-get. At a minimum you will need to install the packages <code><nowiki>tetex-base</nowiki></code>, and <code><nowiki>tetex-bin</nowiki></code>. Extra packages for teTeX can be found in <code><nowiki>tetex-extra</nowiki></code>. | |||
=== Add on packages === | |||
LaTeX can be extended using add on packages. Packages can either be installed using Ubuntu's packaging system, or by manually copying the files to the respective locations. | |||
==== Installing packages manually ==== | |||
<<Anchor(manualpkginstall)>> | |||
If a package you desire is not in Ubuntu's repositories, you may look on [http://www.ctan.org CTAN's web site] or [http://www.tug.org/tex-archive/help/Catalogue/index.html TeX Catalogue Online] to see if they have the package. If they do, download the archive containing the files. In this example, we'll install example package <code><nowiki>foo</nowiki></code>, contained in <code><nowiki>foo.tar.gz</nowiki></code>. | |||
Once <code><nowiki>foo.tar.gz</nowiki></code> has finished downloading, we unzip it somewhere in our home directory: | |||
<pre><nowiki> | <pre><nowiki> | ||
tar xvf foo.tar.gz | |||
</nowiki></pre> | </nowiki></pre> | ||
This expands to folder <code><nowiki>foo/</nowiki></code>. We <code><nowiki>cd</nowiki></code> into <code><nowiki>foo/</nowiki></code> and see <code><nowiki>foo.ins</nowiki></code>. We now run LaTeX on the file: | |||
<pre><nowiki> | <pre><nowiki> | ||
latex foo.ins | |||
</nowiki></pre> | </nowiki></pre> | ||
This will generate <code><nowiki>foo.sty</nowiki></code>. We now have to copy this file into the correct location. For the purposes of this example, we will copy this into our personal <code><nowiki>texmf</nowiki></code> tree. The advantages of this solution are that if we migrate our files to a new computer, we will remember to take our <code><nowiki>texmf</nowiki></code> tree with us, resulting in keeping the same packages we had. The disadvantages are that if multiple users want to use the same packages, the tree will have to be copied to each user's home folder. | |||
We'll first create the necessary directory structure: | |||
<pre><nowiki> | <pre><nowiki> | ||
cd ~ | |||
mkdir -p texmf/tex/latex/foo | |||
</nowiki></pre> | </nowiki></pre> | ||
Notice that the final directory created is labeled <code><nowiki>foo</nowiki></code>. It is a good idea to name directories after the packages they contain. The <code><nowiki>-p</nowiki></code> attribute to <code><nowiki>mkdir</nowiki></code> tells it to create all the necessary directories, since they don't exist. Now, using either the terminal, or the file manager, copy <code><nowiki>foo.sty</nowiki></code> into the directory labeled <code><nowiki>foo</nowiki></code>. | |||
Now, we must make LaTeX recognize the new package: | |||
<pre><nowiki> | <pre><nowiki> | ||
texhash ~/texmf | |||
</nowiki></pre> | </nowiki></pre> | ||
The new package should now be installed. To use it in your LaTeX document, merely insert <code><nowiki>\usepackage{foo</nowiki></code>} in the preamble. | |||
=== Tips & Tricks === | |||
==== Inverse Search ==== | |||
<<Anchor(InverseSearch)>> | |||
Inverse search is a feature where a mouse click in the DVI viewer can open an editor with the corresponding place in the (La)TeX source (also called "reverse search"). In <code><nowiki>xdvi</nowiki></code>, the default is Ctrl-Left click. In <code><nowiki>kdvi</nowiki></code>, Middle click is the default. For information see [http://xdvi.sourceforge.net/inverse-search.html]. | |||
===== Emacs and xdvi ===== | |||
Add the following line to the file <code><nowiki>.emacs</nowiki></code> in your home directory: | |||
< | |||
<pre><nowiki> | <pre><nowiki> | ||
(server-start) | (server-start) | ||
</nowiki></pre> | </nowiki></pre> | ||
Add the following line to <code><nowiki>.Xresources</nowiki></code> | |||
<pre><nowiki> | |||
xdvi.editor: emacsclient --no-wait +%l %f | xdvi.editor: emacsclient --no-wait +%l %f | ||
</nowiki></pre> | </nowiki></pre> | ||
Now run in the terminal: | |||
<pre><nowiki> | |||
xrdb .Xresources | xrdb .Xresources | ||
</nowiki></pre> | </nowiki></pre> | ||
===== Common between Emacs/xdvi and Kile/kdvi ===== | |||
We will need to have a specific LaTeX package in place to enable this feature. Download and install the LaTeX package [http://www.ctan.org/tex-archive/help/Catalogue/entries/srcltx.html srcltx]. There is help on [[UbuntuHelp:LaTeX#manualpkginstall|installing a LaTeX package manually]]. | |||
Once <code><nowiki>srcltx</nowiki></code> is installed, you need to include it in your LaTeX file. Put <code><nowiki>\usepackage[active]{srcltx</nowiki></code>} in the preamble of your LaTeX document. | |||
\usepackage[active]{srcltx | === Resources === | ||
</nowiki></ | * [http://www.tug.org/interest.html TeX Users Group] Includes links to resources around the web | ||
* [http://www.latex-project.org/guides/ LaTeX Documentation] | |||
=== | * [http://tug.org/TeXnik/mainFAQ.cgi?file=index A-Z list of TeX FAQs] | ||
* [http://en.wikibooks.org/wiki/LaTeX Wikibook's guide to LaTeX] | |||
* | |||
---- | ---- | ||
[[category:CategoryOffice]] [[category:CategoryScience]] | |||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2009年11月17日 (二) 19:43的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/LaTeX }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/af | • {{#if: UbuntuHelp:LaTeX|Afrikaans| [[::LaTeX/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ar | • {{#if: UbuntuHelp:LaTeX|العربية| [[::LaTeX/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/az | • {{#if: UbuntuHelp:LaTeX|azərbaycanca| [[::LaTeX/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/bcc | • {{#if: UbuntuHelp:LaTeX|جهلسری بلوچی| [[::LaTeX/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/bg | • {{#if: UbuntuHelp:LaTeX|български| [[::LaTeX/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/br | • {{#if: UbuntuHelp:LaTeX|brezhoneg| [[::LaTeX/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ca | • {{#if: UbuntuHelp:LaTeX|català| [[::LaTeX/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/cs | • {{#if: UbuntuHelp:LaTeX|čeština| [[::LaTeX/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/de | • {{#if: UbuntuHelp:LaTeX|Deutsch| [[::LaTeX/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/el | • {{#if: UbuntuHelp:LaTeX|Ελληνικά| [[::LaTeX/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/es | • {{#if: UbuntuHelp:LaTeX|español| [[::LaTeX/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/fa | • {{#if: UbuntuHelp:LaTeX|فارسی| [[::LaTeX/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/fi | • {{#if: UbuntuHelp:LaTeX|suomi| [[::LaTeX/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/fr | • {{#if: UbuntuHelp:LaTeX|français| [[::LaTeX/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/gu | • {{#if: UbuntuHelp:LaTeX|ગુજરાતી| [[::LaTeX/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/he | • {{#if: UbuntuHelp:LaTeX|עברית| [[::LaTeX/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/hu | • {{#if: UbuntuHelp:LaTeX|magyar| [[::LaTeX/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/id | • {{#if: UbuntuHelp:LaTeX|Bahasa Indonesia| [[::LaTeX/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/it | • {{#if: UbuntuHelp:LaTeX|italiano| [[::LaTeX/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ja | • {{#if: UbuntuHelp:LaTeX|日本語| [[::LaTeX/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ko | • {{#if: UbuntuHelp:LaTeX|한국어| [[::LaTeX/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ksh | • {{#if: UbuntuHelp:LaTeX|Ripoarisch| [[::LaTeX/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/mr | • {{#if: UbuntuHelp:LaTeX|मराठी| [[::LaTeX/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ms | • {{#if: UbuntuHelp:LaTeX|Bahasa Melayu| [[::LaTeX/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/nl | • {{#if: UbuntuHelp:LaTeX|Nederlands| [[::LaTeX/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/no | • {{#if: UbuntuHelp:LaTeX|norsk| [[::LaTeX/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/oc | • {{#if: UbuntuHelp:LaTeX|occitan| [[::LaTeX/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/pl | • {{#if: UbuntuHelp:LaTeX|polski| [[::LaTeX/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/pt | • {{#if: UbuntuHelp:LaTeX|português| [[::LaTeX/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ro | • {{#if: UbuntuHelp:LaTeX|română| [[::LaTeX/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/ru | • {{#if: UbuntuHelp:LaTeX|русский| [[::LaTeX/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/si | • {{#if: UbuntuHelp:LaTeX|සිංහල| [[::LaTeX/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/sq | • {{#if: UbuntuHelp:LaTeX|shqip| [[::LaTeX/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/sr | • {{#if: UbuntuHelp:LaTeX|српски / srpski| [[::LaTeX/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/sv | • {{#if: UbuntuHelp:LaTeX|svenska| [[::LaTeX/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/th | • {{#if: UbuntuHelp:LaTeX|ไทย| [[::LaTeX/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/tr | • {{#if: UbuntuHelp:LaTeX|Türkçe| [[::LaTeX/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/vi | • {{#if: UbuntuHelp:LaTeX|Tiếng Việt| [[::LaTeX/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/yue | • {{#if: UbuntuHelp:LaTeX|粵語| [[::LaTeX/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/zh | • {{#if: UbuntuHelp:LaTeX|中文| [[::LaTeX/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/zh-hans | • {{#if: UbuntuHelp:LaTeX|中文(简体)| [[::LaTeX/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LaTeX | UbuntuHelp:LaTeX | {{#if: | :}}LaTeX}}/zh-hant | • {{#if: UbuntuHelp:LaTeX|中文(繁體)| [[::LaTeX/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:LaTeX|:LaTeX|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :LaTeX/zh | | {{#ifexist: LaTeX/zh | | {{#ifeq: {{#titleparts:LaTeX|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:LaTeX|1|-1|}} | zh | | }}
LaTeX is a language for describing a document. If you have used HTML, or edited a wiki then you will be familiar with the idea of using symbols or commands within a text file to describe the layout of text. LaTeX is commonly used in scientific publishing. It helps you to make well formatted papers, with good looking formulae. It also helps keep track of figure and equation numbers. LaTeX files can be converted into a huge number of formats such as PDF, PostScript, DVI, and HTML. A LaTeX file is an ASCII file containing the text and markup commands. It can be written in a text editor such as Gedit or vim. It is converted into an output format using a LaTeX compiler. Some people like to write LaTeX files in a more integrated environment, with menus and buttons for formatting commands. There are also many add on packages that add features to LaTeX.
Installing
Like Linux, LaTeX is a collection of many interdependent tools and files. Rather than find and install them all you use a LaTeX distribution. LaTeX distributions in the Ubuntu repositories are:
- TeX Live
- teTeX
Note that since May 2006 teTeX is no longer supported. See this page for the official statement: [1]. Some of the teTeX packages in Ubuntu's repositories are transitionary packages to TeX Live.
TeX Live
One LaTeX distribution you can install is TeX Live. TeX Live has a more comprehensive selection of LaTeX tools than teTeX but takes up more space. It is also a newer addition to Ubuntu than teTeX. It is available for Ubuntu from version 6.10 and is in the Universe repository.
To install TeX Live, install texlive
. This will install a basic subset of TeX Live's functionality. To install the complete TeX Live distribution, install texlive-full
.
teTeX
teTeX was a common LaTeX distribution for Linux. This is in the Main and Universe Ubuntu repositories and can be installed with synaptic or apt-get. At a minimum you will need to install the packages tetex-base
, and tetex-bin
. Extra packages for teTeX can be found in tetex-extra
.
Add on packages
LaTeX can be extended using add on packages. Packages can either be installed using Ubuntu's packaging system, or by manually copying the files to the respective locations.
Installing packages manually
<<Anchor(manualpkginstall)>>
If a package you desire is not in Ubuntu's repositories, you may look on CTAN's web site or TeX Catalogue Online to see if they have the package. If they do, download the archive containing the files. In this example, we'll install example package foo
, contained in foo.tar.gz
.
Once foo.tar.gz
has finished downloading, we unzip it somewhere in our home directory:
tar xvf foo.tar.gz
This expands to folder foo/
. We cd
into foo/
and see foo.ins
. We now run LaTeX on the file:
latex foo.ins
This will generate foo.sty
. We now have to copy this file into the correct location. For the purposes of this example, we will copy this into our personal texmf
tree. The advantages of this solution are that if we migrate our files to a new computer, we will remember to take our texmf
tree with us, resulting in keeping the same packages we had. The disadvantages are that if multiple users want to use the same packages, the tree will have to be copied to each user's home folder.
We'll first create the necessary directory structure:
cd ~ mkdir -p texmf/tex/latex/foo
Notice that the final directory created is labeled foo
. It is a good idea to name directories after the packages they contain. The -p
attribute to mkdir
tells it to create all the necessary directories, since they don't exist. Now, using either the terminal, or the file manager, copy foo.sty
into the directory labeled foo
.
Now, we must make LaTeX recognize the new package:
texhash ~/texmf
The new package should now be installed. To use it in your LaTeX document, merely insert \usepackage{foo
} in the preamble.
Tips & Tricks
Inverse Search
<<Anchor(InverseSearch)>>
Inverse search is a feature where a mouse click in the DVI viewer can open an editor with the corresponding place in the (La)TeX source (also called "reverse search"). In xdvi
, the default is Ctrl-Left click. In kdvi
, Middle click is the default. For information see [2].
Emacs and xdvi
Add the following line to the file .emacs
in your home directory:
(server-start)
Add the following line to .Xresources
xdvi.editor: emacsclient --no-wait +%l %f
Now run in the terminal:
xrdb .Xresources
Common between Emacs/xdvi and Kile/kdvi
We will need to have a specific LaTeX package in place to enable this feature. Download and install the LaTeX package srcltx. There is help on installing a LaTeX package manually.
Once srcltx
is installed, you need to include it in your LaTeX file. Put \usepackage[active]{srcltx
} in the preamble of your LaTeX document.
Resources
- TeX Users Group Includes links to resources around the web
- LaTeX Documentation
- A-Z list of TeX FAQs
- Wikibook's guide to LaTeX