[latexrefman-commits] [SCM] latexrefman updated: r924 - trunk

jimhefferon at gnu.org.ua jimhefferon at gnu.org.ua
Wed Jun 9 14:41:18 CEST 2021


Author: jimhefferon
Date: 2021-06-09 12:41:18 +0000 (Wed, 09 Jun 2021)
New Revision: 924

Modified:
   trunk/ChangeLog
   trunk/latex2e.html
   trunk/latex2e.info
   trunk/latex2e.pdf
   trunk/latex2e.texi
Log:
Add section on Expressions such as \numexpr, etc.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2021-06-05 21:53:07 UTC (rev 923)
+++ trunk/ChangeLog	2021-06-09 12:41:18 UTC (rev 924)
@@ -1,5 +1,9 @@
 2021-06-04  Jim Hefferon  <jim at joshua.smcvt.edu>
 
+	* latex2e.texi (Expressions): Add section on \numexpr, etc.
+
+2021-06-04  Jim Hefferon  <jim at joshua.smcvt.edu>
+
 	* latex2e.texi (\baselineskip & \baselinestretch): Add section.  Remove
 	redundant material from low level font command section.
 

Modified: trunk/latex2e.html
===================================================================
--- trunk/latex2e.html	2021-06-05 21:53:07 UTC (rev 923)
+++ trunk/latex2e.html	2021-06-09 12:41:18 UTC (rev 924)
@@ -389,6 +389,7 @@
     <li><a id="toc-_005csettodepth-1" href="#g_t_005csettodepth">14.4 <code>\settodepth</code></a></li>
     <li><a id="toc-_005csettoheight-1" href="#g_t_005csettoheight">14.5 <code>\settoheight</code></a></li>
     <li><a id="toc-_005csettowidth-1" href="#g_t_005csettowidth">14.6 <code>\settowidth</code></a></li>
+    <li><a id="toc-Expressions-1" href="#Expressions">14.7 Expressions</a></li>
   </ul></li>
   <li><a id="toc-Making-paragraphs-1" href="#Making-paragraphs">15 Making paragraphs</a>
   <ul class="no-bullet">
@@ -3690,18 +3691,10 @@
 <span id="index-_005cbaselinestretch"></span>
 <span id="index-_005clinespread-1"></span>
 <span id="index-space-between-lines"></span>
+<span id="index-interline-space"></span>
+<span id="index-leading"></span>
 <span id="index-double-spacing"></span>
-<span id="index-package_002c-setspace"></span>
-<span id="index-setspace-package"></span>
 
-
-<p>Synopsis: to change the document spacing put this in the preamble.
-</p>
-<div class="example">
-<pre class="example">\usepackage{setspace}
-\doublespacing  % or \onehalfspacing for 1.5
-</pre></div>
-
 <p>The <code>\baselineskip</code> is a rubber length (see <a href="#Lengths">Lengths</a>).  It gives
 the leading, the normal distance between lines in a paragraph, from
 baseline to baseline.
@@ -3743,6 +3736,9 @@
 {\footnotesize $$a+b = c$$}
 </pre></div>
 
+<span id="index-_005clineskip"></span>
+<span id="index-_005clineskiplimit"></span>
+<span id="index-_005cprevdepth"></span>
 <p>The process for making paragraphs is that when a new line is added, if
 the depth of the previous line plus the height of the new line is less
 than <code>\baselineskip</code> then TeX inserts vertical glue to make up
@@ -3751,14 +3747,15 @@
 then TeX instead uses <code>\lineskip</code> as the interline glue.  The
 second is that TeX doesn’t actually use the depth of the previous
 line.  Instead it uses <code>\prevdepth</code>, which usually contains that
-depth.  But at the beginning of the paragraph (or any vertical list) or
-just after a rule, <code>\prevdepth</code> has the value -1000pt and that
-keeps TeX from inserting any interline glue at the paragraph start.
+depth.  But at the beginning of the paragraph (or any vertical list)
+or just after a rule, <code>\prevdepth</code> has the value -1000pt and this
+special value tells TeX not to insert any interline glue at the
+paragraph start.
 </p>
 <p>In the standard classes <code>\lineskiplimit</code> is 0pt and
 <code>\lineskip</code> is 1pt.  By the prior paragraph then, the distance
-between lines can approach zero but if it equals zero then the lines
-jump to 1pt apart.
+between lines can approach zero but if it becomes zero (or less than
+zero) then the lines jump to 1pt apart.
 </p>
 <p>Sometimes authors must, for editing purposes, put the document in double
 space or one-and-a-half space.  The right way to influence the interline
@@ -3779,19 +3776,27 @@
 the start of a document, so there you don’t need to follow it with
 <code>\selectfont</code>.)
 </p>
-<p>A more flexible approach is the <samp>setspace</samp> package.  After the
-<code>\usepackage{setspace}</code>, use <code>\doublespacing</code>, or
-<code>\onehalfspacing</code> or one-an-a-half.  In the preamble these will
-start the document off with that sizing.  But you can also use these
-declarations in the document body to change the spacing from that point
-forward, and consequently there is <code>\singlespacing</code> to return the
-spacing to normal.  In the document body, a better practice than using
-the declarations is to use environments, such as
-<code>\begin{doublespace} ... \end{doublespace}</code>.  The package also
-has commands to do arbitrary spacing: <code>\setstretch{<var>factor</var>}</code>
-and <code>\begin{spacing}{<var>factor</var>} ... \end{spacing}</code>.
+<span id="index-package_002c-setspace"></span>
+<span id="index-setspace-package"></span>
+
+<p>A simpler approach is the <samp>setspace</samp> package.  The basic example:
 </p>
+<div class="example">
+<pre class="example">\usepackage{setspace}
+\doublespacing  % or \onehalfspacing for 1.5
+</pre></div>
 
+<p>In the preamble these will start the document off with that sizing.
+But you can also use these declarations in the document body to change
+the spacing from that point forward, and consequently there is
+<code>\singlespacing</code> to return the spacing to normal.  In the
+document body, a better practice than using the declarations is to use
+environments, such as <code>\begin{doublespace}
+... \end{doublespace}</code>.  The package also has commands to do
+arbitrary spacing: <code>\setstretch{<var>factor</var>}</code> and
+<code>\begin{spacing}{<var>factor</var>} ... \end{spacing}</code>.
+</p>
+
 <hr>
 <span id="Floats"></span><div class="header">
 <p>
@@ -12335,6 +12340,8 @@
 </td></tr>
 <tr><td align="left" valign="top">• <a href="#g_t_005csettowidth" accesskey="6">\settowidth</a></td><td>  </td><td align="left" valign="top">Set a length to the width of something.
 </td></tr>
+<tr><td align="left" valign="top">• <a href="#Expressions" accesskey="7">Expressions</a></td><td>  </td><td align="left" valign="top">Compute with lengths and integers.
+</td></tr>
 </table>
 
 
@@ -12589,7 +12596,7 @@
 <hr>
 <span id="g_t_005csettowidth"></span><div class="header">
 <p>
-Previous: <a href="#g_t_005csettoheight" accesskey="p" rel="prev">\settoheight</a>, Up: <a href="#Lengths" accesskey="u" rel="up">Lengths</a>   [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
+Next: <a href="#Expressions" accesskey="n" rel="next">Expressions</a>, Previous: <a href="#g_t_005csettoheight" accesskey="p" rel="prev">\settoheight</a>, Up: <a href="#Lengths" accesskey="u" rel="up">Lengths</a>   [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
 </div>
 <span id="g_t_005csettowidth-1"></span><h3 class="section">14.6 <code>\settowidth</code></h3>
 
@@ -12622,6 +12629,116 @@
 </p>
 
 <hr>
+<span id="Expressions"></span><div class="header">
+<p>
+Previous: <a href="#g_t_005csettowidth" accesskey="p" rel="prev">\settowidth</a>, Up: <a href="#Lengths" accesskey="u" rel="up">Lengths</a>   [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
+</div>
+<span id="Expressions-1"></span><h3 class="section">14.7 Expressions</h3>
+
+<span id="index-expressions"></span>
+
+<p>Synopsis, one of:
+</p>
+<div class="example">
+<pre class="example">\numexpr <var>expression</var> 
+\dimexpr <var>expression</var>
+\glueexpr <var>expression</var>
+\muglue <var>expression</var>
+</pre></div>
+
+<p>Any place where you may write an integer, or a TeX dimen, or TeX
+glue, or muglue, you can instead write an expression to compute that
+type of quantity.
+</p>
+<p>An example is that <code>\the\dimexpr\linewidth-4pt\relax</code> will produce
+document output giving the length that is four points less than width of
+a line (the only purpose of <code>\the</code> is to show the result in the
+document).  Similarly, <code>\romannumeral\numexpr6+3\relax</code> will
+produce ‘<samp>ix</samp>’, and <code>\the\glueexpr 5pt plus 1pt * 2 \relax</code> will
+produce ‘<samp>10.0pt plus 2.0pt</samp>’.
+</p>
+<p>A convenience here over doing calculations by allocating registers and
+then using <code>\advance</code>, etc., is that the evaluation of expressions
+does not involve assignments and can therefore be performed in places
+where assignments are not allowed.  The next example computes the width
+of the <code>\parbox</code>.
+</p>
+<div class="example">
+<pre class="example">\newlength{\offset}\setlength{\offset}{2em}
+\begin{center}
+\parbox{\dimexpr\linewidth-\offset*3}{With malice toward none
+with charity for all with firmness in the right as God gives us to see
+the right let us strive on to finish the work we are in to bind up the
+nation's wounds, to care for him who shall have borne the battle and
+for his widow and his orphan ~ to do all which may achieve and cherish
+a just and lasting peace among ourselves and with all nations.
+---Abraham Lincoln, Second Inaugural Address, from the memorial}
+\end{center}
+</pre></div>
+
+<p>The <var>expression</var> consists of one or more terms of the same type
+(integer, dimension, etc.) that are added or subtracted.  A term that is
+a type of number, dimension, etc., consists of a factor of that type,
+optionally multiplied or divided by factors.  A factor of a type is
+either a quantity of that type or a parenthesized subexpression.  The
+expression produces a result of the given type, so that <code>\numexpr</code>
+produces an integer, <code>\dimexpr</code> produces a dimension, etc.
+</p>
+<p>In the quotation example above, changing to
+<code>\dimexpr\linewidth-3*\offset</code> gives the error <code>Illegal unit
+of measure (pt inserted)</code>.  This is because for <code>\dimexpr</code> and
+<code>\glueexpr</code>, the input consists of a dimension or glue value
+followed by an optional multiplication factor, and not the other way
+around. Thus <code>\the\dimexpr1pt*10\relax</code> is valid and produces
+‘<samp>10.0pt</samp>’, but <code>\the\dimexpr10*1pt\relax</code> gives the
+<code>Illegal unit</code> error.
+</p>
+<p>The expressions absorb tokens and carry out appropriate mathematics up
+to a <code>\relax</code> (which will be absorbed), or up to the first
+non-valid token.  Thus, <code>\the\numexpr2+3px</code> will print ‘<samp>5px</samp>’,
+because LaTeX reads the <code>\numexpr2+3</code>, which is made up of
+numbers, and then finds <code>px</code>, which is not a number.  It therefore
+terminates the expression and produces the ‘<samp>5</samp>’, followed by the
+regular text ‘<samp>px</samp>’.
+</p>
+<p>This termination behavior is useful in comparisons.  In
+<code>\ifnum\numexpr\parindent*2 < 10pt Yes\else No\fi</code>, the less than
+sign terminates the expression and the result is ‘<samp>No</samp>’ (in a
+standard LaTeX article).
+</p>
+<p>Expressions may use the operators <code>+</code>, <code>-</code>, <code>*</code> and
+<code>/</code> along with parentheses for subexpressions, <code>(...)</code>.  In
+glue expressions the <code>plus</code> and <code>minus</code> parts do not need
+parenthesis to be affected by a factor. So <code>\the\glueexpr 5pt plus
+1pt * 2 \relax</code> results in ‘<samp>10pt plus 2pt</samp>’.
+</p>
+<p>TeX will coerce other numerical types in the same way as it does when
+doing register assignment. Thus <code>\the\numexpr\dimexpr
+1pt\relax\relax</code> will result in ‘<samp>65536</samp>’, which is <code>1pt</code>
+converted to scaled points (TeX’s internal unit) and then coerced
+into an integer.  With a <code>\glueexpr</code> here, the stretch and shrink
+would be dropped.  Going the other way, a <code>\numexpr</code> inside a
+<code>\dimexpr</code> or <code>\glueexpr</code> will need appropriate units, as in
+<code>\the\dimexpr\numexpr 1 + 2\relax pt\relax</code>, which produces
+‘<samp>3.0pt</samp>’.
+</p>
+<p>The details of the arithmetic: each factor is checked to be in the
+allowed range, numbers must be less than 2 to the power 31 in absolute
+value, and dimensions or glue components must be less than 2 to the
+power 14 points, or <code>mu</code>, or <code>fil</code>, etc.  The arithmetic
+operations are performed individually, except for a scaling operation (a
+multiplication immediately followed by a division) which is done as one
+combined operation with a 64-bit product as intermediate value. The
+result of each operation is again checked to be in the allowed range.
+</p>
+<p>Finally, division and scaling take place with rounding (unlike TeX’s
+<code>\divide</code>, which truncates).  Thus
+<code>\the\dimexpr5pt*(3/2)\relax</code> puts ‘<samp>10.0pt</samp>’ in the document,
+because it rounds <code>3/2</code> to <code>2</code>, while
+<code>\the\dimexpr5pt*(4/3)\relax</code> puts ‘<samp>5.0pt</samp>’.
+</p>
+
+<hr>
 <span id="Making-paragraphs"></span><div class="header">
 <p>
 Next: <a href="#Math-formulas" accesskey="n" rel="next">Math formulas</a>, Previous: <a href="#Lengths" accesskey="p" rel="prev">Lengths</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a>   [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
@@ -21071,8 +21188,10 @@
 <pre class="example">\usepackage[<var>encoding-name</var>]{inputenc}
 </pre></div>
 
-<p>Declare the input file’s text encoding. The default, if this package
-is not loaded, is UTF-8.
+<p>Declare the input file’s text encoding to be <var>encoding-name</var>. The
+default, if this package is not loaded, is UTF-8.  Technically,
+specifying the encoding name is optional, but in practice it is not
+useful to omit it.
 </p>
 <span id="index-encoding_002c-of-input-files"></span>
 <span id="index-character-encoding"></span>
@@ -24929,6 +25048,8 @@
 <tr><td></td><td valign="top"><a href="#index-_005climsup"><code>\limsup</code></a>:</td><td> </td><td valign="top"><a href="#Math-functions">Math functions</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005cline"><code>\line</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005cline">\line</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005clinebreak"><code>\linebreak</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005clinebreak-_0026-_005cnolinebreak">\linebreak & \nolinebreak</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-_005clineskip"><code>\lineskip</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005cbaselineskip-_0026-_005cbaselinestretch">\baselineskip & \baselinestretch</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-_005clineskiplimit"><code>\lineskiplimit</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005cbaselineskip-_0026-_005cbaselinestretch">\baselineskip & \baselinestretch</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005clinespread"><code>\linespread</code></a>:</td><td> </td><td valign="top"><a href="#Low_002dlevel-font-commands">Low-level font commands</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005clinespread-1"><code>\linespread</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005cbaselineskip-_0026-_005cbaselinestretch">\baselineskip & \baselinestretch</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005clinethickness"><code>\linethickness</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005clinethickness">\linethickness</a></td></tr>
@@ -25120,6 +25241,7 @@
 <tr><td></td><td valign="top"><a href="#index-_005cPr"><code>\Pr</code></a>:</td><td> </td><td valign="top"><a href="#Math-functions">Math functions</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005cprec"><code>\prec</code></a>:</td><td> </td><td valign="top"><a href="#Math-symbols">Math symbols</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005cpreceq"><code>\preceq</code></a>:</td><td> </td><td valign="top"><a href="#Math-symbols">Math symbols</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-_005cprevdepth"><code>\prevdepth</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005cbaselineskip-_0026-_005cbaselinestretch">\baselineskip & \baselinestretch</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005cprime"><code>\prime</code></a>:</td><td> </td><td valign="top"><a href="#Math-symbols">Math symbols</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005cprintglossaries"><code>\printglossaries</code></a>:</td><td> </td><td valign="top"><a href="#Glossaries">Glossaries</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-_005cprintglossaries-1"><code>\printglossaries</code></a>:</td><td> </td><td valign="top"><a href="#Glossaries">Glossaries</a></td></tr>
@@ -25886,6 +26008,7 @@
 <tr><td></td><td valign="top"><a href="#index-expl3-package"><code>expl3</code> <span class="roman">package</span></a>:</td><td> </td><td valign="top"><a href="#LaTeX-command-syntax">LaTeX command syntax</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-expl3-package-1"><code>expl3</code> <span class="roman">package</span></a>:</td><td> </td><td valign="top"><a href="#Upper-and-lower-case">Upper and lower case</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-exponent">exponent</a>:</td><td> </td><td valign="top"><a href="#Subscripts-_0026-superscripts">Subscripts & superscripts</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-expressions"><code>expressions</code></a>:</td><td> </td><td valign="top"><a href="#Expressions">Expressions</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-extended-Latin">extended Latin</a>:</td><td> </td><td valign="top"><a href="#Additional-Latin-letters">Additional Latin letters</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-external-commands">external commands</a>:</td><td> </td><td valign="top"><a href="#g_t_005cwrite18">\write18</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-external-files_002c-writing">external files, writing</a>:</td><td> </td><td valign="top"><a href="#filecontents">filecontents</a></td></tr>
@@ -26070,6 +26193,7 @@
 <tr><td></td><td valign="top"><a href="#index-inputenc"><code>inputenc</code></a>:</td><td> </td><td valign="top"><a href="#inputenc-package">inputenc package</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-inserting-figures">inserting figures</a>:</td><td> </td><td valign="top"><a href="#figure">figure</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-insertions-of-special-characters">insertions of special characters</a>:</td><td> </td><td valign="top"><a href="#Special-insertions">Special insertions</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-interline-space">interline space</a>:</td><td> </td><td valign="top"><a href="#g_t_005cbaselineskip-_0026-_005cbaselinestretch">\baselineskip & \baselinestretch</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-internal-vertical-mode">internal vertical mode</a>:</td><td> </td><td valign="top"><a href="#Modes">Modes</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-invisible-character">invisible character</a>:</td><td> </td><td valign="top"><a href="#g_t_005cphantom-_0026-_005cvphantom-_0026-_005chphantom">\phantom & \vphantom & \hphantom</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-invisible-character-1">invisible character</a>:</td><td> </td><td valign="top"><a href="#g_t_005cmathstrut">\mathstrut</a></td></tr>
@@ -26118,6 +26242,7 @@
 <tr><td></td><td valign="top"><a href="#index-Latin-letters_002c-additional">Latin letters, additional</a>:</td><td> </td><td valign="top"><a href="#Additional-Latin-letters">Additional Latin letters</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-layout-commands">layout commands</a>:</td><td> </td><td valign="top"><a href="#Layout">Layout</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-layout_002c-page-parameters-for">layout, page parameters for</a>:</td><td> </td><td valign="top"><a href="#Page-layout-parameters">Page layout parameters</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-leading">leading</a>:</td><td> </td><td valign="top"><a href="#g_t_005cbaselineskip-_0026-_005cbaselinestretch">\baselineskip & \baselinestretch</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-left-angle-quotation-marks">left angle quotation marks</a>:</td><td> </td><td valign="top"><a href="#Text-symbols">Text symbols</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-left-arrow_002c-in-text">left arrow, in text</a>:</td><td> </td><td valign="top"><a href="#Text-symbols">Text symbols</a></td></tr>
 <tr><td></td><td valign="top"><a href="#index-left-brace_002c-in-text">left brace, in text</a>:</td><td> </td><td valign="top"><a href="#Text-symbols">Text symbols</a></td></tr>

Modified: trunk/latex2e.info
===================================================================
--- trunk/latex2e.info	2021-06-05 21:53:07 UTC (rev 923)
+++ trunk/latex2e.info	2021-06-09 12:41:18 UTC (rev 924)
@@ -2187,15 +2187,10 @@
 5.6 '\baselineskip' & '\baselinestretch'
 ========================================
 
-Synopsis: to change the document spacing put this in the preamble.
+The '\baselineskip' is a rubber length (*note Lengths::).  It gives the
+leading, the normal distance between lines in a paragraph, from baseline
+to baseline.
 
-     \usepackage{setspace}
-     \doublespacing  % or \onehalfspacing for 1.5
-
-   The '\baselineskip' is a rubber length (*note Lengths::).  It gives
-the leading, the normal distance between lines in a paragraph, from
-baseline to baseline.
-
    Ordinarily document authors do not directly change '\baselineskip'
 while writing.  Instead, it is set by the low level font selection
 command '\fontsize' (*note low level font commands fontsize::).  The
@@ -2240,12 +2235,13 @@
 doesn't actually use the depth of the previous line.  Instead it uses
 '\prevdepth', which usually contains that depth.  But at the beginning
 of the paragraph (or any vertical list) or just after a rule,
-'\prevdepth' has the value -1000pt and that keeps TeX from inserting any
-interline glue at the paragraph start.
+'\prevdepth' has the value -1000pt and this special value tells TeX not
+to insert any interline glue at the paragraph start.
 
    In the standard classes '\lineskiplimit' is 0pt and '\lineskip' is
 1pt.  By the prior paragraph then, the distance between lines can
-approach zero but if it equals zero then the lines jump to 1pt apart.
+approach zero but if it becomes zero (or less than zero) then the lines
+jump to 1pt apart.
 
    Sometimes authors must, for editing purposes, put the document in
 double space or one-and-a-half space.  The right way to influence the
@@ -2264,17 +2260,20 @@
 a font setting happens.  But that always takes place at the start of a
 document, so there you don't need to follow it with '\selectfont'.)
 
-   A more flexible approach is the 'setspace' package.  After the
-'\usepackage{setspace}', use '\doublespacing', or '\onehalfspacing' or
-one-an-a-half.  In the preamble these will start the document off with
-that sizing.  But you can also use these declarations in the document
-body to change the spacing from that point forward, and consequently
-there is '\singlespacing' to return the spacing to normal.  In the
-document body, a better practice than using the declarations is to use
-environments, such as '\begin{doublespace} ... \end{doublespace}'.  The
-package also has commands to do arbitrary spacing: '\setstretch{FACTOR}'
-and '\begin{spacing}{FACTOR} ... \end{spacing}'.
+   A simpler approach is the 'setspace' package.  The basic example:
 
+     \usepackage{setspace}
+     \doublespacing  % or \onehalfspacing for 1.5
+
+   In the preamble these will start the document off with that sizing.
+But you can also use these declarations in the document body to change
+the spacing from that point forward, and consequently there is
+'\singlespacing' to return the spacing to normal.  In the document body,
+a better practice than using the declarations is to use environments,
+such as '\begin{doublespace} ... \end{doublespace}'.  The package also
+has commands to do arbitrary spacing: '\setstretch{FACTOR}' and
+'\begin{spacing}{FACTOR} ... \end{spacing}'.
+
 
 File: latex2e.info,  Node: Floats,  Prev: \baselineskip & \baselinestretch,  Up: Layout
 
@@ -8656,6 +8655,7 @@
 * \settodepth::         Set a length to the depth of something.
 * \settoheight::        Set a length to the height of something.
 * \settowidth::         Set a length to the width of something.
+* Expressions::         Compute with lengths and integers.
 
 
 File: latex2e.info,  Node: Units of length,  Next: \setlength,  Up: Lengths
@@ -8828,7 +8828,7 @@
 number, treated as zero. <to be read again> \setbox'.
 
 
-File: latex2e.info,  Node: \settowidth,  Prev: \settoheight,  Up: Lengths
+File: latex2e.info,  Node: \settowidth,  Next: Expressions,  Prev: \settoheight,  Up: Lengths
 
 14.6 '\settowidth'
 ==================
@@ -8855,6 +8855,103 @@
 number, treated as zero. <to be read again> \setbox'.
 
 
+File: latex2e.info,  Node: Expressions,  Prev: \settowidth,  Up: Lengths
+
+14.7 Expressions
+================
+
+Synopsis, one of:
+
+     \numexpr EXPRESSION
+     \dimexpr EXPRESSION
+     \glueexpr EXPRESSION
+     \muglue EXPRESSION
+
+   Any place where you may write an integer, or a TeX dimen, or TeX
+glue, or muglue, you can instead write an expression to compute that
+type of quantity.
+
+   An example is that '\the\dimexpr\linewidth-4pt\relax' will produce
+document output giving the length that is four points less than width of
+a line (the only purpose of '\the' is to show the result in the
+document).  Similarly, '\romannumeral\numexpr6+3\relax' will produce
+'ix', and '\the\glueexpr 5pt plus 1pt * 2 \relax' will produce '10.0pt
+plus 2.0pt'.
+
+   A convenience here over doing calculations by allocating registers
+and then using '\advance', etc., is that the evaluation of expressions
+does not involve assignments and can therefore be performed in places
+where assignments are not allowed.  The next example computes the width
+of the '\parbox'.
+
+     \newlength{\offset}\setlength{\offset}{2em}
+     \begin{center}
+     \parbox{\dimexpr\linewidth-\offset*3}{With malice toward none
+     with charity for all with firmness in the right as God gives us to see
+     the right let us strive on to finish the work we are in to bind up the
+     nation's wounds, to care for him who shall have borne the battle and
+     for his widow and his orphan ~ to do all which may achieve and cherish
+     a just and lasting peace among ourselves and with all nations.
+     ---Abraham Lincoln, Second Inaugural Address, from the memorial}
+     \end{center}
+
+   The EXPRESSION consists of one or more terms of the same type
+(integer, dimension, etc.)  that are added or subtracted.  A term that
+is a type of number, dimension, etc., consists of a factor of that type,
+optionally multiplied or divided by factors.  A factor of a type is
+either a quantity of that type or a parenthesized subexpression.  The
+expression produces a result of the given type, so that '\numexpr'
+produces an integer, '\dimexpr' produces a dimension, etc.
+
+   In the quotation example above, changing to
+'\dimexpr\linewidth-3*\offset' gives the error 'Illegal unit of measure
+(pt inserted)'.  This is because for '\dimexpr' and '\glueexpr', the
+input consists of a dimension or glue value followed by an optional
+multiplication factor, and not the other way around.  Thus
+'\the\dimexpr1pt*10\relax' is valid and produces '10.0pt', but
+'\the\dimexpr10*1pt\relax' gives the 'Illegal unit' error.
+
+   The expressions absorb tokens and carry out appropriate mathematics
+up to a '\relax' (which will be absorbed), or up to the first non-valid
+token.  Thus, '\the\numexpr2+3px' will print '5px', because LaTeX reads
+the '\numexpr2+3', which is made up of numbers, and then finds 'px',
+which is not a number.  It therefore terminates the expression and
+produces the '5', followed by the regular text 'px'.
+
+   This termination behavior is useful in comparisons.  In
+'\ifnum\numexpr\parindent*2 < 10pt Yes\else No\fi', the less than sign
+terminates the expression and the result is 'No' (in a standard LaTeX
+article).
+
+   Expressions may use the operators '+', '-', '*' and '/' along with
+parentheses for subexpressions, '(...)'.  In glue expressions the 'plus'
+and 'minus' parts do not need parenthesis to be affected by a factor.
+So '\the\glueexpr 5pt plus 1pt * 2 \relax' results in '10pt plus 2pt'.
+
+   TeX will coerce other numerical types in the same way as it does when
+doing register assignment.  Thus '\the\numexpr\dimexpr 1pt\relax\relax'
+will result in '65536', which is '1pt' converted to scaled points (TeX's
+internal unit) and then coerced into an integer.  With a '\glueexpr'
+here, the stretch and shrink would be dropped.  Going the other way, a
+'\numexpr' inside a '\dimexpr' or '\glueexpr' will need appropriate
+units, as in '\the\dimexpr\numexpr 1 + 2\relax pt\relax', which produces
+'3.0pt'.
+
+   The details of the arithmetic: each factor is checked to be in the
+allowed range, numbers must be less than 2 to the power 31 in absolute
+value, and dimensions or glue components must be less than 2 to the
+power 14 points, or 'mu', or 'fil', etc.  The arithmetic operations are
+performed individually, except for a scaling operation (a multiplication
+immediately followed by a division) which is done as one combined
+operation with a 64-bit product as intermediate value.  The result of
+each operation is again checked to be in the allowed range.
+
+   Finally, division and scaling take place with rounding (unlike TeX's
+'\divide', which truncates).  Thus '\the\dimexpr5pt*(3/2)\relax' puts
+'10.0pt' in the document, because it rounds '3/2' to '2', while
+'\the\dimexpr5pt*(4/3)\relax' puts '5.0pt'.
+
+
 File: latex2e.info,  Node: Making paragraphs,  Next: Math formulas,  Prev: Lengths,  Up: Top
 
 15 Making paragraphs
@@ -14472,8 +14569,10 @@
 
      \usepackage[ENCODING-NAME]{inputenc}
 
-   Declare the input file's text encoding.  The default, if this package
-is not loaded, is UTF-8.
+   Declare the input file's text encoding to be ENCODING-NAME.  The
+default, if this package is not loaded, is UTF-8.  Technically,
+specifying the encoding name is optional, but in practice it is not
+useful to omit it.
 
    In a computer file, the characters are stored according to a scheme
 called the "encoding".  There are many different encodings.  The
@@ -17497,6 +17596,10 @@
 * \line:                                 \line.               (line   6)
 * \linebreak:                            \linebreak & \nolinebreak.
                                                               (line   6)
+* \lineskip:                             \baselineskip & \baselinestretch.
+                                                              (line  45)
+* \lineskiplimit:                        \baselineskip & \baselinestretch.
+                                                              (line  45)
 * \linespread:                           Low-level font commands.
                                                               (line 112)
 * \linespread <1>:                       \baselineskip & \baselinestretch.
@@ -17747,6 +17850,8 @@
 * \Pr:                                   Math functions.      (line  90)
 * \prec:                                 Math symbols.        (line 524)
 * \preceq:                               Math symbols.        (line 527)
+* \prevdepth:                            \baselineskip & \baselinestretch.
+                                                              (line  45)
 * \prime:                                Math symbols.        (line 531)
 * \printglossaries:                      Glossaries.          (line   6)
 * \printglossaries <1>:                  Glossaries.          (line  43)
@@ -18328,7 +18433,7 @@
 * chapter <1>:                           \chapter.            (line   6)
 * character category code:               \makeatletter & \makeatother.
                                                               (line  19)
-* character encoding:                    inputenc package.    (line  13)
+* character encoding:                    inputenc package.    (line  15)
 * character, invisible:                  \phantom & \vphantom & \hphantom.
                                                               (line   6)
 * character, invisible <1>:              \mathstrut.          (line   6)
@@ -18540,7 +18645,7 @@
 * enclosure list:                        \encl.               (line   6)
 * Encoding, font:                        \DeclareFontEncoding.
                                                               (line   6)
-* encoding, of input files:              inputenc package.    (line  13)
+* encoding, of input files:              inputenc package.    (line  15)
 * end matter of a book:                  \frontmatter & \mainmatter & \backmatter.
                                                               (line   6)
 * end of document hook:                  \AtEndDocument.      (line   6)
@@ -18625,6 +18730,7 @@
                                                               (line  49)
 * exponent:                              Subscripts & superscripts.
                                                               (line   6)
+* expressions:                           Expressions.         (line   6)
 * extended Latin:                        Additional Latin letters.
                                                               (line   6)
 * external commands:                     \write18.            (line   6)
@@ -18841,6 +18947,8 @@
 * inputenc:                              inputenc package.    (line   6)
 * inserting figures:                     figure.              (line   6)
 * insertions of special characters:      Special insertions.  (line   6)
+* interline space:                       \baselineskip & \baselinestretch.
+                                                              (line   6)
 * internal vertical mode:                Modes.               (line  38)
 * invisible character:                   \phantom & \vphantom & \hphantom.
                                                               (line   6)
@@ -18890,6 +18998,8 @@
 * layout commands:                       Layout.              (line   6)
 * layout, page parameters for:           Page layout parameters.
                                                               (line   6)
+* leading:                               \baselineskip & \baselinestretch.
+                                                              (line   6)
 * left angle quotation marks:            Text symbols.        (line  33)
 * left arrow, in text:                   Text symbols.        (line 157)
 * left brace, in text:                   Text symbols.        (line  89)
@@ -19245,7 +19355,7 @@
 * package, polyglossia <3>:              \index.              (line  56)
 * package, PSTricks:                     \line.               (line  36)
 * package, setspace:                     \baselineskip & \baselinestretch.
-                                                              (line   6)
+                                                              (line  79)
 * package, shellesc:                     \write18.            (line  71)
 * package, showidx:                      Indexes.             (line  32)
 * package, siunitx:                      minipage.            (line 137)
@@ -19444,7 +19554,7 @@
 * series, of fonts:                      Low-level font commands.
                                                               (line  48)
 * setspace package:                      \baselineskip & \baselinestretch.
-                                                              (line   6)
+                                                              (line  79)
 * setting counters:                      \setcounter.         (line   6)
 * sh, used by \write18:                  \write18.            (line  60)
 * shapes, of fonts:                      Low-level font commands.
@@ -19659,7 +19769,7 @@
 * underlining:                           Over- and Underlining.
                                                               (line   6)
 * underscore, in text:                   Text symbols.        (line 210)
-* Unicode:                               inputenc package.    (line  13)
+* Unicode:                               inputenc package.    (line  15)
 * Unicode input, native:                 TeX engines.         (line   6)
 * unicode-math package:                  Greek letters.       (line  37)
 * units, of length:                      Units of length.     (line   6)
@@ -19810,450 +19920,451 @@
 Ref: page layout parameters topmargin87544
 Ref: page layout parameters topskip87848
 Node: \baselineskip & \baselinestretch88064
-Node: Floats93175
-Ref: floats bottomfraction97513
-Ref: floats floatpagefraction97640
-Ref: floats textfraction97751
-Ref: floats topfraction97953
-Ref: floats floatsep98205
-Ref: floats intextsep98315
-Ref: floats textfloatsep98530
-Ref: floats bottomnumber98794
-Ref: floats dbltopnumber98902
-Ref: floats topnumber99021
-Ref: floats totalnumber99125
-Node: Sectioning99667
-Ref: sectioning secnumdepth102776
-Ref: Sectioning/secnumdepth102776
-Ref: sectioning tocdepth103402
-Ref: Sectioning/tocdepth103402
-Node: \part104442
-Node: \chapter106619
-Node: \section110392
-Node: \subsection113659
-Node: \subsubsection & \paragraph & \subparagraph116373
-Node: \appendix119030
-Node: \frontmatter & \mainmatter & \backmatter120323
-Node: \@startsection121732
-Ref: startsection name123221
-Ref: \@startsection/name123221
-Ref: startsection level123675
-Ref: \@startsection/level123675
-Ref: startsection indent124556
-Ref: \@startsection/indent124556
-Ref: startsection beforeskip124819
-Ref: \@startsection/beforeskip124819
-Ref: startsection afterskip126340
-Ref: \@startsection/afterskip126340
-Ref: startsection style127651
-Ref: \@startsection/style127651
-Node: Cross references131352
-Node: \label133501
-Node: \pageref135321
-Node: \ref136111
-Node: xr package137106
-Node: Environments138940
-Node: abstract140942
-Node: array142531
-Node: center145423
-Node: \centering147176
-Node: description148673
-Node: displaymath150890
-Node: document152586
-Node: \AtBeginDocument153016
-Node: \AtEndDocument153640
-Node: enumerate154284
-Ref: enumerate enumi156147
-Ref: enumerate enumii156147
-Ref: enumerate enumiii156147
-Ref: enumerate enumiv156147
-Ref: enumerate labelenumi156545
-Ref: enumerate labelenumii156545
-Ref: enumerate labelenumiii156545
-Ref: enumerate labelenumiv156545
-Node: eqnarray157084
-Node: equation159080
-Node: figure159748
-Node: filecontents161902
-Node: flushleft163811
-Node: \raggedright164838
-Node: flushright166036
-Node: \raggedleft166860
-Node: itemize167731
-Ref: itemize labelitemi169279
-Ref: itemize labelitemii169279
-Ref: itemize labelitemiii169279
-Ref: itemize labelitemiv169279
-Ref: itemize leftmargin169938
-Ref: itemize leftmargini169938
-Ref: itemize leftmarginii169938
-Ref: itemize leftmarginiii169938
-Ref: itemize leftmarginiv169938
-Ref: itemize leftmarginv169938
-Ref: itemize leftmarginvi169938
-Node: letter171420
-Node: list171658
-Ref: list makelabel174105
-Ref: list itemindent175490
-Ref: list itemsep175627
-Ref: list labelsep176280
-Ref: list labelwidth176443
-Ref: list leftmargin177454
-Ref: list listparindent178307
-Ref: list parsep178538
-Ref: list partopsep179006
-Ref: list rightmargin179804
-Ref: list topsep179989
-Ref: list beginparpenalty183564
-Ref: list itempenalty183663
-Ref: list endparpenalty183767
-Node: \item184638
-Node: trivlist185884
-Node: math187412
-Node: minipage187718
-Node: picture193247
-Node: \put199477
-Node: \multiput200042
-Node: \qbezier200781
-Node: \graphpaper202254
-Node: \line203048
-Node: \linethickness205022
-Node: \thinlines205471
-Node: \thicklines205882
-Node: \circle206266
-Node: \oval206808
-Node: \shortstack207784
-Node: \vector209181
-Node: \makebox (picture)210095
-Node: \framebox (picture)211277
-Node: \frame212750
-Node: \dashbox213190
-Node: quotation & quote214325
-Node: tabbing215221
-Node: table221124
-Node: tabular223188
-Ref: tabular arrayrulewidth229525
-Ref: tabular arraystrech229765
-Ref: tabular doublerulesep229986
-Ref: tabular tabcolsep230122
-Node: \multicolumn230643
-Node: \vline234519
-Node: \cline235910
-Node: \hline236620
-Node: thebibliography237302
-Node: \bibitem239785
-Node: \cite242079
-Node: \nocite243947
-Node: Using BibTeX244455
-Node: theorem246626
-Node: titlepage247548
-Node: verbatim248831
-Node: \verb250644
-Node: verse252737
-Node: Line breaking253964
-Node: \\255330
-Node: \obeycr & \restorecr257763
-Node: \newline258574
-Node: \- (hyphenation)259603
-Node: \discretionary261241
-Node: \fussy & \sloppy262129
-Node: sloppypar262912
-Node: \hyphenation264058
-Node: \linebreak & \nolinebreak264652
-Node: Page breaking265800
-Node: \clearpage & \cleardoublepage267830
-Node: \newpage269350
-Node: \enlargethispage270648
-Node: \pagebreak & \nopagebreak271604
-Node: Footnotes273271
-Node: \footnote274417
-Ref: footnote footnoterule275685
-Ref: footnote footnotesep276296
-Node: \footnotemark277362
-Node: \footnotetext279701
-Node: Footnotes in section headings280303
-Node: Footnotes in a table281136
-Node: Footnotes of footnotes284058
-Node: Definitions284762
-Node: \newcommand & \renewcommand285809
-Node: \providecommand291110
-Node: \makeatletter & \makeatother292275
-Node: \@ifstar294377
-Node: \newcounter297862
-Node: \newlength299582
-Node: \newsavebox300404
-Node: \newenvironment & \renewenvironment301383
-Node: \newtheorem306707
-Node: \newfont310279
-Node: \protect311512
-Node: \ignorespaces & \ignorespacesafterend313900
-Node: xspace package316581
-Node: Counters318646
-Node: \alph \Alph \arabic \roman \Roman \fnsymbol320347
-Node: \usecounter322972
-Node: \value323831
-Node: \setcounter324884
-Node: \addtocounter325480
-Node: \refstepcounter325934
-Node: \stepcounter326603
-Node: \day & \month & \year327156
-Node: Lengths327967
-Node: Units of length332443
-Ref: units of length pt332646
-Ref: units of length pc332746
-Ref: units of length in332769
-Ref: units of length bp332795
-Ref: units of length cm332926
-Ref: units of length mm332948
-Ref: units of length dd332970
-Ref: units of length cc333002
-Ref: units of length sp333027
-Ref: Lengths/em333058
-Ref: Lengths/en333058
-Ref: Lengths/ex333058
-Ref: units of length em333058
-Ref: units of length en333058
-Ref: units of length ex333058
-Node: \setlength333914
-Node: \addtolength334999
-Node: \settodepth336074
-Node: \settoheight336952
-Node: \settowidth337845
-Node: Making paragraphs338713
-Node: \par340484
-Node: \indent & \noindent342431
-Node: \parindent & \parskip343966
-Node: Marginal notes345273
-Ref: marginal notes marginparpush346669
-Ref: marginal notes marginparsep346843
-Ref: marginal notes marginparwidth346975
-Node: Math formulas347324
-Node: Subscripts & superscripts351492
-Node: Math symbols353653
-Node: Arrows377424
-Node: \boldmath & \unboldmath378612
-Node: Blackboard bold380131
-Node: Calligraphic380933
-Node: Delimiters381464
-Node: \left & \right383652
-Node: \bigl & \bigr etc.387660
-Node: Dots390413
-Ref: ellipses cdots390844
-Ref: ellipses ddots390989
-Ref: ellipses ldots391070
-Ref: ellipses vdots391487
-Node: Greek letters392671
-Node: Math functions394350
-Node: Math accents395994
-Node: Over- and Underlining396893
-Node: Spacing in math mode398720
-Ref: spacing in math mode thickspace399655
-Ref: spacing in math mode medspace400080
-Ref: Spacing in math mode/\thinspace400507
-Ref: spacing in math mode thinspace400507
-Ref: spacing in math mode negthinspace400988
-Ref: spacing in math mode quad401315
-Ref: spacing in math mode qquad401571
-Node: \smash401909
-Node: \phantom & \vphantom & \hphantom404126
-Node: \mathstrut406673
-Node: Math miscellany407634
-Node: Colon character & \colon408140
-Node: \*408833
-Node: \frac409413
-Node: \sqrt409784
-Node: \stackrel410370
-Node: Modes410643
-Ref: modes paragraph mode411093
-Ref: modes lr mode411289
-Ref: modes math mode411895
-Ref: modes vertical mode412230
-Ref: modes internal vertical mode412401
-Ref: modes inner paragraph mode412874
-Ref: modes outer paragraph mode412874
-Node: \ensuremath413288
-Node: Page styles413993
-Node: \maketitle414756
-Node: \pagenumbering417774
-Node: \pagestyle419762
-Node: \thispagestyle423264
-Node: Spaces424218
-Node: \enspace & \quad & \qquad425659
-Node: \hspace426574
-Node: \hfill428412
-Node: \hss429476
-Node: \spacefactor430170
-Node: \@433557
-Ref: \AT433657
-Node: \frenchspacing435597
-Node: \normalsfcodes436432
-Node: \(SPACE)436679
-Node: ~438469
-Node: \thinspace & \negthinspace441046
-Node: \/442217
-Node: \hrulefill & \dotfill444173
-Node: \bigskip & \medskip & \smallskip445529
-Ref: bigskip446347
-Ref: medskip446551
-Ref: smallskip446760
-Node: \bigbreak & \medbreak & \smallbreak447421
-Node: \strut448407
-Node: \vspace451602
-Node: \vfill453166
-Node: \addvspace454094
-Node: Boxes456090
-Node: \mbox & \makebox456796
-Ref: mbox makebox depth458064
-Ref: mbox makebox height458064
-Ref: mbox makebox width458064
-Ref: mbox makebox totalheight458064
-Node: \fbox & \framebox460159
-Ref: fbox framebox fboxrule461473
-Ref: fbox framebox fboxsep461663
-Node: \parbox462753
-Node: \raisebox465059
-Ref: raisebox depth466032
-Ref: raisebox height466032
-Ref: raisebox width466032
-Ref: raisebox totalheight466032
-Node: \sbox & \savebox466733
-Node: lrbox469795
-Node: \usebox470681
-Node: Color471120
-Node: Color package options471919
-Node: Color models473565
-Ref: color models cmyk474362
-Ref: color models gray474725
-Ref: color models rgb474874
-Ref: color models RGB475211
-Ref: color models named475586
-Node: Commands for color475874
-Node: Define colors476289
-Node: Colored text477014
-Node: Colored boxes479411
-Node: Colored pages480800
-Node: Graphics481493
-Node: Graphics package options483620
-Node: Graphics package configuration486373
-Node: \graphicspath487175
-Node: \DeclareGraphicsExtensions490133
-Node: \DeclareGraphicsRule491951
-Node: Commands for graphics495132
-Node: \includegraphics495637
-Ref: includegraphics width500691
-Ref: includegraphics height501224
-Ref: includegraphics totalheight501630
-Ref: includegraphics keepaspectratio501894
-Ref: includegraphics viewport503580
-Ref: includegraphics trim503975
-Ref: includegraphics clip504431
-Ref: includegraphics page504691
-Ref: includegraphics pagebox504782
-Ref: includegraphics interpolate505647
-Ref: includegraphics quiet505852
-Ref: includegraphics draft506013
-Ref: includegraphics bb506818
-Ref: includegraphics bbllx507216
-Ref: includegraphics bblly507216
-Ref: includegraphics bburx507216
-Ref: includegraphics bbury507216
-Ref: includegraphics natwidth507358
-Ref: includegraphics natheight507358
-Ref: includegraphics hiresbb507544
-Ref: includegraphics type508306
-Ref: includegraphics ext508346
-Ref: includegraphics read508449
-Ref: includegraphics command508566
-Node: \rotatebox508812
-Node: \scalebox511666
-Node: \resizebox512722
-Node: Special insertions513914
-Node: Reserved characters514782
-Node: Upper and lower case516042
-Node: Symbols by font position518428
-Node: Text symbols519107
-Node: Accents524091
-Node: \accent526244
-Node: Additional Latin letters528006
-Ref: Non-English characters528188
-Node: inputenc package529207
-Node: \rule531636
-Node: \today532801
-Node: Splitting the input533737
-Node: \endinput535479
-Node: \include & \includeonly536782
-Node: \input541079
-Node: Front/back matter542294
-Node: Table of contents etc.542627
-Node: \addcontentsline546452
-Node: \addtocontents549294
-Node: \nofiles550885
-Node: Indexes551617
-Node: \index553225
-Node: makeindex558330
-Ref: makeindex preamble559998
-Ref: makeindex postamble560138
-Ref: makeindex group skip560223
-Ref: makeindex letheadflag560556
-Ref: makeindex lethead prefix561017
-Ref: makeindex lethead suffix561169
-Ref: makeindex item 0561317
-Ref: makeindex item 1561397
-Ref: makeindex item 2561472
-Ref: makeindex item 01561550
-Ref: makeindex item x1561655
-Ref: makeindex item 12561860
-Ref: makeindex item x2561968
-Ref: makeindex delim 0562128
-Ref: makeindex delim 1562258
-Ref: makeindex delim 2562388
-Ref: makeindex delim n562514
-Ref: makeindex delim r562649
-Ref: makeindex line max562757
-Ref: makeindex indent space562892
-Ref: makeindex indent length562987
-Ref: makeindex page precedence563172
-Node: \printindex564046
-Node: Glossaries564519
-Node: \newglossaryentry566486
-Node: \gls567953
-Node: Letters568747
-Node: \address572365
-Node: \cc573176
-Node: \closing573618
-Node: \encl573932
-Node: \location574346
-Node: \makelabels574610
-Node: \name576927
-Node: \opening577168
-Node: \ps577449
-Node: \signature577738
-Node: \telephone578966
-Node: Input/output579331
-Node: \openin & \openout580061
-Node: \read582804
-Node: \typein583991
-Node: \typeout585251
-Node: \write586301
-Node: \write and security591028
-Node: \message591972
-Node: \wlog593801
-Node: \write18594302
-Node: Command line interface597793
-Ref: Command line597957
-Node: Command line options600040
-Ref: interaction modes601036
-Ref: output directory601990
-Node: Command line input603689
-Node: Jobname605518
-Node: Recovering from errors608799
-Node: Document templates610144
-Node: beamer template610578
-Node: article template611220
-Node: book template611683
-Node: Larger book template612162
-Node: Index613704
-Ref: Command Index613790
+Node: Floats93057
+Ref: floats bottomfraction97395
+Ref: floats floatpagefraction97522
+Ref: floats textfraction97633
+Ref: floats topfraction97835
+Ref: floats floatsep98087
+Ref: floats intextsep98197
+Ref: floats textfloatsep98412
+Ref: floats bottomnumber98676
+Ref: floats dbltopnumber98784
+Ref: floats topnumber98903
+Ref: floats totalnumber99007
+Node: Sectioning99549
+Ref: sectioning secnumdepth102658
+Ref: Sectioning/secnumdepth102658
+Ref: sectioning tocdepth103284
+Ref: Sectioning/tocdepth103284
+Node: \part104324
+Node: \chapter106501
+Node: \section110274
+Node: \subsection113541
+Node: \subsubsection & \paragraph & \subparagraph116255
+Node: \appendix118912
+Node: \frontmatter & \mainmatter & \backmatter120205
+Node: \@startsection121614
+Ref: startsection name123103
+Ref: \@startsection/name123103
+Ref: startsection level123557
+Ref: \@startsection/level123557
+Ref: startsection indent124438
+Ref: \@startsection/indent124438
+Ref: startsection beforeskip124701
+Ref: \@startsection/beforeskip124701
+Ref: startsection afterskip126222
+Ref: \@startsection/afterskip126222
+Ref: startsection style127533
+Ref: \@startsection/style127533
+Node: Cross references131234
+Node: \label133383
+Node: \pageref135203
+Node: \ref135993
+Node: xr package136988
+Node: Environments138822
+Node: abstract140824
+Node: array142413
+Node: center145305
+Node: \centering147058
+Node: description148555
+Node: displaymath150772
+Node: document152468
+Node: \AtBeginDocument152898
+Node: \AtEndDocument153522
+Node: enumerate154166
+Ref: enumerate enumi156029
+Ref: enumerate enumii156029
+Ref: enumerate enumiii156029
+Ref: enumerate enumiv156029
+Ref: enumerate labelenumi156427
+Ref: enumerate labelenumii156427
+Ref: enumerate labelenumiii156427
+Ref: enumerate labelenumiv156427
+Node: eqnarray156966
+Node: equation158962
+Node: figure159630
+Node: filecontents161784
+Node: flushleft163693
+Node: \raggedright164720
+Node: flushright165918
+Node: \raggedleft166742
+Node: itemize167613
+Ref: itemize labelitemi169161
+Ref: itemize labelitemii169161
+Ref: itemize labelitemiii169161
+Ref: itemize labelitemiv169161
+Ref: itemize leftmargin169820
+Ref: itemize leftmargini169820
+Ref: itemize leftmarginii169820
+Ref: itemize leftmarginiii169820
+Ref: itemize leftmarginiv169820
+Ref: itemize leftmarginv169820
+Ref: itemize leftmarginvi169820
+Node: letter171302
+Node: list171540
+Ref: list makelabel173987
+Ref: list itemindent175372
+Ref: list itemsep175509
+Ref: list labelsep176162
+Ref: list labelwidth176325
+Ref: list leftmargin177336
+Ref: list listparindent178189
+Ref: list parsep178420
+Ref: list partopsep178888
+Ref: list rightmargin179686
+Ref: list topsep179871
+Ref: list beginparpenalty183446
+Ref: list itempenalty183545
+Ref: list endparpenalty183649
+Node: \item184520
+Node: trivlist185766
+Node: math187294
+Node: minipage187600
+Node: picture193129
+Node: \put199359
+Node: \multiput199924
+Node: \qbezier200663
+Node: \graphpaper202136
+Node: \line202930
+Node: \linethickness204904
+Node: \thinlines205353
+Node: \thicklines205764
+Node: \circle206148
+Node: \oval206690
+Node: \shortstack207666
+Node: \vector209063
+Node: \makebox (picture)209977
+Node: \framebox (picture)211159
+Node: \frame212632
+Node: \dashbox213072
+Node: quotation & quote214207
+Node: tabbing215103
+Node: table221006
+Node: tabular223070
+Ref: tabular arrayrulewidth229407
+Ref: tabular arraystrech229647
+Ref: tabular doublerulesep229868
+Ref: tabular tabcolsep230004
+Node: \multicolumn230525
+Node: \vline234401
+Node: \cline235792
+Node: \hline236502
+Node: thebibliography237184
+Node: \bibitem239667
+Node: \cite241961
+Node: \nocite243829
+Node: Using BibTeX244337
+Node: theorem246508
+Node: titlepage247430
+Node: verbatim248713
+Node: \verb250526
+Node: verse252619
+Node: Line breaking253846
+Node: \\255212
+Node: \obeycr & \restorecr257645
+Node: \newline258456
+Node: \- (hyphenation)259485
+Node: \discretionary261123
+Node: \fussy & \sloppy262011
+Node: sloppypar262794
+Node: \hyphenation263940
+Node: \linebreak & \nolinebreak264534
+Node: Page breaking265682
+Node: \clearpage & \cleardoublepage267712
+Node: \newpage269232
+Node: \enlargethispage270530
+Node: \pagebreak & \nopagebreak271486
+Node: Footnotes273153
+Node: \footnote274299
+Ref: footnote footnoterule275567
+Ref: footnote footnotesep276178
+Node: \footnotemark277244
+Node: \footnotetext279583
+Node: Footnotes in section headings280185
+Node: Footnotes in a table281018
+Node: Footnotes of footnotes283940
+Node: Definitions284644
+Node: \newcommand & \renewcommand285691
+Node: \providecommand290992
+Node: \makeatletter & \makeatother292157
+Node: \@ifstar294259
+Node: \newcounter297744
+Node: \newlength299464
+Node: \newsavebox300286
+Node: \newenvironment & \renewenvironment301265
+Node: \newtheorem306589
+Node: \newfont310161
+Node: \protect311394
+Node: \ignorespaces & \ignorespacesafterend313782
+Node: xspace package316463
+Node: Counters318528
+Node: \alph \Alph \arabic \roman \Roman \fnsymbol320229
+Node: \usecounter322854
+Node: \value323713
+Node: \setcounter324766
+Node: \addtocounter325362
+Node: \refstepcounter325816
+Node: \stepcounter326485
+Node: \day & \month & \year327038
+Node: Lengths327849
+Node: Units of length332384
+Ref: units of length pt332587
+Ref: units of length pc332687
+Ref: units of length in332710
+Ref: units of length bp332736
+Ref: units of length cm332867
+Ref: units of length mm332889
+Ref: units of length dd332911
+Ref: units of length cc332943
+Ref: units of length sp332968
+Ref: Lengths/em332999
+Ref: Lengths/en332999
+Ref: Lengths/ex332999
+Ref: units of length em332999
+Ref: units of length en332999
+Ref: units of length ex332999
+Node: \setlength333855
+Node: \addtolength334940
+Node: \settodepth336015
+Node: \settoheight336893
+Node: \settowidth337786
+Node: Expressions338674
+Node: Making paragraphs343443
+Node: \par345214
+Node: \indent & \noindent347161
+Node: \parindent & \parskip348696
+Node: Marginal notes350003
+Ref: marginal notes marginparpush351399
+Ref: marginal notes marginparsep351573
+Ref: marginal notes marginparwidth351705
+Node: Math formulas352054
+Node: Subscripts & superscripts356222
+Node: Math symbols358383
+Node: Arrows382154
+Node: \boldmath & \unboldmath383342
+Node: Blackboard bold384861
+Node: Calligraphic385663
+Node: Delimiters386194
+Node: \left & \right388382
+Node: \bigl & \bigr etc.392390
+Node: Dots395143
+Ref: ellipses cdots395574
+Ref: ellipses ddots395719
+Ref: ellipses ldots395800
+Ref: ellipses vdots396217
+Node: Greek letters397401
+Node: Math functions399080
+Node: Math accents400724
+Node: Over- and Underlining401623
+Node: Spacing in math mode403450
+Ref: spacing in math mode thickspace404385
+Ref: spacing in math mode medspace404810
+Ref: Spacing in math mode/\thinspace405237
+Ref: spacing in math mode thinspace405237
+Ref: spacing in math mode negthinspace405718
+Ref: spacing in math mode quad406045
+Ref: spacing in math mode qquad406301
+Node: \smash406639
+Node: \phantom & \vphantom & \hphantom408856
+Node: \mathstrut411403
+Node: Math miscellany412364
+Node: Colon character & \colon412870
+Node: \*413563
+Node: \frac414143
+Node: \sqrt414514
+Node: \stackrel415100
+Node: Modes415373
+Ref: modes paragraph mode415823
+Ref: modes lr mode416019
+Ref: modes math mode416625
+Ref: modes vertical mode416960
+Ref: modes internal vertical mode417131
+Ref: modes inner paragraph mode417604
+Ref: modes outer paragraph mode417604
+Node: \ensuremath418018
+Node: Page styles418723
+Node: \maketitle419486
+Node: \pagenumbering422504
+Node: \pagestyle424492
+Node: \thispagestyle427994
+Node: Spaces428948
+Node: \enspace & \quad & \qquad430389
+Node: \hspace431304
+Node: \hfill433142
+Node: \hss434206
+Node: \spacefactor434900
+Node: \@438287
+Ref: \AT438387
+Node: \frenchspacing440327
+Node: \normalsfcodes441162
+Node: \(SPACE)441409
+Node: ~443199
+Node: \thinspace & \negthinspace445776
+Node: \/446947
+Node: \hrulefill & \dotfill448903
+Node: \bigskip & \medskip & \smallskip450259
+Ref: bigskip451077
+Ref: medskip451281
+Ref: smallskip451490
+Node: \bigbreak & \medbreak & \smallbreak452151
+Node: \strut453137
+Node: \vspace456332
+Node: \vfill457896
+Node: \addvspace458824
+Node: Boxes460820
+Node: \mbox & \makebox461526
+Ref: mbox makebox depth462794
+Ref: mbox makebox height462794
+Ref: mbox makebox width462794
+Ref: mbox makebox totalheight462794
+Node: \fbox & \framebox464889
+Ref: fbox framebox fboxrule466203
+Ref: fbox framebox fboxsep466393
+Node: \parbox467483
+Node: \raisebox469789
+Ref: raisebox depth470762
+Ref: raisebox height470762
+Ref: raisebox width470762
+Ref: raisebox totalheight470762
+Node: \sbox & \savebox471463
+Node: lrbox474525
+Node: \usebox475411
+Node: Color475850
+Node: Color package options476649
+Node: Color models478295
+Ref: color models cmyk479092
+Ref: color models gray479455
+Ref: color models rgb479604
+Ref: color models RGB479941
+Ref: color models named480316
+Node: Commands for color480604
+Node: Define colors481019
+Node: Colored text481744
+Node: Colored boxes484141
+Node: Colored pages485530
+Node: Graphics486223
+Node: Graphics package options488350
+Node: Graphics package configuration491103
+Node: \graphicspath491905
+Node: \DeclareGraphicsExtensions494863
+Node: \DeclareGraphicsRule496681
+Node: Commands for graphics499862
+Node: \includegraphics500367
+Ref: includegraphics width505421
+Ref: includegraphics height505954
+Ref: includegraphics totalheight506360
+Ref: includegraphics keepaspectratio506624
+Ref: includegraphics viewport508310
+Ref: includegraphics trim508705
+Ref: includegraphics clip509161
+Ref: includegraphics page509421
+Ref: includegraphics pagebox509512
+Ref: includegraphics interpolate510377
+Ref: includegraphics quiet510582
+Ref: includegraphics draft510743
+Ref: includegraphics bb511548
+Ref: includegraphics bbllx511946
+Ref: includegraphics bblly511946
+Ref: includegraphics bburx511946
+Ref: includegraphics bbury511946
+Ref: includegraphics natwidth512088
+Ref: includegraphics natheight512088
+Ref: includegraphics hiresbb512274
+Ref: includegraphics type513036
+Ref: includegraphics ext513076
+Ref: includegraphics read513179
+Ref: includegraphics command513296
+Node: \rotatebox513542
+Node: \scalebox516396
+Node: \resizebox517452
+Node: Special insertions518644
+Node: Reserved characters519512
+Node: Upper and lower case520772
+Node: Symbols by font position523158
+Node: Text symbols523837
+Node: Accents528821
+Node: \accent530974
+Node: Additional Latin letters532736
+Ref: Non-English characters532918
+Node: inputenc package533937
+Node: \rule536487
+Node: \today537652
+Node: Splitting the input538588
+Node: \endinput540330
+Node: \include & \includeonly541633
+Node: \input545930
+Node: Front/back matter547145
+Node: Table of contents etc.547478
+Node: \addcontentsline551303
+Node: \addtocontents554145
+Node: \nofiles555736
+Node: Indexes556468
+Node: \index558076
+Node: makeindex563181
+Ref: makeindex preamble564849
+Ref: makeindex postamble564989
+Ref: makeindex group skip565074
+Ref: makeindex letheadflag565407
+Ref: makeindex lethead prefix565868
+Ref: makeindex lethead suffix566020
+Ref: makeindex item 0566168
+Ref: makeindex item 1566248
+Ref: makeindex item 2566323
+Ref: makeindex item 01566401
+Ref: makeindex item x1566506
+Ref: makeindex item 12566711
+Ref: makeindex item x2566819
+Ref: makeindex delim 0566979
+Ref: makeindex delim 1567109
+Ref: makeindex delim 2567239
+Ref: makeindex delim n567365
+Ref: makeindex delim r567500
+Ref: makeindex line max567608
+Ref: makeindex indent space567743
+Ref: makeindex indent length567838
+Ref: makeindex page precedence568023
+Node: \printindex568897
+Node: Glossaries569370
+Node: \newglossaryentry571337
+Node: \gls572804
+Node: Letters573598
+Node: \address577216
+Node: \cc578027
+Node: \closing578469
+Node: \encl578783
+Node: \location579197
+Node: \makelabels579461
+Node: \name581778
+Node: \opening582019
+Node: \ps582300
+Node: \signature582589
+Node: \telephone583817
+Node: Input/output584182
+Node: \openin & \openout584912
+Node: \read587655
+Node: \typein588842
+Node: \typeout590102
+Node: \write591152
+Node: \write and security595879
+Node: \message596823
+Node: \wlog598652
+Node: \write18599153
+Node: Command line interface602644
+Ref: Command line602808
+Node: Command line options604891
+Ref: interaction modes605887
+Ref: output directory606841
+Node: Command line input608540
+Node: Jobname610369
+Node: Recovering from errors613650
+Node: Document templates614995
+Node: beamer template615429
+Node: article template616071
+Node: book template616534
+Node: Larger book template617013
+Node: Index618555
+Ref: Command Index618641
 
 End Tag Table
 

Modified: trunk/latex2e.pdf
===================================================================
(Binary files differ)

Modified: trunk/latex2e.texi
===================================================================
--- trunk/latex2e.texi	2021-06-05 21:53:07 UTC (rev 923)
+++ trunk/latex2e.texi	2021-06-09 12:41:18 UTC (rev 924)
@@ -27,7 +27,6 @@
 @c xx JH ligatures
 @c xx JH \stretch
 @c xx JH \contentsline, \@@dottedtocline?
- at c xx JH \numexpr, \dimexpr, \glueexpr, \muexpr
 @c
 @c xx The typeset source2e has an index with all kernel
 @c xx commands, though some are internal and shouldn't be included.
@@ -10851,6 +10850,7 @@
 * \settodepth::         Set a length to the depth of something.
 * \settoheight::        Set a length to the height of something.
 * \settowidth::         Set a length to the width of something.
+* Expressions::         Compute with lengths and integers.
 @c * Predefined lengths::  Lengths that are, like, predefined.
 @end menu
 
@@ -11123,6 +11123,113 @@
 @samp{Missing number, treated as zero. <to be read again> \setbox}.
 
 
+ at node Expressions
+ at section Expressions
+
+ at findex expressions
+
+ at c Much from Joseph Wright's https://tex.stackexchange.com/a/245663/339
+Synopsis, one of:
+
+ at example
+\numexpr @var{expression} 
+\dimexpr @var{expression}
+\glueexpr @var{expression}
+\muglue @var{expression}
+ at end example
+
+Any place where you may write an integer, or a @TeX{} dimen, or @TeX{}
+glue, or muglue, you can instead write an expression to compute that
+type of quantity.
+
+An example is that @code{\the\dimexpr\linewidth-4pt\relax} will produce
+document output giving the length that is four points less than width of
+a line (the only purpose of @code{\the} is to show the result in the
+document).  Similarly, @code{\romannumeral\numexpr6+3\relax} will
+produce @samp{ix}, and @code{\the\glueexpr 5pt plus 1pt * 2 \relax} will
+produce @samp{10.0pt plus 2.0pt}.
+
+A convenience here over doing calculations by allocating registers and
+then using @code{\advance}, etc., is that the evaluation of expressions
+does not involve assignments and can therefore be performed in places
+where assignments are not allowed.  The next example computes the width
+of the @code{\parbox}.
+
+ at example
+\newlength@{\offset@}\setlength@{\offset@}@{2em@}
+\begin@{center@}
+\parbox@{\dimexpr\linewidth-\offset*3@}@{With malice toward none
+with charity for all with firmness in the right as God gives us to see
+the right let us strive on to finish the work we are in to bind up the
+nation's wounds, to care for him who shall have borne the battle and
+for his widow and his orphan ~ to do all which may achieve and cherish
+a just and lasting peace among ourselves and with all nations.
+---Abraham Lincoln, Second Inaugural Address, from the memorial@}
+\end@{center@}
+ at end example
+
+The @var{expression} consists of one or more terms of the same type
+(integer, dimension, etc.) that are added or subtracted.  A term that is
+a type of number, dimension, etc., consists of a factor of that type,
+optionally multiplied or divided by factors.  A factor of a type is
+either a quantity of that type or a parenthesized subexpression.  The
+expression produces a result of the given type, so that @code{\numexpr}
+produces an integer, @code{\dimexpr} produces a dimension, etc.
+
+In the quotation example above, changing to
+ at code{\dimexpr\linewidth-3*\offset} gives the error @code{Illegal unit
+of measure (pt inserted)}.  This is because for @code{\dimexpr} and
+ at code{\glueexpr}, the input consists of a dimension or glue value
+followed by an optional multiplication factor, and not the other way
+around. Thus @code{\the\dimexpr1pt*10\relax} is valid and produces
+ at samp{10.0pt}, but @code{\the\dimexpr10*1pt\relax} gives the
+ at code{Illegal unit} error.
+
+The expressions absorb tokens and carry out appropriate mathematics up
+to a @code{\relax} (which will be absorbed), or up to the first
+non-valid token.  Thus, @code{\the\numexpr2+3px} will print @samp{5px},
+because @LaTeX{} reads the @code{\numexpr2+3}, which is made up of
+numbers, and then finds @code{px}, which is not a number.  It therefore
+terminates the expression and produces the @samp{5}, followed by the
+regular text @samp{px}.
+
+This termination behavior is useful in comparisons.  In
+ at code{\ifnum\numexpr\parindent*2 < 10pt Yes\else No\fi}, the less than
+sign terminates the expression and the result is @samp{No} (in a
+standard @LaTeX{} article).
+
+Expressions may use the operators @code{+}, @code{-}, @code{*} and
+ at code{/} along with parentheses for subexpressions, @code{(...)}.  In
+glue expressions the @code{plus} and @code{minus} parts do not need
+parenthesis to be affected by a factor. So @code{\the\glueexpr 5pt plus
+1pt * 2 \relax} results in @samp{10pt plus 2pt}.
+
+ at TeX{} will coerce other numerical types in the same way as it does when
+doing register assignment. Thus @code{\the\numexpr\dimexpr
+1pt\relax\relax} will result in @samp{65536}, which is @code{1pt}
+converted to scaled points (@TeX{}'s internal unit) and then coerced
+into an integer.  With a @code{\glueexpr} here, the stretch and shrink
+would be dropped.  Going the other way, a @code{\numexpr} inside a
+ at code{\dimexpr} or @code{\glueexpr} will need appropriate units, as in
+ at code{\the\dimexpr\numexpr 1 + 2\relax pt\relax}, which produces
+ at samp{3.0pt}.
+
+The details of the arithmetic: each factor is checked to be in the
+allowed range, numbers must be less than 2 to the power 31 in absolute
+value, and dimensions or glue components must be less than 2 to the
+power 14 points, or @code{mu}, or @code{fil}, etc.  The arithmetic
+operations are performed individually, except for a scaling operation (a
+multiplication immediately followed by a division) which is done as one
+combined operation with a 64-bit product as intermediate value. The
+result of each operation is again checked to be in the allowed range.
+
+Finally, division and scaling take place with rounding (unlike @TeX{}'s
+ at code{\divide}, which truncates).  Thus
+ at code{\the\dimexpr5pt*(3/2)\relax} puts @samp{10.0pt} in the document,
+because it rounds @code{3/2} to @code{2}, while
+ at code{\the\dimexpr5pt*(4/3)\relax} produces @samp{5.0pt}.
+
+
 @node Making paragraphs
 @chapter Making paragraphs
 



More information about the latexrefman-commits mailing list.