summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/lualatex/novel/noveldocs-08-images.html
blob: f43b79eab44e57f044e33f4414429f0e2e53fe84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Class novel - 8 - Images</title>
<link rel="stylesheet" type="text/css" href="html-resources/novel-doc.css">
</head>

<body>
<div id="master">


<div id="toc">

<p>Document class "novel"</p>

<p><a href="#a8">8. Images</a></p>

<ul>
<li><a href="#a8.1">8.1 Use Raster Images</a></li>
<li><a href="#a8.2">8.2 Use Flattened png or jpg</a>
  <ul>
    <li><a href="#a8.2.1">8.2.1 Saving the Resolution</a></li>
    <li><a href="#a8.2.2">8.2.2 Removing Private Metadata</a></li>
  </ul></li><!-- end 8.2 -->
<li><a href="#a8.3">8.3 Line Art vs. Grayscale</a>
  <ul>
    <li><a href="#a8.3.1">8.3.1 Line Art in GIMP</a></li>
    <li><a href="#a8.3.2">8.3.2 Grayscale in GIMP</a></li>
    <li><a href="#a8.3.3">8.3.3 Scaling After \rework</a></li>
  </ul></li><!-- end 8.3 -->
<li><a href="#a8.4">8.4 Placing Images</a>
  <ul>
    <li><a href="#a8.4.1">8.4.1 \charscale</a></li>
    <li><a href="#a8.4.2">8.4.2 \InlineImage</a></li>
    <li><a href="#a8.4.3">8.4.3 Text Over \InlineImage</a></li>
    <li><a href="#a8.4.4">8.4.4 \BlockImage</a></li>
    <li><a href="#a8.4.5">8.4.5 \BlockImage and Text</a></li>
  </ul></li><!-- end 8.4 -->
</ul>

<p>&nbsp;</p>

</div><!-- end toc -->



<div id="main">
<a id="thetop"></a>
<h1>Documentation for <code>novel</code> document class</h1>
<p>Documentation version: 1.36.</p>

<div class="pagetopage">
<p><b>User Guide</b></p>
<p><a href="noveldocs-01-overview.html">1. Overview</a></p>
<p><a href="noveldocs-02-class-options.html">2. Class Options</a></p>
<p><a href="noveldocs-03-metadata-pdfx.html">3. Metadata, PDF/X</a></p>
<p><a href="noveldocs-04-layout.html">4. Page Layout</a></p>
<p><a href="noveldocs-05-fonts.html">5. Choosing Fonts</a></p>
<p><a href="noveldocs-06-header-footer.html">6. Headers, Footers</a><br>
<p><a href="noveldocs-07-text-size-style.html">7. Text Sizes, Styles</a></p>
<p>8. Using Images</p>
<p><a href="noveldocs-09-chapters-displays.html">9. Display, Start Pages;<br>
<span style="visibility:hidden">9. </span>Chapters; Continued Pages;<br>
<span style="visibility:hidden">9. </span>Footnotes, Endnotes.</a></p>
<p><a href="noveldocs-10-cover-art.html">10. Cover Artwork</a></p>
<p><a href="noveldocs-11-debugging.html">11. Debugging</a></p>
</div>


<a id="a8"></a>
<h2 style="clear:none">8. Images</h2>

<p>If you intend to place a lot of images in your document, or if you need to have text wrap around floating images, then the <code>novel</code> document class is not well-suited to your purpose. This is because the methods of formatting, and the emphasis on maintaining a constant baseline skip, sometimes interfere with the behavior you expect from other document classes.</p>

<p>Yet you can place the occasional image. Most fiction does use imagery on the title page, and sometimes at chapter starts. Some stories include a map, or an image of ancient writing. In a detective novel, we might get a glimpse at handwritten evidence. The <code>novel</code> class has its own commands for easily dealing with these situations.</p>

<p>Like it or not, you are restricted to <code>png</code> and <code>jpg</code> raster images. No vector artwork. No included <code>eps</code> or <code>pdf</code>. Forget about <code>pgf</code> and <code>TikZ</code>. Although you can "cheat" the <code>novel</code> commands, and circumvent the restrictions, don't do it. The restrictions are intentional. The reasons are explained below.</p>



<a id="a8.1"></a>
<h3>8.1 Use Raster Images</h3>

<p>Place raster images, not vector images, in your document.</p>

<p>You may think that the above sentence is a mistake. Haven't you been told that vector artwork is always preferable to rasterized artwork, because vector artwork is scalable? The part about being scalable is true. But if you do not need scalability, vector artwork is worse.</p>

<p>How so? A PDF file can incorporate vector artwork, and if properly done it will meet commercial printing standards. <em>Sadly, it is often not properly done.</em> When vector artwork has technical errors, as it often does, then the appearance will depend on which software is used to view the image. The fact that it is within a PDF does not always help.</p>

<p>When you design a vector image, or perhaps acquire one, you approve its appearance based on what you see on your computer. The odds are good that someone else, on a different computer, will be using the same software and thus see the same result. However, that is not true of the software built into commercial printing machines. That software may interpret ambiguous vector instructions in a different way than you expected.</p>

<p>A good example is on pages 232-234 of the Adobe PDF 1.7 Reference. That's an enormous file, full of technical information. You don't need to read it. But Adobe provides an example of a vector drawing in the form of a five-pointed star, made with one continuous line that crosses itself. There are two possible rules for deciding whether the central pentagon should be filled or not. They produce different results. Adobe chooses a particular rule, and so should all compliant software. But is all software compliant? Without reading the Adobe spec, there is no particular reason to prefer one rule over the other. And, that's a simple example. Many vector drawings are very convoluted, in ways that make the artist's intent difficult to interpret.</p>

<p>You normally do not need to scale images. Your finished work will be viewed at fixed size on the printed page, not at variable size in a PDF reader. So, scalability is not an advantage. Your image is placed on paper at its exact size and resolution. You are in complete control. If it is purely black/white line art, its detail will be about the same whether it was placed as vector or raster. If it is grayscale, it is subject to halftoning, which reduces the resolution in any case.</p>

<p>Do not attempt to place an image by including a PDF within your TeX file. The reason is that the included PDF may carry its own File Data, which will differ from the File Data of the main PDF. There's nothing you can do about that, and commercial printers don't like it. So, don't do it. Indeed, <code>novel</code> may ban it!</p>



<a id="a8.2"></a>
<h3>8.2 Use Flattened png or jpg Image Format</h3>

<p>The <code>novel</code> image-handling commands require the <code>png</code> or <code>jpg</code> formats, exclusively. If you already have a raster image in another format, such as <code>tif</code>, you must convert it. If you have a vector image, such as <code>eps</code> or <code>svg</code> format, you must rasterize it. This must all be done in an external graphics program, such as GIMP or Inkscape. It cannot be done from within TeX.</p>

<p>Both <code>jpg</code> and <code>png</code> images can store their resolution internally. When you export images from a graphics program, be sure that the resolution is stored. This may or may not be an option that you need to check.</p>

<p>With <code>png</code>, the image must be flattened (no transparency). Be sure to flatten the image before you export it to <code>png</code>. With <code>jpg</code>, the exported image is always flattened.</p>

<p>When using grayscale, be sure to convert the image to true grayscale, which has only one color channel. In GIMP, this is achieved with the Image > Mode menu. Note that an RGB or CMYK image "that only uses grays" is <em>not</em> the same thing, since these have three or four color channels!</p>

<p>When using pure black/white (png only), you can get there with GIMP's Image > Mode > Indexed menu.</p>

<p>Note that within the finished PDF file, images are stored in an internal format which differs from your input. If your image is in the wrong format, or contains transparency, it will not be detected by TeX.</p>



<a id="a8.2.1"></a>
<h4>8.2.1 Saving the Resolution</h4>

<p>Image resolution is measured in dots per inch (dpi). In a graphics program, it may be called pixels per inch (ppi). And, if the software was written in Europe or Asia, it may be measured in pixels per centimetre!</p>

<p>When you prepare an image in a graphics program, you must first ensure that it is at the correct resolution. Most U.S. print services require 300dpi for grayscale images, 600dpi for black/white line art. Then, it is a simple matter of multiplying the image dimensions (in inches) by the resolution, to get the image dimensions in pixels.</p>

<p>Example: A grayscale image that will print at 1.25" wide by 1.5" high, must be 375 pixels wide by 450 pixels high, at 300dpi. If the original image is at different dimensions, it must be cropped and scaled to the correct size. However, it is not enough to finish the image at 375x450 pixels. You must specifically set the resolution to 300dpi. If you fail to set the resolution correctly, then the image will not appear at its correct size in your PDF.</p>

<p>In GIMP, you can use the Image > Scale Image dialog box to ensure that the image is at the proper size and resolution. When you change any of the settings, others may change in response. Be sure that all settings are satisfactory.</p>

<p>When you export your image, you may be asked whether or not to save the resolution. Be sure to save it.</p>

<p>Example dialog boxes for grayscale png exported from GIMP:</p>
<p class="centerimg"><img src="html-resources/imgdialogs.png" width="600" height="192" alt="png image with resolution"></p>


<a id="a8.2.2"></a>
<h4>8.2.2 Removing Private Metadata</h4>

<p>Your image may contain "private metadata" that records how the image was created, especially if it was converted from a digital photograph. It may also contain color profile data that is inappropriate for a grayscale or black/white image. Commercial printing standards prefer that such private metadata be removed from images; the PDF File Data should speak for everything, not the individual images.</p>

<p>The simplest way to remove private metadata is via a command-line program: Use either ImageMagick, or GraphicsMagick. These programs work on Windows, Linux, and (so I am told) OS/X. Specific code is shown in the workflow examples, below. If you ever re-work an image, you must once again remove its private data.</p>



<a id="a8.3"></a>
<h3>8.3 Line Art vs. Grayscale</h3>

<p>Two kinds of images may appear in a black-and-white book: line art, and grayscale.</p>

<p>Line art contains only black and white. Moreover, there cannot be any places where the black or white areas are very tiny. Most print services request that your line art be rasterized at 600dpi (dots per inch), but that does not mean you can emulate gray with an alternating pattern of black and white, repeated 300 times per inch. All it means is that the sharp transition from black areas to white areas can be resolved to about 1/600" during printing (only "about" since the ink spreads a little).</p>

<p>So, if you think you can use Floyd-Steinberg dithering to convert a grayscale image to "line art," that won't work: The printer will note that it cannot resolve such fine detail, and treat it as a grayscale. The result will be worse than if you had left it as grayscale instead of dithering to black and white.</p>

<p>Think in terms of how an offset press works. Look it up on the Internet. You can have a sharp boundary between black and white, but you cannot closely mingle tiny black and white areas. Actually, at low production volume, your book may be printed with a technology that can resolve very fine details. But you cannot count on that; and, if your book does sell well, you may be shocked if the print technology changes.</p>

<p>A PDF file can place ordinary (vector) text atop an image. However, if the underlying image is halftoned, there is the risk that the overlying text will also be halftoned, even if it sits atop white areas of the image. Ask your print service for advice. It may be better to make the text part of the image, and anticipate halftoning by using appropriately styled text.</p>



<a id="a8.3.1"></a>
<h4>8.3.1 Workflow: Line Art in GIMP</h4>

<p>To create a suitable line art image in GIMP, with post-processing in ImageMagick or GraphicsMagick, follow these instructions:</p>

<p>(1) Open the image file in GIMP. If it is a vector format (such as svg or pdf), ensure that it is resolved to 600 pixels/in with anti-aliasing, and that its size is the same as your intended dimensions (measured in inches or mm). You can also use a larger size, if you intend to crop some of the periphery; or you can use a smaller size, if you intend to make it larger by adding white space.</p>

<p>(2) If you need to crop to a smaller size, or add to a larger size, do it now. Image > Canvas Size, with Resize Layers All.</p>

<p>(3) If you need to edit the image, by adding or removing anything, do it now.</p>

<p>(4) Image > Flatten Image.</p>

<p>(5) Image > Mode > Grayscale.</p>

<p>(6) View > Zoom to an appropriate amount that shows the image at approximately its print size. That depends on your monitor's resolution. On my own computer, 25\% is about right. Does not need to be exact.</p>

<p>(7) Colors > Threshold. If necessary, adjust the slider until the image looks best. It might be that the default 50\% works for you. If you move it to the left, then black areas will become a little narrower. If to the right, black areas will become a little thicker.</p>

<p>(8) Image > Mode > Indexed > Use black and white (1-bit) palette. Remove unused colors from colormap. No dithering.</p>

<p>(9) File > Export. Use png (Portable Network Graphics) extension. When the dialog box appears, ensure that "save resolution" is checked. Use the highest level of compression offered. The exported image may look poor in some image viewers, because those viewers do not read the full resolution. Not a problem. The image will look good when seen in better viewers.</p>

<p>(10) Command-Line Terminal, using GraphicsMagick (or ImageMagick without the preceding <code>gm</code>):</p>

<p class="code"><code>gm mogrify -strip nameofimage.png</code></p>

<p>(11) Sanity check, again using GraphicsMagick (or ImageMagick without the preceding <code>gm</code>):</p>

<p class="code"><code>gm identify -verbose nameofimage.png</code></p>

<p>After a few moments, the Terminal will show some information. It should say that the depth is 1-bits per pixel, that the only color is gray (1 bits),  that the resolution is 236.22 pixels per centimeter (which is 600dpi). The page geometry, divided by 600, will give you the image size in inches (thus, a page geometry of 900+1200+0+0 represents an image 1.5" wide x 2" high).</p>


<a id="a8.3.2"></a>
<h4>8.3.2 Workflow: Grayscale in GIMP</h4>

<p>To produce a suitable grayscale image in GIMP, with post-processing in ImageMagick or GraphicsMagick, follow these instructions:</p>

<p>(1) Open the image file in GIMP. If it is a vector format (such as svg or pdf), ensure that it is resolved to 300 pixels/in with anti-aliasing, and that its size is the same as your intended dimensions (measured in inches or mm). You can also use a larger size, if you intend to crop some of the periphery; or you can use a smaller size, if you intend to make it larger by adding white space.</p>

<p>(2) If you need to crop to a smaller size, or add to a larger size, do it now. Image > Canvas Size, with Resize Layers All.</p>

<p>(3) If you need to edit the image, by adding or removing anything, do it now.</p>

<p>(4) Image > Flatten Image.</p>

<p>(5) Image > Mode > Grayscale.</p>

<p>(6) View > Zoom to an appropriate amount that shows the image at approximately its print size. That depends on your monitor's resolution. On my own computer, 25\% is about right. Does not need to be exact.</p>

<p>(7) Very dark grays are hard to produce accurately, and so are very light grays. If your image relies on areas that ar nearly black and nearly white, then consider adjusting lightness and contrast so that they are not so close to black and white. GIMP's Colors > Levels might be more useful than Colors > Brightness/Contrast.</p>

<p>(8) There is no transparency, but you can achieve that effect by ensuring that white areas are truly white, not light gray. Use GIMP's Select By Color Tool, with a very low threshold (perhaps 1) to choose areas that should be exactly white, then clear them.</p>

<p>(9) File > Export. Use png (Portable Network Graphics) extension. When the dialog box appears, ensure that "save resolution" is checked. Use the highest level of compression offered. The exported image may look poor in some image viewers, because those viewers do not read the full resolution. Not a problem. The image will look good when seen in better viewers.</p>

<p>(10) Command-Line Terminal, using GraphicsMagick (or ImageMagick without the preceding <code>gm</code>):</p>

<p class="code"><code>gm mogrify -strip nameofimage.png</code></p>

<p>(11) Sanity check, again using GraphicsMagick (or ImageMagick without the preceding <code>gm</code>):</p>

<p class="code"><code>gm identify -verbose nameofimage.png</code></p>

<p>After a few moments, the Terminal will show some information. It should say that the type is grayscale, at 8 bits per pixel. The resolution is 118.11 pixels per centimeter (which is 300dpi). The page geometry, divided by 300, will give you the image size in inches (thus, a page geometry of 900+1200+0+0 represents an image 3" wide x 4" high).</p>

<p class="floatright"><img src="html-resources/pngcolortype.png" width="270" height="46" alt="png color type"><br><img src="html-resources/jpgcolorspace.png" width="296" height="46" alt="jpg colorspace"></p>
<p>Most important of all: Scroll through the information. Near its end, you should see a line like this. The exact wording will depend on your software:</p>

<p class="code" style="clear:both">(For png images) &nbsp; <code>png: IHDR.color_type: 0 (grayscale)</code></p>

<p class="code">(For jpg images) &nbsp; <code>JPEG-Colorspace: 1</code> and <code>JPEG-Colorspace-Name: GRAYSCALE</code></p>

<p>The above codes are the only ones that matter. Even if other information claims that the image is grayscale, or lists the colors and they are all shades of gray, <em>that is not good enough</em>. When automated software reviews your PDF for compliance, it will look at the png IHDR.color_type, which must be 0, or the JPEG-Colorspace, which must be 1. Anything else fails. If the information is different, it means that you forget to change the mode to grayscale before you exported the image.</p>

<p>You may ask: If the image was not really grayscale, can it be converted to grayscale using a simple command line, with ImageMagick or GraphicsMagick? The answer is yes, but don't do it that way. The reason is that there are many ways to map colors (even "gray colors") to true grayscale, and an automated conversion may produce unexpectedly light or dark results. It is better to do the conversion in a graphics program, where you can see what you are doing.</p>


<a id="a8.3.3"></a>
<h4>8.3.3 Workflow: Scaling the image after \Rework.</h4>

<p>When you use one or both of the <code>\Rework</code> commands, the font size and/or the baselineskip will change. However, it does not scale images. In many cases, there is no problem. But in some cases, an un-scaled image will disrupt the previous flow of text or pagination. If you look in the log file, you will see an Alert message, which suggests (only suggests) appropriate values for scaling problem images, depending on whether they are placed inline or block. Then, you should re-work the image in an external image editor. When you scale the image, be sure that the revised version is at the correct resolution of 300dpi or 600dpi, or whatever is necessary.</p>

<p>It is best to go back to your copy of the original artwork, before you exported it to <code>png</code> or <code>jpg</code>. But what if you do not have anything but the 1-bit or grayscale images that you created earlier? Then do this:</p>

<p>(1) If the image is 1-bit, change to Color > Mode grayscale.</p>

<p>(2) Use Image > Scale Image to get new dimensions, at 600 or 300 pixels per inch. Careful: Sometimes when you change size, it auto-changes resolution, or vice-versa. Click back and forth in the dialog box, to ensure that both the dimensions and resolution are correct. The default Cubic interpolation is OK.</p>

<p>(3) Change View to something that puts the image at its approximate print size.</p>

<p>(4) If desired, play with Filters > Enhance > Sharpen.</p>

<p>(5) Image > Flatten.</p>

<p>(6) If the image is to be 1-bit line art, use Colors > Threshold and Image > Mode >Indexed, as before.</p>

<p>(7) Export as png, then <code>mogrify</code> the image, as before. Be sure to identify the image and look for its png IHDR.color_type or JPEG-Colorspace, as before.</p>

<p>The above does not take too much time, and will provide superior results. Note that when an image is placed within text, the calculation for text positioning is different than the calculation for image positioning. It is possible (although unlikely) that a <code>\Rework</code> situation will cause an unexpected page break, due to roundoff error in the placement of the final line on a page. This can be fixed by subtracting (or, in some cases, adding) as little as <code>\vspace{-0.001\nbs}</code> before or after the re-scaled image.</p>




<a id="a8.4"></a>
<h3>8.4 Placing Images In Your Document</h3>

<p>An image may be placed as an inline element, using the <code>\InlineImage</code> command. This allows the image to mingle with text, and even have text as an overlay.</p>
<p><code>\BlockImage</code> places the image so that <em>subsequent</em> text will clear the bottom of the image, and be on the baseline grid. You may also <em>accompany</em> the image with text in its own block space, if you wish.</p>
<p>If your book has a lot of images, then you should consider using a page layout program (such as Scribus) instead of TeX. That's because the best strategies for an image-intensive picture book are very different from the strategies adoped by <code>novel</code>.</p>
<p>Beware of overlap. If images overlap each other, or overlap with text, no error will result. If text lies atop an image, the result may be desirable. All other situations are undesirable. Since TeX cannot detect such errors, you need to carefully review the result.</p>
<p>Do not use the ordinary TeX commands, or environments, for floats or figures.</p>


<a id="a8.4.1"></a>
<h4>8.4.1 \charscale[<em>scale,hoffset,voffset</em>]{<em>text</em>}, \charscale*[<em>scale,hoffset,voffset</em>]{<em>text</em>}</h4>

<p>The <code>\charscale</code> command pertains to text, not images. It is mentioned here because it can place text almost anywhere on a page, even overlapping other text or previously-placed images. Thus, it provides an image-like effect.</p>
<p>The command is documented on <a href="noveldocs-07-text-size-style.html#a7.1.2">Page 7</a>.</p>


<a id="a8.4.2"></a>
<h4>8.4.2 \InlineImage[<em>hoffset,voffset</em>]{<em>imageFile.png or .jpg</em>} and starred version</h4>
<p>This command places the image as an inline element, at 100% scale. The use of <code>png</code> or <code>jpg</code> images, with file extension, is required.<p>
<p>You may offset the image horizontally or vertically. Positive direction is to the right and up. If you use one offset, then you must use both (empty brackets may be used for defaults). Any units of length may be used, but the preferred units are <code>em</code> or <code>\textwidth</code> for horizontal, and <code>em</code> or <code>\nbs</code> for vertical, because these are most compatible with the <code>\Rework</code> commands.</p>
<p>By default, the <em>top</em> of the image is at the text baseline. If you prefer that the <em>bottom</em> of the image be at the text baseline, use voffset <code>b</code>. Example:</p>
<p class="code"><code>\InlineImage[0pt,b]{imageFile.png}</code></p>
<p>Thanks to the <code>calc</code> package, offsets may use \widthof{<em>text</em>} and/or \heightof{<em>text</em>} as lengths. The most useful of these is when you wish to align the top of an image at the X-height of surrounding text:</p>
<p class="code"><code>\InlineImage[0pt,\heightof{X}]{imageFile.png}</code></p>
<p>You may also use <code>\heightof{\Aring}</code> for the tallest accented letter normally found in Latin-1.</p>
<p>Lengths <code>\imagewidth</code> and <code>\imageheight</code> may also be used for offsets. These lengths remain set, and can be used for other purposes (such as displacing text) until another image is placed.</p>
<p>Offsets may be written as combinations of lengths. If you use the baseline <code>b</code> as above, it must be the first character of voffset. If you use <code>\widthof</code> or <code>\heightof</code>, then its backslash must be the first character <em>unless</em> it is preceded by another length. Thus, an offset of <code>-\heightof{X}</code> is prohibited, but you can use <code>0pt-\heightof{X}</code>.
<p>Here are some examples of allowable code:</p>
<p class="code"><code>
\InlineImage[2.3em, -0.4em]{imageFile.png}<br>
\InlineImage[0pt-\widthof{eee}, b+\heightof{X}-0.2em]{imageFile.jpg}
</code></p>
<p>The image occupies zero vertical space. So, it will not push apart baselines. The next line(s) of text may overlie the image. In some cases, this is desirable. If you do not want that effect, then you can either insert a suitable number of <code>\null</code> lines after the image, or use <code>\BlockImage</code> instead.</p>
<p>With the un-starred command, the image occupies its natural horizontal width. That is, text following the image will (if it fits) continue from the right edge of the image. But with the starred command, the image occupies zero width. In this case, text following the image will continue from the left of the image, and overlie the image.</p>
<p>Having text overlie the image is allowable, and can create some interesting special effects. However, such effects are rarely used in fiction. When your print service sees what you have done, they may think that it is a mistake, and flag your file. Be sure that you discuss this with your print service.</p>
<p>If you do allow text to overlie an image, be sure that the image is very light. Repeat: <em>very light</em>. Depending on the printing technology, an image may print darker than you see on your computer screen, and that would make text hard to read. At low print volume, your print service will probably use a technology that is like an industrial-strength home inkjet printer, which can make very sharp text over images. However, if your book goes to volume production, then the technology will be different. Volume printing will use halftoned images, and the text overlay may also become halftoned, which will reduce its sharpness considerably. Once again: Discuss this with your print service!</p>
<p>Note that an image may be placed in a way that prints some of the image in the margin. That's allowable if your margin is wider than the minimum required for printing clearance. But even if it is not allowable, there will be no complaint or warning from TeX.</p>
<p>Do not place an image so that it approaches or goes beyond the page edge. That requires a "bleed box" which is not part of <code>novel</code> capabilities. If your book needs that kind of image handling, use a page layout program instead.</p>
<p>Do not place images so that they overlap. Although that is allowed in the PDF, it is likely to be flagged as an error by your print service.</p>



<a id="a8.4.3"></a>
<h4>8.4.3 Text Over \InlineImage</h4>

<p>As noted above, an <code>\InlineImage</code> or its starred version, can be used as the background to any subsequent text. Just as with any other text, whatever sits atop an image must be pure black. If you need text in gray, then you must integrate the rasterized text with the image in an external graphics program, instead of typing the text in your document.</p>

<p>When text overlays an image, it retains its identity as vector paths, as far as the PDF is concerned. In some printing processes, particularly those for very low volume production, the result will be as sharp and dark as ordinary text. However, if your books sells well (or is being prepared to sell well), the image will be converted to halftone, and the text that lies above it may also be converted to halftone. This will reduce the sharpness of the text. It is not necessarily a problem, unless your text is very small or has fine details.</p>

<p>If the text-over-image is part of a title, then the text is naturally large and dark, and will easily withstand halftoning.</p>

<p>Be aware that not all print services will accept text over images. It's not that they <em>cannot</em> do it; after all, your home and office printers can easily do it. The reason they object is because the pages of your book will be handled in small volume by persons who are unfamiliar with the book. Text over an image may be flagged as a printing error or a bug in the PDF. In the advertising world, text over image is routine. But in the world of fictional novels, it is unusual. Don't imagine that they will decide what you meant to do, by reading your book. Also, very sharp image/text, at low printing volume, will not appear as sharp when the technology changes for higher volume production. They know that, but are not sure if <em>you</em> know that.</p>

<p>An inline image occupies zero vertical space. If you place its top near the bottom of the textblock, then the image will happily flow into the lower margin and perhaps off the bottom of the page, without an error (but the print service will reject it). The reason that TeX does not provide an error message is quite simple: Technically, it is not an error! It is just not what you meant to do. The software cannot read your mind.</p>

<p>Example:</p>

<p class="code"><code>
\noindent\InlineImage*[0pt,1.2\nbs]{gavel.png} Lord Withens took a seat at the rear of the courtroom, attempting to be inconspicuous. Yet his effort was in vain, as he was the only person there with a riding crop and spurs.\par<br>
He would have taken the car, had it not been stolen. But that was why he was here, at the arraignment of the person charged with the theft. It was most unfortunate that the accused was his own elderly father; but then, theft ran in the family line.\par
</code></p>

<p class="centerimg"><img src="html-resources/inlineimagest.png" width="651" height="249" alt="example of InlineImage*"></p>



<a id="a8.4.4"></a>
<h4>8.4.4 \BlockImage[<em>alignment,hoffset,voffset</em>]{<em>imageFile.png or .jpg</em>}[<em>text</em>]</h4>

<p>Note that <code>\BlockImage</code> has an optional argument that precedes the mandatory image file name. It has another optional argument that follows the file name. If this second option is used, there must be no space between <code>}[</code>.</p>

<p>The first optional argument has up to three comma-separated values. The first is alignment: <code>l</code>, <code>c</code>, or <code>r</code> for left, center, or right. The second and third values are hoffset and voffset. Unlike the <code>\InlineImage</code> command, do not use <code>b</code> to indicate vertical position relative to the image bottom; it is always at the top with this command. The default alignment is centered, without offsets.</p>

<p>An automatic calculation clears the height of the image. Subsequent text will be on grid. This is the right thing to do when the image and included text fit on a single page. But if they cannot both fit on a single page, an unusual layout will result.</p>


<a id="a8.4.5"></a>
<h4>8.4.5 \BlockImage and Text</h4>

<p>The second optional argument of <code>\BlockImage</code>, following the image, may contain text that will accompany the image in the same block of space. The text is left-aligned like ordinary text, no matter which alignment you use for the image. The text may be in more than one paragraph, and may use <code>{\centering ...\par}</code> or <code>\begin{adjustwidth} ... \end{adjustwidth}</code> for positioning relative to the image. The text may overlie the image, using <code>\charscale</code>. You may need to use <code>\indent</code> or <code>\forceindent</code> or <code>\backindent</code> to control how the text appears. Note that you cannot "flow" text around an image in <code>novel</code> class.</p>

<p>Example:</p>
<p class="code">
<code>
It was a dark and stormy night. Lord Withens mounted his horse and rode through the darkness, accidentally trampling some petunias in Her Ladyship's garden.\par<br>
\BlockImage[l]{gnome.png}[\begin{adjustwidth}{8em}{0pt}\forceindent Suddenly he was confronted by an irate gnome, who expressed an opinion in the crudest of language, even for a gnome.\par<br>
Lord Withens was taken aback. How dare this mere gnome speak to him in such a tone of voice? But then he remembered that the gnomes had gone to college, where swearing was routine.\par\end{adjustwidth}]<br>
\charscale[1, 5\nbs]{CENSORED}\forceindent Lord Withens shrugged, and rode on. There was nothing to do but remain silent, this time taking more care. He would speak with his wife about the gnome situation when he returned.\par
</code></p>

<p class="centerimg"><img src="html-resources/irategnome.png" width="639" height="423" alt="example of BlockImage with accompanying text"></p>

<p>In the above example, the text to the right of the image happens to have just the right number of lines to fill the available area. But that is only because I wrote it that way. If I had written less, then there would be one or more blank lines before the subsequent text ("Lord Withens shrugged..."). If I had written more, then the subsequent text would have been pushed down by the necessary number of lines, and there would have been more white area underneath the gnome.</p>
<p>Thus, this technique requires careful inspection, particularly if there is the danger that the image or accompanying text may overflow the bottom of the page.</p>
<p>Note that I used the start of the following text as a reference point for placing CENSORED over the gnome. That is not the only way it could have been done, but it was easy to discern the necessary offset.</p>
<p>&bull; In general, avoid using accompanying text with an image, with the possible exception of titles and other special layouts. There is little need for it in the flowing text of a novel. If you find that you need to use it frequently, then perhaps your book would benefit from a page layout program such as Scribus, instead of TeX.</p>







</div><!-- end main -->

<div id="finish"></div>

</div><!-- end master -->

</body>
</html>