summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/Default-Units.html
blob: 168c5cc309e368a66406958d98d46f9bfd0c4d1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- This manual documents GNU troff version 1.23.0.

Copyright � 1994-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<title>Default Units (The GNU Troff Manual)</title>

<meta name="description" content="Default Units (The GNU Troff Manual)">
<meta name="keywords" content="Default Units (The GNU Troff Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Request-Index.html" rel="index" title="Request Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Measurements.html" rel="up" title="Measurements">
<link href="Motion-Quanta.html" rel="prev" title="Motion Quanta">
<style type="text/css">
<!--
div.example {margin-left: 3.2em}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Default-Units">
<div class="nav-panel">
<p>
Previous: <a href="Motion-Quanta.html" accesskey="p" rel="prev">Motion Quanta</a>, Up: <a href="Measurements.html" accesskey="u" rel="up">Measurements</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Default-Units-1">5.3.2 Default Units</h4>
<a class="index-entry-id" id="index-default-units"></a>
<a class="index-entry-id" id="index-units_002c-default"></a>

<p>A general-purpose register (one created or updated with the <code class="code">nr</code>
request; see see <a class="pxref" href="Registers.html">Registers</a>) is implicitly dimensionless, or reckoned
in basic units if interpreted in a measurement context.  But it is
convenient for many requests and escape sequences to infer a scaling
unit for an argument if none is specified.  An explicit scaling unit
(not after a closing parenthesis) can override an undesirable default.
Effectively, the default unit is suffixed to the expression if a scaling
unit is not already present.  GNU <code class="code">troff</code>&rsquo;s use of integer
arithmetic should also be kept in mind (see <a class="pxref" href="Numeric-Expressions.html">Numeric Expressions</a>).
</p>
<p>The <code class="code">ll</code> request interprets its argument in ems by default.
Consider several attempts to set a line length of 3.5&nbsp;inches when
the type size is 10&nbsp;points on a terminal device with a resolution
of 240 basic units and horizontal motion quantum of 24.  Some
expressions become zero; the request clamps them to that quantum.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">.ll 3.5i      \&quot; 3.5i (= 840u)
.ll 7/2       \&quot; 7u/2u -&gt; 3u -&gt; 3m -&gt; 0, clamped to 24u
.ll (7 / 2)u  \&quot; 7u/2u -&gt; as above
.ll 7/2i      \&quot; 7u/2i -&gt; 7u/480u -&gt; 0 -&gt; as above
.ll 7i/2      \&quot; 7i/2u -&gt; 1680u/2m -&gt; 1680u/24u -&gt; 35u
.ll 7i/2u     \&quot; 3.5i (= 840u)
</pre></div></div>

<a class="index-entry-id" id="index-measurements_002c-specifying-safely"></a>
<p>The safest way to specify measurements is to attach a scaling unit.  To
multiply or divide by a dimensionless quantity, use &lsquo;<samp class="samp">u</samp>&rsquo; as its
scaling unit.
</p>


</div>



</body>
</html>