/usr/share/doc/fweb/html-info/Inserting-woven-code.html is in fweb-doc 1.62-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>FWEB: Inserting woven code</title>
<meta name="description" content="FWEB: Inserting woven code">
<meta name="keywords" content="FWEB: Inserting woven code">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-index.html#Concept-index" rel="index" title="Concept index">
<link href="Parameter-index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Packages.html#Packages" rel="up" title="Packages">
<link href="Pretty_002dprinting.html#Pretty_002dprinting" rel="next" title="Pretty-printing">
<link href="Numbering.html#Numbering" rel="prev" title="Numbering">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Inserting-woven-code"></a>
<div class="header">
<p>
Previous: <a href="Customizing-LaTeX.html#Customizing-LaTeX" accesskey="p" rel="prev">Customizing LaTeX</a>, Up: <a href="Packages.html#Packages" accesskey="u" rel="up">Packages</a> [<a href="Parameter-index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-index.html#Concept-index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Package-fwebinsert_003a-Inserting-FWEAVE_0027s-output-into-a-LaTeX-document"></a>
<h4 class="subsubsection">10.1.6.1 Package <code>fwebinsert</code>: Inserting <small>FWEAVE</small>’s output into a LaTeX document</h4>
<a name="index-FWEB-output_002c-inserting-into-LaTeX-document"></a>
<a name="index-fwebinsert_002esty"></a>
<p>Beginning with version 1.61, it is (barely) possible to insert the
TeX output woven by <small>FWEAVE</small> into a LaTeX document. For
example, a code listing could be an appendix to a dissertation, or a
handbook on numerical methods could insert fragments of code formatted
by <small>FWEAVE</small>.
</p>
<p>Suppose one has the file <samp>test.web</samp> and used <small>FWEAVE</small> to create
<samp>test.tex</samp>. Unfortunately, it does <em>not</em> work to simply
<code>\input test.tex</code> into a LaTeX document, because by
default <samp>test.tex</samp> operates in a “stand-alone” mode and tries to
issue a <code>\begin{document}</code> command.
</p>
<p>Instead, one must use the package <code>fwebinsert</code> and the special
input command <code>\FWEBinput</code>, as in the following example. There are
two important steps.
</p>
<blockquote>
<ol>
<li> Use <small>FWEAVE</small> to create <samp>test.tex</samp>.
[You may wish to use the ‘<samp>-x</samp>’ flag
(see <a href="_002dx.html#g_t_002dx">-x</a>) to prevent some of the lists at the end, such as the index
or module list, from being printed.]
</li><li> Now ‘<samp>latex test</samp>’ until all of the section numbering is up-to-date.
(This step is necessary because information in the <samp>aux</samp> file is
used in processing the section headings.)
</li></ol>
</blockquote>
<p>Now <samp>test.tex</samp> is ready to be inserted in a code like the
following:
</p>
<div class="example">
<pre class="example">\documentclass{article}
\usepackage{fwebinsert}
\begin{document}
\section{Body}
The body of the document.
\appendix
\FWEBinput{test}
\end{document}
</pre></div>
<p>Note that the ‘<samp>@*</samp>’ commands in <samp>test.web</samp> are converted into
LaTeX sectioning commands such as <code>\section</code>. The above example
works correctly because the first ‘<samp>@*</samp>’ in <samp>test.web</samp> is
equivalent to a <code>\section</code> (level 0) command, which should indeed
immediately follow an <code>\appendix</code> command. Suppose, however, that
you wanted to input <samp>test.web</samp> as part of the body of the above
example, and wanted the ‘<samp>@*</samp>’s to be treated as subsections (level
1) rather than sections. To tell <code>fwebinsert</code> what level number to
assign to the ‘<samp>@*</samp>’s, provide that number as an optional argument
to <code>\FWEBinput</code>, as in the following example:
</p>
<div class="example">
<pre class="example">\documentclass{article}
\usepackage{fwebinsert}
\begin{document}
\section{Body}
The body of the document.
\FWEBinput[1]{test}
\end{document}
</pre></div>
<p>Alternatively, say <code>\FWEBlevel{1}</code> before the <code>\FWEBinput</code>.
(The optional argument construction merely calls <code>\FWEBlevel</code>.)
</p>
<p>Here are some caveats about <code>fwebinsert</code>:
</p>
<ul>
<li> Implementing this package was tricky. It may work in simple
circumstances, but it is not fully debugged.
</li><li> The <code>\FWEBinput</code> command surrounds the included TeX code with
<code>\begingroup</code>...<code>\endgroup</code>, in an attempt to prevent various
macro conflicts. As it stands, the command <code>\fwebinput</code> is
<code>\let</code> equal to <code>\FWEBinput</code>. If necessary, one could redefine
<code>\fwebinput</code> to not include the enclosing
<code>\begingroup</code>...<code>\endgroup</code>.
</li><li> For anything except level-0 inclusions, one should have just one
<code>\FWEBinput</code> command following each sectioning command. (This is a
bug.)
</li><li> <a name="index-fwebnum_002esty-1"></a>
One is supposed to be able to use the package <code>fwebnum</code>
(see <a href="Numbering.html#Numbering">Numbering</a>) in
conjunction with <code>fwebinsert</code>. One can apply that to either the
included file (via a <code>LaTeX.package</code> entry in <samp>fweb.sty</samp>), the
including file (via a <code>\usepackage</code> command), or both. Try out
these various combinations to see what emerges.
</li></ul>
<hr>
<div class="header">
<p>
Previous: <a href="Customizing-LaTeX.html#Customizing-LaTeX" accesskey="p" rel="prev">Customizing LaTeX</a>, Up: <a href="Packages.html#Packages" accesskey="u" rel="up">Packages</a> [<a href="Parameter-index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-index.html#Concept-index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|