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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
|
%%
%% This is file `novel-LayoutSettings.sty', part of `novel' document class.
%% Copyright 2017-2018 Robert Allgeyer.
%%
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%%
\ProvidesFile{novel-LayoutSettings.sty}%
[2018/04/07 v1.50.4 LaTeX file (layout settings)]
%%
%% Note that nearly all layout settings are pre-configured based on Trim Size.
%% In general, these user commands may be used to over-ride the presets.
%% SIZE-RELATED COMMANDS AVAILABLE IN PREAMBLE.
%% ----------------------------------------------------------------------------
%% Use if necessary for customization.
%% If you like a class option that pre-sets these values,
%% then you do not have to use any of these commands.
%
% Note: This class does not ask you to set the width/height of the textblock.
% Instead, these values are automatically calculated from other dimensions.
%% Trim Size is the finished width and height of the book (not thickness).
% Books are (usually) manufactured to a small number of standard Trim Sizes.
% The available choice of sizes will depend on your print service,
% and may by limited by binding method, paper, or distribution channels.
% These are NOT the usual TeX "paper size" choices, such as A4 or letterpaper.
% In the U.S.A., 5.5in W x 8.5in H is very common for softcover fiction,
% so it will (later) be set as default, unless you set your own.
\newif \if@SetTrimSize % true if \SetTrimSize rather than defaults.
\newlength\@TrimWidth
\newlength\@TrimHeight
\newcommand\SetTrimSize[2]{% width, height
\global\@SetTrimSizetrue
\gsetlength\@TrimWidth{#1}
\gsetlength\@TrimHeight{#2}
}% end set trimsize
%%
%% Margins are measured from Trim Size inwards, always positive.
% If the Media Size is larger than Trim Size, then the area beyond
% the Trim Size is NOT margins. It is discarded scrap paper.
% However, word processors (in general) do not understand the difference
% between Trim Size and Media Size. So, if you are ever asked to
% lay out the book in a word processor, using a standard (A4 or letter)
% physical paper size, then you will be asked to set the "margins"
% very wide, because the word processor margins include both
% the finished book margins, and the discarded scrap paper.
% In certain circumstances, text or images may intrude into the margin area.
% This is not always an error, because it may be intentional.
% Margins at top and bottom are relative to:
% top of header, or top of textblock if no header;
% bottom of footer, or bottom of textblock if no footer.
% Inner margin generally greater than Outer, due to gutter.
% Standard margins command ("TOBI, or not TOBI, that is the question."):
\newif \if@SetMargins % true if \SetMargins rather than defaults.
\newlength\@TopMargin
\newlength\@OuterMargin
\newlength\@BottomMargin
\newlength\@InnerMargin
\newcommand\SetMargins[4]{ % top, outer, bottom, inner
\global\@SetMarginstrue
\gsetlength\@TopMargin{#1}
\gsetlength\@OuterMargin{#2}
\gsetlength\@BottomMargin{#3}
\gsetlength\@InnerMargin{#4}
}% end set margins
\LetLtxMacro\SetMargin{\SetMargins}\relax % for those who mis-type
%%
%% New in version 1.50: Unsafe Zone (opposite of "safe area").
% This feature only applies with class options `draft,shademargins'
% and does NOT apply in `coverart'.
% The purpose of margins is to confine the main text (and header/footer).
% In `novel' (unlike most other TeX document classes) there is no provision
% for marginal notes, because they are not used in popular fiction.
% Yet there may be circumstances where you intentionally or accidentally
% have text, or part of an image, placed or overflowing into a margin.
% In PDF, even PDF/X, that is not a problem. It cannot read your mind.
% However, every print service specifies a "safe area." All text, and
% all images without bleed, must remain within the safe area.
% The limits of the safe area are typically 0.125in to 0.5in inside the
% Trim Size, depending on technology. This defines how close you may
% place anything near the page edges.
% In `novel' the opposite of the safe area is the "unsafe zone" (UZ).
% So, the UZ lies just inside the perimeter of the Trim Size.
% Each margin is at least as wide as its corresponding UZ.
% Some print services use "minimum margin" to mean the UZ.
% When you are in draft mode with `shademargins' class option,
% the UZ (if it is set) will be displayed in dark gray.
% Then, you can inspect the PDF for any intrusion into the UZ.
% If you intrude into the UZ, there is no warning or error.
% The UZ is strictly for visualization. There is no default setting.
% If you do not set the UZ yourself, then no UZ will be displayed.
% In any case, the final PDF is unaffected.
\newif \if@UnsafeZone % true if \SetUnsafeZone used
\newlength\@TopUZWidth
\newlength\@OuterUZWidth
\newlength\@BottomUZWidth
\newlength\@InnerUZWidth
\newcommand\SetUnsafeZone[4]{% top, outer, bottom, inner.
\global\@UnsafeZonetrue
\gsetlength\@TopUZWidth{#1}
\gsetlength\@OuterUZWidth{#2}
\gsetlength\@BottomUZWidth{#3}
\gsetlength\@InnerUZWidth{#4}
} % end \SetUnsafeZone
\LetLtxMacro\SetUnsafeZones{\SetUnsafeZone}\relax % for those who mis-type
%%
% PDF Media Size is already known to TeX as \paperwidth and \paperheight.
% For this reason, there is no need to define additional lengths.
% Sheet-fed printers use a small number of standard paper sizes.
% Whether you use P.O.D. or print at home or office, your print job will
% almost certainly be sheet-fed. After printing, the sheet is trimmed
% to the specified Trim Size. Note that the sheet sizes used in
% commercial printing are specialized for the purpose, and may be
% different from the routine A4 and USletter sizes familiar to you.
% In most cases (except for cover artwork), your PDF Media Size will be
% exactly the same as the finished Trim Size. Placement of the Trim Size
% onto a larger sheet of paper is done automatically at the print service,
% a procedure known as "imposition." Several small Trim Sizes may be
% printed onto a single sheet, in order to waste less paper in trimming.
% In a few cases, the print service will ask you to provide a PDF that has
% the Trim Size centered H/V within a larger Media Size.
% Sometimes (especially for cover artwork), that's because you are
% doing the imposition yourself. In other cases (especially for interiors)
% it is because most of the files seen at the print service came from
% word processors, where the writers (not knowing better) created layouts
% on A4 or USletter with large "margins," rather than correct Trim Size.
% Then, if you submit a file at actual Trim Size, it looks wrong,
% not because it is wrong, but because it stands out from the crowd.
% You may use \SetMediaSize to deal with this situation.
% You do not need \SetMediaSize, if (as usual) it is identical to TrimSize.
% Changing the Media Size does not affect Trim Size or internal page layout.
% Class options `cropview' and `closecrop' (only in draft mode)
% affect Media Size. See their descriptions below.
%
% \SetMediaSize[<obsolete option>]{width}{height} usage:
% The optional argument is obsolete. Anything there will be ignored.
\newif \if@MediaSize % true if \SetMediaSize rather than default = Trim Size.
\DeclareDocumentCommand\SetMediaSize { O{} m m } {% width, height
\@MediaSizetrue
\gsetlength\paperwidth{#2}
\gsetlength\paperheight{#3}
}% end \SetMediaSize
%%
%% Lines Per Page refers to the main textblock, not including header or footer.
% If you do not set it, a suitable default will be based on other settings.
% The number of lines is contrained by Trim Height, Margins, and normal em.
% This is because the minimum \baselineskip must be 1.2x normal em size,
% to avoid crowding of the text and variable line heights.
% The check for constraint is done in file novel-CalculateLayout.sty.
% The same check also verifies that the number is an integer >=10.
\newif \if@LinesPerPage % true if \SetLinesPerPage rather than default.
\newcommand\SetLinesPerPage[1]{
\IfInteger{#1}{}{%
\ClassError{novel}{\string\SetLinesPerPage\space must be integer >=10}%
{Do not write period, comma, or space within \string\SetLinesPerPage.}%
}
\FPiflt{#1}{10}
\ClassError{novel}{\string\SetLinesPerPage\ must be at least 10}%
{LinesPerPage were set or calculated at less than 10.}%
\fi
\global\@LinesPerPagetrue
\gdef\@LinesPerPage{#1}
}% end set linesperpage
%%
%% \SetFontSize may be in any units, even decimals: 12.2pt, 11.5bp, etc.
% Before external packages load, the font size is temporarily set to
% 10pt at 13pt skip, so that moldy-oldie packages don't get confused.
% Later, the size is changed to its actual value based on this command,
% or on the defaults for Trim Size.
\newif \if@FontSizeSet % true if \SetFontSize rather than default.
\newlength\@SetFontSize
\newcommand\SetFontSize[1]{
\global\@FontSizeSettrue
\gsetlength\@SetFontSize{#1}
}% end set font size
%%
%% MISCELLANOUS SETTINGS. Mostly remove "glue". Best to leave as-is.
%% ----------------------------------------------------------------------------
% Standard TeX \hoffset and \voffset is not relative to the MediaBox, but is
% relative to 1in from the top left corner of the MediaBox. Ouch.
% When necessary, the 1in (72.27pt) is compensated in later calculations.
\setlength\hoffset{0pt} % relative to 1in built-in offset at left
\setlength\voffset{0pt} % relative to 1in built-in offset at top
%
\@twocolumnfalse
\@twosidetrue
\@mparswitchtrue
%
\setlength\abovedisplayskip{0pt}
\setlength\abovedisplayshortskip{0pt}
\setlength\belowdisplayshortskip{0pt}
\setlength\belowdisplayskip{0pt}
\global\@topnum \z@
%
\setlength\smallskipamount{0pt}
\setlength\medskipamount{0pt}
\setlength\bigskipamount{0pt}
\setlength\topsep{0pt}
\setlength\partopsep{0pt}
\setlength\parsep{0pt}
\setlength\marginparwidth{0pt}
\setlength\marginparsep{0pt}
\setlength\marginparpush{0pt}
\setlength\floatsep{0pt}
\setlength\textfloatsep{0pt}
\setlength\dbltextfloatsep{0pt}
\setlength\intextsep{0pt}
% \topskip will be set as normal baslineskip, which must first be calculated.
% That is done in novel-CalculateLayout.sty.
\widowpenalty 150 % same as TeX default
\clubpenalty 150 % same as TeX default
\setlength\lineskip{0pt}
\setlength\normallineskip{0pt}
\renewcommand\baselinestretch{1} % multiplier
\setlength\parskip{0pt}
\@lowpenalty 51
\@medpenalty 151
\@highpenalty 301
% Floats not allowed, but just in case:
\setcounter{topnumber}{2}
\renewcommand\topfraction{.7}
\setcounter{bottomnumber}{1}
\renewcommand\bottomfraction{.3}
\setcounter{totalnumber}{3}
\renewcommand\textfraction{.2}
\renewcommand\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.7}
\renewcommand\dblfloatpagefraction{.5}
%
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\normalfont\rmfamily}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\normalfont\sffamily}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\normalfont\ttfamily}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\normalfont\bfseries}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\normalfont\itshape}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\normalfont\slshape}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\normalfont\scshape}
%
\setlength\columnsep{12pt} % usually not needed, picked something at random
\setlength\columnseprule{0pt}
\pagestyle{empty} % will be over-ridden by fancyhead in separate file
\pagenumbering{arabic} % may be over-ridden in document
\flushbottom % best for continuous text
%
%% End miscellaneous settings.
%% FRONTMATTER, MAINMATTER. BUT NO BACKMATTER!
%% ----------------------------------------------------------------------------
%
% See novel.cls for the AtBeginShipout routine.
%
% These do not have @ in name, so that they can be used in document body:
\newif \ifWithinFrontmatter % true within frontmatter
\newif \ifWithinMainmatter % true within mainmatter
\def\frontmatter{ % starts page count and frontmatter count at 1.
\ifWithinFrontmatter
\ClassError{novel}{\string\frontmatter\ used more than once}%
{You issued \string\frontmatter\ more than once.}%
\fi
\ifWithinMainmatter
\ClassError{novel}{\string\frontmatter\ cannot follow \mainmatter}%
{In order: \string\frontmatter\ \string\mainmatter ^^J%
but you do not need both of them.}%
\fi
\global\WithinFrontmattertrue\global\WithinMainmatterfalse
\clearpage
\pagenumbering{roman}
\setcounter{page}{1}
}
%
\def\mainmatter{ % restarts page to 1, arabic numbers; freeze frontpagecount
\ifWithinMainmatter
\ClassError{novel}{\string\mainmatter\ used more than once}%
{You issued \string\mainmatter\ more than once.}%
\fi
\cleartorecto % added v. 1.40.1
\global\WithinFrontmatterfalse\global\WithinMainmattertrue
\pagenumbering{arabic}
\setcounter{page}{1}
}
%
\def\backmatter{\@ifstar\@backmatterst\@backmatterns} % asterisk obsolete
\def\@backmatterst{%
\ClassWarning{novel}{^^J\string\backmatter*\ ignored. Do not use. ^^J}%
}
%
\def\@backmatterns{%
\cleartorecto% v. 1.40.2
\typeout{^^JClass `novel' Alert: \string\backmatter\space merely %
clears to recto. See docs. ^^J}% v. 1.42
%
}
%
\def\Backmatter{\@ifstar\@Backmatterst\@Backmatterns} % obsolete
%
\def\@Backmatterst{% continues frontmatter count w/ uppercase Roman numerals
\ClassWarning{novel}{^^J\string\Backmatter*\ ignored. Do not use. ^^J}%
}
%
\def\@Backmatterns{%
\ClassWarning{novel}{^^J\string\Backmatter\ ignored. Do not use. ^^J}%
}
%
%% end frontmatter, mainmatter. No backmatter!
%% DISABLE OR NEUTRALIZE SOME STANDARD LATEX COMMANDS
%% ----------------------------------------------------------------------------
% The `novel' class disallows these commands, or neutralizes them by simply
% repeating their arguments. In some cases, they request functionality that's
% not implemented in `novel'. In other cases, functionality is part of core,
% but would interfere with the `novel' emphasis on constant line skip.
% You may redefine the commands using your own Preamble code (discouraged).
%
\gdef\null{\hbox{\strut}} % May be important!
%
% Standard LaTeX font sizes are ineffective:
\gdef\@DisableFontSizes{% called by `novel.cls' \AtBeginDocument
\let\HUGE\relax
\let\Huge\relax
\let\huge\relax
\let\LARGE\relax
\let\Large\relax
\let\large\relax
\let\small\relax
\let\footnotesize\relax
\let\scriptsize\relax
\let\tiny\relax
} %
% In `novel' there is no academic organization.
% All these do is echo the argument, if any:
\long\gdef\part#1{#1}
\long\gdef\chapter#1{#1}
\long\gdef\section#1{#1}
\long\gdef\subsection#1{#1}
\long\gdef\subsubsection#1{#1}
\long\gdef\paragraph#1{#1}
\long\gdef\subparagraph#1{#1}
\long\gdef\appendix#1{#1}
% In some situations, the use will be interrupted:
\DeclareDocumentCommand\@nodocommand { O{} +m } {%
\ClassError{novel}{No command or environment `#1' in this class}%
{Many academic layout commands or environments are disabled in `novel'. ^^J%
#2.}%
}
% Here is the interruption list:
\long\gdef\maketitle\@nodocommand{maketitle}
\long\gdef\makeindex\@nodocommand{makeindex}
\long\gdef\tableofcontents\@nodocommand{tableofcontents}
\long\gdef\listoftables\@nodocommand{listoftables}
\long\gdef\listoffigures\@nodocommand{listoffigures}
\long\gdef\thebibliography\@nodocommand{thebibliography}
\long\gdef\theindex\@nodocommand{theindex}
\long\gdef\titlepage\@nodocommand{titlepage}
\long\gdef\description\@nodocommand{description}
\long\gdef\caption\@nodocommand{caption}
\long\gdef\abstract\@nodocommand{abstract}
\long\gdef\table\@nodocommand[Use `sandbox' mode to create an image]{table}
\long\gdef\figure\@nodocommand[Use `sandbox' mode to create an image]{figure}
%
%% end disable or neutralize.
%% Neutralize settings commands:
\gdef\@DisableLayoutSettings{% called by `novel.cls' \AtBeginDocument
\LetLtxMacro\SetMediaSize\relax
\LetLtxMacro\SetTrimSize\relax
\LetLtxMacro\SetMargins\relax
\LetLtxMacro\SetLinesPerPage\relax
\LetLtxMacro\SetFontSize\relax
\LetLtxMacro\SetUnsafeZone\relax
}% end \@DisableLayoutSettings
%%
%%
\endinput
%%
%% End of file `novel-LayoutSettings.sty'.
|