LaTeX

From Wikiversity
Jump to navigation Jump to search

LaTeX is a markup language (as is MediaWiki!) for producing mathematical texts of the highest quality. Its use is widespread in the mathematics world. It is built on plain TeX developed by Donald Knuth. You can embed LaTeX markups in MediaWiki by the <math></math> tags, e.g. <math> e = m c^2</math> is rendered as .

Readings[edit | edit source]

Installation[edit | edit source]

  • If you are using Linux, you probably have it already! Just type "latex".
  • If you are using Windows, the simplest thing to do is to open Cygwin (the linux emulator) and type "latex". If you haven't installed Cygwin, do it! You will often find it useful. The installation may take less than an hour but it is usually straightforward.
    • Note that it is now fairly simple to install a linux dual boot, for example, with wubi. All you need is a number of Gigabytes in a refactored hard-drive. You can delete it like a regular windows directory whenever you don't want it any more.

Step by step guide for beginners[edit | edit source]

  1. Create a file with .tex suffix, e.g. "helloworld.tex" (see /helloworld.tex).
  2. Go to your linux/cygwin/[1] whatever shell, go to the directory of your file "helloworld.tex" and type "latex helloworld".
  3. A .dvi file will be created - you may view it directly if you have the right tools.
  4. If not, type "dvips helloworld" or type "dvipdf helloworld" to convert it to a postscript or PDF file.
  5. Use Ghostview to view the .ps file, or the Adobe Acrobat Reader to view the .pdf file.

Choosing an editor[edit | edit source]

A good editing environment helps! A useful and free option is the LaTeX editor (LEd) (see their home page).

A LaTeX extension is also available for Open Office.

Or for a quick and easy solution, try Roger's Online Equation Editor.

Lessons[edit | edit source]

Obtain PDF from Latex[edit | edit source]

pdflatex hello.tex

Use Latex Source in Wikiversity[edit | edit source]

You can use latex sources also in Wikiversity. In general you will create a PDF file from your latex source. pdflatex converts the a tex-file hello.tex in hello.pdf. You may need sometimes a different output format. If you want to convert the tex-file into a Wiki markdown output for Wikiversity you can use PanDoc.

Pandoc[edit | edit source]

This is useful if you want to use parts from source text in LaTeX also in a Wikiversity learning resource (e.g. for a mathematical text for a lecture). Copy the source in PanDoc and

When press "convert" you can use the Wiki source code in your learning resource.

Expand Newcommands[edit | edit source]

Sometimes it is necessary to expand latex macros because the macros in your source are not available in Wikiversity.

External Links[edit | edit source]

References[edit | edit source]

  1. If you are new to cygwin, you can find your c-drive by something like cd /cygdrive/c