MTI

Section: Environments, Tables, and Troff Macros (7)
Updated: 86/02/09
Index Return to Main Contents
 

NAME

mti - travel-itinerary formatting macros  

SYNOPSIS

nroff -mti [ -rQ2 ] [ options ] file ...
troff -mti [ -rQ2 ] [ options ] file ...  

DESCRIPTION

This package of nroff and troff macro definitions makes formatted travel itineraries. They're especially designed for road trips --- through they'll work for other kinds of travel, too.

You give them the starting date, the time and mileage points you'll hit each day, and each food/lodging expense you plan. (You also need to store the cost of travelling --- usually fuel economy, with other fixed traveling expenses optional). They'll output an itinerary that lists each timepoint and expense, as well as daily and running totals of cost and distance.  

EXAMPLE

Here's a small part of a finished (fictional) itinerary, with `. . .' in place of the omitted lines:
          .
          .
          .
          .
6 PM  Camp near Dustbowl, NM
LODGING: Camping fee  $8.

TODAY: 415 mi. in 9 hours for $18; other costs $8; total $26
TO DATE: 1690 miles, $77

DAY #7 OF TRIP: Friday, 6/21 4 PM Arrive at Fred Smith's home TODAY: 404 mi. in 8 hours for $17; other costs $6; total $23 TO DATE: 2094 miles, $100
DAY #8 OF TRIP: Saturday, 6/22 . .

The source (unformatted) itinerary commands are flexible enough that it's easy to rearrange your itinerary, try alternate routes, etc... after you've set up an itinerary, the macros will calculate the total trip length and expenses.

For example, here are the lines that produced the itinerary above. Start each day with .SD, use .EN for each entry, and use .ED at the end of each day. Lodging expenses are marked with .LO, and .FO is for food:


  .EN 6 PM "Camp near Dustbowl, NM"
  .LO "Camping fee" 8
  .ED 9
  .SD
  .EN 7 AM "NM-18, US-87 to Dalhart, TX" 129
  .EN 9 AM "Time-zone change from MDT to CDT" 0
  .EN 10 AM "TX-297, TX-281, US-22, US-83 to Canadian, TX" 135
  .FO "Lunch in Canadian?" 6
  .EN 1 PM "US-83, OK-54, I-40 to Oklahoma City" 140
  .EN 4 PM "Arrive at Fred Smith's home" 0
  .ED 8
  .SD

The argument to ED is the number of hours spent traveling that day. The last argument to EN is the number of miles driven since the previous timepoint.

All the -mti macros are defined below. It's okay to use most nroff and troff requests with this package. However, watch out for fill- and non-fill modes, because the macros switch back and forth between the two modes. See the individual macro descriptions below. Also, be careful about setting number and string registers: the macros use a few of them (see the list below).

Font and point size changes with \f and \s are also allowed; for example, ``\fIword\fR'' will italicize word.  

OPTION

If you use -rQ2 on the commandline, the macros won't print the TODAY: and TO DATE: summaries at the end of each day. Other commandline options go directly to nroff or troff.  

REGISTERS AND MACROS

Here's a summary of the number and string registers --- and the macros --- that make up the -mti macros. After the summary are detailed explanations and examples of each. So, beginners can safely skip this reference section for now. This list doesn't include internal macros and registers.

Regist.   Initial   String/   Explanation
Name      Value     Number

_CS       $         str     currency-unit symbol
_DT       -         num     numerical date of trip start
_DU       -         num     distance per currency unit
_DY       -         str     name of day when trip starts
_FD       -         num     number days in February
_MN       _         num     numerical month of trip start
_TI       _         str     title for top corner each page
_UL       miles     str     distance unit name, long
_US       mi        str     distance unit name, short



Macro   Number  Req'd/     Explanation
Name    Args.   Opt'nl

_ED     1       reqd     end of day
_EN     4       reqd     timepoint entry
_ET     0       reqd     end of title page
_FO     2       optl     food expense
_LO     2       optl     lodging expense
_OE     2       optl     other expenses
_SD     0       reqd     start of daily entry
_ST     2       reqd     start of title block
 

SOURCE-FILE DESCRIPTION

This part of the manual describes what you should put in a source (unformatted) itinerary file.

The FIRST SECTION of each file stores numbers and strings (words) that set the initial conditions (starting date, fuel economy, etc.). You can put these first few lines in any order, as long as they're all at the top of the file. Individual descriptions:

.ds DY Day
Required: day of the week that trip starts. First letter of day must be capitalized, rest lower-case. No abbreviations. Example:
       .ds DY Saturday
.nr DT Date
Required: numerical date when the trip starts. For example, if the trip started on August 15th:
       .nr DT 15
.nr MN Month
Required: numerical month that the trip starts (January = 1, February = 2, etc.). Example:
       .nr MN 8
.nr DU xx
Required: Distance you can travel for each currency-unit you spend (in the U.S., number of miles that cost one dollar; in France, kilometres you can travel for one Franc; etc.). This rather weird number was designed to get around a problem: nroff and troff can't do decimal arithmetic -- only integers. Here are two examples that should clear things up:

On your trip across the U.S., you guess that you'll get 30 miles/gallon, and that gas will cost $1.25 per gallon. So, the miles per dollar are:

            30 miles/gallon
        ----------------------- = 24 miles/dollar
          1.25 dollars/gallon

...which means that you'd put this line in your source file:
       .nr DU 24

Or, if you were driving across Europe, getting 17 kilometres/litre and spending DKK 6- per litre, the setting of DU should be 17 divided by 6, or about 3 kilometres per DKK. So, you'd put this line in your itinerary:
       .nr DU 3

.nr FD 2x
Required: Number of days in February --- 28 or 29. Tells program whether this is a leap year. Must be set, even if your itinerary doesn't include February. For example, if there are 28 days in February during the year of your trip (a non-leap year):
       .nr FD 28

If your trip crosses two years but only one February, set FD for the number of days in the February when you'll be traveling.

.ds TI TITLE
Optional: title for upper right-hand corner of each page. If you don't define it, it'll be blank. Here's how you could define it:
       .ds TI CROSS-COUNTRY TRIP
.ds CS xxx
Optional: currency symbol (default = $). Can be set to other currency names, like SKR, this way:
       .ds CR SKR

This is used in the TODAY: and TO DATE: lines printed at the end of each day.

Normally, the currency symbol and the cost are printed touching each other, like $123 or hfl162 (Dutch Guilder). If you want space after the currency symbol (like hfl 162), use a backslash and a trailing blank when you define the currency symbol. For example,
       .ds CR hfl\ 

Just be sure to put the blank after the backslash!

.ds US units
Optional: the units of distance, short name. The default is mi (miles).. To change it to, say, km:
       .ds US km
.ds UL units
Optional: the units of distance, long name, plural. The default is miles. To change it to, say, kilometers:
       .ds UL kilometers

The TITLE SECTION is usually short. It starts with the .ST macro, and ends with .ET. If you want other text on the title page, you can put it between the macro calls.

.ST "First line" "Second line"
Required: after you've set the number and string registers in the first section, you must use .ST (start title page). If you want a title on the first page, it can have one or two lines... the macros will make it in larger type and center each line.

Quote each line of the title, and put the text on the same line as the .ST call. If you don't want one or both lines, just leave them out. Example:
       .sT "Our trip" "to Lower Slobovia"

After the .ST, you can put text for the title page. You'll usually want to skip down a few lines (say, .sp 5) before starting the text. The title page is made in no-fill mode, so what you type in will be exactly what appears on the title page. You can start fill mode (.fi and maybe .ad), but BE SURE to go back to non-fill mode (.nf) before you use the .ET macro!

.ET
Required: At the end of the title page (after the .ST and the optional text), end the title page with .ET.

The last part of the file are the DAILY ENTRIES, which are enclosed with .SD and .ED macro calls. Here are the details:

.SD
Each day's entry must start with the .SD macro. Put it on a line by itself.
.EN time AM/PM "description" distance
Required: For each timepoint in a day, use the .EN (entry) macro. The first argument is the clock time, a number between 1 and 12 (though 24-hour time will work fine here).

If you use a 12-hour clock, the second argument should be AM, PM, NOON, or something like that. On a 24-hour clock, use your imagination.

You should put quotes around the third argument, which is usually the description of a route you're taking since the last timepoint. It can also hold the name of a destination.

The fourth argument must be a number --- the distance travelled during this entry. (Or, in other words, the distance travelled since the previous entry.)

Here's an example. It's 10 AM and you're about to leave Auckland, New Zealand for a trip to Rotorua. The trip is via highways 3 and 12 and is 200 kilometres long (I'm making this up!). You'd write this .EN macro:
       .EN 10 AM "Hwys. 3, 12 to Rotorua" 200

.FO "description" cost
Optional: When you plan to spend money for food, note it with .FO. You must use .FO between a pair of .SD and .ED macros.

Example: in the middle of the day, you plan to spend $55 for lunch for your tour group. You might use this entry:
       .FO "lunch at El Greaso, Dallas" 55

.LO "description" cost
Optional: When you plan lodging expenses, note them with .LO. Use .LO between a pair of .SD and .ED macros.

Example: You'll be staying at the Waldorf-Astoria tonight, spending $1000. You might use this entry, including the phone number for convenience:
       .LO "Waldorf-Astoria, 212/345-2999" 1000

.OE "description" cost
Optional: The .OE (capital letter O) macro is for expenses besides food and lodging. You have to use .OE between a pair of .SD and .ED macros.

Example: You expect a transmission overhaul in Nairobi:
       .OE "Rebuild transmission" 550

.ED total-time
Required: At the end of each day's entries, use .ED with the total time spent traveling that day. This is usually the elapsed time between the first and last timepoints in the day --- unless you're crossing time zones.

Example: If you started traveling at 9 AM and finished at 5 PM, that's 8 hours of traveling:
       .ED 8

lines with no macros
If you don't use a macro on a line, the line will be copied directly to the itinerary without filling, adjusting, or wrapping. The lines may look better if you indent them with a tab character.
 

FILES

/usr/lib/public/tmac/tmac.ti  

SEE ALSO

ms(7), nroff(1), troff(1).  

BUGS

More default settings might be nice. Some parts could be shortened by using subroutines. Internal register names aren't unique enough and may conflict with any registers that the user defines.  

AUTHOR

Jerry Peek; Portland, Oregon.

I'm not an expert at formatter macros, so use these at your own risk. I'll take no responsibility for their accuracy or suitability for any purpose.

Bugs and rewrites to jerryp%tektools@tektronix.csnet or {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp. Flames will probably be ".ig"'ed.


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXAMPLE
OPTION
REGISTERS AND MACROS
SOURCE-FILE DESCRIPTION
FILES
SEE ALSO
BUGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 06:39:59 GMT, December 12, 2024