computersci.org
Print     Recent Changes     Search    
Home




LaTeX Reference Manual


Lengths

« Layout | Table of Contents | Line and Page Breaking »
A length is a measure of distance. Many LaTeX commands take a length as an argument. The following commands are used to create, modify and use lengths.

\newlength

Command:

    \newlength{\gnat} 

The \newlength command defines the mandatory argument, \gnat, as a length command with a value of 0in. An error occurs if a \gnat command already exists.

\setlength

Command:

    \setlength{\gnat}{length} 

The \setlength command is used to set the value of a length command. The length argument can be expressed in any terms of length La Te X understands, i.e., inches (in), millimetres (mm), points (pt), etc.

\addtolength

Command:

    \addtolength{\gnat}{length} 

The \addtolength command increments a “length command” by the amount specified in the length argument. It can be a negative amount.

\settodepth

Command:

    \settodepth{\gnat}{text} 

The \settodepth command sets the value of a length command equal to the depth of the text argument.

\settoheight

Command:

    \settoheight{\gnat}{text} 

The \settoheight command sets the value of a length command equal to the height of the text argument.

\settowidth

Command:

    \settowidth{\gnat}{text} 

The \settowidth command sets the value of a length command equal to the width of the text argument.

Predefined Lengths

    \width 
    \height
    \depth
    \totalheight 

These length parameters can be used in the arguments of the box-making commands. They specify the natural width etc. of the text in the box. \totalheight equals \height + \depth. To make a box with the text stretched to double the natural size, e.g., say

   \makebox[2\width]{Get a stretcher}



« Layout | Table of Contents | Line and Page Breaking »

Page last modified on February 08, 2009, at 10:48 AM