summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty')
-rw-r--r--Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty805
1 files changed, 805 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty b/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty
new file mode 100644
index 00000000000..1de97130d1d
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty
@@ -0,0 +1,805 @@
+%%
+%% This is file `novel-LayoutSettings.sty', part of class `novel'.
+%% Copyright 2017 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}%
+[2017/03/01 v1.0.6 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.
+
+\newlength\Old@TrimWidth % finished width of printed book
+\newlength\Old@TrimHeight % finished height of printed book
+\newlength\New@TrimWidth % Initialized to \Old@TrimWidth.
+\newlength\New@TrimHeight % Initialized to \Old@TrimHeight.
+\newlength\Old@TopMargin
+\newlength\Old@OutsideMargin
+\newlength\Old@BottomMargin
+\newlength\Old@InsideMargin
+\newlength\New@TopMargin
+\newlength\New@OutsideMargin
+\newlength\New@BottomMargin
+\newlength\New@InsideMargin
+\newlength\Old@MediaWidth % Defaults to trim width, but can be set larger.
+\newlength\Old@MediaHeight % Defaults to trim height, but can be set larger.
+\newlength\New@MediaWidth % Initialized to \Old@MediaWidth.
+\newlength\New@MediaHeight % Initialized to \Old@MediaHeight.
+\newlength\Old@FontSize
+%
+\gdef\my@HeadFootStyle{1} % default: header but not footer
+\gdef\my@VersoEmblem{} % no default emblem
+\gdef\my@RectoEmblem{} % no default emblem
+\gdef\novel@checkfeatures#1{} % re-defined below
+%
+\newif \if@TrimSizeSet
+\newif \if@MarginsSet
+\newif \if@MediaSizeSet
+\newif \if@LinesPerPageSet
+\newif \if@FontSizeSet
+\newif \if@ReworkTrimSet
+\newif \if@ReworkMarginsSet
+%
+\newlength\normalxheight
+\newlength\normalXheight
+%%
+
+
+%% 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 or height of the textblock.
+% Instead, these values are automatically calculated from other dimensions.
+%
+
+%
+% \SetTrimSize{}{} width and height of printed book.
+\newcommand\SetTrimSize[2]{%
+ \global\@TrimSizeSettrue
+ \ifthenelse{\dimtest{#1}{<}{2.99in}}{
+ \ClassError{novel}{Unacceptably small Trim Width}%
+ {Trim Width must be at least 3in.}%
+ }{}
+ \ifthenelse{\dimtest{#2}{<}{2.99in}}{
+ \ClassError{novel}{Unacceptably small Trim Height}%
+ {Trim Height must be at least 3in.}%
+ }{}
+ \if@ReworkTrimSet
+ \ClassError{novel}{^^JCannot set Trim after reworking Trim or Margins}%
+ {\string\SetTrimSize\space cannot follow \string\ReworkTrimSize.}%
+ \fi
+ \if@ReworkMarginsSet
+ \ClassError{novel}{^^JCannot set Trim after reworking Trim or Margins}%
+ {\string\SetTrimSize\space cannot follow \string\ReworkTrimSize^^J%
+ and cannot follow \string\ReworkMargins.}%
+ \fi
+ \setlength\Old@TrimWidth{#1}%
+ \setlength\Old@TrimHeight{#2}%
+ \setlength\New@TrimWidth{#1}%
+ \setlength\New@TrimHeight{#2}%
+ \if@MediaSizeSet\else
+ \setlength\Old@MediaWidth{#1}%
+ \setlength\Old@MediaHeight{#2}%
+ \setlength\New@MediaWidth{#1}%
+ \setlength\New@MediaHeight{#2}%
+ \fi
+}
+%
+% Retroactively change Trim Size after layout. See documentation:
+\newcommand\ReworkTrimSize[2]{%
+ \global\@ReworkTrimSettrue
+ \setlength\New@TrimWidth{#1}%
+ \setlength\New@TrimHeight{#2}%
+ \setlength\New@MediaWidth{#1}%
+ \setlength\New@MediaHeight{#2}%
+ \typeout{^^J Class `novel' Info: %
+ Used \string\ReworkTrimSize{}{} command.^^J%
+ Carefully review your PDF to ensure that line breaks, paragraphs,^^J%
+ and page breaks are where you expect them to be.^^J}%
+}
+% 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.
+% Inside margin generally greater than outside, due to gutter.
+% Standard margins command ("TOBI, or not TOBI, that is the question."):
+\newcommand\SetMargins[4]{ % top, outside, bottom, inside
+ \global\@MarginsSettrue
+ \if@ReworkMarginsSet
+ \ClassError{novel}{^^JCannot set Margins after reworking them}%
+ {\string\SetMargins\space cannot follow \string\ReworkMargins.}%
+ \fi
+ \setlength\Old@TopMargin{#1}
+ \setlength\New@TopMargin{#1}
+ \setlength\Old@OutsideMargin{#2}
+ \setlength\New@OutsideMargin{#2}
+ \setlength\Old@BottomMargin{#3}
+ \setlength\New@BottomMargin{#3}
+ \setlength\Old@InsideMargin{#4}
+ \setlength\New@InsideMargin{#4}
+}
+% Retroactively change margins after layout. See documentation:
+\newcommand\ReworkMargins[4]{
+ \global\@ReworkMarginsSettrue
+ \setlength\New@TopMargin{#1}
+ \setlength\New@OutsideMargin{#2}
+ \setlength\New@BottomMargin{#3}
+ \setlength\New@InsideMargin{#4}
+ \typeout{^^J Class novel Info: %
+ Used \string\ReworkMargins{}{} command.^^J%
+ Carefully review your PDF to ensure that line breaks, paragraphs,^^J%
+ and page breaks are where you expect them to be.^^J}%
+}
+% \SetMediaSize[]{}{} such as {8.5in}{11in}.
+% This command is only used when the Trim Size must be placed in a larger
+% Media Size. Otherwise, Media Size is automatically set to Trim Size.
+% This command cannot be used until after Trim Size is set, either by
+% class option or by \SetTrimSize{}{}.
+% Trim will be horizontally and vertically centered in media.
+% No `rework' is needed for Media Size, because interior layout is relative
+% to Trim Size, not Media Size.
+%
+\newif \if@offcenterTrim \@offcenterTrimfalse
+\newcommand\SetMediaSize[3][center]{ % [alignment] width, height
+ \ifthenelse{\equal{#1}{center} \OR \equal{#1}{edge}}{
+ \global\@MediaSizeSettrue
+ \setlength\Old@MediaWidth{#2}
+ \setlength\New@MediaWidth{#2}
+ \setlength\Old@MediaHeight{#3}
+ \setlength\New@MediaHeight{#3}
+ }{
+ \ClassError{novel}{Bad optional argument for \string\SetMediaSize}%
+ {\string\SetMediaSize\space optional argument must be `center' or `edge'.}%
+ }
+ \ifthenelse{\equal{#1}{edge}}{\@offcenterTrimtrue}{}
+}
+% \SetLinesPerPage{} may be limited due to fontsize and Trim Size constraints.
+% There is no `rework' command, because as long as the number of lines fit,
+% the line spacing will be automatically changed to fit a reworked size.
+% The only possible problem is if lines were originally so tight that
+% a reworked size cannot fit. In that case, the user's best plan is to remove
+% header or footer (if possible), or reduce vertical margins (if possible).
+\newcommand\SetLinesPerPage[1]{
+ \global\@LinesPerPageSettrue
+ \FPiflt{#1}{1}%
+ \ClassError{novel}{\string\SetLinesPerPage\ must be at least 1}%
+ {You requested less than one line per page. Naughty!^^J}%
+ \else\fi %
+ \FPround{\temp@IntegerLines}{#1}{0}
+ \def\my@LinesPerPage{\temp@IntegerLines}
+}
+% \SetFontSize{} may be in any units, even decimals: 12.2pt, 11.5bp, etc.
+% When packages load, the font size is temporarily set to 11pt at 15pt skip,
+% so that moldy-oldie packages don't get confused about metrics.
+% Then the size is changed to its actual value based on this command, or on
+% the defaults for Trim Size, or on the effects of \Rework.
+\newcommand\SetFontSize[1]{
+ \global\@FontSizeSettrue
+ \global\setlength\Old@FontSize{#1}
+}
+%
+%% End size-related commands available in Preamble.
+
+
+
+%% RESERVE SPACE FOR HEADER/FOOTER, AND SET DEFAULT CHAPTER DISPLAY PAGE
+%% -----------------------------------------------------------------------------
+%% At this point, `novel' needs to know whether or not header/footer used,
+%% so that space can be reserved at top/bottom. Actual styling comes later.
+%
+% If the user wishes to tweak layout, these Preamble commands store info,
+% that will be used in novel-CalculateLayout.sty.
+% The jumps are scale factors, which increase or decrease headsep and footskip
+% relative to normal baselineskip. Do not use \setlength\headsep or
+% \setlength\footskip directly, because direct settings will lead to
+% improper calculations.
+% These "jumps" are measured baseline-to-baseline. So, \SetHeadJump{1} means
+% that the baseline of the header is 1 baselineskip above the baseline of
+% the first line of textblock. In other words, on-grid. Value 2 would be
+% equivalent to double-spaced vertically. A value of 1.5 is default, based
+% on observations of actual novels.
+% If \SetHeadJump is less than 1, then a warning appears in the log.
+\gdef\SetHeadJump#1{\gdef\@headjump{#1}}
+\SetHeadJump{1.5} % default
+\gdef\SetFootJump#1{\gdef\@footjump{#1}}
+\SetFootJump{1.5} % default
+% See docs part 7 for available style choices:
+\gdef\SetHeadFootStyle#1{\gdef\my@HeadFootStyle{#1}}
+% See docs part 7 for what these emblems do, if used:
+\newcommand\SetEmblems[2]{ % verso, recto
+ \gdef\my@VersoEmblem{{\headfont #1}}
+ \gdef\my@RectoEmblem{{\headfont #2}}
+}
+\let\SetEmblem\SetEmblems% for convenience
+% If you want something fancier than \thepage:
+\gdef\SetPageNumberStyle#1{\gdef\pagenumberstyle{#1}}
+\AtBeginDocument{
+ \ifcsname pagenumberstyle\endcsname\else
+ \SetPageNumberStyle{\thepage}
+ \fi
+}
+%
+\newif \if@gotHeader \@gotHeaderfalse
+\newif \if@gotFooter \@gotFooterfalse
+\newif \if@styledHeader \@styledHeaderfalse
+\newif \if@styledFooter \@styledFooterfalse
+\newif \if@validHF \@validHFfalse
+%
+\gdef\@reserveHFspace{ % used for layout calculations
+ \ifthenelse{\equal{\my@HeadFootStyle}{0}}{
+ \@gotHeaderfalse\@gotFooterfalse\@validHFtrue
+ }{}
+ \ifthenelse{\equal{\my@HeadFootStyle}{1}}{ % default
+ \@gotHeadertrue\@gotFooterfalse\@validHFtrue
+ }{}
+ \ifthenelse{\equal{\my@HeadFootStyle}{2}}{
+ \@gotHeaderfalse\@gotFootertrue\@validHFtrue
+ }{}
+ \ifthenelse{\equal{\my@HeadFootStyle}{3}}{
+ \@gotHeaderfalse\@gotFootertrue\@validHFtrue
+ }{}
+ \ifthenelse{\equal{\my@HeadFootStyle}{4}}{
+ \@gotHeadertrue\@gotFooterfalse\@validHFtrue
+ }{}
+ \ifthenelse{\equal{\my@HeadFootStyle}{5}}{
+ \@gotHeadertrue\@gotFootertrue\@validHFtrue
+ }{}
+ \ifthenelse{\equal{\my@HeadFootStyle}{6}}{
+ \@gotHeadertrue\@gotFootertrue\@validHFtrue
+ }{}
+ % Ensure that user choice was on the allowed list:
+ \if@validHF\else
+ \ClassError{novel}{Invalid choice for \string\SetHeadFootStyle}%
+ {\string\SetHeadFootStyle\space needs choice of 0,1,2,3,4,5,6,^^J%
+ even if you wish to customize using fancyhdr syntax.^^J}%
+ \fi
+} % end \@reserveHFspace
+% Each new chapter generally has its own header/footer style. This allows a
+% default setting when chapters begin with ChapterDisplay environment:
+\gdef\SetChapterDisplay#1{\gdef\@setchapterdisplay{#1}}
+\SetChapterDisplay{footer} % default
+\AtBeginDocument{% check if user wrote good command or not
+ \def\@setchapterdisplayOK{false}%
+ \ifthenelse{\equal{\@setchapterdisplay}{empty}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{plain}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{footer}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{fancyplain}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{fancy}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{forcenumber}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{dropfolio}}{% no footnote there
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{dropfoliolater}}{% has footnote(s) there
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplay}{foliobeneath}}{%
+ \def\@setchapterdisplayOK{true}%
+ }{}%
+ \ifthenelse{\equal{\@setchapterdisplayOK}{true}}{}{%
+ \ClassError{novel}{\string\SetChapterDisplay\space bad argument}%
+ {\string\SetChapterDisplay\space only allows certain choices.^^J}%
+ }%
+}
+%
+%% End reserve space for header/footer and set default ChapterDisplay
+
+
+%%
+\newtoggle{@usesymbolmark} % true when footnote markers are symbolic
+\newtoggle{@realmarker} % true when OT features sups, sinf, subs requested
+%
+% \SetMarkers does two things.
+% Option real: OT features sups, sinf, subs requested. Fake if not available.
+% Option fake: Always fake OT features sups, sinf, subs.
+% Mandatory: asterisk, dagger, number. Pertains to footnote markers only.
+% No matter real or fake, the asterisk symbol is always real, and the
+% dagger, dbldagger, and section (when used as footnote markers)
+% are always partially faked.
+\newcommand\SetMarkerStyle[2][real]{
+ \def\@goodfnm{no}
+ \ifthenelse{\equal{#2}{asterisk}}{%
+ \def\@goodfnm{yes}\global\toggletrue{@usesymbolmark}\gdef\@myfnsymbols{*}}{}
+ \ifthenelse{\equal{#2}{dagger}}{%
+ \def\@goodfnm{yes}\global\toggletrue{@usesymbolmark}\gdef\@myfnsymbols{†}}{}
+ \ifthenelse{\equal{#2}{number}}{%
+ \def\@goodfnm{yes}\global\togglefalse{@usesymbolmark}}{}
+ \def\@goodfnk{no}
+ \ifthenelse{\equal{#1}{real}\OR\equal{#1}{}}{%
+ \def\@goodfnk{yes}\global\toggletrue{@realmarker}}{}
+ \ifthenelse{\equal{#1}{fake}}{%
+ \def\@goodfnk{yes}\global\togglefalse{@realmarker}}{}
+ \ifthenelse{\equal{\@goodfnm}{no}\OR\equal{\@goodfnk}{no}}{%
+ \ClassError{novel}{Bad choice for \string\SetMarkers}%
+ {Optional: real, fake. Required: asterisk, dagger, number.}%
+ }{}
+}
+%
+\SetMarkerStyle[real]{asterisk} % default
+%%
+
+
+%% Sets the gap between cropmarks and trim area:
+\newlength\@mygap
+\def\SetCropmarkGap#1{
+ \ifthenelse{\lengthtest{#1 < 0pt}}{
+ \setlength\@mygap{0pt}
+ }{
+ \setlength\@mygap{#1}
+ }
+}
+\SetCropmarkGap{0.125in} % default
+%%
+
+
+%% Fake \microtypesetup until package is loaded later:
+\newif \if@setmicrotype
+\gdef\microtypesetup#1{
+ \gdef\@mymicrotypesetup{#1} % used in novel-FontDefaults.sty
+ \global\@setmicrotypetrue
+}
+%%
+
+
+
+
+%% MISCELLANOUS SETTINGS. Mostly remove "glue". Best to leave as-is.
+%% -----------------------------------------------------------------------------
+%%
+%
+\@twocolumnfalse
+\@twosidetrue
+\@mparswitchtrue
+%
+\abovedisplayskip \z@
+\abovedisplayshortskip \z@
+\belowdisplayshortskip \z@
+\belowdisplayskip \abovedisplayskip
+\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\textfloatsep{0pt}
+\setlength\dbltextfloatsep{0pt}
+%
+\setlength\lineskip{0pt}
+\setlength\normallineskip{0pt}
+\renewcommand\baselinestretch{1} % multiplier
+\setlength\parskip{0pt}
+\@lowpenalty 51
+\@medpenalty 151
+\@highpenalty 301
+%
+\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 % may be over-ridden in document, but not advised
+%
+%% End miscellaneous settings.
+
+
+% The following might become unnecessary if fontspec adds the capability
+% to disable keys. For now: Color and Opacity cannot be used as font features,
+% for a black/white printed book. Alas, fontspec over-rules xcolor.
+% So, this code over-rules fontspec:
+\gdef\novel@checkfeatures#1{%
+ \def\@featuresareok{yes}
+ \IfSubStr{#1}{Color}{\def\@featuresareok{no}}{}%
+ \IfSubStr{#1}{Colour}{\def\@featuresareok{no}}{}%
+ \IfSubStr{#1}{color}{\def\@featuresareok{no}}{}%
+ \IfSubStr{#1}{colour}{\def\@featuresareok{no}}{}%
+ \IfSubStr{#1}{Opacity}{\def\@featuresareok{no}}{}%
+ \IfSubStr{#1}{opacity}{\def\@featuresareok{no}}{}%
+ \ifthenelse{\equal{\@featuresareok}{yes}}{}{%
+ \ClassError{novel}{Color and Opacity forbidden as font features}%
+ {You defined a font, or added a font feature, with Color or Opacity.^^J%
+ That is disallowed in `novel' class.}%
+ }
+}
+%%
+
+
+
+%% DEFINITION OF MASTER AND OTHER FONTS
+%% -----------------------------------------------------------------------------
+%%
+% The `no-math' option prevents fontspec from tracking certain font changes.
+% This is probably necessary, since novel does some of its own font tracking:
+\RequirePackage[no-math]{fontspec} % For LuaLaTeX. NOT package `fontenc'.
+\defaultfontfeatures{} % reset
+% User-created fonts (not standard, not novel-specific defaults:
+\defaultfontfeatures{%
+ SmallCapsFeatures={Renderer=Basic},Kerning=On,%
+ Ligatures=TeX,%
+}%
+% Latin Modern Math (Open Type) fonts will be selected by default, for math.
+% You shouldn't be doing math! You can use \setmathfont, if you wish.
+% If you must load a math font package, it should be done using \RequirePackage
+% before (yes, before) calling the document class.
+\RequirePackage{unicode-math}
+%%
+%% This could have been easier, but fontspec allows mandatory and optional
+% arguments to appear in either order. We wish to store the fontnames
+% and arguments, but need Expl syntax to tell which is which.
+\ExplSyntaxOn
+%% Store settings for the master font:
+% The master font will become the main font AtEndPreamble. It will also become
+% the default ancestor of all novel-defined fonts, except the deco font.
+\newif \if@masterfontset
+\gdef\@masterfontfeatures{}
+\gdef\@masterfontname{}
+\DeclareDocumentCommand \SetMasterFont { O{} m O{} } {%
+ \novel@checkfeatures{#1,#3}
+ \gdef\@masterfontfeatures{#1,#3}
+ \gdef\@masterfontname{#2}
+ \global\@masterfontsettrue
+}%
+%% Store settings for the chapterfont:
+% The chapter font is used by the \ChapterTitle{} command.
+\newif \if@chapterfontset
+\gdef\@chapterfontfeatures{}
+\gdef\@chapterfontname{}
+\DeclareDocumentCommand \SetChapterFont { O{} m O{} } {%
+ \novel@checkfeatures{#1,#3}
+ \gdef\@chapterfontfeatures{#1,#3}
+ \gdef\@chapterfontname{#2}
+ \global\@chapterfontsettrue
+}%
+%% Store settings for the subchfont:
+% The subch font is used by the \ChapterSubtitle{} command.
+\newif \if@subchfontset
+\gdef\@subchfontfeatures{}
+\gdef\@subchfontname{}
+\DeclareDocumentCommand \SetSubchFont { O{} m O{} } {%
+ \novel@checkfeatures{#1,#3}
+ \gdef\@subchfontfeatures{#1,#3}
+ \gdef\@subchfontname{#2}
+ \global\@subchfontsettrue
+}%
+%% Store settings for the headfont:
+% The headfont is used in headers and footers.
+\newif \if@headfontset
+\gdef\@headfontfeatures{}
+\gdef\@headfontname{}
+\DeclareDocumentCommand \SetHeadFont { O{} m O{} } {%
+ \novel@checkfeatures{#1,#3}
+ \gdef\@headfontfeatures{#1,#3}
+ \gdef\@headfontname{#2}
+ \global\@headfontsettrue
+}%
+%% Store settings for the deco font:
+% The deco font is used for decorations and acronyms.
+% It must be NovelDeco.otf or a font based on NovelDeco.otf. No other!
+\newif \if@decofontset
+\newif \if@gotdeco
+\gdef\@decofontfeatures{}
+\gdef\@decofontname{}
+\DeclareDocumentCommand \SetDecoFont { O{} m O{} } {%
+ \novel@checkfeatures{#1,#3}
+ \gdef\@decofontfeatures{#1,#3}
+ \gdef\@decofontname{#2}
+ \global\@decofontsettrue
+ \global\@gotdecotrue
+ \newfontface\decofont[#1,#3]{#2}
+}%
+%
+\msg_set:nnnn {fontspec} {font-not-found} { % rewrites the standard message
+ Font~ "#1"~ cannot~ be~ found.
+ }{
+ If~the~missing~font~is~Libertinus~or~Libertine~or~Biolinum~or~NovelDeco,\\
+ see~the~`novel'~class~documents~for~help.\\
+ If~the~missing~font~is~anything~else,~then~the~missing~font~is\\
+ not~caused~by~`novel'~class.\\
+}%
+%% For syntax consistency:
+\cs_new_eq:NN \NewFontFamily \newfontfamily
+\cs_new_eq:NN \NewFontFace \newfontface
+\cs_new_eq:NN \SetSansFont \setsansfont
+\cs_new_eq:NN \SetMonoFont \setmonofont
+\cs_new_eq:NN \SetMathFont \setmathfont
+\cs_new_eq:NN \AddFontFeatures \addfontfeatures
+\cs_new_eq:NN \AddFontFeature \addfontfeatures
+%%
+%% \CreateFontFeature{substitutions}{feature code}
+% Problem: The font has one or more alternate glyphs that you would like to use,
+% but they are not listed in a feature set for the font.
+% Solution: Create your own feature set, with \CreateFontFeature. The created
+% feature may then be used like a real feature, in any font definition.
+% The substitutions are a comma-separated list, char=char.alt and so forth.
+% For example, the following substitutions are syntactically OK:
+% emdash=emdah.alt, one=one.rev, ntilde=ntilde.03
+% If a substitution is not available in a particular font, it is ignored.
+% You have to look at the font in a font editor, to know what is available.
+% It is possible to make silly substitutions, such as a=b, five=three without
+% throwing an error, unless your code causes a cycle.
+% The most useful application of this command is to reach alternate emdash,
+% and alternate oldstyle one. Not every font has these.
+% The feature code is a 4-character pseudo- Open Type code, otherwise unused.
+% For example, the feature code might be myfs (my fake substitution)
+% but it cannot be a pre-defined code such as lnum or smcp. It may be
+% a style set such as ss03 if you are sure that the font in question
+% do not already have ss03 (but this is taking a chance).
+% Once defined, you may use it like this (for example):
+% \SetMasterFont[RawFeature=+myfs]{fontname}
+% \NewFontFamily\myfake[RawFeature=+myfs]{fontname}
+% In the document body: {\addfontfeature{myfs} text}
+\DeclareDocumentCommand \CreateFontFeature { m m } {%
+ \IfEndWith{#1}{,}{\StrGobbleRight{#1}{1}[\@fakezero]}{\def\@fakezero{#1}}
+ \def\@fakeone{["\@fakezero"}
+ \StrSubstitute{\@fakeone}{=}{"]="}[\@fakeone]
+ \StrSubstitute{\@fakeone}{,}{",\space["}[\@fakeone]
+ \directlua{
+ fonts.handlers.otf.addfeature {
+ name = "#2",
+ type = "substitution",
+ data = {\@fakeone},
+ }
+ }
+} %% end \CreateFontFeature. Above thanks to fontspec 2016.
+%%
+\ExplSyntaxOff
+%%
+%% end definition of master and other fonts.
+
+
+
+%% FAKE POLYGLOSSIA COMMANDS
+%% -----------------------------------------------------------------------------
+% The polyglossia package is not loaded until \AfterEndPreamble.
+% So, its commands are not directly available in the Preamble.
+% These fake commands store the data. Later, the commands will be relaxed,
+% then the real polyglossia commands can work, and the data will be passed
+% to the real commands at that time.
+% Default main language will be set to english by novel-FontDefaults.sty.
+\newcommand\SetMainLanguage[2][]{
+ \gdef\@setmainlangopt{#1}
+ \gdef\@setmainlang{#2}
+}
+\let\setmainlanguage\SetMainLanguage\relax
+\newcommand\SetDefaultLanguage[2][]{
+ \gdef\@setmainlangopt{#1}
+ \gdef\@setmainlang{#2}
+}
+\let\setdefaultlanguage\SetDefaultLanguage\relax
+\SetMainLanguage[]{} % if not user-specified, defaults to english
+\newcommand\SetOtherLanguage[2][]{
+ \gdef\@setotherlangopt{#1}
+ \gdef\@setotherlang{#2}
+}
+\let\setotherlanguage\SetOtherLanguage\relax
+\SetOtherLanguage[]{} % default empty
+\newcommand\SetOtherLanguages[2][]{
+ \gdef\@setotherlangsopt{#1}
+ \gdef\@setotherlangs{#2}
+}
+\let\setotherlanguages\SetOtherLanguages\relax
+\SetOtherLanguages[]{} % default empty
+%
+%% end fake polyglossia commands.
+
+
+
+%% FRONTMATTER, MAINMATTER, BACKMATTER
+%% -----------------------------------------------------------------------------
+%
+\newif \ifWithinFrontmatter \WithinFrontmatterfalse
+\newif \ifWithinMainmatter \WithinMainmatterfalse
+\newif \ifWithinBackmatter \WithinBackmatterfalse
+\newcounter{frontmatterpages}
+\newcounter{runningpages}
+\AtBeginShipout{\stepcounter{runningpages}}
+%
+\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.^^J}%
+ \fi
+ \ifWithinMainmatter
+ \ClassError{novel}{\string\frontmatter\ cannot follow \mainmatter}%
+ {In order: \string\frontmatter\ \string\mainmatter\ \string\backmatter^^J%
+ but you do not need all of them.^^J}%
+ \fi
+ \ifWithinBackmatter
+ \ClassError{novel}{\string\frontmatter\ cannot follow \backmatter}%
+ {In order: \string\frontmatter\ \string\mainmatter\ \string\backmatter^^J%
+ but you do not need all of them.^^J}%
+ \fi
+ \WithinFrontmattertrue\WithinMainmatterfalse\WithinBackmatterfalse
+ \pagenumbering{roman}
+ \setcounter{page}{1}
+ \setcounter{frontmatterpages}{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
+ \ifWithinBackmatter
+ \ClassError{novel}{\string\mainmatter\ cannot follow \backmatter}%
+ {In order: \string\frontmatter\ \string\mainmatter\ \string\backmatter^^J%
+ but you do not need all of them.^^J}%
+ \fi
+ \WithinFrontmatterfalse\WithinMainmattertrue\WithinBackmatterfalse
+ \setcounter{frontmatterpages}{\value{page}}
+ \addtocounter{frontmatterpages}{-1}
+ \pagenumbering{arabic}
+ \setcounter{page}{1}
+}
+%
+\def\backmatter{\@ifstar\@backmatterst\@backmatterns}
+%
+\def\@backmatterst{ % continues frontmatter count with lowercase roman numerals
+ \ifWithinBackmatter
+ \ClassError{novel}{\string\backmatter\space used more than once}%
+ {You issued \string\backmatter\space more than once.^^J}%
+ \fi
+ % If you really must go directly from front to back without main,
+ % simply issue \mainmatter\backmatter together. Not advised.
+ \ifWithinFrontmatter
+ \ClassError{novel}{Missing \string\mainmatter}%
+ {You went directly from \string\frontmatter\space to \string\backmatter^^J%
+ Must have \string\mainmatter\space in between.^^J}%
+ \fi
+ \WithinFrontmatterfalse\WithinMainmatterfalse\WithinBackmattertrue
+ \addtocounter{frontmatterpages}{1}
+ \pagenumbering{roman}
+ \setcounter{page}{\value{frontmatterpages}}
+}
+%
+\def\@backmatterns{ % continues mainmatter arabic numerals
+ \ifWithinBackmatter
+ \ClassError{novel}{\string\backmatter\space used more than once}%
+ {You issued \string\backmatter\space more than once.^^J}%
+ \fi
+ % If you really must go directly from front to back without main,
+ % simply issue \mainmatter\backmatter together. Not advised.
+ \ifWithinFrontmatter
+ \ClassError{novel}{Missing \string\mainmatter}%
+ {You went directly from \string\frontmatter\space to \string\backmatter^^J%
+ Must have \string\mainmatter\space in between.^^J}%
+ \fi
+ \WithinFrontmatterfalse\WithinMainmatterfalse\WithinBackmattertrue
+}
+%
+\def\Backmatter{\@ifstar\@Backmatterst\@Backmatterns}
+%
+\def\@Backmatterst{ % continues frontmatter count with uppercase Roman numerals
+ \ifWithinBackmatter
+ \ClassError{novel}{\string\backmatter\space used more than once}%
+ {You issued \string\backmatter\space more than once.^^J}%
+ \fi
+ % If you really must go directly from front to back without main,
+ % simply issue \mainmatter\backmatter together. Not advised.
+ \ifWithinFrontmatter
+ \ClassError{novel}{Missing \string\mainmatter}%
+ {You went directly from \string\frontmatter\space to \string\backmatter^^J%
+ Must have \string\mainmatter\space in between.^^J}%
+ \fi
+ \WithinFrontmatterfalse\WithinMainmatterfalse\WithinBackmattertrue
+ \addtocounter{frontmatterpages}{1}
+ \pagenumbering{Roman}
+ \setcounter{page}{\value{frontmatterpages}}
+}
+%
+\def\@Backmatterns{ % restarts page count with uppercase Roman numerals
+ \ifWithinBackmatter
+ \ClassError{novel}{\string\backmatter\ used more than once}%
+ {You issued \string\backmatter\ more than once.^^J}%
+ \fi
+ % If you really must go directly from front to back without main,
+ % simply issue \mainmatter\backmatter together. Not advised.
+ \ifWithinFrontmatter
+ \ClassError{novel}{Missing \string\mainmatter}%
+ {You went directly from \string\frontmatter\space to \string\backmatter^^J%
+ Must have \string\mainmatter\space in between.^^J}%
+ \fi
+ \WithinFrontmatterfalse\WithinMainmatterfalse\WithinBackmattertrue
+ \pagenumbering{Roman}
+ \setcounter{page}{1}
+}
+%
+%% end frontmatter, mainmatter, 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 is
+% not implemented in `novel'. In other cases, the functionality is part of core,
+% but would interfere with the `novel' emphasis on constant line skip.
+% You may re-define the commands using your own code in Preamble (discouraged).
+%
+\gdef\null{\hbox{\strut}} % May be important!
+%
+% Standard LaTeX font sizes are ineffective:
+\let\small\relax
+\let\footnotesize\relax
+\let\scriptsize\relax
+\let\tiny\relax
+%
+\let\large\relax
+\let\Large\relax
+\let\LARGE\relax
+\let\huge\relax
+\let\Huge\relax
+\let\HUGE\relax
+% 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}
+% In some situations, the use will be interrupted:
+\gdef\@nodocommand#1{
+ \ClassError{novel}{No command `\string\#1' in this class}%
+ {The `\string\#1' command is not implemented in `novel' class.^^J}%
+}
+% 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}
+%
+%% end disable or neutralize.
+
+
+
+%%
+%% End of file `novel-LayoutSettings.sty'.
+