[latexrefman-commits] [SCM] latexrefman updated: r659 - trunk
jimhefferon at gnu.org.ua
jimhefferon at gnu.org.ua
Thu Jun 21 01:44:19 CEST 2018
Author: jimhefferon
Date: 2018-06-21 02:44:19 +0300 (Thu, 21 Jun 2018)
New Revision: 659
Modified:
trunk/ChangeLog
trunk/latex2e.html
trunk/latex2e.info
trunk/latex2e.pdf
trunk/latex2e.texi
Log:
\sbox and \savebox and related stuff
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2018-06-20 15:05:12 UTC (rev 658)
+++ trunk/ChangeLog 2018-06-20 23:44:19 UTC (rev 659)
@@ -1,3 +1,10 @@
+2018-06-20 Jim Hefferon <jhefferon at smcvt.edu>
+
+ * latex2e.texi (\sbox & \savebox) Combined the two. Added examples,
+ adjusted wording
+ (lrbox) Adjust wording.
+ (\usebox) Adjust wording, add error messages.
+
2018-06-19 Jim Hefferon <jhefferon at smcvt.edu>
* latex2e.texi (\strut) Added.
Modified: trunk/latex2e.html
===================================================================
--- trunk/latex2e.html 2018-06-20 15:05:12 UTC (rev 658)
+++ trunk/latex2e.html 2018-06-20 23:44:19 UTC (rev 659)
@@ -408,12 +408,11 @@
<ul class="no-bullet">
<li><a name="toc-_005cmbox-_0026-_005cmakebox-1" href="#g_t_005cmbox-_0026-_005cmakebox">20.1 <code>\mbox</code> & <code>\makebox</code></a></li>
<li><a name="toc-_005cfbox-_0026-_005cframebox-1" href="#g_t_005cfbox-_0026-_005cframebox">20.2 <code>\fbox</code> & <code>\framebox</code></a></li>
- <li><a name="toc-lrbox-1" href="#lrbox">20.3 <code>lrbox</code></a></li>
- <li><a name="toc-_005cparbox-1" href="#g_t_005cparbox">20.4 <code>\parbox</code></a></li>
- <li><a name="toc-_005craisebox-1" href="#g_t_005craisebox">20.5 <code>\raisebox</code></a></li>
- <li><a name="toc-_005csavebox-1" href="#g_t_005csavebox">20.6 <code>\savebox</code></a></li>
- <li><a name="toc-_005csbox_007b_005cboxcmd_007d_007btext_007d" href="#g_t_005csbox">20.7 <code>\sbox{<var>\boxcmd</var>}{<var>text</var>}</code></a></li>
- <li><a name="toc-_005cusebox_007b_005cboxcmd_007d" href="#g_t_005cusebox">20.8 <code>\usebox{<var>\boxcmd</var>}</code></a></li>
+ <li><a name="toc-_005cparbox-1" href="#g_t_005cparbox">20.3 <code>\parbox</code></a></li>
+ <li><a name="toc-_005craisebox-1" href="#g_t_005craisebox">20.4 <code>\raisebox</code></a></li>
+ <li><a name="toc-_005csbox-_0026-_005csavebox-1" href="#g_t_005csbox-_0026-_005csavebox">20.5 <code>\sbox</code> & <code>\savebox</code></a></li>
+ <li><a name="toc-lrbox-1" href="#lrbox">20.6 <code>lrbox</code></a></li>
+ <li><a name="toc-_005cusebox_007b_005cboxcmd_007d" href="#g_t_005cusebox">20.7 <code>\usebox{<var>\boxcmd</var>}</code></a></li>
</ul></li>
<li><a name="toc-Color-1" href="#Color">21 Color</a>
<ul class="no-bullet">
@@ -10270,7 +10269,7 @@
</pre></div>
<p>The final example shows how to save the value of an argument to use in
-<var>enddef</var>, in this case in a box (see <a href="#g_t_005csbox">\sbox</a>).
+<var>enddef</var>, in this case in a box (see <a href="#g_t_005csbox-_0026-_005csavebox">\sbox & \savebox</a>).
</p>
<div class="example">
<pre class="example">\newsavebox{\quoteauthor}
@@ -16217,26 +16216,30 @@
<a name="index-boxes"></a>
-<p>All the predefined length parameters (see <a href="#Predefined-lengths">Predefined lengths</a>) can be
-used in the arguments of the box-making commands.
+<p>At its core, LaTeX puts things in boxes and then puts the boxes on a
+page. So these commands are central.
</p>
+<p>All of the predefined length parameters (see <a href="#Predefined-lengths">Predefined lengths</a>) can
+be used in the arguments of the box-making commands.
+</p>
+<p>There are many packages on CTAN that are useful for manipulating boxes.
+One useful adjunct to the commands here is <samp>adjustbox</samp>.
+</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#g_t_005cmbox-_0026-_005cmakebox" accesskey="1">\mbox & \makebox</a>:</td><td> </td><td align="left" valign="top">Horizontal boxes.
</td></tr>
<tr><td align="left" valign="top">• <a href="#g_t_005cfbox-_0026-_005cframebox" accesskey="2">\fbox & \framebox</a>:</td><td> </td><td align="left" valign="top">Put a frame around a box.
</td></tr>
-<tr><td align="left" valign="top">• <a href="#lrbox" accesskey="3">lrbox</a>:</td><td> </td><td align="left" valign="top">An environment like <code>\sbox</code>.
+<tr><td align="left" valign="top">• <a href="#g_t_005cparbox" accesskey="3">\parbox</a>:</td><td> </td><td align="left" valign="top">Box with text in paragraph mode.
</td></tr>
-<tr><td align="left" valign="top">• <a href="#g_t_005cparbox" accesskey="4">\parbox</a>:</td><td> </td><td align="left" valign="top">Box with text in paragraph mode.
+<tr><td align="left" valign="top">• <a href="#g_t_005craisebox" accesskey="4">\raisebox</a>:</td><td> </td><td align="left" valign="top">Raise or lower text.
</td></tr>
-<tr><td align="left" valign="top">• <a href="#g_t_005craisebox" accesskey="5">\raisebox</a>:</td><td> </td><td align="left" valign="top">Raise or lower text.
+<tr><td align="left" valign="top">• <a href="#g_t_005csbox-_0026-_005csavebox" accesskey="5">\sbox & \savebox</a>:</td><td> </td><td align="left" valign="top">Like <code>\makebox</code> but save the text for later.
</td></tr>
-<tr><td align="left" valign="top">• <a href="#g_t_005csavebox" accesskey="6">\savebox</a>:</td><td> </td><td align="left" valign="top">Like <code>\makebox</code>, but save the text for later use.
+<tr><td align="left" valign="top">• <a href="#lrbox" accesskey="6">lrbox</a>:</td><td> </td><td align="left" valign="top">Environment version of <code>\sbox</code>.
</td></tr>
-<tr><td align="left" valign="top">• <a href="#g_t_005csbox" accesskey="7">\sbox</a>:</td><td> </td><td align="left" valign="top">Like <code>\mbox</code>, but save the text for later use.
+<tr><td align="left" valign="top">• <a href="#g_t_005cusebox" accesskey="7">\usebox</a>:</td><td> </td><td align="left" valign="top">Print saved text.
</td></tr>
-<tr><td align="left" valign="top">• <a href="#g_t_005cusebox" accesskey="8">\usebox</a>:</td><td> </td><td align="left" valign="top">Print saved text.
-</td></tr>
</table>
@@ -16265,7 +16268,7 @@
</pre></div>
<p>Create a box, a container for material. The <var>text</var> is is typeset in
-LR mode (see <a href="#Modes">Modes</a>), so it is not broken into lines. The
+LR mode (see <a href="#Modes">Modes</a>) so it is not broken into lines. The
<code>\mbox</code> command is robust, while <code>\makebox</code> is fragile
(see <a href="#g_t_005cprotect">\protect</a>).
</p>
@@ -16277,9 +16280,9 @@
<pre class="example">See Table~\mbox{T-4}
</pre></div>
-<p>The first two versions, <code>\mbox</code> and <code>\makebox</code> are equivalent,
-and create a box just wide enough to contain the <var>text</var>. (They are
-like plain TeX’s <code>\hbox</code>.)
+<p>The first two command versions, <code>\mbox</code> and <code>\makebox</code>, are
+roughly equivalent. They create a box just wide enough to contain the
+<var>text</var>. (They are like plain TeX’s <code>\hbox</code>.)
</p>
<p>In the third version the optional argument <var>width</var> specifies the
width of the box. Note that the space occupied by the text need not
@@ -16293,9 +16296,15 @@
<p>with ‘<samp>Chapter Exam</samp>’ centered. But <var>text</var> can also be too wide
for <var>width</var>. See the example below of zero-width boxes.
</p>
-<p>In the fourth version the optional argument <var>position</var> gives
-position of the text within the box. It may take the following values:
+<p>In the <var>width</var> argument you can use the following lengths that refer
+to the dimension of the box that LaTeX gets on typsetting <var>text</var>:
+<code>\depth</code>, <code>\height</code>, <code>\width</code>, <code>\totalheight</code> (this
+is the box’s height plus its depth).
</p>
+<p>For the fourth command version the optional argument <var>position</var>
+gives position of the text within the box. It may take the following
+values:
+</p>
<dl compact="compact">
<dt><code>c</code></dt>
<dd><p>The <var>text</var> is centered (default).
@@ -16341,6 +16350,9 @@
edge of the text at a known location, regardless of the length of that
text.
</p>
+<p>For boxes with frames see <a href="#g_t_005cfbox-_0026-_005cframebox">\fbox & \framebox</a>. For colors
+see <a href="#Colored-boxes">Colored boxes</a>.
+</p>
<p>There is a related version of <code>\makebox</code> that is used within the
<code>picture</code> environment, where the length is given in terms of
<code>\unitlength</code> (see <a href="#g_t_005cmakebox-_0028picture_0029">\makebox (picture)</a>).
@@ -16356,7 +16368,7 @@
<a name="g_t_005cfbox-_0026-_005cframebox"></a>
<div class="header">
<p>
-Next: <a href="#lrbox" accesskey="n" rel="next">lrbox</a>, Previous: <a href="#g_t_005cmbox-_0026-_005cmakebox" accesskey="p" rel="prev">\mbox & \makebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
+Next: <a href="#g_t_005cparbox" accesskey="n" rel="next">\parbox</a>, Previous: <a href="#g_t_005cmbox-_0026-_005cmakebox" accesskey="p" rel="prev">\mbox & \makebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="g_t_005cfbox-_0026-_005cframebox-1"></a>
<h3 class="section">20.2 <code>\fbox</code> & <code>\framebox</code></h3>
@@ -16374,7 +16386,8 @@
</pre></div>
<p>Create boxes with an enclosing frame. These commands are the same as
-<code>\mbox</code> and <code>\makebox</code> except for the box (see <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>).
+<code>\mbox</code> and <code>\makebox</code> except for the box (see <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>). The <code>\fbox</code> command is robust, the <code>\framebox</code>
+command is fragile (see <a href="#g_t_005cprotect">\protect</a>).
</p>
<div class="example">
<pre class="example">\fbox{Warning! No work shown, no credit given.}
@@ -16384,8 +16397,10 @@
Around that box, separated from it by a small gap, are four lines making
a frame.
</p>
-<p>The optional arguments allow you to specify the box width as
-<var>width</var>, and the position of the text inside that box as
+<p>The first two command invocations, <code>\fbox{...}</code> and
+<code>\framebox{...}</code>, are roughly the same. As to the third and
+fourth invocations, the optional arguments allow you to specify the box
+width as <var>width</var> and the position of the text inside that box as
<var>position</var>. See <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a> for the full description but
here is an example creating an empty box that is 1/4in wide.
</p>
@@ -16416,8 +16431,8 @@
<a name="index-_005cfboxsep"></a>
<p>The distance from the frame to the enclosed box. The default is 3pt.
Change it with a command such as <code>\setlength{\fboxsep}{0pt}</code>
-(see <a href="#g_t_005csetlength">\setlength</a>). Settting it to 0pt is useful sometimes: this will put a frame around the picture with
-no white border
+(see <a href="#g_t_005csetlength">\setlength</a>). Setting it to 0pt is useful sometimes:
+this will put a frame around the picture with no white border.
</p>
<div class="example">
<pre class="example">{\setlength{\fboxsep}{0pt}
@@ -16431,7 +16446,7 @@
<p>As with <code>\mbox</code> and <code>\makebox</code>, LaTeX will not break lines
in <var>text</var>. But this example has LaTeX break lines to make a
-paragraph, and then frames the result.
+paragraph, and then frame the result.
</p>
<div class="example">
<pre class="example">\framebox{%
@@ -16448,60 +16463,30 @@
</p>
<hr>
-<a name="lrbox"></a>
-<div class="header">
-<p>
-Next: <a href="#g_t_005cparbox" accesskey="n" rel="next">\parbox</a>, Previous: <a href="#g_t_005cfbox-_0026-_005cframebox" accesskey="p" rel="prev">\fbox & \framebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
-</div>
-<a name="lrbox-1"></a>
-<h3 class="section">20.3 <code>lrbox</code></h3>
-
-<a name="index-lrbox"></a>
-
-<p>Synopsis:
-</p>
-<div class="example">
-<pre class="example">\begin{lrbox}{\<var>cmd</var>}
- <var>text </var>
-\end{lrbox}
-</pre></div>
-
-<p>This is the environment form of <a href="#g_t_005csbox"><code>\sbox</code></a>.
-</p>
-<p>The <var>text</var> inside the environment is saved in the box <code>\<var>cmd</var></code>,
-which must have been declared with <code>\newsavebox</code>.
-</p>
-
-<hr>
<a name="g_t_005cparbox"></a>
<div class="header">
<p>
-Next: <a href="#g_t_005craisebox" accesskey="n" rel="next">\raisebox</a>, Previous: <a href="#lrbox" accesskey="p" rel="prev">lrbox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
+Next: <a href="#g_t_005craisebox" accesskey="n" rel="next">\raisebox</a>, Previous: <a href="#g_t_005cfbox-_0026-_005cframebox" accesskey="p" rel="prev">\fbox & \framebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="g_t_005cparbox-1"></a>
-<h3 class="section">20.4 <code>\parbox</code></h3>
+<h3 class="section">20.3 <code>\parbox</code></h3>
<a name="index-_005cparbox"></a>
+<a name="index-paragraph-mode-1"></a>
+<a name="index-paragraph_002c-in-a-box"></a>
-<p>Synopses:
+<p>Synopses, one of these:
</p>
<div class="example">
<pre class="example">\parbox{<var>width</var>}{<var>contents</var>}
+\parbox[<var>position</var>]{<var>width</var>}{<var>contents</var>}
+\parbox[<var>position</var>][<var>height</var>]{<var>width</var>}{<var>contents</var>}
+\parbox[<var>position</var>][<var>height</var>][<var>inner-pos</var>]{<var>width</var>}{<var>contents</var>}
</pre></div>
-<p>or
-</p>
-<div class="example">
-<pre class="example">\parbox[<var>position</var>][<var>height</var>][<var>inner-pos</var>]{<var>width</var>}{<var>contents</var>}
-</pre></div>
-
-<a name="index-paragraph-mode-1"></a>
-
<p>Produce a box of text that is <var>width</var> wide. Use this command to make
-a box small pieces of text; its contents are created in <em>paragraph
-mode</em>. For larger pieces of text, including ones containing a
-paragraph-making environment, use a <code>minipage</code> environment
-(see <a href="#minipage">minipage</a>).
+a box of small pieces of text, of a single paragraph. This command is
+fragile (see <a href="#g_t_005cprotect">\protect</a>).
</p>
<div class="example">
<pre class="example">\begin{picture}(0,0)
@@ -16511,23 +16496,28 @@
\end{picture}
</pre></div>
-<p>The options for <code>\parbox</code> (except for <var>content</var>) are the same
-as those for <var>minipage</var>. So a summary of those options is here but
-see <a href="#minipage">minipage</a> for a complete description.
+<p>The <var>contents</var> are processed in a text mode (see <a href="#Modes">Modes</a>) so
+LaTeX will break lines to make a paragraph. But it won’t make
+multiple paragraphs; for that, use a <code>minipage</code> environment
+(see <a href="#minipage">minipage</a>).
</p>
-<p>There are two required argument to <code>\parbox</code>. The <var>width</var> is a
-rigid length (see <a href="#Lengths">Lengths</a>). It sets the width of the box into which
-LaTeX typesets <var>contents</var>. The <var>contents</var> is the text that
-is placed in that box. It should not have any paragraph-making components.
+<p>The options for <code>\parbox</code> (except for <var>contents</var>) are the same
+as those for <code>minipage</code>. For convenience a summary of the options
+is here but see <a href="#minipage">minipage</a> for a complete description.
</p>
+<p>There are two required arguments. The <var>width</var> is a rigid length
+(see <a href="#Lengths">Lengths</a>). It sets the width of the box into which LaTeX
+typesets <var>contents</var>. The <var>contents</var> is the text that is placed
+in that box. It should not have any paragraph-making components.
+</p>
<p>There are three optional arguments, <var>position</var>, <var>height</var>, and
<var>inner-pos</var>. The <var>position</var> gives the vertical alignment of the
<code>parbox</code> with respect to the surrounding material. The possible
-values are <code>c</code> or <code>m</code> (the vertical center of the
-<code>parbox</code> lines up with the center of the adjacent line; this is the
-default), or <code>t</code> (match either the top line of the <code>parbox</code>
-with the baseline of the surrounding material), or <code>b</code> (match the
-bottom line).
+values are <code>c</code> or <code>m</code> to make the vertical center of the
+<code>parbox</code> lines up with the center of the adjacent line (this is the
+default), or <code>t</code> to match the top line of the <code>parbox</code> with
+the baseline of the surrounding material, or <code>b</code> to match the
+bottom line.
</p>
<p>The optional argument <var>height</var> overrides the natural height of the
box.
@@ -16537,111 +16527,232 @@
<var>position</var>. Its possible values are: <code>t</code> to put the
<var>content</var> at the top of the box, <code>c</code> to put it in the vertical
center, <code>b</code> to put it at the bottom of the box, and <code>s</code> to
-stretch it out vertically; the text must contain vertically stretchable
-space.
+stretch it out vertically (for this, the text must contain vertically
+stretchable space).
</p>
-<p>This command is fragile (see <a href="#g_t_005cprotect">\protect</a>).
-</p>
-
<hr>
<a name="g_t_005craisebox"></a>
<div class="header">
<p>
-Next: <a href="#g_t_005csavebox" accesskey="n" rel="next">\savebox</a>, Previous: <a href="#g_t_005cparbox" accesskey="p" rel="prev">\parbox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
+Next: <a href="#g_t_005csbox-_0026-_005csavebox" accesskey="n" rel="next">\sbox & \savebox</a>, Previous: <a href="#g_t_005cparbox" accesskey="p" rel="prev">\parbox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="g_t_005craisebox-1"></a>
-<h3 class="section">20.5 <code>\raisebox</code></h3>
+<h3 class="section">20.4 <code>\raisebox</code></h3>
<a name="index-_005craisebox"></a>
-<p>Synopsis:
+<p>Synopsis, one of:
</p>
<div class="example">
<pre class="example">\raisebox{<var>distance</var>}{<var>text</var>}
+\raisebox{<var>distance</var>}[<var>height</var>]{<var>text</var>}
+\raisebox{<var>distance</var>}[<var>height</var>][<var>depth</var>]{<var>text</var>}
</pre></div>
-<p>or
+<p>Raise or lower <var>text</var>. This command is fragile (see <a href="#g_t_005cprotect">\protect</a>).
</p>
+<p>This example makes a command for the restriction of a function by
+lowering the vertical bar symbol.
+</p>
<div class="example">
-<pre class="example">\raisebox{<var>distance</var>}[<var>height</var>][<var>depth</var>]{<var>text</var>}
+<pre class="example">\newcommand\restricted[1]{\raisebox{-.5ex}{$|$}_{#1}}
+$f\restricted{A}$
</pre></div>
-<p>Raise (or lower) <var>text</var>. The first mandatory argument specifies how
-high <var>text</var> is to be raised (or lowered if it is a negative amount).
-<var>text</var> itself is processed in LR mode.
+<p>The first mandatory argument <var>distance</var> specifies how far to raise
+the second mandatory argument <var>text</var>. This is a rigid length
+(see <a href="#Lengths">Lengths</a>). If it is negative then it lowers <var>text</var>. The
+<var>text</var> is processed in LR mode so it cannot contain line breaks
+(see <a href="#Modes">Modes</a>).
</p>
<p>The optional arguments <var>height</var> and <var>depth</var> are dimensions. If
-they are specified, LaTeX treats <var>text</var> as extending a certain
-distance above the baseline (<var>height</var>) or below (<var>depth</var>),
-ignoring its natural height and depth.
+they are specified, they override the natural height and depth of the
+box LaTeX gets by typesetting <var>text</var>.
</p>
+<p>In the arguments <var>distance</var>, <var>height</var>, and <var>depth</var> you can
+use the following lengths that refer to the dimension of the box that
+LaTeX gets on typesetting <var>text</var>: <code>\depth</code>, <code>\height</code>,
+<code>\width</code>, <code>\totalheight</code> (this is the box’s height plus its
+depth).
+</p>
+<p>This will align two graphics on their top (see <a href="#Graphics">Graphics</a>).
+</p>
+<div class="example">
+<pre class="example">\usepackage{graphicx} \usepackage{calc} % in preamble
+ ...
+\begin{center}
+ \raisebox{1ex-\height}{\includegraphics[width=0.4\linewidth]{lion.png}}
+ \qquad
+ \raisebox{1ex-\height}{\includegraphics[width=0.4\linewidth]{meta.png}}
+\end{center}
+</pre></div>
+<p>The first <code>\height</code> is the height of <samp>lion.png</samp> while the
+second is the height of <samp>meta.png</samp>.
+</p>
+
<hr>
-<a name="g_t_005csavebox"></a>
+<a name="g_t_005csbox-_0026-_005csavebox"></a>
<div class="header">
<p>
-Next: <a href="#g_t_005csbox" accesskey="n" rel="next">\sbox</a>, Previous: <a href="#g_t_005craisebox" accesskey="p" rel="prev">\raisebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
+Next: <a href="#lrbox" accesskey="n" rel="next">lrbox</a>, Previous: <a href="#g_t_005craisebox" accesskey="p" rel="prev">\raisebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
-<a name="g_t_005csavebox-1"></a>
-<h3 class="section">20.6 <code>\savebox</code></h3>
+<a name="g_t_005csbox-_0026-_005csavebox-1"></a>
+<h3 class="section">20.5 <code>\sbox</code> & <code>\savebox</code></h3>
+<a name="index-_005csbox"></a>
<a name="index-_005csavebox"></a>
+<a name="index-box_002c-save"></a>
-<p>Synopsis:
+<p>Synopsis, one of:
</p>
<div class="example">
-<pre class="example">\savebox{<var>\boxcmd</var>}[<var>width</var>][<var>pos</var>]{<var>text</var>}
+<pre class="example">\sbox{<var>box-cmd</var>}{<var>text</var>}
+\savebox{<var>box-cmd</var>}{<var>text</var>}
+\savebox{<var>box-cmd</var>}[<var>width</var>]{<var>text</var>}
+\savebox{<var>box-cmd</var>}[<var>width</var>][<var>pos</var>]{<var>text</var>}
</pre></div>
-<p>This command typeset <var>text</var> in a box just as with <code>\makebox</code>
-(see <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>), except that instead of printing the
-resulting box, it saves it in the box labeled <var>\boxcmd</var>, which must
-have been declared with <code>\newsavebox</code> (see <a href="#g_t_005cnewsavebox">\newsavebox</a>).
+<p>Typeset <var>text</var> just as with <code>\makebox</code> (see <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>) except that LaTeX does not output it but instead saves it
+in a storage bin named <var>box-cmd</var>. The bin name <var>box-cmd</var> begins
+with a backslash. You must have previously allocated the bin
+<var>box-cmd</var> with <code>\newsavebox</code> (see <a href="#g_t_005cnewsavebox">\newsavebox</a>).The
+<code>\sbox</code> command is robust while <code>\savebox</code> is fragile
+(see <a href="#g_t_005cprotect">\protect</a>).
</p>
+<p>This creates and uses a bin.
+</p>
+<div class="example">
+<pre class="example">\newsavebox{\fullname}
+\sbox{\fullname}{John Jacob Jingleheimer Schmidt}
+ ...
+\usebox{\fullname}! His name is my name, too!
+Whenever we go out, the people always shout!
+There goes \\usebox{\fullname}! Ya da da da da da da.
+</pre></div>
+<p>One advantage of using and reusing a bin over a <code>\newcommand</code> is
+efficiency, that LaTeX need not repeatedly retypeset the contents.
+See the example below.
+</p>
+<p>The first two command invocations,
+<code>\sbox{<var>box-cmd</var>}{<var>text</var>}</code> and
+<code>\savebox{<var>box-cmd</var>}{<var>text</var>}</code>, are roughly equivalent.
+As to the third and fourth, the optional arguments allow you to specify
+the box width as <var>width</var>, and the position of the text inside that
+box as <var>position</var>. See <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a> for the full
+description.
+</p>
+<p>In the <code>\sbox</code> and <code>\savebox</code> commands the <var>text</var> is
+typeset in LR mode so it does not have line breaks (see <a href="#Modes">Modes</a>). If
+you use these then LaTeX doesn’t give you an error but it ignores
+what you want: if you enter <code>\sbox{\newbin}{test \\ test}</code> and
+<code>\usebox{\newbin}</code> then you get ‘<samp>testtest</samp>’, while if you
+enter <code>\sbox{\newbin}{test \par test}</code> and
+<code>\usebox{\newbin}</code> then you get ‘<samp>test test</samp>’, but no error or
+warning. To fix this use a <code>\parbox</code> or <code>minipage</code> as here.
+</p>
+<div class="example">
+<pre class="example">\savebox{\abin}{%
+ \begin{minipage}{\linewidth}
+ \begin{enumerate}
+ \item First item
+ \item Second item
+ \end{enumerate}
+ \end{minipage}}
+ ...
+\usebox{\abin}
+</pre></div>
+
+<p>As an example of the efficiency of reusing a bin’s contents, this puts
+the same picture on each page of the document by putting it in the
+header. LaTeX only typesets it once.
+</p>
+<div class="example">
+<pre class="example">\usepackage{graphicx} % all this in the preamble
+\newsavebox{\sealbin}
+\savebox{\sealbin}{%
+ \setlength{\unitlength}{1in}%
+ \begin{picture}(0,0)%
+ \put(1.5,-2.5){%
+ \begin{tabular}{c}
+ \includegraphics[height=2in]{companylogo.png} \\
+ Office of the President
+ \end{tabular}}
+ \end{picture}%
+}
+\markright{\usebox{\sealbin}}
+\pagestyle{headings}
+</pre></div>
+
+<p>The <code>picture</code> environment is good for fine-tuning the placement.
+</p>
+<p>If the bin has not already been defined then you get something like
+‘<samp>Undefined control sequence. <argument> \nobin</samp>’.
+</p>
+
<hr>
-<a name="g_t_005csbox"></a>
+<a name="lrbox"></a>
<div class="header">
<p>
-Next: <a href="#g_t_005cusebox" accesskey="n" rel="next">\usebox</a>, Previous: <a href="#g_t_005csavebox" accesskey="p" rel="prev">\savebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
+Next: <a href="#g_t_005cusebox" accesskey="n" rel="next">\usebox</a>, Previous: <a href="#g_t_005csbox-_0026-_005csavebox" accesskey="p" rel="prev">\sbox & \savebox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
-<a name="g_t_005csbox_007b_005cboxcmd_007d_007btext_007d"></a>
-<h3 class="section">20.7 <code>\sbox{<var>\boxcmd</var>}{<var>text</var>}</code></h3>
+<a name="lrbox-1"></a>
+<h3 class="section">20.6 <code>lrbox</code></h3>
-<a name="index-_005csbox"></a>
+<a name="index-lrbox"></a>
<p>Synopsis:
</p>
<div class="example">
-<pre class="example">\sbox{<var>\boxcmd</var>}{<var>text</var>}
+<pre class="example">\begin{lrbox}{<var>box-cmd</var>}
+ <var>text</var>
+\end{lrbox}
</pre></div>
-<p><code>\sbox</code> types <var>text</var> in a box just as with <code>\mbox</code>
-(see <a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>) except that instead of the resulting box
-being included in the normal output, it is saved in the box labeled
-<var>\boxcmd</var>. <var>\boxcmd</var> must have been previously declared with
-<code>\newsavebox</code> (see <a href="#g_t_005cnewsavebox">\newsavebox</a>).
+<p>The <var>text</var> inside the environment is saved in the bin
+<code><var>box-cmd</var></code>. The <var>box-cmd</var> must begin with a
+backslash. You must create this bin in advance with <code>\newsavebox</code>
+(see <a href="#g_t_005cnewsavebox">\newsavebox</a>). This is the environment form of the <code>\sbox</code>
+and <code>\savebox</code> commands, and is equivalent to them. See <a href="#g_t_005csbox-_0026-_005csavebox">\sbox & \savebox</a> for the full information.
</p>
+<p>In this example the environment is convenient for entering the
+<code>tabular</code>.
+</p>
+<div class="example">
+<pre class="example">\newsavebox{\jhbin}
+\begin{lrbox}{\jhbin}
+ \begin{tabular}{c}
+ \includegraphics[height=1in]{jh.png} \\
+ Jim Hef{}feron
+ \end{tabular}
+\end{lrbox}
+ ...
+\usebox{\jhbin}
+</pre></div>
+
<hr>
<a name="g_t_005cusebox"></a>
<div class="header">
<p>
-Previous: <a href="#g_t_005csbox" accesskey="p" rel="prev">\sbox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
+Previous: <a href="#lrbox" accesskey="p" rel="prev">lrbox</a>, Up: <a href="#Boxes" accesskey="u" rel="up">Boxes</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="g_t_005cusebox_007b_005cboxcmd_007d"></a>
-<h3 class="section">20.8 <code>\usebox{<var>\boxcmd</var>}</code></h3>
+<h3 class="section">20.7 <code>\usebox{<var>\boxcmd</var>}</code></h3>
<a name="index-_005cusebox"></a>
+<a name="index-box_002c-use-saved-box"></a>
<p>Synopsis:
</p>
<div class="example">
-<pre class="example">\usebox{<var>\boxcmd</var>}
+<pre class="example">\usebox{<var>box-cmd</var>}
</pre></div>
-<p><code>\usebox</code> produces the box most recently saved in the bin
-<var>\boxcmd</var> by a <code>\savebox</code> command (see <a href="#g_t_005csavebox">\savebox</a>).
+<p>Produce the box most recently saved in the bin <var>box-cmd</var> by
+<code>\sbox</code>, or <code>\savebox</code>, or <code>lrbox</code>. See <a href="#g_t_005csbox-_0026-_005csavebox">\sbox & \savebox</a> for more information and examples. This command is robust
+(see <a href="#g_t_005cprotect">\protect</a>).
</p>
<hr>
@@ -20688,6 +20799,8 @@
<tr><td></td><td valign="top"><a href="#index-box">box</a>:</td><td> </td><td valign="top"><a href="#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-box_002c-allocating-new">box, allocating new</a>:</td><td> </td><td valign="top"><a href="#g_t_005cnewsavebox">\newsavebox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-box_002c-colored">box, colored</a>:</td><td> </td><td valign="top"><a href="#Colored-boxes">Colored boxes</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-box_002c-save">box, save</a>:</td><td> </td><td valign="top"><a href="#g_t_005csbox-_0026-_005csavebox">\sbox & \savebox</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-box_002c-use-saved-box">box, use saved box</a>:</td><td> </td><td valign="top"><a href="#g_t_005cusebox">\usebox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boxes">boxes</a>:</td><td> </td><td valign="top"><a href="#Boxes">Boxes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-brace_002c-left_002c-in-text">brace, left, 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-brace_002c-right_002c-in-text">brace, right, in text</a>:</td><td> </td><td valign="top"><a href="#Text-symbols">Text symbols</a></td></tr>
@@ -21263,6 +21376,7 @@
<tr><td></td><td valign="top"><a href="#index-paragraph-mode-1">paragraph mode</a>:</td><td> </td><td valign="top"><a href="#g_t_005cparbox">\parbox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-paragraph-symbol">paragraph symbol</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-paragraph_002c-ending">paragraph, ending</a>:</td><td> </td><td valign="top"><a href="#g_t_005cpar">\par</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-paragraph_002c-in-a-box">paragraph, in a box</a>:</td><td> </td><td valign="top"><a href="#g_t_005cparbox">\parbox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-paragraphs">paragraphs</a>:</td><td> </td><td valign="top"><a href="#Making-paragraphs">Making paragraphs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-parameters_002c-for-footnotes">parameters, for footnotes</a>:</td><td> </td><td valign="top"><a href="#g_t_005cfootnote">\footnote</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-parameters_002c-page-layout">parameters, page layout</a>:</td><td> </td><td valign="top"><a href="#Page-layout-parameters">Page layout parameters</a></td></tr>
@@ -22353,8 +22467,8 @@
<tr><td></td><td valign="top"><a href="#index-_005crq"><code>\rq</code></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-_005crule"><code>\rule</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005crule">\rule</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005cS"><code>\S</code></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-_005csavebox"><code>\savebox</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005csavebox">\savebox</a></td></tr>
-<tr><td></td><td valign="top"><a href="#index-_005csbox"><code>\sbox</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005csbox">\sbox</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-_005csavebox"><code>\savebox</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005csbox-_0026-_005csavebox">\sbox & \savebox</a></td></tr>
+<tr><td></td><td valign="top"><a href="#index-_005csbox"><code>\sbox</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005csbox-_0026-_005csavebox">\sbox & \savebox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005csc"><code>\sc</code></a>:</td><td> </td><td valign="top"><a href="#Font-styles">Font styles</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005cscalebox"><code>\scalebox</code></a>:</td><td> </td><td valign="top"><a href="#g_t_005cscalebox">\scalebox</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005cscriptsize"><code>\scriptsize</code></a>:</td><td> </td><td valign="top"><a href="#Font-sizes">Font sizes</a></td></tr>
Modified: trunk/latex2e.info
===================================================================
--- trunk/latex2e.info 2018-06-20 15:05:12 UTC (rev 658)
+++ trunk/latex2e.info 2018-06-20 23:44:19 UTC (rev 659)
@@ -7003,7 +7003,7 @@
\end{citequote}
The final example shows how to save the value of an argument to use
-in ENDDEF, in this case in a box (*note \sbox::).
+in ENDDEF, in this case in a box (*note \sbox & \savebox::).
\newsavebox{\quoteauthor}
\newenvironment{citequote}[1][Shakespeare]{%
@@ -10892,18 +10892,23 @@
20 Boxes
********
-All the predefined length parameters (*note Predefined lengths::) can be
-used in the arguments of the box-making commands.
+At its core, LaTeX puts things in boxes and then puts the boxes on a
+page. So these commands are central.
+ All of the predefined length parameters (*note Predefined lengths::)
+can be used in the arguments of the box-making commands.
+
+ There are many packages on CTAN that are useful for manipulating
+boxes. One useful adjunct to the commands here is 'adjustbox'.
+
* Menu:
* \mbox & \makebox:: Horizontal boxes.
* \fbox & \framebox:: Put a frame around a box.
-* lrbox:: An environment like '\sbox'.
* \parbox:: Box with text in paragraph mode.
* \raisebox:: Raise or lower text.
-* \savebox:: Like '\makebox', but save the text for later use.
-* \sbox:: Like '\mbox', but save the text for later use.
+* \sbox & \savebox:: Like '\makebox' but save the text for later.
+* lrbox:: Environment version of '\sbox'.
* \usebox:: Print saved text.
@@ -10920,7 +10925,7 @@
\makebox[WIDTH][POSITION]{TEXT}
Create a box, a container for material. The TEXT is is typeset in LR
-mode (*note Modes::), so it is not broken into lines. The '\mbox'
+mode (*note Modes::) so it is not broken into lines. The '\mbox'
command is robust, while '\makebox' is fragile (*note \protect::).
Because 'text' is not broken into lines, you can use '\mbox' to
@@ -10929,9 +10934,9 @@
See Table~\mbox{T-4}
- The first two versions, '\mbox' and '\makebox' are equivalent, and
-create a box just wide enough to contain the TEXT. (They are like plain
-TeX's '\hbox'.)
+ The first two command versions, '\mbox' and '\makebox', are roughly
+equivalent. They create a box just wide enough to contain the TEXT.
+(They are like plain TeX's '\hbox'.)
In the third version the optional argument WIDTH specifies the width
of the box. Note that the space occupied by the text need not equal the
@@ -10943,9 +10948,14 @@
with 'Chapter Exam' centered. But TEXT can also be too wide for
WIDTH. See the example below of zero-width boxes.
- In the fourth version the optional argument POSITION gives position
-of the text within the box. It may take the following values:
+ In the WIDTH argument you can use the following lengths that refer to
+the dimension of the box that LaTeX gets on typsetting TEXT: '\depth',
+'\height', '\width', '\totalheight' (this is the box's height plus its
+depth).
+ For the fourth command version the optional argument POSITION gives
+position of the text within the box. It may take the following values:
+
'c'
The TEXT is centered (default).
@@ -10977,6 +10987,9 @@
'Asymptote', where you put the edge of the text at a known location,
regardless of the length of that text.
+ For boxes with frames see *note \fbox & \framebox::. For colors
+see *note Colored boxes::.
+
There is a related version of '\makebox' that is used within the
'picture' environment, where the length is given in terms of
'\unitlength' (*note \makebox (picture)::).
@@ -10988,7 +11001,7 @@
minipage::.
-File: latex2e.info, Node: \fbox & \framebox, Next: lrbox, Prev: \mbox & \makebox, Up: Boxes
+File: latex2e.info, Node: \fbox & \framebox, Next: \parbox, Prev: \mbox & \makebox, Up: Boxes
20.2 '\fbox' & '\framebox'
==========================
@@ -11002,6 +11015,8 @@
Create boxes with an enclosing frame. These commands are the same as
'\mbox' and '\makebox' except for the box (*note \mbox & \makebox::).
+The '\fbox' command is robust, the '\framebox' command is fragile (*note
+\protect::).
\fbox{Warning! No work shown, no credit given.}
@@ -11009,8 +11024,10 @@
Around that box, separated from it by a small gap, are four lines making
a frame.
- The optional arguments allow you to specify the box width as WIDTH,
-and the position of the text inside that box as POSITION. *Note \mbox &
+ The first two command invocations, '\fbox{...}' and '\framebox{...}',
+are roughly the same. As to the third and fourth invocations, the
+optional arguments allow you to specify the box width as WIDTH and the
+position of the text inside that box as POSITION. *Note \mbox &
\makebox:: for the full description but here is an example creating an
empty box that is 1/4in wide.
@@ -11028,8 +11045,8 @@
'\fboxsep'
The distance from the frame to the enclosed box. The default is
3pt. Change it with a command such as '\setlength{\fboxsep}{0pt}'
- (*note \setlength::). Settting it to 0pt is useful sometimes: this
- will put a frame around the picture with no white border
+ (*note \setlength::). Setting it to 0pt is useful sometimes: this
+ will put a frame around the picture with no white border.
{\setlength{\fboxsep}{0pt}
\framebox{\includegraphics[width=0.5\textwidth]{prudence.jpg}}}
@@ -11038,7 +11055,7 @@
As with '\mbox' and '\makebox', LaTeX will not break lines in TEXT.
But this example has LaTeX break lines to make a paragraph, and then
-frames the result.
+frame the result.
\framebox{%
\begin{minipage}{0.6\linewidth}
@@ -11052,40 +11069,21 @@
units depend on 'picture''s '\unitlength' (*note \framebox (picture)::).
-File: latex2e.info, Node: lrbox, Next: \parbox, Prev: \fbox & \framebox, Up: Boxes
+File: latex2e.info, Node: \parbox, Next: \raisebox, Prev: \fbox & \framebox, Up: Boxes
-20.3 'lrbox'
-============
-
-Synopsis:
-
- \begin{lrbox}{\CMD}
- TEXT
- \end{lrbox}
-
- This is the environment form of *note '\sbox': \sbox.
-
- The TEXT inside the environment is saved in the box '\CMD', which
-must have been declared with '\newsavebox'.
-
-
-File: latex2e.info, Node: \parbox, Next: \raisebox, Prev: lrbox, Up: Boxes
-
-20.4 '\parbox'
+20.3 '\parbox'
==============
-Synopses:
+Synopses, one of these:
\parbox{WIDTH}{CONTENTS}
-
-or
-
+ \parbox[POSITION]{WIDTH}{CONTENTS}
+ \parbox[POSITION][HEIGHT]{WIDTH}{CONTENTS}
\parbox[POSITION][HEIGHT][INNER-POS]{WIDTH}{CONTENTS}
Produce a box of text that is WIDTH wide. Use this command to make a
-box small pieces of text; its contents are created in "paragraph mode".
-For larger pieces of text, including ones containing a paragraph-making
-environment, use a 'minipage' environment (*note minipage::).
+box of small pieces of text, of a single paragraph. This command is
+fragile (*note \protect::).
\begin{picture}(0,0)
...
@@ -11093,22 +11091,26 @@
this semilog paper, the relationship is exponential.}}
\end{picture}
- The options for '\parbox' (except for CONTENT) are the same as those
-for MINIPAGE. So a summary of those options is here but see *note
-minipage:: for a complete description.
+ The CONTENTS are processed in a text mode (*note Modes::) so LaTeX
+will break lines to make a paragraph. But it won't make multiple
+paragraphs; for that, use a 'minipage' environment (*note minipage::).
- There are two required argument to '\parbox'. The WIDTH is a rigid
-length (*note Lengths::). It sets the width of the box into which LaTeX
-typesets CONTENTS. The CONTENTS is the text that is placed in that box.
-It should not have any paragraph-making components.
+ The options for '\parbox' (except for CONTENTS) are the same as those
+for 'minipage'. For convenience a summary of the options is here but
+see *note minipage:: for a complete description.
+ There are two required arguments. The WIDTH is a rigid length (*note
+Lengths::). It sets the width of the box into which LaTeX typesets
+CONTENTS. The CONTENTS is the text that is placed in that box. It
+should not have any paragraph-making components.
+
There are three optional arguments, POSITION, HEIGHT, and INNER-POS.
The POSITION gives the vertical alignment of the 'parbox' with respect
-to the surrounding material. The possible values are 'c' or 'm' (the
-vertical center of the 'parbox' lines up with the center of the adjacent
-line; this is the default), or 't' (match either the top line of the
-'parbox' with the baseline of the surrounding material), or 'b' (match
-the bottom line).
+to the surrounding material. The possible values are 'c' or 'm' to make
+the vertical center of the 'parbox' lines up with the center of the
+adjacent line (this is the default), or 't' to match the top line of the
+'parbox' with the baseline of the surrounding material, or 'b' to match
+the bottom line.
The optional argument HEIGHT overrides the natural height of the box.
@@ -11116,76 +11118,181 @@
inside the 'parbox'. Its default is the value of POSITION. Its
possible values are: 't' to put the CONTENT at the top of the box, 'c'
to put it in the vertical center, 'b' to put it at the bottom of the
-box, and 's' to stretch it out vertically; the text must contain
-vertically stretchable space.
+box, and 's' to stretch it out vertically (for this, the text must
+contain vertically stretchable space).
- This command is fragile (*note \protect::).
-
-File: latex2e.info, Node: \raisebox, Next: \savebox, Prev: \parbox, Up: Boxes
+File: latex2e.info, Node: \raisebox, Next: \sbox & \savebox, Prev: \parbox, Up: Boxes
-20.5 '\raisebox'
+20.4 '\raisebox'
================
-Synopsis:
+Synopsis, one of:
\raisebox{DISTANCE}{TEXT}
+ \raisebox{DISTANCE}[HEIGHT]{TEXT}
+ \raisebox{DISTANCE}[HEIGHT][DEPTH]{TEXT}
-or
+ Raise or lower TEXT. This command is fragile (*note \protect::).
- \raisebox{DISTANCE}[HEIGHT][DEPTH]{TEXT}
+ This example makes a command for the restriction of a function by
+lowering the vertical bar symbol.
- Raise (or lower) TEXT. The first mandatory argument specifies how
-high TEXT is to be raised (or lowered if it is a negative amount). TEXT
-itself is processed in LR mode.
+ \newcommand\restricted[1]{\raisebox{-.5ex}{$|$}_{#1}}
+ $f\restricted{A}$
+ The first mandatory argument DISTANCE specifies how far to raise the
+second mandatory argument TEXT. This is a rigid length (*note
+Lengths::). If it is negative then it lowers TEXT. The TEXT is
+processed in LR mode so it cannot contain line breaks (*note Modes::).
+
The optional arguments HEIGHT and DEPTH are dimensions. If they are
-specified, LaTeX treats TEXT as extending a certain distance above the
-baseline (HEIGHT) or below (DEPTH), ignoring its natural height and
-depth.
+specified, they override the natural height and depth of the box LaTeX
+gets by typesetting TEXT.
+ In the arguments DISTANCE, HEIGHT, and DEPTH you can use the
+following lengths that refer to the dimension of the box that LaTeX gets
+on typesetting TEXT: '\depth', '\height', '\width', '\totalheight' (this
+is the box's height plus its depth).
+
+ This will align two graphics on their top (*note Graphics::).
+
+ \usepackage{graphicx} \usepackage{calc} % in preamble
+ ...
+ \begin{center}
+ \raisebox{1ex-\height}{\includegraphics[width=0.4\linewidth]{lion.png}}
+ \qquad
+ \raisebox{1ex-\height}{\includegraphics[width=0.4\linewidth]{meta.png}}
+ \end{center}
+
+ The first '\height' is the height of 'lion.png' while the second is
+the height of 'meta.png'.
+
-File: latex2e.info, Node: \savebox, Next: \sbox, Prev: \raisebox, Up: Boxes
+File: latex2e.info, Node: \sbox & \savebox, Next: lrbox, Prev: \raisebox, Up: Boxes
-20.6 '\savebox'
-===============
+20.5 '\sbox' & '\savebox'
+=========================
-Synopsis:
+Synopsis, one of:
- \savebox{\BOXCMD}[WIDTH][POS]{TEXT}
+ \sbox{BOX-CMD}{TEXT}
+ \savebox{BOX-CMD}{TEXT}
+ \savebox{BOX-CMD}[WIDTH]{TEXT}
+ \savebox{BOX-CMD}[WIDTH][POS]{TEXT}
- This command typeset TEXT in a box just as with '\makebox' (*note
-\mbox & \makebox::), except that instead of printing the resulting box,
-it saves it in the box labeled \BOXCMD, which must have been declared
-with '\newsavebox' (*note \newsavebox::).
+ Typeset TEXT just as with '\makebox' (*note \mbox & \makebox::)
+except that LaTeX does not output it but instead saves it in a storage
+bin named BOX-CMD. The bin name BOX-CMD begins with a backslash. You
+must have previously allocated the bin BOX-CMD with '\newsavebox' (*note
+\newsavebox::).The '\sbox' command is robust while '\savebox' is fragile
+(*note \protect::).
+ This creates and uses a bin.
+
+ \newsavebox{\fullname}
+ \sbox{\fullname}{John Jacob Jingleheimer Schmidt}
+ ...
+ \usebox{\fullname}! His name is my name, too!
+ Whenever we go out, the people always shout!
+ There goes \\usebox{\fullname}! Ya da da da da da da.
+
+One advantage of using and reusing a bin over a '\newcommand' is
+efficiency, that LaTeX need not repeatedly retypeset the contents. See
+the example below.
+
+ The first two command invocations, '\sbox{BOX-CMD}{TEXT}' and
+'\savebox{BOX-CMD}{TEXT}', are roughly equivalent. As to the third and
+fourth, the optional arguments allow you to specify the box width as
+WIDTH, and the position of the text inside that box as POSITION. *Note
+\mbox & \makebox:: for the full description.
+
+ In the '\sbox' and '\savebox' commands the TEXT is typeset in LR mode
+so it does not have line breaks (*note Modes::). If you use these then
+LaTeX doesn't give you an error but it ignores what you want: if you
+enter '\sbox{\newbin}{test \\ test}' and '\usebox{\newbin}' then you get
+'testtest', while if you enter '\sbox{\newbin}{test \par test}' and
+'\usebox{\newbin}' then you get 'test test', but no error or warning.
+To fix this use a '\parbox' or 'minipage' as here.
+
+ \savebox{\abin}{%
+ \begin{minipage}{\linewidth}
+ \begin{enumerate}
+ \item First item
+ \item Second item
+ \end{enumerate}
+ \end{minipage}}
+ ...
+ \usebox{\abin}
+
+ As an example of the efficiency of reusing a bin's contents, this
+puts the same picture on each page of the document by putting it in the
+header. LaTeX only typesets it once.
+
+ \usepackage{graphicx} % all this in the preamble
+ \newsavebox{\sealbin}
+ \savebox{\sealbin}{%
+ \setlength{\unitlength}{1in}%
+ \begin{picture}(0,0)%
+ \put(1.5,-2.5){%
+ \begin{tabular}{c}
+ \includegraphics[height=2in]{companylogo.png} \\
+ Office of the President
+ \end{tabular}}
+ \end{picture}%
+ }
+ \markright{\usebox{\sealbin}}
+ \pagestyle{headings}
+
+The 'picture' environment is good for fine-tuning the placement.
+
+ If the bin has not already been defined then you get something like
+'Undefined control sequence. <argument> \nobin'.
+
-File: latex2e.info, Node: \sbox, Next: \usebox, Prev: \savebox, Up: Boxes
+File: latex2e.info, Node: lrbox, Next: \usebox, Prev: \sbox & \savebox, Up: Boxes
-20.7 '\sbox{\BOXCMD}{TEXT}'
-===========================
+20.6 'lrbox'
+============
Synopsis:
- \sbox{\BOXCMD}{TEXT}
+ \begin{lrbox}{BOX-CMD}
+ TEXT
+ \end{lrbox}
- '\sbox' types TEXT in a box just as with '\mbox' (*note \mbox &
-\makebox::) except that instead of the resulting box being included in
-the normal output, it is saved in the box labeled \BOXCMD. \BOXCMD must
-have been previously declared with '\newsavebox' (*note \newsavebox::).
+ The TEXT inside the environment is saved in the bin 'BOX-CMD'. The
+BOX-CMD must begin with a backslash. You must create this bin in
+advance with '\newsavebox' (*note \newsavebox::). This is the
+environment form of the '\sbox' and '\savebox' commands, and is
+equivalent to them. *Note \sbox & \savebox:: for the full information.
+ In this example the environment is convenient for entering the
+'tabular'.
+
+ \newsavebox{\jhbin}
+ \begin{lrbox}{\jhbin}
+ \begin{tabular}{c}
+ \includegraphics[height=1in]{jh.png} \\
+ Jim Hef{}feron
+ \end{tabular}
+ \end{lrbox}
+ ...
+ \usebox{\jhbin}
+
-File: latex2e.info, Node: \usebox, Prev: \sbox, Up: Boxes
+File: latex2e.info, Node: \usebox, Prev: lrbox, Up: Boxes
-20.8 '\usebox{\BOXCMD}'
+20.7 '\usebox{\BOXCMD}'
=======================
Synopsis:
- \usebox{\BOXCMD}
+ \usebox{BOX-CMD}
- '\usebox' produces the box most recently saved in the bin \BOXCMD by
-a '\savebox' command (*note \savebox::).
+ Produce the box most recently saved in the bin BOX-CMD by '\sbox', or
+'\savebox', or 'lrbox'. *Note \sbox & \savebox:: for more information
+and examples. This command is robust (*note \protect::).
File: latex2e.info, Node: Color, Next: Graphics, Prev: Boxes, Up: Top
@@ -13798,8 +13905,8 @@
* .ind file: Indexes. (line 23)
* :: Colon character & \colon.
(line 6)
-* \fboxrule: \fbox & \framebox. (line 34)
-* \fboxsep: \fbox & \framebox. (line 39)
+* \fboxrule: \fbox & \framebox. (line 38)
+* \fboxsep: \fbox & \framebox. (line 43)
* \NEWLINE: \(SPACE). (line 6)
* \SPACE: \(SPACE). (line 6)
* \TAB: \(SPACE). (line 6)
@@ -13844,7 +13951,7 @@
* ASCII tilde, in text: Text symbols. (line 67)
* asterisk, centered, in text: Text symbols. (line 70)
* Asymptote package: \strut. (line 62)
-* Asymptote package <1>: \mbox & \makebox. (line 65)
+* Asymptote package <1>: \mbox & \makebox. (line 70)
* at clause, in font definitions: \newfont. (line 19)
* author, for titlepage: \maketitle. (line 43)
* auxiliary file: Output files. (line 33)
@@ -13891,6 +13998,8 @@
* box: \mbox & \makebox. (line 6)
* box, allocating new: \newsavebox. (line 6)
* box, colored: Colored boxes. (line 6)
+* box, save: \sbox & \savebox. (line 6)
+* box, use saved box: \usebox. (line 6)
* boxes: Boxes. (line 6)
* brace, left, in text: Text symbols. (line 85)
* brace, right, in text: Text symbols. (line 88)
@@ -14464,7 +14573,7 @@
* package, amsthm: theorem. (line 28)
* package, appendix: \appendix. (line 29)
* package, Asymptote: \strut. (line 62)
-* package, Asymptote <1>: \mbox & \makebox. (line 65)
+* package, Asymptote <1>: \mbox & \makebox. (line 70)
* package, babel: \chapter. (line 70)
* package, babel <1>: thebibliography. (line 53)
* package, babel <2>: Accents. (line 6)
@@ -14525,7 +14634,7 @@
(line 42)
* package, textcomp: Font styles. (line 134)
* package, TikZ: \strut. (line 62)
-* package, TikZ <1>: \mbox & \makebox. (line 64)
+* package, TikZ <1>: \mbox & \makebox. (line 69)
* package, titlesec: \part. (line 54)
* package, titlesec <1>: \chapter. (line 78)
* package, titlesec <2>: \section. (line 64)
@@ -14560,9 +14669,10 @@
* paragraph indentations in quoted text, omitting: quotation & quote.
(line 6)
* paragraph mode: Modes. (line 12)
-* paragraph mode <1>: \parbox. (line 14)
+* paragraph mode <1>: \parbox. (line 6)
* paragraph symbol: Text symbols. (line 44)
* paragraph, ending: \par. (line 6)
+* paragraph, in a box: \parbox. (line 6)
* paragraphs: Making paragraphs. (line 6)
* parameters, for footnotes: \footnote. (line 34)
* parameters, page layout: Page layout parameters.
@@ -14793,7 +14903,7 @@
* tie: ~. (line 6)
* tie-after accent: Accents. (line 81)
* TikZ package: \strut. (line 62)
-* TikZ package <1>: \mbox & \makebox. (line 64)
+* TikZ package <1>: \mbox & \makebox. (line 69)
* tilde accent: Accents. (line 43)
* tilde accent, math: Math accents. (line 38)
* tilde, ASCII, in text: Text symbols. (line 67)
@@ -15196,9 +15306,9 @@
* \extracolsep: tabular. (line 115)
* \fbox: \fbox & \framebox. (line 6)
* \fboxrule: \framebox (picture). (line 13)
-* \fboxrule <1>: \fbox & \framebox. (line 33)
+* \fboxrule <1>: \fbox & \framebox. (line 37)
* \fboxsep: \framebox (picture). (line 13)
-* \fboxsep <1>: \fbox & \framebox. (line 38)
+* \fboxsep <1>: \fbox & \framebox. (line 42)
* \fill: \hfill. (line 18)
* \flat: Math symbols. (line 221)
* \floatpagefraction: Floats. (line 98)
@@ -15696,8 +15806,8 @@
* \rq: Text symbols. (line 54)
* \rule: \rule. (line 6)
* \S: Text symbols. (line 57)
-* \savebox: \savebox. (line 6)
-* \sbox: \sbox. (line 6)
+* \savebox: \sbox & \savebox. (line 6)
+* \sbox: \sbox & \savebox. (line 6)
* \sc: Font styles. (line 82)
* \scalebox: \scalebox. (line 6)
* \scriptsize: Font sizes. (line 11)
@@ -16062,9 +16172,9 @@
(line 49)
* flushleft environment: flushleft. (line 6)
* flushright environment: flushright. (line 6)
-* frame rule width: \fbox & \framebox. (line 34)
-* frame, line width: \fbox & \framebox. (line 34)
-* frame, separation from contents: \fbox & \framebox. (line 39)
+* frame rule width: \fbox & \framebox. (line 38)
+* frame, line width: \fbox & \framebox. (line 38)
+* frame, separation from contents: \fbox & \framebox. (line 43)
* <http://puszcza.gnu.org.ua/software/latexrefman/> home page: About this document.
(line 6)
* in: Units of length. (line 17)
@@ -16289,155 +16399,154 @@
Node: \newlength262873
Node: \newsavebox263733
Node: \newenvironment & \renewenvironment264677
-Node: \newtheorem269791
-Node: \newfont273319
-Node: \protect274615
-Node: \ignorespaces & \ignorespacesafterend277001
-Node: Counters279747
-Node: \alph \Alph \arabic \roman \Roman \fnsymbol281420
-Node: \usecounter284248
-Node: \value285111
-Node: \setcounter286040
-Node: \addtocounter286642
-Node: \refstepcounter287107
-Node: \stepcounter287765
-Node: \day \month \year288107
-Node: Lengths288652
-Node: Units of length293088
-Ref: Lengths/em293725
-Ref: Lengths/en293725
-Ref: Lengths/ex293725
-Node: \setlength294581
-Node: \addtolength295358
-Node: \settodepth296332
-Node: \settoheight297087
-Node: \settowidth297846
-Node: Predefined lengths298628
-Node: Making paragraphs299143
-Node: \par300798
-Node: \indent & \noindent302636
-Node: \parindent & \parskip304188
-Node: Marginal notes305226
-Node: Math formulas307025
-Node: Subscripts & superscripts311012
-Node: Math symbols313121
-Node: Blackboard bold339491
-Node: Calligraphic340266
-Node: \boldmath & \unboldmath340838
-Node: Ellipses342368
-Node: Math functions344522
-Node: Math accents346130
-Node: Over- and Underlining347029
-Node: Spacing in math mode348857
-Ref: Spacing in math mode/\thinspace349864
-Ref: Spacing in math mode/\quad350545
-Ref: Spacing in math mode/\qquad350801
-Node: Math miscellany350899
-Node: Colon character & \colon351458
-Node: \*352151
-Node: \frac352735
-Node: \left & \right353148
-Node: \sqrt354325
-Node: \stackrel354920
-Node: Modes355193
-Node: \ensuremath357807
-Node: Page styles358524
-Node: \maketitle359287
-Node: \pagenumbering362297
-Node: \pagestyle364234
-Node: \thispagestyle367739
-Node: Spaces368126
-Node: \enspace & \quad & \qquad369567
-Node: \hspace370514
-Node: \hfill372328
-Node: \hss373384
-Node: \spacefactor374081
-Node: \@377470
-Ref: \AT377570
-Node: \frenchspacing379513
-Node: \normalsfcodes380348
-Node: \(SPACE)380595
-Node: ~382230
-Node: \thinspace & \negthinspace384709
-Node: \/385652
-Node: \hrulefill & \dotfill386958
-Node: \bigskip & \medskip & \smallskip388294
-Node: \bigbreak & \medbreak & \smallbreak390186
-Node: \strut391171
-Node: \vspace394357
-Node: \vfill395914
-Node: \addvspace396792
-Node: Boxes398789
-Node: \mbox & \makebox399451
-Node: \fbox & \framebox402279
-Node: lrbox404584
-Node: \parbox404939
-Node: \raisebox407043
-Node: \savebox407652
-Node: \sbox408075
-Node: \usebox408535
-Node: Color408796
-Node: Color package options409640
-Node: Color models411286
-Node: Commands for color413595
-Node: Define colors414010
-Node: Colored text414725
-Node: Colored boxes417097
-Node: Colored pages418531
-Node: Graphics419224
-Node: Graphics package options421351
-Node: Graphics package configuration424104
-Node: \graphicspath424906
-Node: \DeclareGraphicsExtensions427829
-Node: \DeclareGraphicsRule429626
-Node: Commands for graphics432815
-Node: \includegraphics433320
-Node: \rotatebox446289
-Node: \scalebox449084
-Node: \resizebox450136
-Node: Special insertions451328
-Node: Reserved characters452130
-Node: Upper and lower case453331
-Node: Symbols by font position455246
-Node: Text symbols455866
-Node: Accents459314
-Node: Additional Latin letters461856
-Ref: Non-English characters462027
-Node: \rule463044
-Node: \today463473
-Node: Splitting the input464227
-Node: \endinput465779
-Node: \include & \includeonly467046
-Node: \input471270
-Node: Front/back matter471978
-Node: Tables of contents472183
-Node: \addcontentsline473366
-Node: \addtocontents474384
-Node: Glossaries474917
-Node: Indexes475436
-Node: Letters477069
-Node: \address480735
-Node: \cc481546
-Node: \closing481964
-Node: \encl482241
-Node: \location482656
-Node: \makelabels482920
-Node: \name485072
-Node: \opening485313
-Node: \ps485594
-Node: \signature485883
-Node: \telephone487100
-Node: Terminal input/output487465
-Node: \typein487730
-Node: \typeout488315
-Node: Command line488938
-Node: Document templates489890
-Node: beamer template490343
-Node: article template490997
-Node: book template491424
-Node: Larger book template491905
-Node: tugboat template493391
-Node: Concept Index495762
-Node: Command Index573620
+Node: \newtheorem269802
+Node: \newfont273330
+Node: \protect274626
+Node: \ignorespaces & \ignorespacesafterend277012
+Node: Counters279758
+Node: \alph \Alph \arabic \roman \Roman \fnsymbol281431
+Node: \usecounter284259
+Node: \value285122
+Node: \setcounter286051
+Node: \addtocounter286653
+Node: \refstepcounter287118
+Node: \stepcounter287776
+Node: \day \month \year288118
+Node: Lengths288663
+Node: Units of length293099
+Ref: Lengths/em293736
+Ref: Lengths/en293736
+Ref: Lengths/ex293736
+Node: \setlength294592
+Node: \addtolength295369
+Node: \settodepth296343
+Node: \settoheight297098
+Node: \settowidth297857
+Node: Predefined lengths298639
+Node: Making paragraphs299154
+Node: \par300809
+Node: \indent & \noindent302647
+Node: \parindent & \parskip304199
+Node: Marginal notes305237
+Node: Math formulas307036
+Node: Subscripts & superscripts311023
+Node: Math symbols313132
+Node: Blackboard bold339502
+Node: Calligraphic340277
+Node: \boldmath & \unboldmath340849
+Node: Ellipses342379
+Node: Math functions344533
+Node: Math accents346141
+Node: Over- and Underlining347040
+Node: Spacing in math mode348868
+Ref: Spacing in math mode/\thinspace349875
+Ref: Spacing in math mode/\quad350556
+Ref: Spacing in math mode/\qquad350812
+Node: Math miscellany350910
+Node: Colon character & \colon351469
+Node: \*352162
+Node: \frac352746
+Node: \left & \right353159
+Node: \sqrt354336
+Node: \stackrel354931
+Node: Modes355204
+Node: \ensuremath357818
+Node: Page styles358535
+Node: \maketitle359298
+Node: \pagenumbering362308
+Node: \pagestyle364245
+Node: \thispagestyle367750
+Node: Spaces368137
+Node: \enspace & \quad & \qquad369578
+Node: \hspace370525
+Node: \hfill372339
+Node: \hss373395
+Node: \spacefactor374092
+Node: \@377481
+Ref: \AT377581
+Node: \frenchspacing379524
+Node: \normalsfcodes380359
+Node: \(SPACE)380606
+Node: ~382241
+Node: \thinspace & \negthinspace384720
+Node: \/385663
+Node: \hrulefill & \dotfill386969
+Node: \bigskip & \medskip & \smallskip388305
+Node: \bigbreak & \medbreak & \smallbreak390197
+Node: \strut391182
+Node: \vspace394368
+Node: \vfill395925
+Node: \addvspace396803
+Node: Boxes398800
+Node: \mbox & \makebox399636
+Node: \fbox & \framebox402810
+Node: \parbox405334
+Node: \raisebox407614
+Node: \sbox & \savebox409272
+Node: lrbox412234
+Node: \usebox413056
+Node: Color413406
+Node: Color package options414250
+Node: Color models415896
+Node: Commands for color418205
+Node: Define colors418620
+Node: Colored text419335
+Node: Colored boxes421707
+Node: Colored pages423141
+Node: Graphics423834
+Node: Graphics package options425961
+Node: Graphics package configuration428714
+Node: \graphicspath429516
+Node: \DeclareGraphicsExtensions432439
+Node: \DeclareGraphicsRule434236
+Node: Commands for graphics437425
+Node: \includegraphics437930
+Node: \rotatebox450899
+Node: \scalebox453694
+Node: \resizebox454746
+Node: Special insertions455938
+Node: Reserved characters456740
+Node: Upper and lower case457941
+Node: Symbols by font position459856
+Node: Text symbols460476
+Node: Accents463924
+Node: Additional Latin letters466466
+Ref: Non-English characters466637
+Node: \rule467654
+Node: \today468083
+Node: Splitting the input468837
+Node: \endinput470389
+Node: \include & \includeonly471656
+Node: \input475880
+Node: Front/back matter476588
+Node: Tables of contents476793
+Node: \addcontentsline477976
+Node: \addtocontents478994
+Node: Glossaries479527
+Node: Indexes480046
+Node: Letters481679
+Node: \address485345
+Node: \cc486156
+Node: \closing486574
+Node: \encl486851
+Node: \location487266
+Node: \makelabels487530
+Node: \name489682
+Node: \opening489923
+Node: \ps490204
+Node: \signature490493
+Node: \telephone491710
+Node: Terminal input/output492075
+Node: \typein492340
+Node: \typeout492925
+Node: Command line493548
+Node: Document templates494500
+Node: beamer template494953
+Node: article template495607
+Node: book template496034
+Node: Larger book template496515
+Node: tugboat template498001
+Node: Concept Index500372
+Node: Command Index578449
End Tag Table
Modified: trunk/latex2e.pdf
===================================================================
(Binary files differ)
Modified: trunk/latex2e.texi
===================================================================
--- trunk/latex2e.texi 2018-06-20 15:05:12 UTC (rev 658)
+++ trunk/latex2e.texi 2018-06-20 23:44:19 UTC (rev 659)
@@ -8594,7 +8594,7 @@
@end example
The final example shows how to save the value of an argument to use in
- at var{enddef}, in this case in a box (@pxref{\sbox}).
+ at var{enddef}, in this case in a box (@pxref{\sbox & \savebox}).
@example
\newsavebox@{\quoteauthor@}
@@ -13336,17 +13336,22 @@
@cindex boxes
-All the predefined length parameters (@pxref{Predefined lengths}) can be
-used in the arguments of the box-making commands.
+At its core, @LaTeX{} puts things in boxes and then puts the boxes on a
+page. So these commands are central.
+All of the predefined length parameters (@pxref{Predefined lengths}) can
+be used in the arguments of the box-making commands.
+
+There are many packages on CTAN that are useful for manipulating boxes.
+One useful adjunct to the commands here is @file{adjustbox}.
+
@menu
* \mbox & \makebox:: Horizontal boxes.
* \fbox & \framebox:: Put a frame around a box.
-* lrbox:: An environment like @code{\sbox}.
* \parbox:: Box with text in paragraph mode.
* \raisebox:: Raise or lower text.
-* \savebox:: Like @code{\makebox}, but save the text for later use.
-* \sbox:: Like @code{\mbox}, but save the text for later use.
+* \sbox & \savebox:: Like @code{\makebox} but save the text for later.
+* lrbox:: Environment version of @code{\sbox}.
* \usebox:: Print saved text.
@end menu
@@ -13370,7 +13375,7 @@
@end example
Create a box, a container for material. The @var{text} is is typeset in
-LR mode (@pxref{Modes}), so it is not broken into lines. The
+LR mode (@pxref{Modes}) so it is not broken into lines. The
@code{\mbox} command is robust, while @code{\makebox} is fragile
(@pxref{\protect}).
@@ -13382,9 +13387,9 @@
See Table~\mbox@{T-4@}
@end example
-The first two versions, @code{\mbox} and @code{\makebox} are equivalent,
-and create a box just wide enough to contain the @var{text}. (They are
-like plain @TeX{}'s @code{\hbox}.)
+The first two command versions, @code{\mbox} and @code{\makebox}, are
+roughly equivalent. They create a box just wide enough to contain the
+ at var{text}. (They are like plain @TeX{}'s @code{\hbox}.)
In the third version the optional argument @var{width} specifies the
width of the box. Note that the space occupied by the text need not
@@ -13398,9 +13403,15 @@
with @samp{Chapter Exam} centered. But @var{text} can also be too wide
for @var{width}. See the example below of zero-width boxes.
-In the fourth version the optional argument @var{position} gives
-position of the text within the box. It may take the following values:
+In the @var{width} argument you can use the following lengths that refer
+to the dimension of the box that @LaTeX{} gets on typsetting @var{text}:
+ at code{\depth}, @code{\height}, @code{\width}, @code{\totalheight} (this
+is the box's height plus its depth).
+For the fourth command version the optional argument @var{position}
+gives position of the text within the box. It may take the following
+values:
+
@table @code
@item c
The @var{text} is centered (default).
@@ -13470,7 +13481,8 @@
Create boxes with an enclosing frame. These commands are the same as
@code{\mbox} and @code{\makebox} except for the box (@pxref{\mbox &
-\makebox}).
+\makebox}). The @code{\fbox} command is robust, the @code{\framebox}
+command is fragile (@pxref{\protect}).
@example
\fbox@{Warning! No work shown, no credit given.@}
@@ -13481,8 +13493,10 @@
Around that box, separated from it by a small gap, are four lines making
a frame.
-The optional arguments allow you to specify the box width as
- at var{width}, and the position of the text inside that box as
+The first two command invocations, @code{\fbox@{...@}} and
+ at code{\framebox@{...@}}, are roughly the same. As to the third and
+fourth invocations, the optional arguments allow you to specify the box
+width as @var{width} and the position of the text inside that box as
@var{position}. @xref{\mbox & \makebox} for the full description but
here is an example creating an empty box that is 1/4 at dmn{in} wide.
@@ -13541,49 +13555,25 @@
(picture)}).
- at node lrbox
- at section @code{lrbox}
-
- at findex lrbox
-
-Synopsis:
-
- at example
-\begin@{lrbox@}@{\@var{cmd}@}
- @var{text }
-\end@{lrbox@}
- at end example
-
-This is the environment form of @ref{\sbox, at code{\sbox}}.
-
-The @var{text} inside the environment is saved in the box @code{\@var{cmd}},
-which must have been declared with @code{\newsavebox}.
-
-
@node \parbox
@section @code{\parbox}
@findex \parbox
+ at cindex paragraph mode
+ at cindex paragraph, in a box
-Synopses:
+Synopses, one of these:
@example
\parbox@{@var{width}@}@{@var{contents}@}
- at end example
-
- at noindent or
-
- at example
+\parbox[@var{position}]@{@var{width}@}@{@var{contents}@}
+\parbox[@var{position}][@var{height}]@{@var{width}@}@{@var{contents}@}
\parbox[@var{position}][@var{height}][@var{inner-pos}]@{@var{width}@}@{@var{contents}@}
@end example
- at cindex paragraph mode
-
Produce a box of text that is @var{width} wide. Use this command to make
-a box small pieces of text; its contents are created in @dfn{paragraph
-mode}. For larger pieces of text, including ones containing a
-paragraph-making environment, use a @code{minipage} environment
-(@pxref{minipage}).
+a box of small pieces of text, of a single paragraph. This command is
+fragile (@pxref{\protect}).
@example
\begin@{picture@}(0,0)
@@ -13593,23 +13583,28 @@
\end@{picture@}
@end example
-The options for @code{\parbox} (except for @var{content}) are the same
-as those for @var{minipage}. So a summary of those options is here but
-see at tie{}@ref{minipage} for a complete description.
+The @var{contents} are processed in a text mode (@pxref{Modes}) so
+ at LaTeX{} will break lines to make a paragraph. But it won't make
+multiple paragraphs; for that, use a @code{minipage} environment
+(@pxref{minipage}).
-There are two required argument to @code{\parbox}. The @var{width} is a
-rigid length (@pxref{Lengths}). It sets the width of the box into which
- at LaTeX{} typesets @var{contents}. The @var{contents} is the text that
-is placed in that box. It should not have any paragraph-making components.
+The options for @code{\parbox} (except for @var{contents}) are the same
+as those for @code{minipage}. For convenience a summary of the options
+is here but see at tie{}@ref{minipage} for a complete description.
+There are two required arguments. The @var{width} is a rigid length
+(@pxref{Lengths}). It sets the width of the box into which @LaTeX{}
+typesets @var{contents}. The @var{contents} is the text that is placed
+in that box. It should not have any paragraph-making components.
+
There are three optional arguments, @var{position}, @var{height}, and
@var{inner-pos}. The @var{position} gives the vertical alignment of the
@code{parbox} with respect to the surrounding material. The possible
-values are @code{c} or @code{m} (the vertical center of the
- at code{parbox} lines up with the center of the adjacent line; this is the
-default), or @code{t} (match either the top line of the @code{parbox}
-with the baseline of the surrounding material), or @code{b} (match the
-bottom line).
+values are @code{c} or @code{m} to make the vertical center of the
+ at code{parbox} lines up with the center of the adjacent line (this is the
+default), or @code{t} to match the top line of the @code{parbox} with
+the baseline of the surrounding material, or @code{b} to match the
+bottom line.
The optional argument @var{height} overrides the natural height of the
box.
@@ -13619,87 +13614,216 @@
@var{position}. Its possible values are: @code{t} to put the
@var{content} at the top of the box, @code{c} to put it in the vertical
center, @code{b} to put it at the bottom of the box, and @code{s} to
-stretch it out vertically; the text must contain vertically stretchable
-space.
+stretch it out vertically (for this, the text must contain vertically
+stretchable space).
-This command is fragile (@pxref{\protect}).
-
-
@node \raisebox
@section @code{\raisebox}
@findex \raisebox
-Synopsis:
+Synopsis, one of:
@example
\raisebox@{@var{distance}@}@{@var{text}@}
+\raisebox@{@var{distance}@}[@var{height}]@{@var{text}@}
+\raisebox@{@var{distance}@}[@var{height}][@var{depth}]@{@var{text}@}
@end example
- at noindent or
+Raise or lower @var{text}. This command is fragile (@pxref{\protect}).
+This example makes a command for the restriction of a function by
+lowering the vertical bar symbol.
+
+ at c credit: egreg https://tex.stackexchange.com/a/278631/121234
@example
-\raisebox@{@var{distance}@}[@var{height}][@var{depth}]@{@var{text}@}
+\newcommand\restricted[1]@{\raisebox@{-.5ex@}@{$|$@}_@{#1@}@}
+$f\restricted@{A@}$
@end example
-Raise (or lower) @var{text}. The first mandatory argument specifies how
-high @var{text} is to be raised (or lowered if it is a negative amount).
- at var{text} itself is processed in LR mode.
+The first mandatory argument @var{distance} specifies how far to raise
+the second mandatory argument @var{text}. This is a rigid length
+(@pxref{Lengths}). If it is negative then it lowers @var{text}. The
+ at var{text} is processed in LR mode so it cannot contain line breaks
+(@pxref{Modes}).
The optional arguments @var{height} and @var{depth} are dimensions. If
-they are specified, @LaTeX{} treats @var{text} as extending a certain
-distance above the baseline (@var{height}) or below (@var{depth}),
-ignoring its natural height and depth.
+they are specified, they override the natural height and depth of the
+box @LaTeX{} gets by typesetting @var{text}.
+In the arguments @var{distance}, @var{height}, and @var{depth} you can
+use the following lengths that refer to the dimension of the box that
+ at LaTeX{} gets on typesetting @var{text}: @code{\depth}, @code{\height},
+ at code{\width}, @code{\totalheight} (this is the box's height plus its
+depth).
- at node \savebox
- at section @code{\savebox}
+This will align two graphics on their top (@pxref{Graphics}).
+ at c credit: FAQ https://texfaq.org/FAQ-topgraph
+ at example
+\usepackage@{graphicx@} \usepackage@{calc@} % in preamble
+ ...
+\begin@{center@}
+ \raisebox@{1ex-\height@}@{\includegraphics[width=0.4\linewidth]@{lion.png@}@}
+ \qquad
+ \raisebox@{1ex-\height@}@{\includegraphics[width=0.4\linewidth]@{meta.png@}@}
+\end@{center@}
+ at end example
+
+The first @code{\height} is the height of @file{lion.png} while the
+second is the height of @file{meta.png}.
+
+
+ at node \sbox & \savebox
+ at section @code{\sbox} & @code{\savebox}
+
+ at findex \sbox
@findex \savebox
+ at cindex box, save
-Synopsis:
+Synopsis, one of:
@example
-\savebox@{@var{\boxcmd}@}[@var{width}][@var{pos}]@{@var{text}@}
+\sbox@{@var{box-cmd}@}@{@var{text}@}
+\savebox@{@var{box-cmd}@}@{@var{text}@}
+\savebox@{@var{box-cmd}@}[@var{width}]@{@var{text}@}
+\savebox@{@var{box-cmd}@}[@var{width}][@var{pos}]@{@var{text}@}
@end example
-This command typeset @var{text} in a box just as with @code{\makebox}
-(@pxref{\mbox & \makebox}), except that instead of printing the
-resulting box, it saves it in the box labeled @var{\boxcmd}, which must
-have been declared with @code{\newsavebox} (@pxref{\newsavebox}).
+Typeset @var{text} just as with @code{\makebox} (@pxref{\mbox &
+\makebox}) except that @LaTeX{} does not output it but instead saves it
+in a storage bin named @var{box-cmd}. The bin name @var{box-cmd} begins
+with a backslash. You must have previously allocated the bin
+ at var{box-cmd} with @code{\newsavebox} (@pxref{\newsavebox}).The
+ at code{\sbox} command is robust while @code{\savebox} is fragile
+(@pxref{\protect}).
+This creates and uses a bin.
- at node \sbox
- at section @code{\sbox@{@var{\boxcmd}@}@{@var{text}@}}
+ at example
+\newsavebox@{\fullname@}
+\sbox@{\fullname@}@{John Jacob Jingleheimer Schmidt@}
+ ...
+\usebox@{\fullname@}! His name is my name, too!
+Whenever we go out, the people always shout!
+There goes \\usebox@{\fullname@}! Ya da da da da da da.
+ at end example
- at findex \sbox
+ at noindent
+One advantage of using and reusing a bin over a @code{\newcommand} is
+efficiency, that @LaTeX{} need not repeatedly retypeset the contents.
+See the example below.
+The first two command invocations,
+ at code{\sbox@{@var{box-cmd}@}@{@var{text}@}} and
+ at code{\savebox@{@var{box-cmd}@}@{@var{text}@}}, are roughly equivalent.
+As to the third and fourth, the optional arguments allow you to specify
+the box width as @var{width}, and the position of the text inside that
+box as @var{position}. @xref{\mbox & \makebox} for the full
+description.
+
+In the @code{\sbox} and @code{\savebox} commands the @var{text} is
+typeset in LR mode so it does not have line breaks (@pxref{Modes}). If
+you use these then @LaTeX{} doesn't give you an error but it ignores
+what you want: if you enter @code{\sbox@{\newbin@}@{test \\ test@}} and
+ at code{\usebox@{\newbin@}} then you get @samp{testtest}, while if you
+enter @code{\sbox@{\newbin@}@{test \par test@}} and
+ at code{\usebox@{\newbin@}} then you get @samp{test test}, but no error or
+warning. To fix this use a @code{\parbox} or @code{minipage} as here.
+
+ at c credit: egreg https://tex.stackexchange.com/a/41668/121234
+ at example
+\savebox@{\abin@}@{%
+ \begin@{minipage@}@{\linewidth@}
+ \begin@{enumerate@}
+ \item First item
+ \item Second item
+ \end@{enumerate@}
+ \end@{minipage@}@}
+ ...
+\usebox@{\abin@}
+ at end example
+
+As an example of the efficiency of reusing a bin's contents, this puts
+the same picture on each page of the document by putting it in the
+header. @LaTeX{} only typesets it once.
+
+ at example
+\usepackage@{graphicx@} % all this in the preamble
+\newsavebox@{\sealbin@}
+\savebox@{\sealbin@}@{%
+ \setlength@{\unitlength@}@{1in@}%
+ \begin@{picture@}(0,0)%
+ \put(1.5,-2.5)@{%
+ \begin@{tabular@}@{c@}
+ \includegraphics[height=2in]@{companylogo.png@} \\
+ Office of the President
+ \end@{tabular@}@}
+ \end@{picture@}%
+@}
+\markright@{\usebox@{\sealbin@}@}
+\pagestyle@{headings@}
+ at end example
+
+ at noindent
+The @code{picture} environment is good for fine-tuning the placement.
+
+If the bin has not already been defined then you get something like
+ at samp{Undefined control sequence. <argument> \nobin}.
+
+
+ at node lrbox
+ at section @code{lrbox}
+
+ at findex lrbox
+
Synopsis:
@example
-\sbox@{@var{\boxcmd}@}@{@var{text}@}
+\begin@{lrbox@}@{@var{box-cmd}@}
+ @var{text}
+\end@{lrbox@}
@end example
- at code{\sbox} types @var{text} in a box just as with @code{\mbox}
-(@pxref{\mbox & \makebox}) except that instead of the resulting box
-being included in the normal output, it is saved in the box labeled
- at var{\boxcmd}. @var{\boxcmd} must have been previously declared with
- at code{\newsavebox} (@pxref{\newsavebox}).
+The @var{text} inside the environment is saved in the bin
+ at code{@var{box-cmd}}. The @var{box-cmd} must begin with a
+backslash. You must create this bin in advance with @code{\newsavebox}
+(@pxref{\newsavebox}). This is the environment form of the @code{\sbox}
+and @code{\savebox} commands, and is equivalent to them. @xref{\sbox &
+\savebox} for the full information.
+In this example the environment is convenient for entering the
+ at code{tabular}.
+ at example
+\newsavebox@{\jhbin@}
+\begin@{lrbox@}@{\jhbin@}
+ \begin@{tabular@}@{c@}
+ \includegraphics[height=1in]@{jh.png@} \\
+ Jim Hef@{@}feron
+ \end@{tabular@}
+\end@{lrbox@}
+ ...
+\usebox@{\jhbin@}
+ at end example
+
+
@node \usebox
@section @code{\usebox@{@var{\boxcmd}@}}
@findex \usebox
+ at cindex box, use saved box
Synopsis:
@example
-\usebox@{@var{\boxcmd}@}
+\usebox@{@var{box-cmd}@}
@end example
- at code{\usebox} produces the box most recently saved in the bin
- at var{\boxcmd} by a @code{\savebox} command (@pxref{\savebox}).
+Produce the box most recently saved in the bin @var{box-cmd} by
+ at code{\sbox}, or @code{\savebox}, or @code{lrbox}. @xref{\sbox &
+\savebox} for more information and examples. This command is robust
+(@pxref{\protect}).
@node Color
More information about the latexrefman-commits
mailing list