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

Print Subscribe to Linux Subscribe to Newsletters
Linux & Unix > Excerpts >
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

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

Sign up today to receive special discounts,
product alerts, and news from O'Reilly.
Privacy Policy >
View Sample Newsletter >
  • Youtube
  • http://www.youtube.com/OreillyMedia
  • Twitter
  • Subscribe
  • View All RSS Feeds >
O'Reilly Media

800-889-8969 or 707-827-7019
Monday-Friday 7:30am-5pm PT
©2011, O'Reilly Media, Inc.
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
  • About O'Reilly
  • Academic Solutions
  • Contacts
  • Customer Service
  • Careers
  • Press Room
  • Privacy Policy
  • Terms of Service
  • Writing for O'Reilly
  • Community
  • Authors
  • Forums
  • Membership
  • Newsletters
  • RSS Feeds
  • User Groups
  • More O'Reilly Sites
  • igniteshow.com
  • makerfaire.com
  • makezine.com
  • craftzine.com
  • labs.oreilly.com
  • Partner Sites
  • PayPal Developer Zone
  • O'Reilly Insights on Forbes.com