summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/novel/doc/extras/novel-testsuite.tex
blob: 09ca6b348f07603e804da745a96eeb67fcf7b04a (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
% !TeX TS-program = lualatex
% !TeX encoding = UTF-8

% Copyright 2023 Robert Allgeyer.
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, version 1.3c.
% License URL:  https://www.latex-project.org/lppl/lppl-1-3c/

% TEST SUITE FOR NOVEL DOCUMENT CLASS
%
% IF YOU COMPILE THIS DOCUMENT: Be sure that this file, and its generated PDF,
%   have read/write permissions for any user. If they don't, then
%   compile will fail at the point where files are written.
%
% This document tests the various capabilities of `novel' document class.
% The Preamble settings are originally the defaults.
% Change them to exercise the setting, and see the result.
% In the document body, various commands are exercised.
%
% You need all fonts from the `libertinus' package,
% all fonts from `lmodern' package,
% and the included NovelDeco.otf.
%
% You also need the file` novel-testimage.png'
% in the same folder as this document.
% It is grayscale png, 150x150 pixels, with resolution 300pdi.
% 
% The `test' class option is required. You may add others.

\documentclass[test,shademargins,draft]{novel} % v. 1.83.
\SetTitle{Test Suite}
\SetSubtitle{Novel Document Class}
\SetAuthor{Author Name}
% Additional Preamble, if desired.


\begin{document}

\frontmatter % begins at page i.

\thispagestyle{footer}
\vspace*{5\nbs}
\begin{center}
\charscale[3.6]{\textbf{Test Suite}}\par
\vspace{1.5\nbs}
\charscale[1.6]{Novel Document Class}\par
\vspace{4\nbs}
\ChapterDeco[6]{\decoglyph{n9548}}
\vspace{2\nbs}
\charscale[1.5]{The following page will be blank!}\par
\vfill
If you choose a head/foot style with footer, then page number i (lowercase roman) will appear in the footer below.\par
But if the head/foot style has no footer, then nothing below.\par
\end{center}
\clearpage


% Now to begin at page 1:
\mainmatter

\begin{ChapterStart}[10]
\vspace*{3\nbs}
\ChapterTitle{Chapter One}
\ChapterSubtitle{Dark and Stormy}
\ChapterDeco[4]{\decoglyph{n9548}}
\end{ChapterStart}

This tests the ChapterStart environment, plus \string\ChapterTitle, \string\ChapterSubtitle, \string\ChapterDeco, and \string\decoglyph.

In the TeX document, you can change the height of the environment, the alignment of its components, the decoglyph, and so forth.

The first paragraph will not be indented, but all following paragraphs will be indented.

Since this is a recto (odd-numbered) page at right side, the default margins will be a little larger at left, where there is an allowance for binding gutter.

Unless you change the head/foot style, you should see no heading. Arabic page number 1 should be at the bottom.

\clearpage


% NEXT PAGE:

This page tests the \string\charscale\space command, and \string\rotatebox. The combined effect is shown below:\par
\vspace{1.5\nbs} % trial and error
\charscale[2,3em,-4em]{\rotatebox[origin=c]{45}{Random Test Items}}
\vspace{7.5\nbs} % trial and error

Above, you should see the phrase Random Test Items in larger than normal text, tilted 45 degrees, nicely fitting between the text above and this text. Offset has been used, so it is not quite centered.

If you change the font size or number of lines per page, then the tilted phrase might not fit nicely. That can be fixed by changing the amount of \string\vspace\space above and below the rotated text.

The amount of \string\vspace\space is not calculated automatically. You have to determine it by trial and error (or do some math). The total amount of \string\vspace, top and bottom, must be an integer.

If you use \string\rotatebox\space without \string\charscale, then it will create its own vertical gap. Unfortunately, the height of this gap is very difficult for you to calculate, so you would not be able to easily restore the line grid by adding some amount of \string\vspace. So, don't use \string\rotatebox\space without \string\charscale.

\clearpage


% NEXT PAGE:

This page tests \string\FloatImage\space effects. Remember that \textit{novel} uses its own methods of placing images.

There will be a gap before the image appears. In the tex code, find \string\vspace\space there, and change the space. At some point, the image will float to the top of the following page.

\vspace{7\nbs}

\FloatImage[ht]{novel-testimage.png}

Above, the top of the image sits where the baseline of text would be. If the image fits where placed, then this paragraph comfortably clears the bottom of the image. If the gap is increased so that the image flats to the top of the next page, then this paragraph will be directly beneath the preceding paragraph.



\clearpage

% NEXT PAGE:

This page tests \string\InlineImage\space effects. Note that the command also has a starred version. The difference: Unstarred, the width of the image is taken into account. Starred, the width of the image is ignored.

\null

\noindent\InlineImage*[0,\normalXheight]{novel-testimage.png}This paragraph is not indented. The starred command places an image, offset so that its top sits at the X-height of the text. The image underlies the following text. If you use this effect, then be sure that the image is much lighter, or the text will be hard to read.

\null\null\null

\noindent\InlineImage[0,b-\normaldescender]{novel-testimage.jpg}This paragraph is not indented. The unstarred command places an image, offset so that its bottom sits at the descender of the text. It was necessary to insert previous blank lines, or the image would overlie (and obscure) the preceding paragraph.

\null\null

\noindent\InlineImage[0,1.5em]{novel-testscript.png}This paragraph is not indented. The unstarred command places an image, offset so that it rises above the paragraph, and also descends beneath the following text. 

\null\null

In all of the above, the alignments will change, if you change the text size or lines per page.

\clearpage


% NEXT PAGE:

This page tests \string\WrapImage. The command is written following the paragraph you are now reading.

\WrapImage[r]{novel-testscript.jpg}

The image will appear at right, with this text flowing around it. the first few lines will be at the left of the image. Then, as the paragraph continues, it eventually is restored to full text width, once it gets past the bottom of the image. Note that the top of the image is aligned to the X-height of the first line of text.

\null
\null

\clearpage

% NEXT 2 PAGES:

This page, combined with the following page, test the detection mechanism for \string\scenebreak, \string\sceneline, and \string\scenestars.

In the source document, there is \string\vspace\space following this paragraph. To detect the effects, vary the \string\vspace.

% Change this to see the effects:
\vspace{20\nbs} % originally 20\nbs

Following this paragraph is the \string\scenestars\space command. It prints a few asterisks centered in a gap. It is one way to indicate that a scenbreak is present, when the break occurs at the very top or bottom of a page (because a blank line might not be noticed there).

\scenestars

If you change the above \string\vspace\space to 25\string\nbs, you will get a Warning about the line being too close to the bottom. Change to 28\string\nbs, and the Warning will say that it is too close to the top (of the following page. Note that \string\scenestars\space is allowed to be at the very bottom or very top, or somewhere in the middle of the page. The same applies to \string\sceneline.

If you wish, you can always use \string\scenestars\space or \string\sceneline\space to indicate a scene break. But more common practice is to use a blank line, \string\scenebreak, except for those cases where you ``must'' use one of the others.

\scenebreak

Above this paragraph is \string\scenebreak, which appears as a blank line. A \string\scenebreak\space cannot be located close to the top or bottom of a page. Unlike \string\sceneline\space or \string\scenestars, you cannot place \string\scenebreak\space at the very top or bottom, either. So, changing the \string\vspace\space to any of 14\string\nbs\space through 17\string\nbs\space will generate a Warning.

\clearpage


% NEXT PAGE:

This page tests the footnote and endnote capabilities.\footnote{This is the first sample footnote. Unless you change the marker style, it will be marked with an asterisk.} Two footnotes have been placed.\footnote{This is the second footnote. Unless you change the marker style, it will be marked by a dagger.}

\null

Test of \string\QuickChapter:


\QuickChapter[3em]{Just Before Midnight}

Above, \string\QuickChapter\space inserted two blank lines, in which a phrase is followed by a short line. The text is slightly larger than normal, and sits slightly above the normal baseline.

\null

There is a \string\bigemdash\space between here\makebox[2.5em]{\bigemdash}and here. Its length is set at 2.5em, using \string\makebox. Compare to normal—emdash. Thickness and yoffset is adjustable.

\null

This tests the endnote capability.\endnote You will see marker 1 after the last sentence, and marker 2 after this one.\endnote\memo{This text does not print.} But no actual endnotes are created. You may manually place them wherever you wish. For that, you may use the \string\endnotetext\space command (if its style works for you), or any other method.

\null

\endnotetext{1}{This tests the \string\endnotetext\space command, although you would not normally place the text of an endnote here. It is only a test.\par}

\endnotetext{2}{Text for a second endnote.\par}

\clearpage


% NEXT PAGE:

The following tests the \textit{parascale} environment:

\begin{parascale}[0.8]
But this text has a different scale than normal. Both the font size and the baseline skip have been proportionately changed. As a result, the lines are not on the normal line grid.\par
If the following normal text needs to be back on grid (usually the case), here is what you must do: Compile, and note the number of lines occupied by the scaled text. Calculate the discrepancy, and fix with \string\vspace. Or let \textit{novel} do the thinking for you; there will be a Warning message with advice.\par
\vspace{0.2\nbs} % based on result of Warning.
\end{parascale}

Back to normal text.  At the dimensions originally used for this test, there are 9 lines of scaled text. Not counting the first scaled line, the remaining 8 scaled lines each introduce a deficit of 0.2\string\nbs. So, the cumulative deficit is 1.6\string\nbs. The integer part doesn't matter. So, \string\vspace{0.6\string\nbs} must be added prior to \string\end\{parascale\}, to restore the normal line grid.

It is also possible to split the \string\vspace, prior to \string\begin\{parascale\} and \string\end\{parascale\}, as long as the total is correct.

If the \string\vspace\space is not added, then there will be a Warning message.

If the parascale spans more than one page, then the correct amount to add will depend on the lines present on the final page, not the total number of lines.

\clearpage


% NEXT PAGE

This page tests the \textit{adjustwidth} environment. Changing textwidth is a useful way to create block indents, occasionally used for long quotations, or for other special text that must be visually distinguished from normal.

\begin{adjustwidth}{2\normalparindent}{\normalparindent}
\forceindent This text uses the \textit{adjustwidth} environment. It is set to block indent 2\string\normalparindent\space at left, and indent 1\string\normalparindent\space at right. The \string\forceindent\space command precedes the text, so that (within the block) it indents like an ordinary paragraph.\par
\end{adjustwidth}

This text is after the environment, so it occupies the normal amount of text width.

\clearpage


% NEXT PAGE:

This tests various text effects:

\null

\FirstLine{\noindent\charscale[2]{T}\hspace{-2pt}his line has its first letter enlarged, and sets the first line in small caps. After the first line, text continues as usual. Note that space must be provided prior to this paragraph, so that the first letter does not intrude on text (or margin) above it.}

The \string\charscale\space command scales the letter, and \string\FirstLine\space performs the small caps. Also, some kerning was applied so that the large T has the following \textsc{h} resting beneath its top. The \string\noindent\space command goes inside \string\FirstLine.

\null\null

\dropcap{H}ere is placed is a drop cap, using \textit{novel's} \string\dropcap\space command. Alternatively, the \textit{lettrine} package could be used. There are differences in how the drop caps are specified, depending on what you do. So, be sure to read the documentation, or you will be surprised.\par
In general, it is difficult to style drop caps so that they look good for many different letters. An alternative is to use images for the drop caps. If you use images, please read the \textit{novel} documentation, as the method is not the same as the usual methods from the \textsc{lettrine} package.\par
Note that there is no automated way to combine a drop cap with a first line in small caps. This is discussed in \textsc{novel} documentation.

\null
This line is in the main font.\par
\textsf{This line is in the sans font.}\par
\texttt{This line is in the mono font.}\par
{\mustbelibertinus This line is in Libertinus Serif.}\par % specific to testsuite
{\mustbelmodern This line is in Latin Modern Roman.}\par % specific to testsuite


\clearpage


% NEXT PAGE:

\thispagestyle{dropfoliobeneath} % compare to dropfolioinside

This page tests drop folio. There will be no page header. If your head/foot style normally has a footer, then you will see it as usual.

If you choose a head/foot style without footer, you will still see a page number centered below. Exactly where it appears will depend on which kind of drop folio is used.

If using \string\thispagestyle\{dropfoliobeneath\} then the page number will appear within the lower margin.

If using \string\thispagestyle\{dropfolioinside\} then the page number will appear just above the lower margin, where the final line of text would otherwise be placed. 

Use class options [draft,shademargins] to see the position.

The initial choice is \textit{dropfoliobeneath}.

\clearpage

% NEXT PAGE:

This tests the \string\cleartoend\space command. If this page is recto (odd), then exactly one blank page will follow. If this page is verso (even), then exactly two blank pages will follow.

\null\null


When you request PDF/X (default), whether or not you are in draft mode, each image placed in your document is inspected. This is one of those things that require Lua code, which is one reason why the \textit{novel} class requires LuaLaTeX only.

When an image is inspected, it is added to one of two lists, either good or unknown. Each time an image is  requested, the lists are examined, so the same image file is not inspected twice. This saves time.

The lists are saved in the \textit{aux} file. Then, if you re-compile, images already inspected won't be re-inspected. To re-initialize the lists, discard the \textit{aux} file.

\null

Two of the images were pre-processed via \textit{novel-scripts}. These will be detected as good. They are:

\makeatletter\@AllGoodImages\makeatother

\null

Two of the images were not pre-processed, so their compliance is unknown. They might be good or bad. They are:

 \makeatletter\@UnknownImages\makeatother

\null

Note: If you change the document settings to \string\SetPDFX\{off\} then you will not see either of the image lists, and will not get the Warning message.

Also, using \string\SetPDFX\{off\} will re-initialize the lists.



\end{document}