LinuxDevCenter.com

oreilly.comSafari Books Online.Conferences.

We've expanded our Linux news coverage and improved our search! Search for all things Linux across O'Reilly!

Search
Search Tips

advertisement

Listen Print Subscribe to Linux Subscribe to Newsletters
Living Linux

Document Templates for TeX and LaTeX

04/21/2000

Last week I showed how to process TeX and LaTeX input files. Now that you're familiar with how to print and preview these files, we can start making input files using these simple, boilerplate templates.

To make a document with TeX or LaTeX, you generally use your favorite text editor to write an input file containing the text with the appropriate markup. Then, you process this TeX or LaTeX input file to create an output file in the DVI format, which you can then preview, convert or print.

What an input file looks like

For presenting a programming language, it's an old tradition among programmers to give a simple program that just outputs the text "Hello, world" to the screen; such a program is usually just detailed enough to give those unfamiliar with the language a feel for its basic syntax.

We can do the same with document processing languages like TeX and LaTeX. Here's the "Hello, world" for a TeX document:

Hello, world
\end

If you processed this file with tex, it would output a DVI file that displayed the text "Hello, world" in the default font on the default page, with default margins. Here's the LaTeX equivalent:

\documentclass{article}
\begin{document}
Hello, world.
\end{document}

Even though the TeX example is simpler, LaTeX is generally easier to use for making structured documents, while TeX is better for more experimental layouts or specialized documents.

Using the templates

To write a document with a template, insert the contents of the template file into a new file that has a .tex or .ltx extension, and edit that. (Use your favorite text editor.)

To make sure that you don't accidentally overwrite the actual template files, you can make them read only, like this:

$ chmod a-w template-file-names RET

The bracketed, uppercase text in the templates explains what belongs there; fill in these lines with your own text, and delete the ones you don't need.

Then, process your file with either the latex or tex command as discussed last week, and you've got a typeset document!

Continue to the next page for the templates.

Pages: 1, 2

Next Pagearrow




Tagged Articles

Be the first to post this article to del.icio.us

Recommended for You

  1. Cover of Managing RAID on Linux
    Managing RAID on Linux
    Print: $39.95
    Ebook: $31.99
  2. Cover of Take Control of Permissions in Mac OS X
    Take Control of Permissions in Mac OS X
    Ebook: $10.00
  3. Cover of Linux System Administration
    Linux System Administration
    Print: $44.99
    Ebook: $35.99
  4. Cover of Learning Red Hat Linux
    Learning Red Hat Linux
    Print: $39.95

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com