特殊:Badtitle/NS100:LaTeX:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Zhan留言 | 贡献
格式混乱,修改..
Oneleaf留言 | 贡献
无编辑摘要
第29行: 第29行:
texlive
texlive
</nowiki></pre>
</nowiki></pre>
 
=== Add on packages ===
=== Add on packages ===


第79行: 第79行:


=== Inverse Search ===
=== Inverse Search ===
 
Inverse search means that
Inverse search means that


* A mouse click  in the dvi-viewer window can open an editor with the corresponding place in the (La)TeX source (also called `reverse search')
**** A mouse click  in the dvi-viewer window can open an editor with the corresponding place in the (La)TeX source (also called `reverse search')
        * Ctrl-Left Click is the default for xdvi
* Ctrl-Left Click is the default for xdvi
        * Middle Click is the default for kdvi
* Middle Click is the default for kdvi
* the dvi-viewer can jump to (and visually highlight) a position in the DVI file that corresponds to a certain line number in the (La)TeX source file (`forward search').  
**** the dvi-viewer can jump to (and visually highlight) a position in the DVI file that corresponds to a certain line number in the (La)TeX source file (`forward search').  


* for information see [http://xdvi.sourceforge.net/inverse-search.html]
**** for information see [http://xdvi.sourceforge.net/inverse-search.html]
==== Emacs and xdvi ====
==== Emacs and xdvi ====


第94行: 第94行:
===== Instructions to set up reverse search with emacs and xdvi =====
===== Instructions to set up reverse search with emacs and xdvi =====


* Add the following line to the file <code><nowiki>.emacs</nowiki></code> in your home directory  
** 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>  
** Add the following line to <code><nowiki>.Xresources</nowiki></code>  
<pre><nowiki>
<pre><nowiki>
xdvi.editor: emacsclient --no-wait +%l %f
xdvi.editor: emacsclient --no-wait +%l %f
</nowiki></pre>
</nowiki></pre>
* and run  
** and run  
<pre><nowiki>
<pre><nowiki>
xrdb .Xresources
xrdb .Xresources
</nowiki></pre>
</nowiki></pre>
* Download and install the latex package [http://www.ctan.org/tex-archive/help/Catalogue/entries/srcltx.html srcltx]
** Download and install the latex package [http://www.ctan.org/tex-archive/help/Catalogue/entries/srcltx.html srcltx]
 
* You need to compile your latex file with the srcltx package. Put the line


** You need to compile your latex file with the srcltx package. Put the line
<pre><nowiki>
<pre><nowiki>
\usepackage[active]{srcltx}
\usepackage[active]{srcltx}
</nowiki></pre>
</nowiki></pre>in your latex files for this to work
in your latex files for this to work


==== Kile and kdvi ====
==== Kile and kdvi ====


* You need to compile your latex file with the srcltx package. Put the line  
** You need to compile your latex file with the srcltx package. Put the line  
 
<pre><nowiki>
<pre><nowiki>
\usepackage[active]{srcltx}
\usepackage[active]{srcltx}
</nowiki></pre>
</nowiki></pre>in your latex files and forward and reverse search should work.
in your latex files and forward and reverse search should work.





2007年5月24日 (四) 12:04的版本

{{#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 formated 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

  • Tetex
  • Texline

Tetex is a common Latex distribution for Linux. This is in the main Ubuntu repository and can be installed with synaptic or apt-get. At a minimum you will need to install the packages

tetex-base tetex-bin

you may also want some add on packages

tetex-extra

Another Latex distribution you can install is texlive. Texlive has a more comprehensive selection of Latex tools than tetex but takes up more space. It is also a newer addition to Ubuntu so you may run into some teething problems. It is available for Ubuntu from version 6.10 and is in the universe repository.

To install texlive install the package

texlive

Add on packages

Latex can be extended using add on packages.

Repositories

In addition to tetex-extra there are numerous packages in the repositories containing add-ons. To see what packages are available you can browse Software Packages in "breezy", tex section.

Other add-ons

There are also lots of add-ons which are not in the repositories. A comprehensive list is availiable at the TeX Catalogue Online or the Comprehensive TeX Archive Network. They are usually downloaded as tar.gz or zip files. To install them they need to be uncompressed and copied to /usr/local/share/texmf/tex/latex/. Then you need to run texhash, to update the database.

If you downloaded the package mhchem.zip to your home directory, then this should work:

cd /usr/local/share/texmf/tex/latex
sudo unzip ~/mhchem.zip
sudo texhash

Local Installation

You can also install style or class files in your home directory. This is especially useful if you don't have access to root privileges. The variable TEXINPUTS controls where latex looks for local files.

Suppose you want to put them in a subdirectory of your home directory called mylatex. Just set TEXINPUTS as follows:

 
export TEXINPUTS= ~/mylatex/:

Now you can put files in ~/mylatex and latex will know where to find them.

To set this as the default value of TEXINPUTS add the line above to .bashrc or type

cd
echo "export TEXINPUTS= ~/mylatex:" >>  .bashrc

Useful addons include:

Resources

Inverse Search

Inverse search means that

        • A mouse click in the dvi-viewer window can open an editor with the corresponding place in the (La)TeX source (also called `reverse search')
  • Ctrl-Left Click is the default for xdvi
  • Middle Click is the default for kdvi
        • the dvi-viewer can jump to (and visually highlight) a position in the DVI file that corresponds to a certain line number in the (La)TeX source file (`forward search').
        • for information see [1]

Emacs and xdvi

Reverse search

Instructions to set up reverse search with 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
    • and run
xrdb .Xresources
    • Download and install the latex package srcltx
    • You need to compile your latex file with the srcltx package. Put the line
\usepackage[active]{srcltx}

in your latex files for this to work

Kile and kdvi

    • You need to compile your latex file with the srcltx package. Put the line
\usepackage[active]{srcltx}

in your latex files and forward and reverse search should work.