From 3e4f442d1ed8ac2a1395a7c1485740c3d2f66691 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 27 Mar 2018 21:21:56 +0000 Subject: novel (27mar18) git-svn-id: svn://tug.org/texlive/trunk@47146 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/lualatex/novel/novel-CGATSTR001.clo | 17 +- .../tex/lualatex/novel/novel-CalculateLayout.sty | 875 +++++++-------------- .../tex/lualatex/novel/novel-ChapterScene.sty | 246 ++++-- .../tex/lualatex/novel/novel-DropCap.sty | 237 ++++++ .../tex/lualatex/novel/novel-FOGRA39.clo | 17 +- .../tex/lualatex/novel/novel-FileData.sty | 148 ++-- .../tex/lualatex/novel/novel-FontDefaults.sty | 211 ----- .../texmf-dist/tex/lualatex/novel/novel-Fonts.sty | 416 ++++++++++ .../tex/lualatex/novel/novel-Footnotes.sty | 305 +++++-- .../tex/lualatex/novel/novel-HeadFootStyles.sty | 612 ++++++++------ .../texmf-dist/tex/lualatex/novel/novel-Images.sty | 507 +++++++----- .../tex/lualatex/novel/novel-JC200103.clo | 17 +- .../tex/lualatex/novel/novel-LayoutSettings.sty | 823 ++++++------------- .../tex/lualatex/novel/novel-Obsolete.sty | 453 +++++++++++ .../tex/lualatex/novel/novel-PostLayout.sty | 263 +++++++ .../tex/lualatex/novel/novel-Sandbox.sty | 143 ++++ .../tex/lualatex/novel/novel-TextMacros.sty | 525 +++++++------ .../tex/lualatex/novel/novel-microtype.cfg | 23 +- .../texmf-dist/tex/lualatex/novel/novel-pdfx.sty | 322 ++++---- .../tex/lualatex/novel/novel-xmppacket.clo | 186 +++++ .../tex/lualatex/novel/novel-xmppacket.sty | 183 ----- Master/texmf-dist/tex/lualatex/novel/novel.cls | 722 +++++++++-------- 22 files changed, 4306 insertions(+), 2945 deletions(-) create mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-DropCap.sty delete mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty create mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-Fonts.sty create mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-Obsolete.sty create mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-PostLayout.sty create mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-Sandbox.sty create mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.clo delete mode 100644 Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.sty (limited to 'Master/texmf-dist/tex/lualatex/novel') diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-CGATSTR001.clo b/Master/texmf-dist/tex/lualatex/novel/novel-CGATSTR001.clo index 9d1d8787ac5..a550245b838 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-CGATSTR001.clo +++ b/Master/texmf-dist/tex/lualatex/novel/novel-CGATSTR001.clo @@ -1,11 +1,19 @@ -% Typically used in the USA. Novel file version 1.46.2 +%% +%% This is file `novel-CGATSTR001.clo', part of `novel' document class. +%% The values of the arguments are public industry standards. +%% +\ProvidesFile{novel-CGATSTR001.clo}% +[2018/01/14 any version. (novel Output Intent CGATS TR 001)] +%% -% The values of the arguments are public industry standards. +% Typically used in the USA. % Remember: TeX special characters must be backslashed here. % You may see % or # or _ in the data or file names. % Be sure that they are written as \% \# \_ or there will be trouble. +% If any line is long, let it wrap. Do not attempt to break it onto multiple lines. + % This identifier has spaces, even though file name has no spaces. \gdef\@OIidentifier{CGATS TR 001} % also called "reference name" \gdef\@OIcondition{SWOP (Publication) printing in USA (Printing process definition: ANSI CGATS.6).} @@ -13,3 +21,8 @@ \gdef\@OIregistry{http://www.color.org} \gdef\@OIprofile{USWebCoatedSWOP.icc} +%% +\endinput +%% +%% end of file `novel-CGATSTR001.clo' + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-CalculateLayout.sty b/Master/texmf-dist/tex/lualatex/novel/novel-CalculateLayout.sty index 90904b3b09b..77f960c3bcf 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-CalculateLayout.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-CalculateLayout.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-CalculateLayout.sty', a custom file. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-CalculateLayout.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% It may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c @@ -12,7 +12,7 @@ %% %% \ProvidesFile{novel-CalculateLayout.sty}% -[2018/01/14 v1.46.2 LaTeX file (layout calculations)] +[2018/03/28 v1.50 LaTeX file (layout calculations)] %% %% @@ -20,635 +20,308 @@ %% -\newlength\normalFontSize % becomes 1em in normal text, also abbreviated as \nfs -\newlength\normalBaselineSkip % also abbreviated as \nbs - -%% SET DEFAULT SIZES, AND INITIAL CORRECTIONS -%% ----------------------------------------------------------------------------- -%% -% Default Trim Size, if user does not set it. This is a popular size for -% USA softcover fiction, and is close to a popular British size. -\if@TrimSizeSet\else - \SetTrimSize{5.5in}{8.5in} % width, height +%% PROVIDE DEFAULT TRIM SIZE, MARGINS, AND NORMAL EM SIZE, IF NOT SET BY USER +%% ---------------------------------------------------------------------------- +% Default Trim Size is 5.5in W x 8.5in H, unless \SetTrimSize used. +% This size is typical of American P.O.D. softcover fiction: +\if@SetTrimSize\else + \gsetlength\@TrimWidth{5.5in} + \gsetlength\@TrimHeight{8.5in} \fi -\if@MediaSizeSet\else - \SetMediaSize[center]{\New@TrimWidth}{\New@TrimHeight} % original, or re-worked. -\fi -% Default margins are based on Trim Height, if user does not set margins. -% Works for standard w/h aspect ratios, but not for exotically narrow. -\if@MarginsSet\else - \ifthenelse{\dimtest{\Old@TrimHeight}{<}{8.99in}}{ % small sizes: - \global\setlength\Old@TopMargin{0.5in} - \global\setlength\Old@OutsideMargin{0.5in} - \global\setlength\Old@BottomMargin{0.5in} - \global\setlength\Old@InsideMargin{0.75in} - \global\setlength\New@TopMargin{0.5in} - \global\setlength\New@OutsideMargin{0.5in} - \global\setlength\New@BottomMargin{0.5in} - \global\setlength\New@InsideMargin{0.75in} +% Default margins based on Trim Height, unless \SetMargins used: +\if@SetMargins\else + \ifdimcomp{\@TrimHeight}{<}{8.99in}{ % small sizes: + \gsetlength\@TopMargin{0.5in} + \gsetlength\@OuterMargin{0.5in} + \gsetlength\@BottomMargin{0.5in} + \gsetlength\@InnerMargin{0.75in} }{ % medium sizes: - \ifthenelse{\dimtest{\Old@TrimHeight}{<}{9.99in}}{ - \global\setlength\Old@TopMargin{0.75in} - \global\setlength\Old@OutsideMargin{0.75in} - \global\setlength\Old@BottomMargin{0.75in} - \global\setlength\Old@InsideMargin{1in} - \global\setlength\New@TopMargin{0.75in} - \global\setlength\New@OutsideMargin{0.75in} - \global\setlength\New@BottomMargin{0.75in} - \global\setlength\New@InsideMargin{1in} + \ifdimcomp{\@TrimHeight}{<}{9.99in}{ % + \gsetlength\@TopMargin{0.75in} + \gsetlength\@OuterMargin{0.75in} + \gsetlength\@BottomMargin{0.75in} + \gsetlength\@InnerMargin{1in} }{ % large sizes: - \global\setlength\Old@TopMargin{1in} - \global\setlength\Old@OutsideMargin{1in} - \global\setlength\Old@BottomMargin{1in} - \global\setlength\Old@InsideMargin{1.25in} - \global\setlength\New@TopMargin{1in} - \global\setlength\New@OutsideMargin{1in} - \global\setlength\New@BottomMargin{1in} - \global\setlength\New@InsideMargin{1.25in} - } % end internal dimtest - } % end dimtest for margins. -\fi % end default margins -% -% Choose default font size based on Trim Width, unless font size set by user: + \gsetlength\@TopMargin{1in} + \gsetlength\@OuterMargin{1in} + \gsetlength\@BottomMargin{1in} + \gsetlength\@InnerMargin{1.25in} + } % + } % +\fi +% Default normal em size is based on Trim Width: \if@FontSizeSet\else - \ifthenelse{\dimtest{\Old@TrimWidth}{<}{5.49in}}{ - \global\setlength\Old@FontSize{11pt} % smaller books + \ifdimcomp{\@TrimWidth}{<}{5.49in}{ + \gsetlength\@SetFontSize{11pt} % smaller books }{ - \ifthenelse{\dimtest{\Old@TrimWidth}{<}{6.24in}}{ - \global\setlength\Old@FontSize{11.4pt} % medium books + \ifdimcomp{\@TrimWidth}{<}{6.24in}{ + \gsetlength\@SetFontSize{11.4pt} % medium books }{ - \global\setlength\Old@FontSize{12pt} % larger books - } % end internal dimtest - } % end dimtest for font size. + \gsetlength\@SetFontSize{12pt} % larger books + } % + } % \fi -% -% Default lines/page based on Trim Height, font size, unless LPP set by user: -\if@LinesPerPageSet\else - \def\@tempOFSnum{\strip@pt\Old@FontSize} - \FPmul{\@tempOBSnum}{\@tempOFSnum}{1.3} % for a nice, uncramped baselineskip - \def\@tempTH{\strip@pt\Old@TrimHeight} - \def\@tempTM{\strip@pt\Old@TopMargin} - \FPsub{\@tempLH}{\@tempTH}{\@tempTM} - \FPsub{\@tempLH}{\@tempLH}{\@tempTM} % \@tempLH is available live height - \FPdiv{\@tempLPP}{\@tempLH}{\@tempOBSnum} - \FPsub{\@tempLPP}{\@tempLPP}{1.5} % allows for default header - \FPround{\@tempLPP}{\@tempLPP}{0} % integer - \FPclip{\@tempLPP}{\@tempLPP} % remove excess trailing 0. - \gdef\my@LinesPerPage{\@tempLPP} +%% end set default trim, margins, normal em size. + + +%% THEORY OF PAGE LAYOUT +%% ---------------------------------------------------------------------------- +% The "available width" is the trim width minus the outer and inner margins: +\newlength\@AvailableWidth +\gsetlength\@AvailableWidth{\@TrimWidth-\@OuterMargin-\@InnerMargin} +% The "occupied width" of the text block is the TeX dimension \textwidth. +% Your originally set layout can always fill the available width, +% although that is not always true when using \Rework: +\gsetlength\textwidth{\@AvailableWidth} +% The "available height" is the trim height minus the top and bottom margins: +\newlength\@AvailableHeight +\gsetlength\@AvailableHeight{\@TrimHeight-\@TopMargin-\@BottomMargin} +% The "occupied height" includes header, textblock, footer, and allowances +% for risers/diacriticals at top, descenders at bottom. It must fit within +% the available height. This is the tricky part, so pay attention: +% In `novel' class, the topmost line of text (main block or header) +% is positioned with its baseline at 1 normal em below available top. +% That provides good clearance for uppercase letters with diacritical marks. +% The lowermost line of text (main block or footer) is positioned with its +% baseline at 0.3 normal em above available bottom. This provides +% good clearance for descenders. +% So, if your text does not have uppercase diacriticals, or if you use +% a footer with lining numbers (no descenders), then the upper/lower margins +% will appear to be a little larger than you set them. +% The headjump includes the line itself, plus any added gap to the main text. +% An unused jump is re-set to 0: +\if@HasHeader\else\gdef\@HeadJump{0}\fi +%% +% TeX assumes that your layout has a footer, even if you do not want one. +% Novel handles this by setting the baseline of the mandatory footer at +% 1 normal baselineskip below the last line of main text. Then, one line is +% subtracted from the occupied line count. That places the empty, unused +% virtual footer in the lower margin, where it does not matter. When you +% do have a footer, the necessary line space is added, and the content +% is positioned from the virtual footer using \smash and \raisebox. +% Yes, it is complicated, but it handles more layout possibilities. +% The \@FootJumpFix is one less than \@FootJump, or -1 when no footer: +\if@HasFooter + \FPsub\@FootJumpFix{\@FootJump}{1} +\else + \gdef\@FootJumpFix{-1} \fi -% -% Correct bottom margin for descenders, assumed to be 0.3em: -\addtolength\Old@BottomMargin{0.3\Old@FontSize} -\addtolength\New@BottomMargin{0.3\Old@FontSize} -% Warn if user requests unrealistic HeadJump or FootJump: -\FPiflt{\@headjump}{1} - \ClassWarning{novel}{^^JYou requested \string\HeadJump<1. Unless you have^^J% - a very good reason for that, you had better increase it to at least 1.^^J}% -\else\fi -% -\FPiflt{\@footjump}{1} - \ClassWarning{novel}{^^JYou requested \string\FootJump<1. Unless you have^^J% - a very good reason for that, you had better increase it to at least 1.^^J}% -\else\fi -% -%% end set default sizes and initial corrections - - - -%% OLD, NEW, CURRENT, LIVE, TEXT MACRO DEFINITIONS -%% ----------------------------------------------------------------------------- -% The \Rework commands are special to `novel' class. -% Situation: You compile the book with certain settings. Looks good. -% But then you need to change the Trim Size and/or Margins, without affecting -% paragraphs or pagination from what you had before. -% Solution: Retain your existing settings for Trim Size and Margins. -% Then, add \Rework commands, which instruct the layout engine to manipulate -% font size (and, if necessary, baseline skip) so that paragraphs and -% pagination remain as before. This is done dynamically, in a single pass. -% How it works: Paragraph layout depends on ratio of text width to font size. -% So, when text width changes, simply change font size in proportion. -% Then, pagination simply depends on lines per page, unchanged. -% But if the lines don't fit due any more, then both text width and font size -% are further shrunk, to retain paragraphs and also allow enough line space. -% -% "Old" values are pre-configured values, depending on class Trim Size option. -% However, the presets are over-ridden by user with using \Set---- commands. -% "New" values are initialized to "Old" or \Set---- as above. -% Then, they can be over-ridden by user with \Rework---- commands. -% "Current" values are initialized to "Old" values. Then they change, -% as calculations progress. -% Widths and Heights are lengths, stored by \setlength. -% Expressions ending in "Num" are pure numbers, suitable for FP calculations. -% "Live" refers to the area available to text (including header/footer). -% That is, the "live area" is the Trim Size, excluding the Margins. -% -% Find the Old and New Live Width and Height, and initialize -% Text Width and Height to Old Live. Initialize Font Size. -\newlength\Old@LiveWidth - \setlength\Old@LiveWidth{\Old@TrimWidth} - \addtolength\Old@LiveWidth{-\Old@OutsideMargin} - \addtolength\Old@LiveWidth{-\Old@InsideMargin} - \def\Old@LiveWidthNum{\strip@pt\Old@LiveWidth} -\newlength\Old@LiveHeight - \setlength\Old@LiveHeight{\Old@TrimHeight} - \addtolength\Old@LiveHeight{-\Old@TopMargin} - \addtolength\Old@LiveHeight{-\Old@BottomMargin} -\newlength\Current@FontSize - \setlength\Current@FontSize{\Old@FontSize} - \def\Current@FontSizeNum{\strip@pt\Current@FontSize} - \def\Old@FontSizeNum{\strip@pt\Old@FontSize} - \addtolength\Old@LiveHeight{-\Current@FontSizeNum pt} - \def\Old@LiveHeightNum{\strip@pt\Old@LiveHeight} -\newlength\Current@TextWidth - \setlength\Current@TextWidth{\Old@LiveWidth} - \def\Current@TextWidthNum{\strip@pt\Current@TextWidth} -\newlength\Current@TextHeight - \setlength\Current@TextHeight{\Old@LiveHeight} - \def\Current@TextHeightNum{\strip@pt\Current@TextHeight} -\newlength\New@LiveWidth - \setlength\New@LiveWidth{\New@TrimWidth} - \addtolength\New@LiveWidth{-\New@OutsideMargin} - \addtolength\New@LiveWidth{-\New@InsideMargin} - \def\New@LiveWidthNum{\strip@pt\New@LiveWidth} -\newlength\New@LiveHeight - \setlength\New@LiveHeight{\New@TrimHeight} - \addtolength\New@LiveHeight{-\New@TopMargin} - \addtolength\New@LiveHeight{-\New@BottomMargin} - \def\New@LiveHeightNum{\strip@pt\New@LiveHeight} -% -%% End old, new... macro definitions. - - -%% PRELIMINARY CALCULATION OF BASELINESKIP -%% ----------------------------------------------------------------------------- -% Get values of \@gotHeader and \@gotFooter booleans: -\@reserveHFspace % defined in `novel-LayoutSettings.sty'. -% Adjusted LinesPerPage will include header, footer, and added separations: -\let\adj@LinesPerPage\my@LinesPerPage % Start with the textblock lines. -% The footskip is always "there" even if no content. Remove it: -\FPsub{\adj@LinesPerPage}{\adj@LinesPerPage}{1} -% -\if@gotHeader % allow for header jump - \FPadd{\adj@LinesPerPage}{\adj@LinesPerPage}{\@headjump} +% Putting it all together, the "occupied height" is: +% 1.3\@SetFontSize + (\@HeadJump+\@LinesPerPage+\@FootJumpFix)\baselineskip +% +%% end theory of page layout. + + +%% SET DEFAULT LINES PER PAGE, IF NOT SET BY USER +%% ---------------------------------------------------------------------------- +% Lines per page refers only to the main text block, not header/footer: +\if@LinesPerPage\else + % Estimate \baselineskip as 1.3\@SetFontSize, which is a comfortable value. + % Calculate resulting \@LinesPerPage, then proceed as if set. + % Actual \baselineskip will be re-calculated later. + \edef\@tempLPP{% + \fpeval{% package xfp + (\@AvailableHeight - 0.3\@SetFontSize) % adjusts for final descenders + / (1.3*\@SetFontSize) % denominator, with desired skip/em ratio + -\@HeadJump -\@FootJumpFix % adjustments + }% + } % + \FPtrunc{\@LinesPerPage}{\@tempLPP}{0} % final, integer floor \fi -% -\if@gotFooter % allow for footer jump - \FPadd{\adj@LinesPerPage}{\adj@LinesPerPage}{\@footjump} +% Error if too few lines per page, whether set or default: +\FPiflt{\@LinesPerPage}{2} + \ClassError{novel}{Calculated LinesPerPage less than 2}% + {Too few lines. Either font size too big, or text height too small.}% \fi -% -% Baseline Skip is Live Height divided by adjusted number of lines. -% Thus initially, Text (with header/footer) occupies full Live Height. -\newlength\Current@BaselineSkip -\FPdiv{\Current@BaselineSkipNum}{\Old@LiveHeightNum}{\adj@LinesPerPage} -% Check to see if Baseline Skip is insufficient: -\FPdiv{\@ratioBStoFS}{\Current@BaselineSkipNum}{\Current@FontSizeNum} -\FPiflt{\@ratioBStoFS}{1.2}% - \ClassError{novel}{Too many lines per page^^J}% - {You requested too many lines per page, for the page dimensions and^^J% - font size. Maybe few lines, or smaller font size, or eliminate^^J% - header or footer? Or a bigger Trim Size?^^J}% -\else % OK, so set CurrentBaselineSkip: - \setlength\Current@BaselineSkip{\Current@BaselineSkipNum pt} +%% end set default lines per page. + + +%% CALCULATE BASELINESKIP +%% ---------------------------------------------------------------------------- +% In `novel' class, the user does not directly set line-to-line spacing, +% known as \baselineskip. Instead, \baselineskip is calculated from other +% settings, so that "occupied height" fills "available height." +% See the above theory of layout, for the equations. Solve for \baselineskip = +% (\@AvailableHeight-1.3\@SetFontSize) divided by +% (\@HeadJump+\@LinesPerPage+\@FootJumpFix) +% +\xdef\@AdjLPP{\fpeval{\@HeadJump+\@LinesPerPage+\@FootJumpFix}} % used often +\edef\@tempBLS{% + \fpeval{(\@AvailableHeight-1.3\@SetFontSize) / \@AdjLPP}% +} % +\FPtrunc\@tempBLS{\@tempBLS}{2} % round down to 2 decimalplaces +\gsetlength\baselineskip{\@tempBLS pt} +% +% Error if \baselineSkip is too tight, in relation to normal em size: +\ifdimcomp{\baselineskip}{<}{1.2\@SetFontSize}{% + \ClassError{novel}{Calculated baselineskip is too small}% + {Default baselineskip is calculated from normal em size, ^^J% + available text height, and lines per page. Result is too small. ^^J% + Change something, then try again.}% +}{}% +%% end calculate baselineskip. + + +%% LOAD REWORK, IF USED +%% REWORK IS EXPERIMENTAL CODE. NOT DOCUMENTED. +%% ---------------------------------------------------------------------------- +% Note that \Rework does not change lines per page. +\gdef\@TMratio{1} +\if@ReworkTrimSize + \ObsoleteRework +\else + \if@ReworkMargins + \ObsoleteRework + \fi \fi -\newlength\Old@BaselineSkip - \setlength\Old@BaselineSkip{\Current@BaselineSkipNum pt} -\gdef\Old@BaselineSkipNum{\strip@pt\Old@BaselineSkip} -% -%% End preliminary calculation of baselineskip. - - - -%% FIT CurrentTextWidth TO NewLiveWidth -%% ----------------------------------------------------------------------------- -\FPdiv{\my@TextRescaleNum}{\New@LiveWidthNum}{\Current@TextWidthNum} -\FPmul{\Current@FontSizeNum}{\Current@FontSizeNum}{\my@TextRescaleNum} -\setlength\Current@FontSize{\Current@FontSizeNum pt} -\FPmul{\Current@TextWidthNum}{\Current@TextWidthNum}{\my@TextRescaleNum} -\setlength\Current@TextWidth{\Current@TextWidthNum pt} -% -%% end fit CurrentTextWidth to NewLiveWidth - - -%% ADJUST CurrentBaselineSkip TO FIT NewLiveHeight -%% ----------------------------------------------------------------------------- -% Test if New Text Height fits within New Live Height: -\FPifgt{\Current@TextHeightNum}{\New@LiveHeightNum} % does not fit, so fix it - \FPdiv{\my@NBSrescaleNum}{\New@LiveHeightNum}{\Current@TextHeightNum} - \FPmul{\Current@BaselineSkipNum}{\Current@BaselineSkipNum}{\my@NBSrescaleNum} - \setlength\Current@BaselineSkip{\Current@BaselineSkipNum pt} - \FPmul{\Current@TextHeightNum}{\Current@BaselineSkipNum}{\adj@LinesPerPage} +%% end load rework. + + +%% FINISH LAYOUT (but post-layout deals with special class options) +%% ---------------------------------------------------------------------------- +% Caution if font size (set or reworked) is small: +\ifdimcomp{\@SetFontSize}{<}{10pt}{ % + \typeout{^^JClass `novel' Alert: Normal font at less than 10pt. ^^J% + Whether or not this is too small, depends on circumstances. ^^J% + Beware if you use footnotes, which are smaller. ^^J% + } +}{} % +\ifdimcomp{\@SetFontSize}{<}{8.03pt}{ % 8 PostScript points (TeX bp) + \ClassWarning{novel}{^^JNormal font at less than 8 points. ^^J% + This is usually undesirable. May be rejected by some print services. ^^J% + } +}{} % +% Default Media Size is same as Trim Size, unless \SetMediaSize used: +\if@MediaSize\else + \gsetlength\paperwidth{\@TrimWidth} + \gsetlength\paperheight{\@TrimHeight} \fi -% Check if the revised skip is too small: -\FPdiv{\@ratioBLtoFS}{\Current@BaselineSkipNum}{\Current@FontSizeNum} -\FPiflt{\@ratioBLtoFS}{1.2} % Too small. Re-tweak font, text width, skip. - \FPdiv{\@rescaleFontSize}{\@ratioBLtoFS}{1.2} - \FPmul{\Current@FontSizeNum}{\Current@FontSizeNum}{\@rescaleFontSize} - \setlength\Current@FontSize{\Current@FontSizeNum pt} - \FPmul{\Current@TextWidthNum}{\Current@TextWidthNum}{\@rescaleFontSize} - \setlength\Current@TextWidth{\Current@TextWidthNum pt} - \FPdiv{\Current@BaselineSkipNum}{\New@LiveHeightNum}{\adj@LinesPerPage} - \setlength\Current@BaselineSkip{\Current@BaselineSkipNum pt} - \FPmul{\Current@TextHeightNum}{\Current@BaselineSkipNum}{\adj@LinesPerPage} +% Sanity check for cover art, which needs bleed: +\if@coverart + \setlength\@tempLength{\paperwidth-\@TrimWidth} + \ifthenelse{\dimtest{\@tempLength}{<}{6mm}}{% + \ClassWarning{novel}{^^JBIG BAD WARNING! Insufficient bleed width ?^^J% + Commercial printers generally require 0.125in (3mm) bleed,^^J% + on all four sides of the Trim. But your dimensions do not provide this.^^J% + Perhaps you need to increase the Media Width ?^^J} + }{} + \ifthenelse{\dimtest{\@tempLength}{>}{0.5in}}{% + \ClassWarning{novel}{^^JBIG BAD WARNING! Too much bleed width ?^^J% + Commercial printers generally require 0.125in (3mm) bleed,^^J% + on all four sides of the Trim. Sometimes as much as 0.25in (6mm) each.^^J% + But your dimensions provide more than this. + Perhaps you need to decrease the Media Width ?^^J} + }{} + \setlength\@tempLength{\paperheight-\@TrimHeight} + \ifthenelse{\dimtest{\@tempLength}{<}{5.83mm}}{% allows for pixel rounding + \ClassWarning{novel}{^^JBIG BAD WARNING! Insufficient bleed height ?^^J% + Commercial printers generally require 0.125in (3mm) bleed,^^J% + on all four sides of the Trim. But your dimensions do not provide this.^^J% + Perhaps you need to increase the MediaSize ?^^J} + }{} + \ifthenelse{\dimtest{\@tempLength}{>}{0.507in}}{% allows for pixel rounding + \ClassWarning{novel}{^^JBIG BAD WARNING! Too much bleed height ?^^J% + Commercial printers generally require 0.125in (3mm) bleed,^^J% + on all four sides of the Trim. Sometimes as much as 0.25in (6mm) each.^^J% + But your dimensions provide more than this. + Perhaps you need to decrease the MediaSize ?^^J} + }{} \fi -% -% Note that if the revised skip is larger than desired, it is easy to change. -% Simply increase the top/bottom margin, which does not affect line breaks. -% -%% end adjust CurrentBaselineSkip to fit NewLiveHeight. - - -%% DISTRIBUTE SIDE EXCESS -%% ----------------------------------------------------------------------------- -%% The prior calculation may have shrunk CurrentTextWidth below NewLiveWidth. -\newlength\fix@SideMargin - \setlength\fix@SideMargin{\New@LiveWidth} - \addtolength\fix@SideMargin{-\Current@TextWidth} -\addtolength\New@OutsideMargin{0.5\fix@SideMargin} -\addtolength\New@InsideMargin{0.5\fix@SideMargin} -% -%% end distribute side excess. - +% \textheight, normal font size, etc: +\gsetlength\textheight{\@LinesPerPage\baselineskip} +\renewcommand\normalsize{% + \@setfontsize\normalsize{\strip@pt\@SetFontSize}{\strip@pt\baselineskip}% +} +\normalsize % from this point, the "real" normal font size is effective +% + +% +\if@HasHeader + % \headheight is mis-named. Text "height" is supposed to be measured upward + % from the baseline. But \headheight is measured from 0.3em below + % the baseline, to allow for descenders. Thus, to provide actual "height" + % of 1em, \headheight must be set to 1.3em: + \gsetlength\headheight{1.3\@SetFontSize} + % \headsep is a confusing term. It is the separation between the nominal + % 0.3em descenders of header text, and one baseline above the baseline + % of the top line of main text. Got that? Let me do the thinking for you: + \gsetlength\headsep{\@HeadJump\baselineskip-\baselineskip-0.3\@SetFontSize} +\else % no header, no problem: + \gsetlength\headheight{0pt} + \gsetlength\headsep{0pt} +\fi +% \oddsidemargin is at the left (inner, spine edge) of recto pages. +% Measured 1in (72.27pt) inside MediaBox, to the textblock. May be negative. + \gsetlength\oddsidemargin{% + \@InnerMargin+0.5\paperwidth-0.5\@TrimWidth-72.27pt% + } -%% SET TEXTWIDTH, FONT SIZE, BASELINESKIP -%% ----------------------------------------------------------------------------- -\setlength\textwidth{\Current@TextWidthNum pt} -% -\setlength\normalFontSize{\Current@FontSizeNum pt} -\setlength\normalBaselineSkip{\Current@BaselineSkipNum pt} -% -\@setfontsize\normalsize\normalFontSize{\normalBaselineSkip}% -\normalsize % Defined in `novel.cls'. Uses numbers, not lengths. -% -\newlength\nfs % abbreviation for normal fontsize -\setlength\nfs{\normalFontSize} -\gdef\nfsnum{\strip@pt\nfs} -\newlength\nbs % abbreviation for normal baselineskip -\setlength\nbs{\normalBaselineSkip} -\gdef\nbsnum{\strip@pt\nbs} % just the numerical part -% -% This document class limits range of normal point size: -\FPiflt{\Current@FontSizeNum}{8}% - \ClassError{novel}{Normal fontsize must be at least 8pt^^J}% - {In the class options, you chose a font size that is too small.^^J% - It must be at least 8pt.^^J}% -\fi % -\FPifgt{\Current@FontSizeNum}{18.1}% - \ClassError{novel}{Normal fontsize cannot exceed 18bp^^J}% - {In the class options, you chose a font size that is too large.^^J% - It cannot exceed 18bp.^^J}% -\fi -% Alert when lines closer than generally-accepted usage: -\FPmul{\@minBaselineSkipNum}{\Current@FontSizeNum}{1.24} -\FPiflt{\Current@BaselineSkipNum}{\@minBaselineSkipNum} - \typeout{^^JClass `novel' Alert: Line spacing is allowable, but close.^^J% - Consider fewer lines per page, or eliminate header or footer.^^J}% -\fi -% Alert when lines are farther than generally-accepted usage: -\FPmul{\@bigBS}{\Current@FontSizeNum}{1.41} -\FPifgt{\Current@BaselineSkipNum}{\@bigBS} - \typeout{^^JClass `novel' Alert: Line spacing is allowable, but wide.^^J% - Consider more lines per page, or add header or footer.^^J}% -\fi -% -\FPdiv{\Ratio@BaselineSkip}{\Current@BaselineSkipNum}{\Old@BaselineSkipNum} -\FPround{\Ratio@BaselineSkip}{\Ratio@BaselineSkip}{3} -\FPclip{\Ratio@BaselineSkip}{\Ratio@BaselineSkip} -% -\FPdiv{\Ratio@EM}{\Current@FontSizeNum}{\Old@FontSizeNum} -\FPround{\Ratio@EM}{\Ratio@EM}{3} -\FPclip{\Ratio@EM}{\Ratio@EM} -% Alert if images scaled by \Rework: -\ifthenelse{\equal{\Ratio@EM}{1} \AND \equal{\Ratio@BaselineSkip}{1}}{}{% - \typeout{^^JClass `novel' Alert: Due to \string\Rework\space there may be^^J% - places where an image no longer fits properly with surrounding text.^^J% - Try scaling such images in an external graphics editor. They cannot be^^J% - automatically scaled within the document. See `novel' docs, Page 9.^^J% - Suggested scale for inline images: \Ratio@EM ^^J% - Suggested scale for block images: \Ratio@BaselineSkip ^^J% - Maybe also change gaps for imageAtLeft and imageAtRight, trial-and-error.^^J}% -} -% -\setlength\parindent{1.5em} -% -%% Values to be used by footnotes: -\FPdiv{\my@FontScale}{\Current@FontSizeNum}{12} -% Substitute for \footnotesize, but only works for actual footnotes, -% about 10pt with similarly reduced skip: -\FPmul{\@myfootnotesizenum}{\my@FontScale}{10} -\FPround{\@myfootnotesizenum}{\@myfootnotesizenum}{2} -\FPmul{\@myfootnoteskipnum}{\my@FontScale}{\Current@BaselineSkipNum} -\FPmul{\@myfootnoteskipnum}{\@myfootnoteskipnum}{0.84} -\FPround{\@myfootnoteskipnum}{\@myfootnoteskipnum}{2} -% -%% end set textwidth, font size, baselineskip - +% \evensidemargin is at the left (outer edge) of verso pages. + \gsetlength\evensidemargin{% + \@OuterMargin+0.5\paperwidth-0.5\@TrimWidth-72.27pt% + } -%% BEGIN LAYOUT CALCULATIONS -%% ----------------------------------------------------------------------------- -\if@gotHeader - \setlength\headheight{\nbs} - \FPsub{\@headsepmul}{\@headjump}{1} - \FPmul{\@headsep}{\@headsepmul}{\Current@BaselineSkipNum} - \setlength\headsep{\@headsep pt} -\else - \setlength\headheight{0pt} - \setlength\headsep{0pt} -\fi % -% Prior to this, the following were set by user or calculated: -% \textwidth \headsep \headheight -% -\setlength\paperwidth{\New@MediaWidth} % MediaWidth -\setlength\paperheight{\New@MediaHeight} % MediaHeight -%% The `closecrop' class option calculates layout, then removes most of the -%% margins. Draft mode only. Purpose is to create a file with just enough white -%% space around the text to be readable on a handheld device. Not an E-book! -%% Additional closecrop code is located farther down this page. \if@closecrop - \setlength\paperwidth{\textwidth+0.2in} + \gsetlength\oddsidemargin{-0.9in} + \gsetlength\evensidemargin{-0.9in} \fi % -% 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. -% I thought about making the 1in go away, by re-setting \hoffset and \voffset -% to -1in each. Then other calculations would make more sense. -% In the end, I decided against that, since other packages expect the usual. -\setlength\hoffset{0pt} % relative to 1in built-in offset at left side -\setlength\voffset{0pt} % relative to 1in built-in offset at top -% -% \textheight is peculiar. Unless it is exact to 1/65536 TeX pt, which is -% the smallest resolution, the log file will babbled about Underfull vbox -% (badness 10000) for every page. I believe this is a bug in Tex. It's not -% all that bad, folks. On the other hand, if \textheight is even a fraction -% smaller than its theoretical value, there will be one less line of text. -% Even the geometry package can miss, due to rounding error somewhere. -% After some investigation, I determined that the following works. Basically, -% \textheight must be the normal baselineskip multiplied by the number of lines -% per page, minus 1 for the (invisible) footskip, with \normalFontSize added. -% To straddle the fence between Underfull vbox complaints, and missing a line, -% I added a very tiny fudge amount, which is less that 1/65536pt. -\FPsub{\less@LinesPerPage}{\my@LinesPerPage}{1} -\setlength\textheight{\normalFontSize+\less@LinesPerPage\nbs+0.000001pt} -% -% \oddsidemargin is at the left (inside, spine edge) of recto pages. -% Measured 1in (72.27pt) inside the MediaBox, to the textblock. May be negative. -% When the TrimBox equals the MediaBox, or is centered within it, -% the value is \New@InsideMargin+0.5\New@MediaWidth-0.5\New@TrimWidth-72.27pt -\if@offcenterTrim - \setlength\oddsidemargin{\New@InsideMargin-72.27pt} -\else - \setlength\oddsidemargin{% - \New@InsideMargin+0.5\New@MediaWidth-0.5\New@TrimWidth-72.27pt} -\fi -% -\if@closecrop - \setlength\oddsidemargin{-0.9in} -\fi -% -% \evensidemargin is at the left (outside edge) of verso pages. -% Calculation as above, but using \New@OutsideMargin -\if@offcenterTrim - \setlength\evensidemargin{\New@OutsideMargin-72.27pt} -\else - \setlength\evensidemargin{% - \New@OutsideMargin+0.5\New@MediaWidth-0.5\New@TrimWidth-72.27pt} -\fi -% -\if@closecrop - \setlength\evensidemargin{-0.9in} -\fi -% -% \topmargin is measured from 1in below the top of the MediaBox, to the top of -% whatever comes first (header or textblock). May be negative. -% When the TrimBox equals the MediaBox, or is centered within it, -% the value is \New@TopMargin+0.5\New@MediaHeight-0.5\New@TrimHeight-72.27pt -\if@offcenterTrim - \setlength\topmargin{\New@TopMargin-72.27pt} -\else - \setlength\topmargin{% - \New@TopMargin+0.5\New@MediaHeight-0.5\New@TrimHeight-72.27pt} -\fi -% -\if@closecrop - \if@gotHeader - \setlength\topmargin{-1in} - \else - \setlength\topmargin{-0.9in} - \fi -\fi -%% -% Vertical position of the textblock is measured to the "top" of the first line -% of text. But that could be an X height, or an accented character height, -% an ascender, or something else, depending on the line's content. -% Setting \topskip=\normalFontSize places the "top" at 1em above the baseline, -% which provides a fixed clearance regardless of accented characters -% (unless stacked high). Note that when \charscale is used to make a special -% line start, it doesn't affect the height, since it is "smashed." -\setlength\topskip{\normalFontSize} -% -% In `novel' class, footers are done in an unusual manner. The position of -% the footer baseline is fixed, regardless of the desired jump between text -% and footer. Then, the content (if any) of the footer is relatively positioned -% using \smash and \raisebox. -\setlength\footskip{\nbs} -% -\if@closecrop - \if@gotFooter - \if@gotHeader - \setlength\paperheight{% - \textheight+\headsep+\headheight+\@footjump\nbs+1pt} - \else - \setlength\paperheight{% - \textheight+\headsep+\headheight+\@footjump\nbs+\nfs} - \fi - \else - \setlength\paperheight{\textheight+\headsep+\headheight+0.1in} - \fi -\fi -% -%% End layout calculations. +% \topmargin is measured from 1in (72.27pt) below the top of the MediaBox, +% to the top of whatever comes first (header or textblock). May be negative. +% For consistency, the topmost baseline (header or main text) will be +% positioned at 1em below the margin. + \gsetlength\topmargin{\@TopMargin+0.5\paperheight-0.5\@TrimHeight-72.27pt} + \if@HasHeader\else + \gsetlength\topmargin{\topmargin-\baselineskip+\@SetFontSize} + \fi -%% Sanity check: +% novel.cls sets a tentative em size (probably 10pt) so that packages requiring +% an integer point size of 10, 11, or 12 will load without complaint. +% Then, the real point size is established here, when it is too late for +% such packages to complain. Sneaky, eh? +% However, TeX places a strut in the header, rising 0.7x tentative size above +% the header baseline. If the real size is too small, then the strut is +% too large, which displaces the header text downward, simultaneously +% shrinking the headsep and possibly affecting the textblock position. +% This unlikely problem cannot be fixed by adjusting the headheight, but it +% can be fixed by adjusting the topmargin and headsep to compensate: +\ifdimcomp{\@SetFontSize}{<}{\@TentativeEmN pt}{ % + \setlength\@tempLength{\@TentativeEmN pt} + \gsetlength\topmargin{\topmargin-0.7\@tempLength+0.7\@SetFontSize} + \gsetlength\headsep{\headsep+0.7\@tempLength-0.7\@SetFontSize} +}{} % +%% +% It seems that, unless specified by user, TeX may place the top text baseline +% in a vertical position that depends on the height of text in that line. +% That height may vary, depending on ascenders or diacriticals there. +% In order to fix the position, \topskip gets a non-flexible setting. +% The best value is normal baselineskip, partly because it looks right, +% and also to avoid underfull vboxes on nearly every page. +\gsetlength\topskip{\baselineskip} +% In `novel' class, footers are done in an unusual manner, as explained above. +% To fix the position of the virtual footer baseline: +\gsetlength\footskip{\baselineskip} +%% Sanity check: Trim Size must be contained within Media Size. \ifthenelse{% - \dimtest{\New@TrimWidth}{>}{\New@MediaWidth} % - \OR \dimtest{\New@TrimHeight}{>}{\New@MediaHeight}% + \dimtest{\@TrimWidth}{>}{\paperwidth} % + \OR \dimtest{\@TrimHeight}{>}{\paperheight}% }{% \ClassError{novel}{Media Size too small for TrimSize}% - {You wrote \string\SetMediaSize\space with length(s) too small^^J% + {You wrote \string\SetMediaSize\space with length(s) too small ^^J% for the default Trim Size or your values in \string\SetTrimSize.}% -}{} -%% end sanity check - - - -% When Media Size exceeds Trim Size, this sets the position: -\newlength\temp@PaperWidth -\newlength\temp@PaperHeight -\newlength\temp@Hoffset -\newlength\temp@Voffset -% -\if@offcenterTrim - \setlength\temp@PaperWidth{\New@TrimWidth} - \setlength\temp@PaperHeight{\New@TrimHeight} - \setlength\temp@Hoffset{0pt} - \setlength\temp@Voffset{0pt} -\else - \setlength\temp@PaperWidth{\New@MediaWidth} - \setlength\temp@PaperHeight{\New@MediaHeight} - \setlength\temp@Hoffset{\temp@PaperWidth} - \addtolength\temp@Hoffset{-\New@TrimWidth} - \setlength\temp@Hoffset{0.5\temp@Hoffset} - \setlength\temp@Voffset{\temp@PaperHeight} - \addtolength\temp@Voffset{-\New@TrimHeight} - \setlength\temp@Voffset{0.5\temp@Voffset} -\fi -% End when Media Size exceeds Trim Size. - - -% When Media Size = Trim Size, cropmarks are disabled. -% Too late for \@cropviewfalse; OK since CropBox already calculated properly. -\ifthenelse{% - \dimtest{\New@TrimWidth}{=}{\New@MediaWidth} % - \AND \dimtest{\New@TrimHeight}{=}{\New@MediaHeight}% -}{\global\@cropmarksfalse}{} -% end disabling `cropmarks' option. - -% Left, Right, Top, Bottom, x and y -\newlength\Trim@Lx -\newlength\Trim@Rx -\newlength\Trim@Ty -\newlength\Trim@By -\newlength\Live@Lx -\newlength\Live@By -\newlength\adj@NewLiveHeight -\setlength\adj@NewLiveHeight{\New@LiveHeight+0.3\normalFontSize} -% -\gdef\@getPageXY{ - \ifodd\c@page - \setlength\Trim@Lx{\oddsidemargin-\New@InsideMargin+72.27pt} - \setlength\Trim@Rx{\Trim@Lx+\New@TrimWidth} - \setlength\Live@Lx{\oddsidemargin+72.27pt} - \else - \setlength\Trim@Lx{\evensidemargin-\New@OutsideMargin+72.27pt} - \setlength\Trim@Rx{\Trim@Lx+\New@TrimWidth} - \setlength\Live@Lx{\evensidemargin+72.27pt} - \fi - \if@offcenterTrim - \setlength\Trim@By{\New@MediaHeight-\New@TrimHeight} - \setlength\Trim@Ty{\New@MediaHeight} - \else - \setlength\Trim@By{0.5\New@MediaHeight-0.5\New@TrimHeight} - \setlength\Trim@Ty{0.5\New@MediaHeight+0.5\New@TrimHeight} - \fi - \setlength\Live@By{\Trim@By+\New@BottomMargin-0.3\normalFontSize} -} -% - - -%% With class option `shademargins' (only effective in draft mode): -% Based on code by Ulrike Fischer at tex.stackexchange.com, CC-by-sa-3.0: -% The 0.903215 is a value that the user would not be likely to choose. -% The re-defined color command makes an exception for that value. -\definecolor[named]{hingledingle}{gray}{1} % fake white, when white disallowed -% -\if@shademargins - \pagecolor{hingledingle}% - \if@offcenterTrim% - \AddToShipoutPictureBG{\@getPageXY% - \AtPageLowerLeft{\color[gray]{0.903215}% - \hspace{\Trim@Lx}\rule[\Trim@By]{\New@TrimWidth}{\New@TrimHeight}}% - }% - % - \AddToShipoutPictureBG{\@getPageXY% - \AtPageLowerLeft{\color{hingledingle}% - \hspace{\Live@Lx}\rule[\Live@By]{\New@LiveWidth}{\adj@NewLiveHeight}}% - }% - \else% trim is centered - \AddToShipoutPictureBG{\@getPageXY% - \AtPageLowerLeft{\color[gray]{0.903215}% - \hspace{\Trim@Lx}\rule[\Trim@By]{\New@TrimWidth}{\New@TrimHeight}}% - }% - % - \AddToShipoutPictureBG{\@getPageXY% - \AtPageLowerLeft{\color{hingledingle}% - \hspace{\Live@Lx}\rule[\Live@By]{\New@LiveWidth}{\adj@NewLiveHeight}}% - }% - \fi% -\fi % end \if@shademargins -% - -% Labels each page with DRAFT at upper left, if in draft mode: -\if@useDraftMode - \AddToShipoutPictureBG{\@getPageXY% - \AtPageUpperLeft{\raisebox{-\nbs}{\textbf{~DRAFT}}} - }% -\fi -% - -% Cropmarks (trim marks, really) are not important in this document class. -% That's because the targeted printing services generally do not want them. -% But a minimal capability was easy to add. The far end of each mark is -% half an inch from the trim area. The close end is separated by a gap >= 0pt. -% So the length of the marks is generally less than half an inch. -% If trim is at the edge of the media box, instead of centered, -% then only one pair of marks will be written. -% The marks are turned on using `cropmarks' class option. The gap is set -% in Preamble using \SetCropmarkGap{length}. -\if@cropmarks - \if@offcenterTrim - \ifodd\c@page - % H bottom right: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Rx+\@mygap}\rule[\Trim@By-0.5pt]{0.5in-\@mygap}{0.5pt}}} - % V bottom right: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\Trim@Rx}\rule[\Trim@By-0.5in]{0.5pt}{0.5in-\@mygap}}} - \else - % H bottom left: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx-0.5in}\rule[\Trim@By-0.5pt]{0.5in-\@mygap}{0.5pt}}} - % V bottom left: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx-0.5pt}\rule[\Trim@By-0.5in]{0.5pt}{0.5in-\@mygap}}} - \fi - \else - % H top left: - \AddToShipoutPictureBG{\@getPageXY% - \AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx-0.5in}\rule[\Trim@Ty]{0.5in-\@mygap}{0.5pt}}} - % H bottom left: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx-0.5in}\rule[\Trim@By-0.5pt]{0.5in-\@mygap}{0.5pt}}} - % H top right: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Rx+\@mygap}\rule[\Trim@Ty]{0.5in-\@mygap}{0.5pt}}} - % H bottom right: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Rx+\@mygap}\rule[\Trim@By-0.5pt]{0.5in-\@mygap}{0.5pt}}} - % V top left: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx-0.5pt}\rule[\Trim@Ty+\@mygap]{0.5pt}{0.5in-\@mygap}}} - % V bottom left: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx-0.5pt}\rule[\Trim@By-0.5in]{0.5pt}{0.5in-\@mygap}}} - % V top right: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\Trim@Rx}\rule[\Trim@Ty+\@mygap]{0.5pt}{0.5in-\@mygap}}} - % V bottom right: - \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% - \hspace{\Trim@Rx}\rule[\Trim@By-0.5in]{0.5pt}{0.5in-\@mygap}}} - \fi -\fi -% -%% end cropmarks - +}{} % +% end sanity check +%% end finish layout. +%% +\endinput %% %% End of file `novel-CalculateLayout.sty'. diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-ChapterScene.sty b/Master/texmf-dist/tex/lualatex/novel/novel-ChapterScene.sty index e13eb3e33f4..69bf8f0d9b4 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-ChapterScene.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-ChapterScene.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-ChapterScene.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-ChapterScene.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% %% This file may be distributed and/or modified under the @@ -13,31 +13,87 @@ %% %% \ProvidesFile{novel-ChapterScene.sty}% -[2018/01/14 v1.46.2 LaTeX file (chapter and scene macros)] +[2018/03/28 v1.50 LaTeX file (chapter and scene macros)] %% - -% Class `novel' does not use \maketitle. -\gdef\maketitle{% - \ClassError{novel}{\string\maketitle does not exist in this class}% - {Sorry, but there is no \string\maketitle command in `novel' class.^^J% - You must make your own title pages! See documentation.^^J}% +% Each new chapter generally has its own header/footer style. This allows a +% default setting when chapters begin with ChapterStart environment: +\gdef\SetChapterStartStyle#1{% from v. 1.40.3 + \@tempTFfalse% + \ifthenelse{\equal{#1}{fancy}}{\@tempTFtrue}{}% + \ifthenelse{\equal{#1}{empty}}{\@tempTFtrue}{}% + \ifthenelse{\equal{#1}{plain} % + \OR \equal{#1}{fancyplain} \OR \equal{#1}{footer}}{% + \@tempTFtrue% + }{}% + \ifthenelse{\equal{#1}{forcenumber}}{\@tempTFtrue}{}% + \ifthenelse{\equal{#1}{dropfolioinside} % + \OR \equal{#1}{dropfolio} \OR \equal{#1}{dropfoliolater}}{% + \@tempTFtrue% + }{}% + \ifthenelse{\equal{#1}{dropfoliobeneath}}{\@tempTFtrue}{}% + \if@tempTF% + \gdef\@setchapterstart{#1}% + \else% + \ClassError{novel}{Invalid choice for \string\SetChapterStartStyle}% + {Choose: fancy, empty, plain, footer, forcenumber, % + dropfolioinside, dropfoliobeneath.}% + \fi% } -% +\let\SetChapterStart\SetChapterStartStyle\relax % deprecated from v1.40.3. +\SetChapterStartStyle{footer} % default +% New in version 1.40.2: +\gdef\SetChapterStartHeight#1{% + \FPifint{#1}\else% + \ClassError{novel}{\string\SetChapterStartHeight\space integer >= 4}% + {Height of ChapterStart must be integer, greater than or equal to 4.}% + \fi% + \FPiflt{#1}{4}% + \ClassError{novel}{\string\SetChapterStartHeight\space integer >= 4}% + {Height of ChapterStart must be integer, greater than or equal to 4.}% + \else\fi% + \gdef\@setchapterstartheight{#1}% +} +\SetChapterStartHeight{10} % default +% See novel.cls for the accompanying AtBeginDocument routine. +% Scene breaks: +% \SetScenebreakIndent controls whether line after \scenebreak, \sceneline, +% or \scenestars will be indented. Set true or false, default false. +%% End reserve space for header/footer and set default ChapterStart +\newif\if@IndentAfterScenebreak +\newcommand\SetScenebreakIndent[1]{% true or false, default false. + \@tempTFfalse + \ifthenelse{\equal{#1}{true}}{% + \@tempTFtrue + \global\@IndentAfterScenebreaktrue + }{}% + \ifthenelse{\equal{#1}{false}}{% + \@tempTFtrue + \global\@IndentAfterScenebreakfalse + }{}% + \if@tempTF\else% + \ClassError{novel}{Bad argument for \string\SetScenebreakIndent\space}% + {\string\SetScenebreakIndent\space argument must be true or false.}% + \fi% +} +\SetScenebreakIndent{false} % default +% Deprected from v. 1.40.3: +\newcommand\IndentAfterScenebreak{\global\@IndentAfterScenebreaktrue} + %% SCENE CHANGES -%% ----------------------------------------------------------------------------- -%% \scenebreak \sceneline \scenestars +%% ---------------------------------------------------------------------------- +% \scenebreak \sceneline \scenestars % Use anywhere in document body. % These commands skip a line. % \scenebreak leaves the gap empty. % \sceneline centers a line, about 1/3 textwidth. % \scenestars centers three widely-spaced asterisks. % Default behavior is \noindent for following paragraph. -% Use \SetScenebreakIndent{true or false} in Preamble to change this globally. -% Either way, local behavior can be changed using \forceindent or \backindent. +% Use \SetScenebreakIndent{true or false} in Preamble to change globally. +% Either way, local behavior changed using \forceindent or \backindent. \newcommand\scenebreak{\null} % \newcommand\sceneline{% @@ -77,39 +133,46 @@ %% ChapterStart environment. % The most useful way to start a new chapter. Occupies a fixed amount of -% vertical space. Also self-adjust when used with dropfolio. Automatically -% calls \thispagestyle if set for all chapter displays. -% This environment is not restricted to chapters. It is also used for chapter-like -% sections in front matter or main matter, as long as they are styled like a chapter. -\newif \if@addCTline \@addCTlinetrue +% vertical space. Also self-adjust when used with dropfolio. Automatically +% calls \thispagestyle if set for all chapter displays. +% This environment is not restricted to chapters. It is also used for +% chapter-like sections in front matter or main matter, +% as long as they are styled like a chapter. \newcounter{@linequarter} -\newif \if@csalignok \@csalignokfalse -\newlength\@oldparindent + % -% The argument is the number of normal baselineskips high (integer GTE 4). -\ExplSyntaxOn -\DeclareDocumentEnvironment {ChapterStart} { O{\@setchapterstartheight} O{\@setchapterstart} } -{% - \gdef\@thiscsstyle{#2}% - \thispagestyle{\@thiscsstyle}% - \setlength\@oldparindent{\parindent}% - \global\@oldparindent=\@oldparindent% - \setlength\parindent{0pt}% - \global\parindent=\parindent% +% The argument is the number of normal baselineskips high. +\newif\if@WithinChapterStart +\DeclareDocumentEnvironment {ChapterStart} % +{ O{\@setchapterstartheight} O{\@setchapterstart} }{% + \if@ThisPageStyle\else% + \gdef\@thiscsstyle{#2}% + \thispagestyle{\@thiscsstyle}% + \fi% + \global\@WithinChapterStarttrue% + \suppressfloats[t]% ensures that a floated image does not go on top + \gsetlength\parindent{0pt}% within environment \ResetFootnoteSymbol% resets symbolic markers, but not numerical markers - \IfStrEq{#1}{*}{\gdef\@thiscsheight{\@setchapterstartheight}}{\gdef\@thiscsheight{#1}}% + \IfStrEq{#1}{*}{% + \gdef\@thiscsheight{\@setchapterstartheight}% + }{% + \gdef\@thiscsheight{#1}% + }% \FPsub{\@fixlines}{\@thiscsheight}{2}% \FPsub{\@fixlines}{\@fixlines}{0.001}% fudge to avoid rounding problems \FPround{\@thiscsheight}{\@thiscsheight}{0}% \FPiflt{\@thiscsheight}{4}% - \IfStrEq{\@thiscsstyle}{dropfolioinside}{% - \ClassError{novel}{ChapterStart~ height~ insufficient~ for~ dropfolioinside}% - {With~ dropfolioinside,~ the~ ChapterStart~ height~ must~ be~ at~ least~ 4.}% - }{}% + \def\@smcserr{% + \ClassError{novel}{ChapterStart height insufficient for thispagestyle}% + {With your choice for thispagestyle, the height must be at least 4.}% + }% + \IfStrEq{\@thiscsstyle}{dropfolioinside}{\@smcserr}{}%j + \IfStrEq{\@thiscsstyle}{plain}{\@smcserr}{}% + \IfStrEq{\@thiscsstyle}{fancyplain}{\@smcserr}{}% \else\fi% \FPiflt{\@thiscsheight}{3}% - \ClassError{novel}{ChapterStart~ height~ must~ be~ at~ least~ 3}% - {If~ you~ need~ height~ less~ than~ 3,~ consider~ \string\QuickChapter\space~ instead.}% + \ClassError{novel}{ChapterStart height must be at least 3}% + {If you need height less than 3, consider \string\QuickChapter.}% \else\fi% \null% always a line above the first thing to appear within the environment \setcounter{@linequarter}{0}% @@ -129,12 +192,13 @@ }{\vspace{0.25\nbs}}{}% \end{textblock*}% \vspace{\@fixlines\nbs}% - \if@addCTline\null\fi% - \setlength\parindent{\@oldparindent}% - \global\parindent=\parindent% + \if@DeleteCSline\else\null\fi% adjusts when dropfolioinside + \global\@WithinChapterStartfalse% + \vspace{\@NovelCaulk}% + \gsetlength\parindent{\normalparindent}% restored \nov@AfterGroup\NoIndentAfterThis% etextools and noindentafter } -\ExplSyntaxOff % end ChapterStart environment +% end ChapterStart environment %% @@ -144,13 +208,13 @@ \newcommand\ChapterTitle[2][c]{% optional alignment l, c, r \ignorespaces% \vspace{0.5\nbs}\addtocounter{@linequarter}{2}% - \@csalignokfalse% - \ifthenelse{\equal{#1}{l}}{\let\@csalign\relax\@csalignoktrue}{}% - \ifthenelse{\equal{#1}{c}}{\let\@csalign\centering\relax\@csalignoktrue}{}% - \ifthenelse{\equal{#1}{r}}{\let\@csalign\hfill\relax\@csalignoktrue}{}% - \if@csalignok\else% + \@tempTFfalse% + \ifthenelse{\equal{#1}{l}}{\let\@csalign\relax\@tempTFtrue}{}% + \ifthenelse{\equal{#1}{c}}{\let\@csalign\centering\relax\@tempTFtrue}{}% + \ifthenelse{\equal{#1}{r}}{\let\@csalign\hfill\relax\@tempTFtrue}{}% + \if@tempTF\else% \ClassError{novel}{Chapter Title, Deco, Subtitle align must be l, c, or r}% - {On page \thepage you wrote a Chapter command with alignment^^J% + {On page \thepage you wrote a Chapter command with alignment ^^J% other than the allowed l, c, or r.}% \fi% {\@csalign\stake\smash{{\chapterfont{}#2}}\par}% @@ -158,13 +222,13 @@ % \newcommand\ChapterSubtitle[2][c]{% optional alignment l, c, r \vspace{0.25\nbs}\addtocounter{@linequarter}{1} - \@csalignokfalse% - \ifthenelse{\equal{#1}{l}}{\let\@csalign\relax\@csalignoktrue}{} - \ifthenelse{\equal{#1}{c}}{\let\@csalign\centering\relax\@csalignoktrue}{} - \ifthenelse{\equal{#1}{r}}{\let\@csalign\hfill\relax\@csalignoktrue}{} - \if@csalignok\else% + \@tempTFfalse% + \ifthenelse{\equal{#1}{l}}{\let\@csalign\relax\@tempTFtrue}{} + \ifthenelse{\equal{#1}{c}}{\let\@csalign\centering\relax\@tempTFtrue}{} + \ifthenelse{\equal{#1}{r}}{\let\@csalign\hfill\relax\@tempTFtrue}{} + \if@tempTF\else% \ClassError{novel}{Chapter Title, Deco, Subtitle align must be l, c, or r}% - {On page \thepage you wrote a Chapter command with alignment^^J% + {On page \thepage you wrote a Chapter command with alignment ^^J% other than the allowed l, c, or r.}% \fi% {\@csalign{\stake\smash{\subchfont #2}}\par}% @@ -175,22 +239,23 @@ % This works because one is a letter, and the other is a number. % So it is easy to separte them by parsing. \newcommand\ChapterDeco[2][c1]{% optional alignment and scale, either order + \@tempTFfalse \StrDel{#1}{ }[\temp@cds]% may use space separator \StrDel{\temp@cds}{,}[\temp@cd]% may use comma separator \IfSubStr{#1}{l}{% left align - \let\@csalign\relax\@csalignoktrue% + \let\@csalign\relax\@tempTFtrue% \StrDel{\temp@cd}{l}[\temp@cd]% }{}% \IfSubStr{#1}{c}{% centered - \let\@csalign\centering\relax\@csalignoktrue% + \let\@csalign\centering\relax\@tempTFtrue% \StrDel{\temp@cd}{c}[\temp@cd]% }{}% \IfSubStr{#1}{r}{% right align - \let\@csalign\hfill\relax\@csalignoktrue% + \let\@csalign\hfill\relax\@tempTFtrue% \StrDel{\temp@cd}{r}[\temp@cd]% }{}% - \if@csalignok\else% - \let\@csalign\centering\relax\@csalignoktrue% + \if@tempTF\else% + \let\@csalign\centering\relax\@tempTFtrue% \fi% % Now for scaling, with adjusted vertical position: \IfEndWith{\temp@cd}{.}{\StrSubstitute{\temp@cd}{.}{.0}[\temp@cd]}{}% @@ -210,32 +275,30 @@ % is the text, using subchfont. Optional line follows using \bigemdash style. % If option is empty, no line. If a length, then the line is that length. % If option * then the line fills to end of text line. -\newlength\@tempscfx% \newcommand\QuickChapter[2][]{% \null% - \def\@qctweak{0.3} % raise above grid, em of subchfont - \noindent{\subchfont\charscale[1,0pt,\@qctweak em]{#2}% - \setlength\@tempscfx{\heightof{x}}% - \global\@tempscfx=\@tempscfx% + \noindent{\subchfont\charscale[1,0pt,0.3em]{#2}% + \gsetlength\@tempLength{\heightof{x}}% height of x in subchfont }% end subchfont - \def\@tempscfxnum{\strip@pt\@tempscfx}% - \def\nxhnum{\strip@pt\normalxheight}% - \FPdiv{\@qclineth}{\@tempscfxnum}{\nxhnum}% scale of subchfont + \FPdiv{\@qclineth}{\strip@pt\@tempLength}{\strip@pt\normalxheight}% fontscale \FPmul{\@howthick}{\@qclineth}{0.049}% typical emdash thickness, em. - \FPadd{\@howraise}{\@qctweak}{0.23}% typical emdash height em raised. - \FPmul{\@howraise}{\@howraise}{\@qclineth}% - \def\@tempscfxnum{\strip@pt\@tempscfx}% + \FPmul{\@howraise}{0.23}{\@qclineth}% typical emdash height em raised. \ifthenelse{\equal{#1}{} \OR \equal{#1}{ }}{}{% no line, else: \ifthenelse{\equal{#1}{*}}{% line fills: - ~\leaders\hbox{\smash{\rule[\@howraise em]{1pt}{\@howthick em}}}\hfill\stake\par% + ~\leaders% + \hbox{\smash{\rule[\@howraise em]{1pt}{\@howthick em}}}% + \hfill\stake\par% }{% else line at specific length: - ~\makebox[#1][l]{\leaders\hbox{\smash{\rule[\@howraise em]{1pt}{\@howthick em}}}\hfill}% + ~\makebox[#1][l]{% + \leaders\hbox{\smash{\rule[\@howraise em]{1pt}{\@howthick em}}}\hfill% + }% }% }% \NoIndentAfterThis% } % end \QuickChapter %% + %% New in version 1.40: \cleartorecto and \cleartoend % \cleartorecto works same as \clearpage when next page is recto. % If next page would be verso, a blank verso is inserted, @@ -253,22 +316,49 @@ \clearpage \fi } +\newif \if@cleartoend \gdef\cleartoend{ - \clearpage - \ifodd\c@page + \if@cleartoend\else + \clearpage + \ifodd\c@page + \thispagestyle{empty} + \null + \clearpage + \fi \thispagestyle{empty} \null \clearpage \fi - \thispagestyle{empty} - \null - \clearpage + \global\@cleartoendtrue } % +%% +\gdef\@ActivateChapterScene{% called by `novel.cls' \AtBeginDocument + % Activate user choice of whether or not to indent after scenebreak commands: + \if@IndentAfterScenebreak\else + \NoIndentAfterCmd{\scenebreak} + \NoIndentAfterCmd{\sceneline} + \NoIndentAfterCmd{\scenestars} + \fi +}% end \@ActivateChapterScene +%% + + +%% Neutralize settings commands: +\gdef\@DisableChapterSceneSettings{% called by `novel.cls' \AtBeginDocument + \LetLtxMacro\SetHeadFootStyle\relax + \LetLtxMacro\IndentAfterScenebreak\relax + \LetLtxMacro\SetScenebreakIndent\relax +}% end \@DisableChapterSceneSettings +%% -% + + +%% +\endinput +%% %% End of file `novel-ChapterScene.sty'. diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-DropCap.sty b/Master/texmf-dist/tex/lualatex/novel/novel-DropCap.sty new file mode 100644 index 00000000000..44567243054 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-DropCap.sty @@ -0,0 +1,237 @@ +%% +%% This is file `novel-DropCap.sty', part of `novel' document class. +%% Copyright (C) 2017-2018 Robert Allgeyer. +%% +%% It is based on `lettrine.sty', part of `lettrine' package, +%% Copyright (C) 1999-2015 Daniel Flipo. +%% +%% The license for this file is that same for `lettrine': +% +% This program can be distributed and/or modified under the terms +% 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. +% +%% +% This file is new in `novel' version 1.50. +% +\ProvidesFile{novel-DropCap.sty} + [2018/03/28 v1.50 (Drop Caps)] +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +% +% + +% +\newcounter{NDCDefaultLines} +\setcounter{NDCDefaultLines}{3} +\newcounter{NDCDefaultDepth} +\newdimen\NDCDefaultVoffset +\newdimen\NDCDefaultHoffset +\newcommand*{\NDCDefaultScale}{1} +\newcommand*{\NDCDefaultBloat}{1} +\newdimen\NDCDefaultGap +\gsetlength{\NDCDefaultGap}{0.25em} % approx. width of normal space +\newsavebox{\NDC@dropcapbox} +\newsavebox{\NDC@normalXbox} +\newcounter{NDC@lines} +\newcounter{NDC@depth} +\newdimen\NDC@antewidth +\newdimen\NDC@Pindent +\newdimen\NDC@Gap % equivalent to lettrine findent +\newdimen\NDC@Nindent % not a user setting +\newdimen\NDC@voffset +\newdimen\NDC@hoffset +\newdimen\NDC@first +\newdimen\NDC@next +\newdimen\NDC@height +\newcommand*{\NDC@ante}{} +\newcommand*{\NDC@bloat}{} +\newcommand*{\NDC@scale}{} +\def\@getNDCheight{% offsets do not affect height: + \@tempdima=\baselineskip + \setlength{\NDC@height}{\value{NDC@lines}\@tempdima}% local + \addtolength{\NDC@height}{-\@tempdima}% + \sbox{\NDC@normalXbox}{X}% Normal capital X, rather than something else. + \addtolength{\NDC@height}{\ht\NDC@normalXbox}% + \setlength{\NDC@height}{\NDC@scale\NDC@height}% local +} % +\newcommand*{\NDC@char}{% + \@getNDCheight% + % Measures drop cap capital X, rather than something else: + \sbox{\@tempboxa}{% + \NDC@charstyle\fontsize{\NDC@height}{\NDC@height}\selectfont X% + }% + \@tempcntb=\ht\@tempboxa% + \@tempcnta=\NDC@height% + \multiply\@tempcnta by 100% + \divide\@tempcntb by 100% + \divide\@tempcnta by \@tempcntb% + \advance\@tempcnta by -9999% + \ifnum\@tempcnta>0% + \def\@tempa{1.\the\@tempcnta}% + \else% + \def\@tempa{1}% + \fi% + \NDC@charstyle\fontsize{\@tempa\NDC@height}{\@tempa\NDC@height}\selectfont +} % +\define@key{NDC}{lines}{\setcounter{NDC@lines}{#1}} +\define@key{NDC}{depth}{\setcounter{NDC@depth}{#1}} +\define@key{NDC}{hoffset}{\setlength{\NDC@hoffset}{#1}} +\define@key{NDC}{voffset}{\setlength{\NDC@voffset}{#1}} +\define@key{NDC}{ante}{\renewcommand*{\NDC@ante}{#1}} % Like `lettrine' ante, +\define@key{NDC}{ante*}{\renewcommand*{\NDC@ante}{% Like `lettrine' ante, but + \setlength\NDC@antewidth{\widthof{#1}}% auto-hangs the ante in left margin. + \addtolength\NDC@antewidth{0.2em}% provides breathing room + \stake\hspace{-\NDC@antewidth}#1\hspace{0.2em}}% restores alignment +} +\define@key{NDC}{gap}{\setlength{\NDC@Gap}{#1}} +\define@key{NDC}{bloat}{\renewcommand*{\NDC@bloat}{#1}} +\define@key{NDC}{scale}{\renewcommand*{\NDC@scale}{#1}} +\newdimen\NDCboxwidth +\newdimen\NDCboxheight +\newdimen\NDCboxdepth +% +\ExplSyntaxOn +\DeclareDocumentCommand \NDC@boxcap { m }{% + \begingroup% + % The model letter has no upper diacritical. + \def\@NDCmodel{}% + \IfSubStr{ÀÁÂÃÄÅĀĂ}{#1}{\def\@NDCmodel{A}}{}% + \IfSubStr{ĆĈĊČ}{#1}{\def\@NDCmodel{C}}{}% + \IfSubStr{Ď}{#1}{\def\@NDCmodel{D}}{}% + \IfSubStr{ÈÉÊËĒĔĖĚ}{#1}{\def\@NDCmodel{E}}{}% + \IfSubStr{ĜĞĠ}{#1}{\def\@NDCmodel{G}}{}% + \IfSubStr{Ĥ}{#1}{\def\@NDCmodel{H}}{}% + \IfSubStr{ÌÍÎÏĨĪĬİ}{#1}{\def\@NDCmodel{I}}{}% + \IfSubStr{Ĵ}{#1}{\def\@NDCmodel{J}}{}% + \IfSubStr{Ĺ}{#1}{\def\@NDCmodel{L}}{}% + \IfSubStr{ÑŃŇ}{#1}{\def\@NDCmodel{N}}{}% + \IfSubStr{ÒÓÔÕÖŌŎŐ}{#1}{\def\@NDCmodel{O}}{}% + \IfSubStr{ŔŘ}{#1}{\def\@NDCmodel{R}}{}% + \IfSubStr{ŚŜŠ}{#1}{\def\@NDCmodel{S}}{}% + \IfSubStr{Ť}{#1}{\def\@NDCmodel{T}}{}% + \IfSubStr{ÙÚÛÜŨŪŬŮŰ}{#1}{\def\@NDCmodel{U}}{}% + \IfSubStr{Ŵ}{#1}{\def\@NDCmodel{W}}{}% + \IfSubStr{ÝŶŸ}{#1}{\def\@NDCmodel{Y}}{}% + \IfSubStr{ŹŻŽ}{#1}{\def\@NDCmodel{Z}}{}% + \IfSubStr{DŽ}{#1}{\def\@NDCmodel{DZ}}{}% diglyph + \setlength\fboxsep{0.16\@SetFontSize}% + \setlength\fboxrule{0.02\@SetFontSize}% + \ifthenelse{\equal{\@NDCmodel}{}}{% + \framebox{\phantom{|}#1\phantom{|}}% + }{% + \framebox{\phantom{|\@NDCmodel}\llap{\smash{#1}}\phantom{|}}% + }% + \endgroup% +}% end boxcap +% +\DeclareDocumentCommand \dropcap { s O{} m } {% + \@tempTFfalse% + \IfSubStr{#3}{png}{\@tempTFtrue}{}% + \IfSubStr{#3}{PNG}{\@tempTFtrue}{}% + \IfSubStr{#3}{jpg}{\@tempTFtrue}{}% + \IfSubStr{#3}{JPG}{\@tempTFtrue}{}% + \IfSubStr{#3}{jpeg}{\@tempTFtrue}{}% + \IfSubStr{#3}{JPEG}{\@tempTFtrue}{}% + \setcounter{NDC@lines}{\value{NDCDefaultLines}}% + \setcounter{NDC@depth}{\value{NDCDefaultDepth}}% + \setlength{\NDC@hoffset}{\NDCDefaultHoffset}% + \renewcommand*{\NDC@bloat}{\NDCDefaultBloat}% + \renewcommand*{\NDC@scale}{\NDCDefaultScale}% + \setlength{\NDC@voffset}{\NDCDefaultVoffset}% + \renewcommand*{\NDC@ante}{}% + \setlength{\NDC@Gap}{\NDCDefaultGap}% + \setlength{\NDC@Nindent}{0pt}% + \setkeys{NDC}{#2}% + \if@tempTF% + \def\@dropthisthing{\InlineImage[0em,b]{#3}}% + \else% + \IfBooleanTF{#1}% + {\def\@dropthisthing{\NDC@boxcap{#3}}}% + {\def\@dropthisthing{#3}}% + \fi% + \ifnum\value{NDC@lines}=1% + \par\noindent% + \NDC@ante% + \@dropthisthing% + \else% + % Compensate for effect of using \Rework: + \if@ReworkTrimSize% + \FPdiv{\@tempN}{\strip@pt\textwidth}{\strip@pt\@OriginalTextWidth}% + \FPmul{\NDC@bloat}{\NDC@bloat}{\@tempN}% + \else% + \if@ReworkMargins + \FPdiv{\@tempN}{\strip@pt\textwidth}{\strip@pt\@OriginalTextWidth}% + \FPmul{\NDC@bloat}{\NDC@bloat}{\@tempN}% + \fi% + \fi% + \sbox{\NDC@normalXbox}{X}% Normal capital X. + \sbox{\NDC@dropcapbox}{\scalebox{\NDC@bloat}[1]{\NDC@char\@dropthisthing}}% + \@tempdima=\baselineskip% + \setlength{\NDC@first}{-\value{NDC@lines}\@tempdima}% + \addtolength{\NDC@first}{\@tempdima}% + \sbox{\@tempboxa}{X}% + \addtolength{\NDC@first}{-\ht\@tempboxa}% + \addtolength{\NDC@first}{\NDC@voffset}% + \addtolength{\NDC@first}{\ht\NDC@dropcapbox}% + \addtolength{\NDC@voffset}{-\value{NDC@lines}\@tempdima}% + \addtolength{\NDC@voffset}{\@tempdima}% + \par% + \setlength{\NDC@Pindent}{\wd\NDC@dropcapbox}% + \addtolength{\NDC@Pindent}{\NDC@hoffset}% + \settowidth{\NDC@first}{\NDC@ante}% + \addtolength{\NDC@Pindent}{\NDC@first}% + \addtolength{\NDC@Pindent}{\NDC@Gap}% + \setlength{\NDC@first}{\linewidth}% + \addtolength{\NDC@first}{-\NDC@Pindent}% + \addtolength{\NDC@Nindent}{\NDC@Pindent}% + \setlength{\NDC@next}{\linewidth}% + \addtolength{\NDC@next}{-\NDC@Nindent}% + \addtolength{\NDC@Pindent}{\rightmargin}% + \addtolength{\NDC@Nindent}{\rightmargin}% + \setlength{\NDCboxwidth}{\wd\NDC@dropcapbox}% + \setlength{\NDCboxheight}{\ht\NDC@dropcapbox}% + \setlength{\NDCboxdepth}{\dp\NDC@dropcapbox}% + \addtocounter{NDC@lines}{1}% + \addtocounter{NDC@lines}{\value{NDC@depth}}% + \def\NDC@parshape{\c@NDC@lines \the\NDC@Pindent \the\NDC@first}% + \@tempcnta=\tw@% + \@whilenum \@tempcnta<\c@NDC@lines\do{% + \edef\NDC@parshape{\NDC@parshape \the\NDC@Nindent \the\NDC@next}% + \advance\@tempcnta\@ne}% + \edef\NDC@parshape{\NDC@parshape \rightmargin \the\linewidth}% + \noindent% + \parshape=\NDC@parshape\relax% + \smash{% + \llap{% + \mbox{\NDC@ante}% + \raisebox{\NDC@voffset}{\usebox{\NDC@dropcapbox}}% + \hskip\the\NDC@Gap% + }% + }% + \fi% +}% end @NDCdropcap +\ExplSyntaxOff +%% + + +%% In case the user prefers `lettrine': +\gdef\@ActivateDropCaps{% called by `novel.cls' \AtBeginDocument + \@ifpackageloaded{lettrine}{% + \global\LettrineOnGridtrue % Necessary. + \gsetlength\DiscardVskip{10\nbs} % effectively infinite + }{ % For test purposes only: + \providecommand\lettrine[3][]{##2##3} % echoes its mandatory arguments + }% +}% end \@ActivateDropCaps + + + +%% +\endinput +%% +%% End of file `novel-DropCap.sty'. + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-FOGRA39.clo b/Master/texmf-dist/tex/lualatex/novel/novel-FOGRA39.clo index e5d7bfa9f4e..dab3501fb94 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-FOGRA39.clo +++ b/Master/texmf-dist/tex/lualatex/novel/novel-FOGRA39.clo @@ -1,14 +1,27 @@ -% Typically used in Europe. Novel file version 1.46.2 +%% +%% This is file `novel-FOGRA39.clo', part of `novel' document class. +%% The values of the arguments are public industry standards. +\ProvidesFile{novel-FOGRA39.clo}% +[2018/01/14 any version. (novel Output Intent FOGRA39)] +%% -% The values of the arguments are public industry standards. + +% Typically used in Europe. % Remember: TeX special characters must be backslashed here. % You may see % or # or _ in the data or file names. % Be sure that they are written as \% \# \_ or there will be trouble. +% If any line is long, let it wrap. Do not attempt to break it onto multiple lines. + \gdef\@OIidentifier{FOGRA39} % also called "reference name" \gdef\@OIcondition{Offset commercial and specialty printing according to ISO 12647-2:2004 / Amd 1, paper type 1 or 2 (gloss or matte coated offset, 115 g/m2), screen frequency 60/cm.} \gdef\@OIinfo{Coated FOGRA39 (ISO 12647-2:2004)} \gdef\@OIregistry{http://www.color.org} \gdef\@OIprofile{CoatedFOGRA39.icc} +%% +\endinput +%% +%% end of file `novel-FOGRA39.clo' + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-FileData.sty b/Master/texmf-dist/tex/lualatex/novel/novel-FileData.sty index 4cf322f3bdb..56d349d332e 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-FileData.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-FileData.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-FileData.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-FileData.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% %% This file may be distributed and/or modified under the @@ -13,22 +13,42 @@ %% %% \ProvidesFile{novel-FileData.sty}% -[2018/01/14 v1.46.2 LaTeX file (File Data settings)] +[2018/03/28 v1.50 LaTeX file (File Data settings)] %% +%% File Data, also known as PDF Metadata, is non-printing identifying +%% information in the PDF file. Some or all of it can be read by various +%% PDF reader software. +%% PDF/X is also considered File Data, as it concerns the structure of the +%% file and its relationaship to printers, rather than its visible content. +%% In principle, you could set the title as empty. But in that case, no other +%% File Data will be included, and you cannot have PDF/X compliance. +%% There are many more kinds of File Data that a PDF can include, such as +%% subject and keywords. But `novel' is specifically for printing to paper, +%% not for electronic documents that would be found by database search. +%% Thus, there is no provision for such additional File Data. +%% When you sign up with a print service, you will provide subject, keywords, +%% and description directly to their database, rather than in the PDF. +%% No need to set copyright in metadata, since your file is only for use by +%% the print service, and is not being distributed as a PDF e-book. +%% Your copyright notice is on the printed page, where it should be. +%% Particularly note that your print service is NOT the publisher: YOU are! + + %% FILE DATA (PDF Metadata) -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% % \title{} or \SetTitle{} % Copied to File Data at end of Preamble, unless not set. % Provides \theTitle anywhere. % If not set, PDF cannot conform to PDF/X. +\newif \if@HasTitle % true if \SetTitle or \title used \gdef\SetTitle#1{\gdef\@title{#1}} % for stylistic consistency \gdef\title#1{\gdef\@title{#1}} \gdef\thetitle{\@title} % for convenience \gdef\theTitle{\@title} -\SetTitle{} +\SetTitle{IMPORTANT: Provide Book Title} % Default v. 1.46.1. Formerly empty. % % \author{} or \SetAuthor{} % Copied to File Data at end of preamble, unless not set. @@ -51,41 +71,32 @@ % \SetApplication{} (rarely used) % Also known as CreatorTool. % Name of the software that created the source document. -% Changing this does not change the software, it just changes the name. +% Changing this does not change the software, it just changes the information. % Normally leave as default, but can change if urgent. \gdef\SetApplication#1{\gdef\@novelApplication{#1}} \SetApplication{LuaLaTeX with novel and microtype} % default % % \SetProducer{} (rarely used) -% Name of the software that compiles to source to make PDF. -% Changing this does not change the software, it just changes the name. +% Name of the software that compiles the source to make PDF. +% Changing this does not change the software, it just changes the information. % Normally leave as default, but can change if urgent. \gdef\SetProducer#1{\gdef\@novelProducer{#1}} \SetProducer{LuaLaTeX with novel-pdfx and hyperref} % default % -% Although some other data fields could have been added, -% they do not pertain to fiction, especially if your book is print-on-demand. -% For example, subject, keywords and description are not read from PDF metadata, -% you enter them in a form, when you obtain the ISBN. -% No need to set copyright in metadata, since your book is only for use by -% the print service, and is not being distributed as a PDF e-book. -% Your copyright notice is on the printed page, where it should be. -% Particularly note that your print service is NOT the publisher: YOU are! -% %% End file data. %% SET PDF/X ARGUMENTS -%% ----------------------------------------------------------------------------- -%% Arguments: [embed-icc or no-embed]{compliance standard}{output intent} -%% Default option is no-embed. -%% When this command is not used, it is equivalent to compliance `off'. +%% ---------------------------------------------------------------------------- +%% \SetPDFX[Output Intent]{compliance standard} % No embed *.icc. Default. +%% \SetPDFX*[Output Intent]{compliance standard} % Embed *.icc. +%% Default up to and including v. 1.46: \SetPDFX{off} +%% Default as of v. 1.46.1: \SetPDFX[CGATSTR001]{X-1a:2001} % -\newif \if@chosenComplianceOK -\newif \if@chosenEmbedOK -\newif \if@gotConformance -\newif \if@noembedicc \@noembedicctrue -\newif \ifpdfx@isOFF \pdfx@isOFFtrue +% \@pdfxSEToff refers to the setting, rather than whether it really is off. +% \@pdfxISoff refers to whether it really is off. +\newif \if@pdfxSEToff % Prior to v. 1.46.1, was \ifpdfx@isOFF. +\newif \if@pdfxISoff % New in v. 1.46.1. % These will get meaningful info when an output intent file is loaded: \gdef\@OIidentifier{} \gdef\@OIcondition{} @@ -94,76 +105,103 @@ \gdef\@OIprofile{} % %% +\newif \if@HasConformance +\newif \if@EmbedICC \gdef\SetPDFX{\@ifstar\@setpdfxst\@setpdfxns} \newcommand\@setpdfxst[2][CGATSTR001]{ - \global\@noembediccfalse + \global\@EmbedICCtrue \@setpdfx{#1}{#2} } \newcommand\@setpdfxns[2][CGATSTR001]{ - \global\@noembedicctrue + \global\@EmbedICCfalse \@setpdfx{#1}{#2} } % \newcommand\@setpdfx[2]{ + \@tempTFfalse \ifthenelse{\equal{#2}{off}}{ - \global\pdfx@isOFFtrue - \@chosenComplianceOKtrue + \@tempTFtrue + \global\@pdfxSETofftrue + \global\@pdfxISofftrue }{} \ifthenelse{\equal{#2}{X-1a:2001}}{ - \pdfx@isOFFfalse - \@chosenComplianceOKtrue + \@tempTFtrue + \global\@pdfxSETofffalse + \global\@pdfxISofffalse \gdef\@PDFversion{PDF/X-1} \gdef\@PDFXversion{PDF/X-1a:2001} \gdef\@PDFXconformance{PDF/X-1a:2001} - \global\@gotConformancetrue + \global\@HasConformancetrue \global\pdfminorversion=3 }{} \ifthenelse{\equal{#2}{X-1a:2003}}{ - \pdfx@isOFFfalse - \@chosenComplianceOKtrue + \@tempTFtrue + \global\@pdfxSETofffalse + \global\@pdfxISofffalse \gdef\@PDFversion{PDF/X-1} \gdef\@PDFXversion{PDF/X-1a:2003} \gdef\@PDFXconformance{PDF/X-1a:2003} - \global\@gotConformancetrue + \global\@HasConformancetrue \global\pdfminorversion=3 }{} \ifthenelse{\equal{#2}{X-3:2002}}{ - \pdfx@isOFFfalse - \@chosenComplianceOKtrue + \@tempTFtrue + \global\@pdfxSETofffalse + \global\@pdfxISofffalse \gdef\@PDFversion{PDF/X-3} \gdef\@PDFXversion{PDF/X-3:2002} \global\pdfminorversion=3 }{} \ifthenelse{\equal{#2}{X-3:2003}}{ - \pdfx@isOFFfalse - \@chosenComplianceOKtrue + \@tempTFtrue + \global\@pdfxSETofffalse + \global\@pdfxISofffalse \gdef\@PDFversion{PDF/X-3} \gdef\@PDFXversion{PDF/X-3:2003} \global\pdfminorversion=4 }{} - \if@chosenComplianceOK\else + \if@tempTF\else \ClassError{novel}{Bad compliance argument for \string\SetPDFX}% - {Choose: off, X-1a:2001, X-1a:2003, X-3:2002, X-3:2003.^^J}% - \fi - % - \ifpdfx@isOFF\else % Output Intent ignored if compliance is `off'. - % Grab the file that defines the output intent information: - \makeatletter % Apparently needed when non-*.sty is input within a command! - \IfFileExists{novel-#1.clo}{\input{novel-#1.clo}}{ - \ClassError{novel}{Bad Output Intent argument for \string\SetPDFX}% - {Use filename (without~extension) of a file with *.clo~extension. ^^J% - Filename must begin with novel- ^^J% - The file must be where TeX can find it. Or use standard code: ^^J% - CGATSTR001, FOGRA39, JC200103.}% - } - \makeatother % back to usual + {Choose: X-1a:2001, X-1a:2003, X-3:2002, X-3:2003, off.}% \fi + % Grab the file that defines the Output Intent information: + % File name format: novel-YourIntent.clo + % Setting: \SetPDFX[YourIntent]{compliance} + % Contents of file: See the above included Output Intent data. + \StrDel{#1}{\space}[\NPDFXOINS] + \IfFileExists{novel-\NPDFXOINS.clo}{\input{novel-\NPDFXOINS.clo}}{% + \ClassError{novel}{Bad Output Intent for \string\SetPDFX}% + {Use filename (without extension) of a file with *.clo extension. ^^J% + Filename must begin with novel- ^^J% + Example: File novel-FOGRA39.clo is called as [FOGRA39]. ^^J% + The file must be where TeX can find it. ^^J% + For contents of the file, see package documentation.}% + }{}% } % end \@setpdfx % +\SetPDFX[CGATSTR001]{X-1a:2001} % Default, from v. 1.46.1. Formerly off. %% +%% Neutralize file data settings: +\gdef\@DisableFileDataSettings{% called by `novel.cls' \AtBeginDocument + \let\title\relax + \let\author\relax + \let\subtitle\relax + \LetLtxMacro\SetAuthor\relax + \LetLtxMacro\SetTitle\relax + \LetLtxMacro\SetSubtitle\relax + \LetLtxMacro\SetApplication\relax + \LetLtxMacro\SetProducer\relax + \LetLtxMacro\SetPDFX\relax +}% end \@DisableFileDataSettings +%% + + + +%% +\endinput %% %% End of file `novel-FileData.sty'. diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty b/Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty deleted file mode 100644 index 44b1478107f..00000000000 --- a/Master/texmf-dist/tex/lualatex/novel/novel-FontDefaults.sty +++ /dev/null @@ -1,211 +0,0 @@ -%% -%% This is file `novel-FontDefaults.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-FontDefaults.sty}% -[2018/01/14 v1.46.2 LaTeX file (default fonts)] -%% - - -%% -%% This file is loaded \AtEndPreamble. -%% - -%%%%% - -%% Most TeX installations will use Latin Modern or Computer Modern -%% as default fonts. These are unsuitable for commercial fiction. -%% But `novel' class uses Libertinus as defaults. -%% Change them using \SetParentFont and other fontspec commands, in Preamble. -% Libertinus Serif has Regular, Italic, Bold, Bold Italic. -% But here, Semibold over-rides Bold. -% -%% Now to activate the font definitions: -%% The parent font, ancestor of the main font, and some others: -\if@parentfontset\else % fixed in v. 1.43.1 - \ifthenelse{\equal{\rmdefault}{lmr}}{% - % At this point, if \rmdefault is lmr, it means that the user did not choose - % a different font. Then, Libertinus Serif or Latin Modern Roman - % will be automatically set as \rmdefault: - \IfFontExistsTF{Libertinus Serif}{ % preferred default - \SetParentFont[% - BoldFont=libertinusserif-semibold.otf,% - BoldItalicFont=libertinusserif-semibolditalic.otf,% - ]{Libertinus Serif} - }{ % backup default: - \SetParentFont[% - SmallCapsFont={Latin Modern Roman Caps}% - ]{Latin Modern Roman}% only because it comes with LaTeX - \let\scshape\oldscshape % or small caps won't work - \let\smcp\oldscshape % ditto - }% - }{% However, if \rmdefault is not lmr, it means that the user chose the font. - % If the choice was made via \SetParentFont, no problem. But if done by - % incorrect method such as \setmainfont, \renewcommand\rmdefault, - % or \usepackage{fontname}, then an error is thrown (warning prior to v 1.44): - \if@parentfontset\else - \ClassError{novel}{Wrong command used to set main font}% - {You attempted to define the main document font using a command such as^^J% - \string\renewcommand\string\rmdefault\space or \string\usepackage^^J% - or \string\setmainfont. These are incorrect in `novel' class.^^J% - Use \string\SetParentFont\space instead. See `novel' documentation.^^J}% - \fi - }% -\fi -% Now we are ready to set the main font: -\setmainfont[\parentfontfeatures]{\parentfontname} -\let\mainfont\rmfamily\relax % compatibility -%% - -% The mono font: -\ifthenelse{\equal{\ttdefault}{lmtt}}{% over-ride: - \IfFontExistsTF{Libertinus Mono}{ - \setmonofont[% - ItalicFont={},% Doesn't have these. - BoldFont={},% - BoldItalicFont={},% - ]{Libertinus Mono} - }{ - \setmonofont{Latin Modern Mono}% Eeek! Only because you have it! - } -}{} % User \setmonofont, so leave alone. -%% -% The sans font: -\ifthenelse{\equal{\sfdefault}{lmss}}{ % override: - \IfFontExistsTF{Libertinus Sans}{ - \setsansfont{Libertinus Sans} - }{ - \setsansfont{Latin Modern Sans}% Eeek! Only because you have it! - } -}{} % User \setsansfont, so leave alone. -%% - -%% -% New in version 1.38, \straightquote and \straightdblquote: -\gdef\straightquote{{\addfontfeature{Ligatures=ResetAll}'}} -\gdef\straightdblquote{{\addfontfeature{Ligatures=ResetAll}"}} -%% - -%% The novel-specific fonts: -\if@chapterfontset\else - \SetChapterFont[\parentfontfeatures,Scale=1.6]{\parentfontname} -\fi -\newfontfamily\chapterfont[\@chapterfontfeatures]{\@chapterfontname} -%% -\if@subchfontset\else - \SetSubchFont[\parentfontfeatures,Scale=1.2]{\parentfontname} -\fi -\newfontfamily\subchfont[\@subchfontfeatures]{\@subchfontname} -%% -\newif \if@headfontdefault -\if@headfontset\else - \SetHeadFont[Letters=SmallCaps,\parentfontfeatures,Scale=0.92]{\parentfontname} - \global\@headfontdefaulttrue -\fi -\newfontfamily\headfont[\@headfontfeatures]{\@headfontname} -%% -%% The decofont must be NovelDeco.otf or a user modification of that font: -\if@decofontset\else - \IfFontExistsTF{NovelDeco.otf}{ - \SetDecoFont{NovelDeco} - }{} -\fi -%% -\gdef\acronym#1{#1}% Re-defined below, if decofont available. -%% -%% Now to get the decofont activated: -% Decorative glyphs, only in this font. Should not be re-set by user: -\gdef\decoglyph#1{~}% If NovelDeco not found, nonbreaking space in main text. -% -\if@gotdeco % NovelDeco or a user-defined alternative was found: - \newfontface\@decoglyph[% - \@decofontfeatures,% - ]{\@decofontname} - \newfontface\@decoglypha[% - \@decofontfeatures,RawFeature=+ss01,% - ]{\@decofontname} - \newfontface\@decoglyphb[% - \@decofontfeatures,RawFeature=+ss02,% - ]{\@decofontname} - \newfontface\@decoglyphc[% - \@decofontfeatures,RawFeature=+ss03,% - ]{\@decofontname} - % - \gdef\decoglyph#1{% Be sure to use % without preceding space: - \IfBeginWith{#1}{n}{% normal weight symbol (same as regular) - \StrBehind{#1}{n}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}% - }{}% - \IfBeginWith{#1}{r}{% regular weight symbol - \StrBehind{#1}{r}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}% - }{}% - \IfBeginWith{#1}{l}{% light weight symbol - \StrBehind{#1}{l}[\@tempdecoglyph]{\@decoglypha\symbol{\@tempdecoglyph}}% - }{}% - \IfBeginWith{#1}{e}{% extra light weight symbol - \StrBehind{#1}{e}[\@tempdecoglyph]{\@decoglyphb\symbol{\@tempdecoglyph}}% - }{}% - \IfBeginWith{#1}{t}{% thin weight symbol - \StrBehind{#1}{t}[\@tempdecoglyph]{\@decoglyphc\symbol{\@tempdecoglyph}}% - }{}% - }% end gdef decoglyph - % - % The trouble with acronyms is that they look too big in regular capitals, - % and too small in small caps. Command \acronym{} tries to provide an - % intermediate size. The letters were drawn from Linux Libertine, scaled, - % weights adjusted, the placed in NovelDeco.otf. - \gdef\acronym#1{{\decofont{#1}}} - % -\fi% end \if@gotdeco -% -% Math font is not needed, because `novel' does not typeset math. -% If you have the Libertinus fonts installed, might as will specify for math. -% Then Latin Modern Math if installed. -% If not, NovelDeco.otf "fakes" math capability, just to fool the fontloader: -\IfFontExistsTF{Libertinus Math}{ - \setmathfont[BoldFont={libertinusmath-regular.otf}]{libertinusmath-regular.otf} -}{ - \IfFontExistsTF{Latin Modern Math}{}{% already set as default by unicode-math. - }{ - \setmathfont[BoldFont={NovelDeco.otf}]{NovelDeco.otf} - } -}% -%% - - -% -%% This provides default microtype settings, allows the user to over-ride, -% and hopefully prevents the user from choosing inappropriate settings: -\let\microtypesetup\relax % fake command no longer needed -\if@setmicrotype % user wrote \microtypesetup{} in Preamble - \IfSubStr{\@mymicrotypesetup}{config}{% user specified own config file - \gdef\@mymicrotypeset{\@mymicrotypesetup} - }{ % default to novel's config file - \gdef\@mymicrotypeset{% - config=novel-microtype,final,\@mymicrotypesetup} - } -\else % user did not write \microtypesetup{} in Preamble - \gdef\@mymicrotypeset{% - config=novel-microtype,final,stretch=20,shrink=20} -\fi -\if@mtoff\else - \RequirePackage[\@mymicrotypeset]{microtype} -\fi -% -%% - - - -% -%% End of file `novel-FontDefaults.sty' - - diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-Fonts.sty b/Master/texmf-dist/tex/lualatex/novel/novel-Fonts.sty new file mode 100644 index 00000000000..68c5d9270b8 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-Fonts.sty @@ -0,0 +1,416 @@ +%% +%% This is file `novel-Fonts.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-Fonts.sty}% +[2018/03/28 v1.50 LaTeX file (font settings and defaults)] +%% + + +%% Package `fontspec' was previously loaded by `\novel.cls'. + + +%% INITIALIZATION +%% ---------------------------------------------------------------------------- +% Fonts are chosen in Preamble using \Set commands. But they are not activated +% until \AtEndPreamble. Until then, the basic TeX font families must be +% temporarily specified, so that certain packages can load without compliant. +% These are Latin Modern fonts, which are Open Type and will work, but are not +% stylistically suitable for works of fiction. The only reason they are +% used here, is because just about every TeX installation has them. +\gdef\rmdefault{lmr} % Latin Modern Roman +\gdef\sfdefault{lmss} % Latin Modern Sans +\gdef\ttdefault{lmtt} % Latin Modern Mono +% 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\@CheckFontspecFeatures#1{% + \@tempTFfalse% + \IfSubStr{#1}{Color}{\@tempTFtrue}{}% + \IfSubStr{#1}{Colour}{\@tempTFtrue}{}% + \IfSubStr{#1}{color}{\@tempTFtrue}{}% + \IfSubStr{#1}{colour}{\@tempTFtrue}{}% + \IfSubStr{#1}{Opacity}{\@tempTFtrue}{}% + \IfSubStr{#1}{opacity}{\@tempTFtrue}{}% + \if@tempTF% + \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.}% + \fi% +} % end \@CheckFontspecFeatures +% Default font features (will be changed later): +\defaultfontfeatures{} % reset +\defaultfontfeatures{SmallCapsFeatures={Renderer=Basic},Ligatures=TeX,} % all +% Main and sans fonts: kerning, ligatures, and OldStyle numbers if available: +\defaultfontfeatures[\rmfamily,\sffamily]% + {Kerning=On,Numbers=OldStyle,Ligatures=Common} +% Fake \microtypesetup until package loaded by \@ActivateFonts, \AtEndPreamble: +\newif \if@MicrotypeSet +\gdef\microtypesetup#1{ + \gdef\@mymicrotypesetup{#1} % used in novel-Fonts.sty + \global\@MicrotypeSettrue +}% +%% end initialization + + +%% SETTINGS FOR PARENT FONT, DESCENDANTS, OTHERS +%% ---------------------------------------------------------------------------- +% In `novel' you do not \usepackage{font name} or \RequirePackage{font name}. +% You do not directly write \renewcommand\rmdefault{font name}. +% You do not directly use \setmainfont[features]{font name}. +% Instead, `novel' requires a `parent font' to be set. The parent font is +% the ancestor of the main (normal) font, and several other descendants. +% The parent font features, if any, should be a minimal set that will be +% applied to all descendants. For example, if the font has an an alternate +% style for a particular letter, and you want to use it for all descendants, +% then you would spedify that feature for the parent font. +% For now, these settings are merely stored. Later, \AtEndPreamble, +% the main (normal) font inherits the settings for the parent font. +% Other descendants inherit those settings, with their own features added. +% Anything not set by you, will have a suitable default set automatically. +\newif \if@ParentFontSet +\gdef\parentfontfeatures{} +\gdef\parentfontname{} +\DeclareDocumentCommand \SetParentFont { O{} m O{} } {% from version 1.1. + \@CheckFontspecFeatures{#1,#3} + \gdef\parentfontfeatures{#1,#3} + \gdef\parentfontname{#2} + \global\@ParentFontSettrue +}% +\DeclareDocumentCommand \SetMasterFont { O{} m O{} } {% DEPRECATED + \@CheckFontspecFeatures{#1,#3} + \gdef\parentfontfeatures{#1,#3} + \gdef\parentfontname{#2} + \global\@ParentFontSettrue +}% +% +% In a work of fiction, you probably do not need a sans or mono font. +% But TeX expects you do have them. So, \AtEndPreamble, Libertinus Sans +% and Libertinus Mono will be set as defaults, if you have those fonts. +% Otherwise, Latin Modern Sans and Mono will be used, but they are not +% well-suited to works of fiction. +% If you wish to set your own sans and mono fonts, do it using standard +% `fontspec' syntax. There is no special method in `novel' class: +% \setsansfont[features]{font name} +% \setmonofont[features]{font name} +% +% The headfont is used in headers and footers: +\newif \if@HeadFontSet +\gdef\@headfontfeatures{} +\gdef\@headfontname{} +\DeclareDocumentCommand \SetHeadFont { O{} m O{} } {% revised v 1.40.3 + \@CheckFontspecFeatures{#1,#3} + \gdef\@headfontfeatures{Numbers=Lining,% + WordSpace=\@looseheadword,#1,#3}% loose letters added in head/foot styles + \gdef\@headfontname{#2} + \global\@HeadFontSettrue +}% +% The chapter font is used by the \ChapterTitle{} command: +\newif \if@ChapterFontSet +\gdef\@chapterfontfeatures{} +\gdef\@chapterfontname{} +\DeclareDocumentCommand \SetChapterFont { O{} m O{} } {% + \@CheckFontspecFeatures{#1,#3} + \gdef\@chapterfontfeatures{Numbers=Lining,#1,#3} + \gdef\@chapterfontname{#2} + \global\@ChapterFontSettrue +}% +% The subch font is used by the \ChapterSubtitle{} command: +\newif \if@SubchFontSet +\gdef\@subchfontfeatures{} +\gdef\@subchfontname{} +\DeclareDocumentCommand \SetSubchFont { O{} m O{} } {% + \@CheckFontspecFeatures{#1,#3} + \gdef\@subchfontfeatures{Numbers=Lining,#1,#3} + \gdef\@subchfontname{#2} + \global\@SubchFontSettrue +}% +% 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@HasDecoFont +\gdef\@decofontfeatures{} +\gdef\@decofontname{} +\DeclareDocumentCommand \SetDecoFont { O{} m O{} } {% + \@CheckFontspecFeatures{#1,#3} + \gdef\@decofontname{#2} + \global\@DecoFontSettrue + \global\@HasDecoFonttrue + \newfontface\decofont[#1,#3]{#2} +}% +% For syntax consistency: +\ExplSyntaxOn +\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 +\ExplSyntaxOff +% New in v. 1.50: built-in drop caps. +\gdef\@DropCapFont{} % until actually set, will be default main font +\gdef\@DropCapColorModel{} % until actually set, using `xcolor' syntax +\gdef\@DropCapColorValue{black} % until actually set, using `xcolor' syntax +\gdef\NDC@charstyle{} +\ExplSyntaxOn +% The argument to \SetDropCapFont is a user-defined `fontspec' font command. +% Example syntax, using `fontspec' in LuaLaTeX: +% Create font command, such as: \newfontface\mynicefont[options]{fontname} +% Then: \SetDropCapFont{\mynicefont} +\newif \if@HasDropCapFont +\DeclareDocumentCommand \SetDropCapFont { m } {% + \@HasDropCapFonttrue% + \gdef\@DropCapFont{#1}% + \gdef\NDC@charstyle{% + #1% + \if@HasDropCapColor% + \ifthenelse{\equal{\@DropCapColorModel}{}}{% + \color{\@DropCapColorValue}% + }{% + \color[\@DropCapColorModel]{\@DropCapColorValue}% + }% + \fi% + }% +}% +% The argument(s) to \SetDropCapColor use `xcolor' syntax: +% [colormodel]{value} OR {colorname} +\newif \if@HasDropCapColor +\DeclareDocumentCommand \SetDropCapColor { O{} m } {% + \@setdropcapcolor[#1]{#2}% +}% end \SetDropCapColor +\DeclareDocumentCommand \@setdropcapcolor { O{} m } {% + \global\@HasDropCapColortrue% + \gdef\@DropCapColorModel{#1}% + \gdef\@DropCapColorValue{#2}% + \renewcommand\NDC@charstyle{% + \@DropCapFont% + \ifthenelse{\equal{\@DropCapColorModel}{}}{% + \color{\@DropCapColorValue}% + }{% + \color[\@DropCapColorModel]{\@DropCapColorValue}% + }% + }% +}% end \@setdropcapcolor +% for convenience: +\cs_new_eq:NN \SetDropcapFont \SetDropCapFont +\cs_new_eq:NN \SetDropcapColor \SetDropCapColor +\ExplSyntaxOff +% +% A default math font (which presumably you do not need) is chosen here. +% You may over-ride using `unicode-math' syntax \setmathfont in Preamble. +\IfFontExistsTF{Libertinus Math}{ % stylistically consisent with novel text + \setmathfont[BoldFont={libertinusmath-regular.otf}]% + {libertinusmath-regular.otf} +}{ + \IfFontExistsTF{Latin Modern Math}{}{% default for package `unicode-math' + }{ % The following hack allows you to proceed without a real math font, + % (but then you cannot print math): + \IfFontExistsTF{NovelDeco.otf}{% + \setmathfont[BoldFont={NovelDeco.otf}]{NovelDeco.otf} % fake math feature + \ClassWarning{novel}{^^JIgnore this if you used \string\setmathfont. ^^J% + Did not find suitable default math font. Used NovelDeco.otf. ^^J% + But NovelDeco does not have real math symbols. ^^J% + Math notation will print incorrectly. No problem if no math. ^^J}% + }{}% if no NovelDeco, do nothing here + } +}% +%% end settings for parent font and others. + + +%% CREATING NEW FONT FONT FEATURES +%% ---------------------------------------------------------------------------- +% \CreateFontFeature{substitutions}{feature code} +% Problem: 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): +% \SetParentFont[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. + + +%% ACTIVATE FONTS \AtEndPreamble +%% ---------------------------------------------------------------------------- +\gdef\@ActivateFonts{% called by `novel.cls' \AtEndPreamble + % We begin with the parent font: + \if@coverart %%%%% + \SetParentFont{NovelDeco.otf} %%%%% + \fi %%%%% + \if@ParentFontSet\else + \ifthenelse{\equal{\rmdefault}{lmr}}{% + % At this point, if \rmdefault is lmr, it means the user did not choose + % a different font. Then, Libertinus Serif or Latin Modern Roman + % will be automatically set as \rmdefault, if available: + \IfFontExistsTF{Libertinus Serif}{ % preferred default + \SetParentFont[% + BoldFont=libertinusserif-semibold.otf,% + BoldItalicFont=libertinusserif-semibolditalic.otf,% + ]{Libertinus Serif} + }{ % backup default, if Libertinus Serif not available: + \SetParentFont[% + SmallCapsFont={Latin Modern Roman Caps}% + ]{Latin Modern Roman}% only because it comes with LaTeX + \let\scshape\oldscshape % or small caps won't work + \let\smcp\oldscshape % or small caps won't work + }% + }{% However, if \rmdefault is not lmr, it means the user chose the font. + % If the choice was made via \SetParentFont, no problem. But if done by + % incorrect method such as \setmainfont, \renewcommand\rmdefault, + % or \usepackage{fontname}, an error is thrown: + \if@ParentFontSet\else + \ClassError{novel}{Wrong command used to set main font}% + {You tried to define the main document font the wrong way. ^^J% + Bad: \string\renewcommand\string\rmdefault\{font\}\space ^^J% + Bad: \string\usepackage\{font package\}\space ^^J% + Bad: \string\RequirePackage\{font package\}\space ^^J% + Bad: \string\setmainfont[features]\{font\}\sapce ^^J% + Those are incorrect in `novel' class. ^^J% + Use \string\SetParentFont[features]\{font\}\space instead. ^^J% + See `novel' documentation.}% + \fi + }% + \fi % end \if@ParentFontSet + % Now we are ready for the main (normal) font, descending from parent font: + \setmainfont[\parentfontfeatures]{\parentfontname} + \let\mainfont\rmfamily\relax % backwards compatibility + % The headfont, which descends from parent font: + \if@HeadFontSet\else % default if not user-set: + \SetHeadFont[Letters=SmallCaps,\parentfontfeatures,Scale=0.92]% + {\parentfontname} + \fi + \newfontfamily\headfont[\@headfontfeatures]{\@headfontname} + % The chapter font, descending from parent font: + \if@ChapterFontSet\else % if no user-set font, default: + \SetChapterFont[\parentfontfeatures,Scale=1.6]{\parentfontname} + \fi + \newfontfamily\chapterfont[\@chapterfontfeatures]{\@chapterfontname} + % The subch font, descending from parent font: + \if@SubchFontSet\else % if no user-set font, default: + \SetSubchFont[\parentfontfeatures,Scale=1.2]{\parentfontname} + \fi + \newfontfamily\subchfont[\@subchfontfeatures]{\@subchfontname} + % The remaining fonts are not descendants of parent font: + % The mono font: + \ifthenelse{\equal{\ttdefault}{lmtt}}{% over-ride: + \IfFontExistsTF{Libertinus Mono}{ % if available + \setmonofont[% + ItalicFont={},% Doesn't have these. + BoldFont={},% + BoldItalicFont={},% + ]{Libertinus Mono} + }{ + \setmonofont{Latin Modern Mono}% backup + } + }{} % User \setmonofont, so leave alone. + % The sans font: + \ifthenelse{\equal{\sfdefault}{lmss}}{ % override: + \IfFontExistsTF{Libertinus Sans}{ % if available + \setsansfont{Libertinus Sans} + }{ + \setsansfont{Latin Modern Sans}% backup + } + }{} % User \setsansfont, so leave alone. + % The decofont must be NovelDeco.otf or a user modification of that font: + \if@DecoFontSet\else + \IfFontExistsTF{NovelDeco.otf}{ + \SetDecoFont{NovelDeco} + }{} % if not available, this will be detected below + \fi + % Decorative glyphs, only in this font. Should not be re-set by user. + \if@HasDecoFont % NovelDeco or a user-defined alternative was found: + \newfontface\@decoglyph[% + \@decofontfeatures,% + ]{\@decofontname} + \newfontface\@decoglypha[% + \@decofontfeatures,RawFeature=+ss01,% + ]{\@decofontname} + \newfontface\@decoglyphb[% + \@decofontfeatures,RawFeature=+ss02,% + ]{\@decofontname} + \newfontface\@decoglyphc[% + \@decofontfeatures,RawFeature=+ss03,% + ]{\@decofontname} + \fi% end \if@HasDecoFont + % New in version 1.50: + \if@HasDecoFont + \NewFontFace\decodropcapfont[RawFeature=+dcap]{\@decofontname} + \else + \NewFontFace\decodropcapfont[\parentfontfeatures,Numbers=Lining]% + {\parentfontname} + \fi + \if@HasDropCapFont\else + \SetDropCapFont{\decodropcapfont} % default + \fi + % This provides default microtype settings, allows the user to over-ride, + % and hopefully prevents the user from choosing inappropriate settings: + \let\microtypesetup\relax % fake command no longer needed + \if@MicrotypeSet % true if user wrote \microtypesetup{} in Preamble + \IfSubStr{\@mymicrotypesetup}{config}{% user specified own config file + \gdef\@mymicrotypeset{\@mymicrotypesetup} + }{ % default to novel's config file + \gdef\@mymicrotypeset{% + config=novel-microtype,final,\@mymicrotypesetup} + } + \else % user did not write \microtypesetup{} in Preamble + \gdef\@mymicrotypeset{% + config=novel-microtype,final,stretch=20,shrink=20} + \fi + \if@mtoff + \providecommand\textls[2][]{##2} % echoes its mandatory argument + \else + \RequirePackage[\@mymicrotypeset]{microtype} + \renewcommand\textls[2][]{##2} % nullifies the microtype command (problems) + \fi + % end microtypesetup +% +} % end \@ActivateFonts, called by `novel.cls' \AtEndPreamble. +%% + + +%% +\endinput +%% +%% End of file `novel-Fonts.sty' + + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-Footnotes.sty b/Master/texmf-dist/tex/lualatex/novel/novel-Footnotes.sty index a2d01335dd5..744302b2d07 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-Footnotes.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-Footnotes.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-Footnotes.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-Footnotes.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% %% This file may be distributed and/or modified under the @@ -13,13 +13,118 @@ %% %% \ProvidesFile{novel-Footnotes.sty}% -[2018/01/14 v1.46.2 LaTeX file (commands for footnotes and endnotes)] +[2018/03/28 v1.50 LaTeX file (commands for footnotes and endnotes)] +%% + + + +%% Markers (superscript, subscripts): +\newtoggle{@usesymbolmark} % true when footnote markers are symbolic +\newtoggle{@realmarker} % true when OT features sups, sinf, subs requested +% + + +%% superscripts and subscripts +\let\subs\relax +\let\sups\relax +\let\textsuperscript\relax +\let\textsubscript\relax +% Perhaps superscripts and subscripts (scientific) are in the font, or not. +% Problem: The best fonts have these characters at size/weight designed +% to mingle with normal size. But many fonts merely scaled characters, +% which will be too light at the small size. +% The unstarred version of these commands use the Open Type features when +% they are present, then faking (auto scale/raise) if features not present. +% The starred version just fakes, without regard for features. +% + +% Note that the effect of these commands continues, not just one-shot: +\gdef\realmarker{\global\toggletrue{@realmarker}} % anywhere in text +\gdef\fakemarker{\global\togglefalse{@realmarker}} % anywhere in text +\newlength\@hoAhl % height of Ahl, locally measured and set when needed +%% +\ExplSyntaxOn +% +\DeclareDocumentCommand \sups { m } {% + \iftoggle{@realmarker}{% + \fontspec_if_feature:nTF {sups}{% + \ifvmode\else\unskip\fi% + {\addfontfeature{VerticalPosition=Superior}\smash{#1}}% + }{% + \setlength\@hoAhl{\heightof{Ahl}}% local + \ifvmode\else\unskip\fi\charscale[0.7,0pt,0.5\@hoAhl]{#1}% + }% + }{% + \setlength\@hoAhl{\heightof{Ahl}}% local + \ifvmode\else\unskip\fi% + {\addfontfeature{Numbers=Lining}\charscale[0.7,0pt,0.5\@hoAhl]{#1}}% + }% +}% end \sups +% +\DeclareDocumentCommand \subs { m } {% + \iftoggle{@realmarker}{% + \fontspec_if_feature:nTF {sinf}{% + \ifvmode\else\unskip\fi% + {\addfontfeature{VerticalPosition=ScientificInferior}\smash{#1}}% + }{% + \fontspec_if_feature:nTF {subs}{% + \ifvmode\else\unskip\fi% + {\addfontfeature{VerticalPosition=Inferior}\smash{#1}}% + }{% + \setlength\@hoAhl{\heightof{Ahl}}% local + \ifvmode\else\unskip\fi\charscale[0.7,0pt,-0.2\@hoAhl]{#1}% + }% + }% + }{% + \setlength\@hoAhl{\heightof{Ahl}}% local + \ifvmode\else\unskip\fi% + {\addfontfeature{Numbers=Lining}\charscale[0.7,0pt,-0.2\@hoAhl]{#1}}% + }% +}% end \subs +% +\cs_new_eq:NN \textsuperscript \sups +\cs_new_eq:NN \textsubscript \subs +\ExplSyntaxOff +%% + + + +% \SetMarkerStyle 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.}% + }{} +} +\LetLtxMacro{\SetMarkers}{\SetMarkerStyle} % backward compatibilty pre-v1.40.3. +% +\SetMarkerStyle[real]{asterisk} % default %% %% FOOTNOTES -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- % In `novel' class, you may place footnotes at the botom of the textblock. % The markers may be symbolic (default begins with asterisk), or % set so that the asterisk is not used, or the markers may be numbers, @@ -28,6 +133,13 @@ % You can also make a non-marked footnote, which does not increment the count. +% Lengths used to tweak vertical position of symbolic (text) footnote markers: +\newlength\@twast % tweaks asterisk +\newlength\@twdag % tweaks dagger +\newlength\@twdbldag % tweaks double dagger +\newlength\@twsect % tweaks section mark +\newlength\@tweight % tweaks 8, reliably the tallest digit + %% footnotesize is calculated by layout, based on normal font size and skip. %% It is used only for actual footnotes! @@ -51,12 +163,12 @@ \newtoggle{@usenomark} % when true: no mark, no increment count \newtoggle{@placedfootnotenumber} % true if any numerical footnote placed % -\let\my@oldfootnote\footnote\relax % copies the original definition +\let\@myoldfootnote\footnote\relax % copies the original definition \let\footnote\relax % so it can be re-defined, below % \gdef\@fourem{% length of rule separating footnotes from main text - \vspace{-\nbs} - \noindent\strut\smash{\rule[-2pt]{0.33\textwidth}{0.05\normalFontSize}} + \vspace{-\nbs}% + \noindent\strut\smash{\rule[-2pt]{0.33\textwidth}{0.05\@SetFontSize}}% } \let\footnoterule\@fourem % @@ -77,12 +189,12 @@ }{% \global\togglefalse{@usenomark}% }% - \gdef\footnoterule{\@fourem}% + \gdef\footnoterule{\vfill\@fourem}% %%%%% \begingroup% - \def\footnotesize{% Not gdef. Only here in footnote. Calculated during layout. - \@setfontsize\footnotesize{\@myfootnotesizenum pt}{\@myfootnoteskipnum pt}% + \def\footnotesize{% Not gdef. Local to footnote. Calculated during layout. + \@setfontsize\footnotesize{\@myfootnotesizeN pt}{\@myfootnoteskipN pt}% }% - \unskip\my@oldfootnote{#2}% + \unskip\@myoldfootnote{#2}% \endgroup% } % end \footnote % @@ -103,22 +215,50 @@ {% \global\togglefalse{@placedfootnotenumber}% \ifthenelse{\equal{\@myfnsymbols}{*}}{% - \ifthenelse{\equal{\value{@fnsymbolcount}}{1}}{\charscale[1,0pt,-\@twast]{*}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{2}}{\charscale[0.8,0pt,-\@twdag]{†}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{3}}{\charscale[0.8,0pt,-\@twdbldag]{‡}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{4}}{\charscale[0.8,0pt,-\@twsect]{§}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{5}}{\charscale[1,0pt,-\@twast]{**}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{6}}{\charscale[0.8,0pt,-\@twdag]{††}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{7}}{\charscale[0.8,0pt,-\@twdbldag]{‡‡}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{8}}{\charscale[0.8,0pt,-\@twsect]{§§}}{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{1}}{% + \charscale[1,0pt,-\@twast]{*}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{2}}{% + \charscale[0.8,0pt,-\@twdag]{†}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{3}}{% + \charscale[0.8,0pt,-\@twdbldag]{‡}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{4}}{% + \charscale[0.8,0pt,-\@twsect]{§}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{5}}{% + \charscale[1,0pt,-\@twast]{**}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{6}}{% + \charscale[0.8,0pt,-\@twdag]{††}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{7}}{% + \charscale[0.8,0pt,-\@twdbldag]{‡‡}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{8}}{% + \charscale[0.8,0pt,-\@twsect]{§§}% + }{}% }{}% \ifthenelse{\equal{\@myfnsymbols}{†}}{% - \ifthenelse{\equal{\value{@fnsymbolcount}}{1}}{\charscale[0.8,0pt,-\@twdag]{†}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{2}}{\charscale[0.8,0pt,-\@twdbldag]{‡}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{3}}{\charscale[0.8,0pt,-\@twsect]{§}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{4}}{\charscale[0.8,0pt,-\@twdag]{††}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{5}}{\charscale[0.8,0pt,-\@twdbldag]{‡‡}}{}% - \ifthenelse{\equal{\value{@fnsymbolcount}}{6}}{\charscale[0.8,0pt,-\@twsect]{§§}}{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{1}}{% + \charscale[0.8,0pt,-\@twdag]{†}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{2}}{% + \charscale[0.8,0pt,-\@twdbldag]{‡}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{3}}{% + \charscale[0.8,0pt,-\@twsect]{§}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{4}}{% + \charscale[0.8,0pt,-\@twdag]{††}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{5}}{% + \charscale[0.8,0pt,-\@twdbldag]{‡‡}% + }{}% + \ifthenelse{\equal{\value{@fnsymbolcount}}{6}}{% + \charscale[0.8,0pt,-\@twsect]{§§}% + }{}% }{}% }{% \global\toggletrue{@placedfootnotenumber}% @@ -164,25 +304,40 @@ -%% ENDNOTES -%% ----------------------------------------------------------------------------- +%% ENDNOTES. Behavior modified in v. 1.50 (added error messages). +%% ---------------------------------------------------------------------------- % \endnote only places a marker. It does not store a note for later use. -% Since it gobbles following space, use \endnote{} when needed. -% The \memo{} command is helpful, to make a non-printing note to yourself. +% Any argument is non-printing. So \endnote{ancestry of yada} does not print +% anything other than the endnote marker number, and does not save +% `ancestry of Yada' for later use. The argument is a self-memo, so that you +% remember why you want an endnote there, when you look at the source. +% Following \endnote or \endnotetext with [ will produce an error. +% Reason: Confuses novel's commands with those from banned `endnote' package. % Whenever \endnote is used, the marker number and page is added to a list, -% and the list is typed into the log file after the document ends. That way, -% you can hunt down where the endnotes markers were placed. -\newtoggle{@gotendnotes} % true when \endnote used +% and the list is typed into the log file after the document ends. That way, +% you can hunt down where the endnotes markers were placed. +\newtoggle{@gotendnotes} % true if \endnote used % \long\gdef\@endnotelist{} \newcounter{@endnotecount} % -\DeclareDocumentCommand \endnote { } -{% -\global\toggletrue{@gotendnotes}% -\stepcounter{@endnotecount}\sups{\arabic{@endnotecount}}% -\long\edef\@endnotelist{\@endnotelist\space (\arabic{@endnotecount},p.\thepage)}% +\def\@addendnote{% + \global\toggletrue{@gotendnotes}% + \stepcounter{@endnotecount}\sups{\arabic{@endnotecount}}% + \long\edef\@endnotelist{% + \@endnotelist\space (\arabic{@endnotecount},p.\thepage)% + }% +} +\def\@nendnote#1{\@addendnote} +\def\@nenspace{\@addendnote\space} +\def\@nenerror{% + \ClassError{novel}{\string\endnote\space cannot be followed by [ character}% + {To avoid possible confusion with similar command from other packages, ^^J% + you may not follow \string\endnote\space with [ character. ^^J% + However, you may do \string\endnote\string{\string}[ if desired.}% } +\def\@ndospace{\@ifnextchar[\@nenerror\@nenspace} +\def\endnote{\@ifnextchar\bgroup\@nendnote\@ndospace} %% % \endnotetext{ID}{text} where ID is (usually) the endnote number. % If ID is other than space or tilde, it prints at left margin, followed by @@ -190,19 +345,59 @@ % If ID is space or empty, then the entire text is block-indented. This is % the method for continuing a prior endnote to a new paragraph. The text % may begin with \forceindent, according to your needs. -\DeclareDocumentCommand \endnotetext { m +m }% xparse allows \end... commands! -{ +\def\@nentexterror{% + \ClassError{novel}{\string\endnotetext\space cannot be followed by [ character}% + {To avoid possible confusion with similar command from other packages, ^^J% + you may not follow \string\endnotetext\space with [ character. ^^J% + This command takes two mandatory arguments. No optional argument.}% +} +% +\newcommand\nentext[2]{% \ifthenelse{\equal{#1}{\space}\OR\equal{#1}{}}% {\noindent\hangindent=\parindent\flexbox{\space}#2\par}% - {\noindent\hangindent=\parindent\flexbox{#1.}#2\par}% + {\noindent\hangindent=\parindent\flexbox{\lnum{#1}. }#2\par}% } +% In case the user inadvertently uses systax from `endnotes' package: +\def\endnotetext{\@ifnextchar[\@nentexterror\nentext} +% %% end endnotes +%% See novel.cls for the accompanying \AtBeginDocument routine. + + +%% Pertains to some standard LaTeX footnote code: +\AtBeginShipout{\gdef\@fnafter{}} +%% -%% See novel.cls for the accompanying AtBeginDocument routine. -%% See novel.cls for the accompanying AtEndDocument routine. +\gdef\@ActivateFootnotes{% called by `novel.cls' \AtBeginDocument + % Pertains to novel-footnotes.sty: + \LetLtxMacro\SetMarkerStyle\relax + \gsetlength\footnotesep{0.8\nbs} + % Adjusted position of footnote markers. Must wait for main font size: + \gsetlength\@twast{\heightof{*}-\normalAringheight} + \gsetlength\@twdag{\heightof{†}} + \gsetlength\@twdag{0.8\@twdag-\normalAringheight} + \gsetlength\@twdbldag{\heightof{‡}} + \gsetlength\@twdbldag{0.8\@twdbldag-\normalAringheight} + \gsetlength\@twsect{\heightof{§}} + \gsetlength\@twsect{0.8\@twsect-\normalAringheight} + \gsetlength\@tweight{\heightof{8}}% + \gsetlength\@tweight{0.8\@tweight-\normalAringheight}% + % Must wait to see how \SetFootnoteMarker was used: + \ifthenelse{\equal{\@myfnsymbols}{*}}{\setcounter{@maxfnsymbol}{8}}{} + \ifthenelse{\equal{\@myfnsymbols}{†}}{\setcounter{@maxfnsymbol}{6}}{} + % Values to be used by footnotes: + \FPdiv{\@myFontScale}{\strip@pt\@SetFontSize}{12} + % Substitute for \footnotesize, but only works for actual footnotes, + % about 10pt with similarly reduced skip: + \FPmul{\@myfootnotesizeN}{\@myFontScale}{10} + \FPround{\@myfootnotesizeN}{\@myfootnotesizeN}{2} + \FPmul{\@myfootnoteskipN}{\@myFontScale}{\strip@pt\nbs} + \FPmul{\@myfootnoteskipN}{\@myfootnoteskipN}{0.84} + \FPround{\@myfootnoteskipN}{\@myfootnoteskipN}{2} +}% end \@ActivateFootnotes @@ -210,25 +405,27 @@ %% ATENDDOCUMENT -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% Write a list of endnote (number,page) into log file, % and Big Bad Warning if numerical footnotes and endnotes both used: \AtEndDocument{% - \iftoggle{@gotendnotes}% - {\typeout{^^J^^JClass `novel' Alert: You placed endnotes (number,page):^^J% - \@endnotelist% - ^^J^^J}% - }{} + \iftoggle{@gotendnotes}{% + \typeout{^^JClass `novel' Alert: You placed endnotes (number,page): ^^J% + \@endnotelist ^^J}% + }{} % - \iftoggle{@placedfootnotenumber}% - {\iftoggle{@gotendnotes}% - {\typeout{^^JClass `novel' BIG BAD WARNING:^^J% - Numbered footnotes and endnotes! Better use symbolic footnotes!^^J^^J}% - }{}% - }{}% + \iftoggle{@placedfootnotenumber}{% + \iftoggle{@gotendnotes}{% + \ClassWarning{novel}{^^JBIG BAD WARNING! You used numbered footnotes ^^J% + and numbered endnotes. Better change to symbolic footnotes! ^^J}% + }{} + }{}% }% end \AtEndDocument %% +%% +\endinput +%% %% end of file `novel-Footnotes.sty' diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-HeadFootStyles.sty b/Master/texmf-dist/tex/lualatex/novel/novel-HeadFootStyles.sty index d86b923f011..20664fadb18 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-HeadFootStyles.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-HeadFootStyles.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-HeadFootStyles.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-HeadFootStyles.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% %% This file may be distributed and/or modified under the @@ -13,7 +13,7 @@ %% %% \ProvidesFile{novel-HeadFootStyles.sty}% -[2018/01/14 v1.46.2 LaTeX file (header and footer layouts and styles)] +[2018/03/28 v1.50 LaTeX file (header and footer layouts and styles)] %% @@ -24,122 +24,346 @@ %% \AtEndPreamble, and only if the user did not already define the layout %% in the Preamble. -%% Note that `style' sometimes means `layout`. +\gdef\@HeadFootStyle{1} % default: header but not footer +\gdef\@VersoEmblem{} % no default emblem +\gdef\@RectoEmblem{} % no default emblem +%% SET HEADER/FOOTER STYLE AND RESERVE SPACE FOR HEADER/FOOTER +%% ---------------------------------------------------------------------------- +% There are several pre-configured header/footer styles, addressing every +% situation likely to be seen in popular fiction. The style details are +% coded, using `fancyhdr' syntax, in novel-HeadFootStyles.sty. +% If you wish to create a custom head/foot style, you must first choose +% one of the pre-configured styles, then customize it. That way, +% the layout engine knows whether header or footer are present. +\newif \if@StyledHeader % true if user-customized header using \fancyhead +\newif \if@StyledFooter % true if user-customized footer using \fancyfoot +% +\gdef\SetHeadFootStyle#1{% + \if@coverart + \gdef\@HeadFootStyle{0} % required: no header/footer for coverart + \ifthenelse{\equal{#1}{0}}{}{% + \ClassWarning{novel}{^^JClass option `coverart' does not % + allow header/footer. Ignored. ^^J} + }% + \else + \@tempTFfalse + \ifthenelse{\equal{#1}{0}}{% + \global\@HasHeaderfalse\global\@HasFooterfalse\@tempTFtrue% + }{} + \ifthenelse{\equal{#1}{1}}{% + \global\@HasHeadertrue\global\@HasFooterfalse\@tempTFtrue% + }{} + \ifthenelse{\equal{#1}{2}}{% + \global\@HasHeaderfalse\global\@HasFootertrue\@tempTFtrue% + }{} + \ifthenelse{\equal{#1}{3}}{% + \global\@HasHeaderfalse\global\@HasFootertrue\@tempTFtrue% + }{} + \ifthenelse{\equal{#1}{4}}{% + \global\@HasHeadertrue\global\@HasFooterfalse\@tempTFtrue% + }{} + \ifthenelse{\equal{#1}{5}}{% + \global\@HasHeadertrue\global\@HasFootertrue\@tempTFtrue% + }{} + \ifthenelse{\equal{#1}{6}}{% + \global\@HasHeadertrue\global\@HasFootertrue\@tempTFtrue% + }{} + % Ensure that user choice was on the allowed list: + \if@tempTF\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.}% + \fi + \gdef\@HeadFootStyle{#1} + \fi +}% +\SetHeadFootStyle{1} % default, header only +\let\SetHeadStyle\SetHeadFootStyle\relax % deprecated +% +% \HeadJump is a number from 1 to 3 (may be decimal). It measures the +% distance from baseline of header text, to first baseline of main text, +% then divides by the normal baseline. +% So, a \HeadJump of 1 means that the header text is positioned exactly +% one line above main text (unlikely). A value of 2 skips a whole line. +% The default value is 1.5, which is often used in popular fiction. +% No matter what value is set, it will be re-set to 0 later, if the +% choice of head/foot style does not have a header. +% Likewise for \FootJump, measuring from baseline of lowermost main text, +% to baseline of footer text. +\gdef\SetHeadJump#1{% + \IfDecimal{#1}{% + \FPiflt{#1}{1} + \ClassError{novel}{\string\SetHeadJump\space must be at least 1}% + {\string\SetHeadJump\string from 1 to 3, may be decimal.}% + \fi + \FPifgt{#1}{3} + \ClassError{novel}{\string\SetHeadJump\space must not exceed 3}% + {\string\SetHeadJump\string from 1 to 3, may be decimal.}% + \fi + \gdef\@HeadJump{#1} + }{% + \ClassError{novel}{Unable to parse \string\SetHeadJump\space argument}% + {Needs integer or decimal, but not ending in decimal point or comma. ^^J% + Must be a number from 1 to 3, but may not be a macro.}% + }% +} +\SetHeadJump{1.5} % default +% +\gdef\SetFootJump#1{% + \IfDecimal{#1}{% + \FPiflt{#1}{1} + \ClassError{novel}{\string\SetFootJump\space must be at least 1}% + {\string\SetFootJump\string from 1 to 3, may be decimal.}% + \fi + \FPifgt{#1}{3} + \ClassError{novel}{\string\SetFootJump\space must not exceed 3}% + {\string\SetFootJump\string from 1 to 3, may be decimal.}% + \fi + \gdef\@FootJump{#1} + }{% + \ClassError{novel}{Unable to parse \string\SetFootJump\space argument}% + {Needs integer or decimal, but not ending in decimal point or comma. ^^J% + Must be a number from 1 to 3, but may not be a macro.}% + }% +} +\SetFootJump{1.5} % default +% +%% end set style and reserve space for header/footer. + + +%% Used in novel-headfootstyles.sty: +% \SetLooseHead looseness factor (fontspec LetterSpace) 0=tight, 50=default +\gdef\SetLooseHead#1{ + \FPdiv{\@loosehead}{#1}{10} % change method fontspec w/ microtype + \FPmin{\@looseheadN}{\@loosehead}{50} % don't want numbers too loose + \FPdiv{\@looseheadword}{\@loosehead}{30} % inter-word, new in v. 1.40.3 + \FPadd{\@looseheadword}{\@looseheadword}{1} +} +\SetLooseHead{50} +%% + +% +% See docs for what these emblems do, if used: +\newcommand\SetEmblems[2]{ % verso, recto + \gdef\@VersoEmblem{{\headfont #1}} + \gdef\@RectoEmblem{{\headfont #2}} +} +\let\SetEmblem\SetEmblems% for convenience +% If you want something fancier than \thepage: +\gdef\SetPageNumberStyle#1{% no small caps, so lowercase roman preserved + \gdef\pagenumberstyle{{\addfontfeature{Letters=ResetAll}#1}} +} +\SetPageNumberStyle{\thepage}% no small caps +% See novel.cls for the accompanying AtBeginDocument routine. + %% INITIALIZE FANCYHDR -%% ----------------------------------------------------------------------------- -%% Before now now, space was reserved for header/footer. +%% ---------------------------------------------------------------------------- +% Earlier, space was reserved for header/footer, but the content of +% headers and footers was not specified. Now, package `fancyhdr' +% will be used to create the content. % Start by loading package `fancyhdr' and blanking everything: -% -\newtoggle{@inheadfoot} % true in header or footer -% \RequirePackage{fancyhdr} \renewcommand\headrulewidth{0pt} \renewcommand\footrulewidth{0pt} \fancyhead[LO,RE,LE,RO,CE,CO]{} \fancyfoot[LO,RE,LE,RO,CE,CO]{} -% \SetLooseHead looseness factor (fontspec LetterSpace) 0=tight, 50=default -\gdef\SetLooseHead#1{ - \gdef\@@loosehead{#1} - \FPdiv{\@loosehead}{\@@loosehead}{10} % change in method of using fontspec with microtype - \FPmin{\@looseheadnum}{\@loosehead}{50} % Don't want numbers too loose. - \FPdiv{\@looseheadword}{\@loosehead}{30} % new in v. 1.40.3. - \FPadd{\@looseheadword}{\@looseheadword}{1} -} -\SetLooseHead{50} -% Create flags to know if \fancyhead and \fancyfoot have been defined by user, -% somewhere in the Preamble. If not, then pre-defined layout based on trimsize -% will be applied \AtEndPreamble. -\LetLtxMacro{\@tempFancyhead}{\fancyhead} % from package `letltxmacro' +% It might be useful to know whether something is being placed in main text, +% or within a header/footer. A new boolean is created, which is only true +% when within a header or footer. You can define macros so that they test +% this boolean. +% To make this work, \fancyhead and \fancyfoot are re-defined: +\newtoggle{@inheadfoot} % true within header or footer +\LetLtxMacro{\@myfancyhead}{\fancyhead} +\LetLtxMacro{\@myfancyfoot}{\fancyfoot} \renewcommand\fancyhead[2][]{% - \@styledHeadertrue% - \@tempFancyhead[#1]{\toggletrue{@inheadfoot}{\normalsize#2}}% + \global\@StyledHeadertrue% + \@myfancyhead[#1]{\toggletrue{@inheadfoot}{\normalsize #2}}% not global } -% -\LetLtxMacro{\@tempFancyfoot}{\fancyfoot} \renewcommand\fancyfoot[2][]{% - \@styledFootertrue% - \FPsub{\@footraise}{\@footjump}{1}% - \FPmul{\@footraise}{-\@footraise}{\Current@BaselineSkipNum}% - \@tempFancyfoot[#1]{% - \toggletrue{@inheadfoot}% - \stake\smash{\raisebox{\@footraise pt}{{\normalsize#2}}}% + \global\@StyledFootertrue% + \FPsub{\@footraise}{\@FootJump}{1}% + \FPmul{\@footraise}{-\@footraise}{\strip@pt\nbs}% + \@myfancyfoot[#1]{% + \toggletrue{@inheadfoot}% not global + \stake\smash{\raisebox{\@footraise pt}{\normalsize #2}}% }% } -% -\LetLtxMacro{\@myTempTPS}{\thispagestyle} +%% end initialize fancyhdr. + + +%% THISPAGESTYLE COMMANDS +%% ---------------------------------------------------------------------------- % Re-define \thispagestyle based on layout. When it requests only the page % number, decide what to do based on this command and whether footer is used: -\newif \if@thispagestyleset \@thispagestylesetfalse -% -%% See AtBeginShipout routine in novel.cls. +\newif \if@ThisPageStyle % true if \thispagestyle declared for current page +\newif \if@DeleteCSline % true when using @dropfolioinside +\AtBeginShipout{% re-sets when page done + \global\@DeleteCSlinefalse% + \global\@ThisPageStylefalse% +} +\LetLtxMacro{\@myTempTPS}{\thispagestyle} % \gdef\thispagestyle#1{% - \global\@thispagestylesettrue% - \gdef\@pagestyleOK{false}% + \global\@ThisPageStyletrue% + \@tempTFfalse% + % Style `fancy' is same as normal style: \ifthenelse{\equal{#1}{fancy}}{% - \gdef\@pagestyleOK{true}% + \@tempTFtrue% \@myTempTPS{fancy}% }{}% + % Style `empty' has no visible content in header or footer. + % This style is pre-defined, so no need to re-define it here. \ifthenelse{\equal{#1}{empty}}{% - \gdef\@pagestyleOK{true}% + \@tempTFtrue% \@myTempTPS{empty}% }{}% - \ifthenelse{\equal{#1}{plain}\OR\equal{#1}{fancyplain}\OR\equal{#1}{footer}}{% - \gdef\@pagestyleOK{true}% - \if@gotFooter \@myTempTPS{fancyplain}% - \else \@myTempTPS{empty}% + % Style `footer' has no visible content in header. + % If the normal style has a footer, it will be used as-is. However, if the + % normal style does not have a footer, then (unlike the above style) + % the page number will not be placed at bottom; as with style `empty'. + \ifthenelse{\equal{#1}{footer}}{% + \@tempTFtrue% + \if@HasFooter\@myTempTPS{@footer}% + \else\@myTempTPS{empty}% \fi% }{}% + % Style `forcenumber' is rarely used. If the normal style has a footer, + % it will be used as-is (presumably contains the page number), and there + % will be no visible content in the header. + % But if there is no normal footer, then the outside portion of the header + % is printed. No other portion of the header. Presumably the page number + % is located at the outside of the header. \ifthenelse{\equal{#1}{forcenumber}}{% - \gdef\@pagestyleOK{true}% - \if@gotFooter \@myTempTPS{fancyplain}% - \else \@myTempTPS{fancynumber}% + \@tempTFtrue% + \if@HasFooter\@myTempTPS{@footer}% + \else\@myTempTPS{@forcenumber}% \fi% }{}% - % - \ifthenelse{\equal{#1}{dropfolioinside}% after \clearpage - \OR \equal{#1}{dropfolio} \OR \equal{#1}{dropfoliolater}}{% compatibility - \gdef\@pagestyleOK{true}% - \if@gotFooter% - \@myTempTPS{fancyplain}% + % Style `dropfoliobeneath': There will be no visible content in header. + % If the normal style has a footer, it will be used as-is. This assumes + % that the page number is contained in the footer, the usual case. + % If the normal style has no footer, then the page number will be centered + % within the lower margin, at the position where an exta line would be. + % Thus, pagination of the main text is unaffected. + % Since the number is closer than usual to the page bottom edge, you must + % ensure that it does not intrude into the unsafe zone (where printers + % prohibit any printable matter). TeX cannot check this for you. However, + % you can define an Unsafe Zone, and inspect placement of the number + % in draft mode. + % Styles `plain*' and `fancyplain*' (with asterisk) are aliases. + \ifthenelse{\equal{#1}{dropfoliobeneath}% + \OR \equal{#1}{plain*} \OR \equal{#1}{fancyplain*}}{% + \@tempTFtrue% + \if@HasFooter\@myTempTPS{@footer}% \else% - \global\@addCTlinefalse% - \@myTempTPS{empty}% - \@dropfolioinside + \@myTempTPS{@dropfoliobeneath}% + \typeout{^^JClass `novel' Alert: Page no. \thepage\space in margin. ^^J% + Review layout to ensure that this is within the Safe Area. ^^J% + }% \fi% }{}% - % With `dropfoliobeneath` only a footer is used, if present. If no footer, - % then the styled page number is centered at one baselineskip beneath the - % ordinary bottom of the textblock. Thus, the number intrudes into the - % bottom margin. This is OK if the bottom margin is wider than minimum. - % Whether the margin is wide enough, is for the user to determine, because - % the document class does not know the printer's limitations. - \ifthenelse{\equal{#1}{dropfoliobeneath}}{% after \clearpage - \gdef\@pagestyleOK{true}% - \if@gotFooter% - \@myTempTPS{fancyplain}% + % Style `dropfolioinside': There will be no visible content in header. + % If the normal style has a footer, it will be used as-is. This assumes + % that the page number is contained in the footer, the usual case. + % If the normal style has not footer, then the page number will be centered + % where the last line of main text would ordinarily be. No extra gap. + % That may cause the (former) last line of main text to flow to the top of + % the next page, and so forth. However, if this page style is used on + % a page with ChapterStart, then the height of ChapterStart will be + % automatically reduced by one line, so that there is no repagination. + % Styles `plain', `fancyplain', `dropfolio', and `dropfoliolater' are aliases + % for `dropfolioinside'. I couldn't make up my mind regarding the + % command name. For compatibility, all these do the same thing. + \ifthenelse{\equal{#1}{dropfolioinside}% + \OR \equal{#1}{plain} \OR \equal{#1}{fancyplain}% + \OR \equal{#1}{dropfolio} \OR \equal{#1}{dropfoliolater}}{% + \@tempTFtrue% + \if@HasFooter\@myTempTPS{@footer}% \else% - \@myTempTPS{empty}% - \@dropfoliobeneath + \global\@DeleteCSlinetrue% + \enlargethispage{-\nbs}% + \@myTempTPS{@dropfolioinside}% \fi% }{}% - %% - \ifthenelse{\equal{\@pagestyleOK}{true}}{}{% - \ClassWarning{novel}{^^JPage \pagenumberstyle\space has % - \string\thispagestyle{}^^J% - but its argument is not defined. Default substituted. Better fix that.^^J}% - }% + % Verify that an allowable choice was made: + \if@tempTF\else% + \ClassError{novel}{^^JPage \thepage\space has \string\thispagestyle ^^J% + but its argument is not on the list of choices. See docs. ^^J}% + \fi% +} % end \thispagestyle. +% +\let\dropfolionow\relax % compatibility with earlier version. +% +% Here are the thispagestyle definitions: +\fancypagestyle{@footer}{ % blanks header, but leaves footer as-is + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0pt} + \fancyhead[LO,RE,LE,RO,CE,CO]{} +} +\fancypagestyle{@dropfolioinside}{ % page number where last line would be + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0pt} + \fancyhead[LO,RE,LE,RO,CE,CO]{} + \fancyfoot[LO,RE,LE,RO]{} + \fancyfoot[CO,CE]{% + \raisebox{\dimexpr\@FootJump\nbs}{\@lspagenum\pagenumberstyle}% + } +} +\fancypagestyle{@dropfoliobeneath}{ % page number in margin below text + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0pt} + \fancyhead[LO,RE,LE,RO,CE,CO]{} + \fancyfoot[LO,RE,LE,RO]{} + \fancyfoot[CO,CE]{% + \raisebox{\dimexpr\@FootJump\nbs-\nbs}{\@lspagenum\pagenumberstyle}% + } } +\fancypagestyle{@forcenumber}{ % if has header but not footer + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0pt} + \fancyhead[LO,RE,LE,RO,CE,CO]{} + \fancyhead[LE]{% + \makebox[2.5em][l]{\@lspagenum\pagenumberstyle}% + \@VersoEmblem% + } + \fancyhead[RO]{% + \@RectoEmblem% + \makebox[2.5em][r]{\@lspagenum\pagenumberstyle}% + } + \fancyfoot[LO,RE,LE,RO,CE,CO]{} +} +%% end \thispagestyle commands. + + +%% +\gdef\@lshftext{\headfont\addfontfeature{LetterSpace=\@loosehead}} +\gdef\@lspagenum{\headfont\addfontfeature{LetterSpace=\@looseheadN}} +%% + +% Content of header text (if present) can be changed at any time within +% the body, using the following commands. If not used, then +% Verso is initialized to \theauthor and Recto is initialized to \thetitle +% AtBeginDocument, with adjustments to interword spacing. +% If you wish, you may write the commands with empty arguments, in which case +% the header still appears with page number (if present), but no text. +% +\gdef\NewVersoHeadText#1{\gdef\versoheadtext{#1}} +\let\SetVersoHeadText\NewVersoHeadText\relax % for convenience +\let\RenewVersoHeadText\NewVersoHeadText\relax % for convenience % -%% End initialize fancyhdr. +\gdef\NewRectoHeadText#1{\gdef\rectoheadtext{#1}} +\LetLtxMacro\SetRectoHeadText\NewRectoHeadText\relax % for convenience +\LetLtxMacro\RenewRectoHeadText\NewRectoHeadText\relax % for convenience +% +%% %% See AtBeginDocument routine in novel.cls: -%% ----------------------------------------------------------------------------- -\gdef\@activateHeadFootStyles{ % called AtBeginDocument by novel.cls +%% ---------------------------------------------------------------------------- +\gdef\@ActivateHeadFootStyles{ % called AtBeginDocument by novel.cls % Pre-configured header/footer styles, unless user over-rode them: % \versoheadtext is initialized to \theauthor % \rectoheadtext is initialized to \thetitle @@ -150,208 +374,126 @@ \NewRectoHeadText{\thetitle} % revised in v. 1.40.3 }{} % - % ---------------------------------------------------------------------------- + % --------------------------------------------------------------------------- % IF YOU ARE WRITING YOUR OWN HEADER/FOOTER LAYOUT: % Look here for the pre-defined layouts, for use as models. % Note that if you write \fancyhead or \fancyfoot in the Preamble, - % that sets the \@styledHeader flag, so these codes do not over-ride yours. - \ifthenelse{\equal{\my@HeadFootStyle}{1}}{ % default - \if@styledHeader\else - \fancyhead[LE]{\makebox[2.5em][l]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}\my@VersoEmblem% + % that sets the \@StyledHeader flag, so these codes do not over-ride yours. + % \@lshftext loosens text tracking. + % \@lspagenum loosens page number tracking, like \@lshftext but capped + % at a maximum looseness. + \ifthenelse{\equal{\@HeadFootStyle}{1}}{ % default + \if@StyledHeader\else + \fancyhead[LE]{% + \makebox[2.5em][l]{\@lspagenum\pagenumberstyle}% + \@VersoEmblem% } - \fancyhead[RO]{\my@RectoEmblem\makebox[2.5em][r]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}% + \fancyhead[RO]{% + \@RectoEmblem% + \makebox[2.5em][r]{\@lspagenum\pagenumberstyle}% } - \fancyhead[CE]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\versoheadtext}}} - \fancyhead[CO]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\rectoheadtext}}} + \fancyhead[CE]{\@lshftext\versoheadtext} + \fancyhead[CO]{\@lshftext\rectoheadtext} \fi }{} % - \ifthenelse{\equal{\my@HeadFootStyle}{2}}{ - \if@styledFooter\else - \fancyfoot[LE]{\makebox[2.5em][l]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}\my@VersoEmblem% + \ifthenelse{\equal{\@HeadFootStyle}{2}}{ + \global\@StyledHeaderfalse + \if@StyledFooter\else + \fancyfoot[LE]{% + \makebox[2.5em][l]{\@lspagenum\pagenumberstyle}% + \@VersoEmblem% } - \fancyfoot[RO]{\my@RectoEmblem\makebox[2.5em][r]{% - {\headfont{\addfontfeature{LetterSpace=\@loosehead}\pagenumberstyle}}}% + \fancyfoot[RO]{% + \@RectoEmblem% + \makebox[2.5em][r]{\@lspagenum\pagenumberstyle}% } \fi }{} % - \ifthenelse{\equal{\my@HeadFootStyle}{3}}{ - \if@styledFooter\else - \fancyfoot[CO,CE]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}% - } + \ifthenelse{\equal{\@HeadFootStyle}{3}}{ + \if@StyledFooter\else + \fancyfoot[CO,CE]{\@lspagenum\pagenumberstyle} \fi }{} % - \ifthenelse{\equal{\my@HeadFootStyle}{4}}{ - \if@styledHeader\else - \fancyhead[LE]{\makebox[2.5em][l]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}% - \my@VersoEmblem\hspace{1em}% - {\headfont{\addfontfeature{LetterSpace=\@loosehead}\versoheadtext}}% + \ifthenelse{\equal{\@HeadFootStyle}{4}}{ + \if@StyledHeader\else + \fancyhead[LE]{% + \makebox[2.5em][l]{\@lspagenum\pagenumberstyle}% + \@VersoEmblem% + \hspace{1em}% + {\@lshftext\versoheadtext}% } - \fancyhead[RO]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\rectoheadtext}}% - \hspace{1em}\my@RectoEmblem\makebox[2.5em][r]{{% - \headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}% + \fancyhead[RO]{% + {\@lshftext\rectoheadtext}% + \hspace{1em}% + \@RectoEmblem% + \makebox[2.5em][r]{\@lspagenum\pagenumberstyle}% } \fi }{} % - \ifthenelse{\equal{\my@HeadFootStyle}{5}}{ - \if@styledHeader\else - \fancyhead[CE]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\versoheadtext}}} - \fancyhead[CO]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\rectoheadtext}}} + \ifthenelse{\equal{\@HeadFootStyle}{5}}{ + \if@StyledHeader\else + \fancyhead[CE]{\@lshftext\versoheadtext} + \fancyhead[CO]{\@lshftext\rectoheadtext} \fi - \if@styledFooter\else + \if@StyledFooter\else \fancyfoot[CO,CE]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}% + {\@lspagenum\pagenumberstyle}% } \fi }{} % - \ifthenelse{\equal{\my@HeadFootStyle}{6}}{ - \if@styledHeader\else - \fancyhead[LE]{\makebox[2.5em][l]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}\my@VersoEmblem% + \ifthenelse{\equal{\@HeadFootStyle}{6}}{ + \if@StyledHeader\else + \fancyhead[LE]{% + \makebox[2.5em][l]{\@lspagenum\pagenumberstyle}% + \@VersoEmblem% } - \fancyhead[RO]{\my@RectoEmblem\makebox[2.5em][r]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}% + \fancyhead[RO]{% + \@RectoEmblem% + \makebox[2.5em][r]{\@lspagenum\pagenumberstyle}% } - \fancyhead[RE]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\versoheadtext}}} - \fancyhead[LO]{{\headfont{\addfontfeature{LetterSpace=\@loosehead}\rectoheadtext}}} + \fancyhead[RE]{\@lshftext\versoheadtext} + \fancyhead[LO]{\@lshftext\rectoheadtext} \fi }{} - % + % END MODELS FOR WRITING YOUR OWN. % % END PRE-DEFINED LAYOUTS AND STYLES. - % ---------------------------------------------------------------------------- + % --------------------------------------------------------------------------- % - % Substitute for \thispagestyle{plain} - \fancypagestyle{fancyplain}{ % if has footer - \renewcommand\headrulewidth{0pt} - \renewcommand\footrulewidth{0pt} - \fancyhead[LO,RE,LE,RO,CE,CO]{} - \fancyfoot[LO,RE,LE,RO,CE,CO]{} - \fancyfoot[CO,CE]{{\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}} - } - % Not a user command, use plain or fancyplain: - \fancypagestyle{fancynumber}{ % if has header but not footer - \renewcommand\headrulewidth{0pt} - \renewcommand\footrulewidth{0pt} - \fancyhead[LO,RE,LE,RO,CE,CO]{} - \fancyhead[LE]{\makebox[2.5em][l]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}\my@VersoEmblem% - } - \fancyhead[RO]{\my@RectoEmblem\makebox[2.5em][r]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}% - } - \fancyfoot[LO,RE,LE,RO,CE,CO]{} - } +%%%%% % Now put `fancyhdr' to work: \pagestyle{fancy} % default unless over-ridden by \thispagestyle{} % -} % end \@activateHeadFootStyles -% -%% end initialize fancyhdr - - -%% DROPFOLIO -%% ----------------------------------------------------------------------------- -\newlength\temp@pgnumwidth -\newlength\temp@pgnumraise -% -% \@dropfolioinside reduces the textblock height by one lineskip. At the bottom, -% where the last line would have been, the styled page number is centered. -\newcommand\@dropfolioinside{% - \enlargethispage{-\nbs}% - \setlength\temp@pgnumwidth{% - \widthof{{\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}}% - \if@offcenterTrim% - \setlength\temp@pgnumraise{% - \dimexpr\New@BottomMargin+\New@MediaHeight-\New@TrimHeight}% - \global\temp@pgnumraise=\temp@pgnumraise% - \else% - \setlength\temp@pgnumraise{% - \dimexpr\New@BottomMargin+0.5\New@MediaHeight-0.5\New@TrimHeight}% - \global\temp@pgnumraise=\temp@pgnumraise% - \fi% - %%%%% - \ifodd\c@page% - \AddToShipoutPicture*{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx+\New@InsideMargin-0.5\temp@pgnumwidth}% - \charscale[1,0.5\textwidth,\temp@pgnumraise]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}}}% - \else% - \AddToShipoutPicture*{\@getPageXY\AtPageLowerLeft{% - \hspace{\dimexpr\Trim@Lx+\New@OutsideMargin+0.5\textwidth-0.5\temp@pgnumwidth}\raisebox{% - \temp@pgnumraise}{{\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}}}% - \fi% -} % end \@dropfolioinside +} % end \@ActivateHeadFootStyles % -\let\dropfolionow\relax % compatibility with earlier version. -% - -% \@dropfoliobeneath does not change the textblock height. The styled page -% number is centered where an extra line would be, within the bottom margin. -\newcommand\@dropfoliobeneath{% - \setlength\temp@pgnumwidth{% - \widthof{{\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}}% - \if@offcenterTrim% - \setlength\temp@pgnumraise{% - \New@BottomMargin-\nbs+\New@MediaHeight-\New@TrimHeight}% - \else% - \setlength\temp@pgnumraise{% - \New@BottomMargin-\nbs+0.5\New@MediaHeight-0.5\New@TrimHeight}% - \fi% - \AddToShipoutPicture*{\@getPageXY\AtPageLowerLeft{% - \ifodd\c@page% - \hspace{\dimexpr\Trim@Lx+\New@InsideMargin-0.5\temp@pgnumwidth}% - \else% - \hspace{\dimexpr\Trim@Lx+\New@OutsideMargin-0.5\temp@pgnumwidth}% - \fi% - \charscale[1,0.5\textwidth,\temp@pgnumraise]{% - {\headfont{\addfontfeature{LetterSpace=\@looseheadnum}\pagenumberstyle}}}% - }% - }% -} % end \@dropfoliobeneath %% -% -% Content of header text (if present) can be changed at any time within -% the body, using the following commands. If not used, then -% Verso is initialized to \theauthor and Recto is initialized to \thetitle -% AtBeginDocument, with adjustments to interword spacing. -% If you wish, you may write the commands with empty arguments, in which case -% the header still appears with page number (if present), but no text. -% -\newlength\@mykem -% -\gdef\NewVersoHeadText#1{ - \FPdiv{\@myk}{\@loosehead}{500} - \setlength\@mykem{\@myk em} - \gdef\versoheadtext{#1} -} -\let\SetVersoHeadText\NewVersoHeadText\relax % for convenience -\let\RenewVersoHeadText\NewVersoHeadText\relax % for convenience -% -\gdef\NewRectoHeadText#1{ - \FPdiv{\@myk}{\@loosehead}{500} - \setlength\@mykem{\@myk em} - \gdef\rectoheadtext{#1} -} -\let\SetRectoHeadText\NewRectoHeadText\relax % for convenience -\let\RenewRectoHeadText\NewRectoHeadText\relax % for convenience -% +%% Neutralize settings that cannot be used after Preamble: +\gdef\@DisableHeadFootSettings{% called by `novel.cls' \AtBeginDocument + \LetLtxMacro\SetHeadFootStyle\relax + \LetLtxMacro\SetHeadStyle\relax + \LetLtxMacro\SetHeadJump\relax + \LetLtxMacro\SetFootJump\relax + \LetLtxMacro\SetLooseHead\relax +}% end \@DisableHeadFootSettings %% +% The following settings can continue to be re-issued after \begin{document}: +% \SetEmblems also \SetEmblem +% \SetPageNumberStyle +% \SetVersoHeadText also \New and \Renew +% \SetRectoHeadText also \New and \Renew -% +%% +\endinput +%% %% End of file `novel-HeadFootStyles.sty' diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-Images.sty b/Master/texmf-dist/tex/lualatex/novel/novel-Images.sty index 7a67b44bd22..f5ec180c27c 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-Images.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-Images.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-Images.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-Images.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% %% This file may be distributed and/or modified under the @@ -13,54 +13,146 @@ %% %% \ProvidesFile{novel-Images.sty}% -[2018/01/14 v1.46.2 LaTeX file (image placement)] +[2018/03/28 v1.50 LaTeX file (image placement)] %% -%% +%% In `novel', images are handled with a view to preserving uniform line grid. +%% Normally, a work of fiction has no (or very few) images within the main +%% body of text. Images are more likely on display pages (such as title page) +%% or in chapter starts, or maps. + +%% There are two ways to place an image: inline, or float. +%% Inline image does not occupy its own block, but mingles with flowing text. +%% Float image occupies its own block, which will be placed where the command +%% is written, if it fits on that page. If it doesn't fit, then it will be +%% placed at the top of the following page. Surrounding text will be +%% typeset so at to not leave a big gap. Althouth TeX allows several +%% options for positioning a float, `novel' only allows one method. + %% Be sure to read the separate documentation about how to prepare images. -%% In general: (1) png, jpg only. (2) Flattened, no transparency. +%% In general: (1) png or jpg only. (2) Flattened, no transparency. %% (3) 300dpi (grayscale) or 600dpi (black/white) are industry norms. %% (4) Image file must contain its resolution. (5) Exact size, without scaling. %% (6) No private metadata. (7) Be sure grayscale is 1-channel, not rgb gray. + + +%% Luacode and related macro thanks to user Marcel Krüger, +%% at tex.stackexchange.com. +\RequirePackage{luacode} +\begin{luacode*} + function check_colorspaces(allowed_colorspace, name) + local doc = epdf.open(name); + if doc == nil then + tex.sprint(luatexbase.catcodetables['latex-package'], + "\\errmessage{Could not open " .. name .. "}{}{}\\@gobbletwo") + return; + else + for pageno=1,doc:getNumPages() do + local xobjs= doc:getCatalog():getPage(pageno):getResourceDict():lookup("XObject"); + if not xobjs:isNull() then + for i=1,xobjs:dictGetLength() do + xobjDict = xobjs:dictGetVal(i):streamGetDict() + if xobjDict:lookup('Subtype'):getName() == 'Image' then + if not allowed_colorspace[xobjDict:lookup('ColorSpace'):getName()] then + tex.sprint(luatexbase.catcodetables['latex-package'], '\\@firstoftwo') + return + end + end + end + end + end + end + tex.sprint(luatexbase.catcodetables['latex-package'], '\\@secondoftwo') + return; +end +\end{luacode*} +% +\newcommand\PDFHasDisallowedColorspaceTF[1]{% + \directlua{check_colorspaces({DeviceCMYK=true, DeviceGray=true},"\luaescapestring{#1}")}% +} +%% +%% +\begin{luacode*} + function utf16to8(u16str) + local result = "" + local i = 1 + if #u16str % 2 == 1 then + print("ERROR") + return + end + while i < #u16str do + local high, low = u16str:byte(i, i + 1) + i = i + 2 + local current = bit32.replace(low, high, 8, 8) + if bit32.band(high, 0xFC) == 0xD8 then + current = bit32.replace(0, current, 10, 10) + if i > #u16str then + print("ERROR") + return + end + high, low = u16str:byte(i, i + 1) + i = i + 2 + current = bit32.replace(current, bit32.replace(low, high, 8, 8), 0, 10) + 0x10000 + elseif bit32.band(high, 0xFC) == 0xDC then + print("ERROR") + return + end + result = result .. unicode.utf8.char(current) + end + return result + end + function normalize_string(str) + if str:sub(1,2) == "\xFE\xFF" then + return utf16to8(str:sub(3,-3)) + else + return str + end + end + function check_pdf_info(name, field, expected) + local doc = epdf.open(name); + if doc == nil then + tex.sprint(luatexbase.catcodetables['latex-package'], + "\\errmessage{Could not open " .. name .. "}{}{}\\@gobbletwo") + else + local producer = doc:getDocInfo():dictLookup(field) + if not producer:isNull() and normalize_string(producer:getString()) == expected then + tex.sprint(luatexbase.catcodetables['latex-package'], '\\@firstoftwo') + else + tex.sprint(luatexbase.catcodetables['latex-package'], '\\@secondoftwo') + end + end + end +\end{luacode*} +\newcommand\PDFVerifyInfoFieldTF[3]{\directlua{check_pdf_info("\luaescapestring{#1}", "\luaescapestring{#2}", "\luaescapestring{#3}")}} %% +%% New in version 1.50, makecmyk script, with special syntax: +\LetLtxMacro\@scriptincludepdf\includepdf\relax +\providecommand\includepdf[2][]{} +\renewcommand\includepdf[2][]{% from package `pdfpages' + \ClassError{novel}{Cannot use \string\includepdf\space command}% + {You can use novel-scripts `makegray' and `makebw' to convert pdf %%J% + to a raster jpg or png, suitable for placement as an image.}% +} +\gdef\ScriptCoverImage#1{% + \if@coverart% + \PDFVerifyInfoFieldTF{#1}{NSprocessed}{true}% + {\@scriptincludepdf{#1}}% + {\ClassError{novel}{Book cover pdf must be pre-processed by novel-scripts}% + {Each pdf processed by novel-scripts is marked internally. ^^J% + Your cover artwork pdf is unmarked. Use `makecmykpdf' script.}% + }% + \else% + \ClassError{novel}{Cannot use \string\ScriptCoverImage\space in interior}% + {\string\ScriptCoverImage\space only with `coverart' class option.}% + \fi% +} % +%% -% \InlineImage[hoffset,voffset]{imagefile.png or jpg} and starred version. -% -% Use hoffset to displace the image horizontally. Positive is to the right. -% Use voffset to displace the image vertically. Positive is upward. -% Can use hoffset by itself, then voffset defaults to 0pt. -% -% The TOP of the image is placed at the baseline of text (unless offset). -% To place image so that its BOTTOM (rather than top) is at the text baseline, -% use voffset b. Can also use b+2em or b-3.4pt etc. without spaces. -% To place image so that its top is as text X height, voffset \heightof{X}. -% -% You can combine lengths, such as: -% voffset 0.2em+\heightof{X} or b-\heightof{Aring}+0.5em -% However, do not begin the string with + or - followed directly by \heightof. -% -% Unstarred command: Image occupies its natural width, so that following text -% (if on same line) is after the image. -% Starred command: Image occupies zero width, so that following text (if on -% the same line) overlays the image. -% In all cases, the image occupies zero height, so that following text lines -% will overlay the image, unless you insert some \null lines. -% In some case, having following text overlay the image is desirable. But talk -% with your print service about that. Not all like it. -% If the image rises above its line of text, it may overlay text on the -% preceding line, which obscures that text. Don't do it. -% -% Clever use of hoffset, with narrowed textblock, can place text beside image. -% -% \imagewidth and \imageheight may be used for offsets, or for any other -% purpose once the image is placed. These lengths retain their values -% until a subsequent image is placed, not including anything in header/footer. -% -\def\Aring{Å} % has typical maximum accented character height in Latin-1. -% + +% Pertains to images: \newlength\imagewidth \newlength\imageheight \newlength\imagehoffset @@ -69,52 +161,61 @@ \newlength\@imageheight \newlength\@imagehoffset \newlength\@imagevoffset +\newlength\@mytotalht +\newif \if@UsingNovelCommand % true within \InlineImage etc. +%% \gdef\imagestarred{false} \gdef\imagefilename{unknown} -% Neutralize \includegraphics, so it is no longer a user command: -\LetLtxMacro\novel@includegraphics\includegraphics\relax -\LetLtxMacro\includegraphics\relax -\newcommand\includegraphics[2][]{ - \ClassError{novel}{Cannot use \string\includegraphics\space on page \thepage} - {The `novel' class has its own commands for placing images. See docs.^^J% - You cannot use the \string\includegraphics\space command.}% -} -% -\newcommand\pushtextdown[1]{% - \ifthenelse{\equal{#1}{} \OR \equal{#1}{ } \OR \equal{#1}{0}}{% - \def\@howmuchdown{0em}% - }{% - \def\@howmuchdown{#1}% - }% - ~\par\vspace*{-\nbs}\vspace*{\@howmuchdown}\par% -} -% -\newlength\@mytotalht -\newif\if@imgExtOK% -% -% \InlineImage can be used in body, header, footer. -% However, macros such as \imagefilename, \imagewidth, etc. -% are only set or re-set when the image in in the body. -% That prevents an intervening header/footer image from over-writing -% values set by the most recent body image. -% The unstarred command occupies the width of the image. -% The starred command occupies zero width. +\setkeys{Gin}{draft=false} % always shows the image, not a box outline +\LetLtxMacro\novel@sub@inclgr\includegraphics\relax +\if@coverart\else % Need to allow it, for possible use by \includepdf in cover. + \renewcommand\includegraphics[2][]{% + \ClassError{novel}{Direct use of \string\includegraphics\space forbidden}% + {You may only place images using commands specific to `novel' class. ^^J% + See `novel' documentation, section 7.}% + } +\fi % -\ExplSyntaxOn -\DeclareDocumentCommand \InlineImage { s O{0pt} m }{% - \@imgExtOKfalse% - \IfEndWith{#3}{png}{\@imgExtOKtrue}{}% - \IfEndWith{#3}{PNG}{\@imgExtOKtrue}{}% - \IfEndWith{#3}{jpg}{\@imgExtOKtrue}{}% - \IfEndWith{#3}{JPG}{\@imgExtOKtrue}{}% - \IfEndWith{#3}{jpeg}{\@imgExtOKtrue}{}% - \IfEndWith{#3}{JPEG}{\@imgExtOKtrue}{}% - \if@imgExtOK\else% - \ClassError{novel}{^^JImage~`#3'~format~not~allowed}% - {^^JImage~`#3'~has~file~type~not~allowed~in~`novel'~class.^^J% - Must~have~file~extension~png,~jpg,~jpeg,~(or~capitalized).^^J% - Others~such~as~bmp,~tiff,~pdf,~eps,~svg~are~not~allowed.^^J}% +\newcommand\@TestImageExtension[1]{% + \@tempTFfalse% + \IfEndWith{#1}{.png}{\@tempTFtrue}{}% + \IfEndWith{#1}{.PNG}{\@tempTFtrue}{}% + \IfEndWith{#1}{.jpg}{\@tempTFtrue}{}% + \IfEndWith{#1}{.JPG}{\@tempTFtrue}{}% + \IfEndWith{#1}{.jpeg}{\@tempTFtrue}{}% + \IfEndWith{#1}{.JPEG}{\@tempTFtrue}{}% + \if@tempTF\else% + \ClassError{novel}{Image format `#1' not allowed, page \thepage}% + {Image `#1' has file type not allowed in `novel' class. ^^J% + Must have file extension png, jpg, jpeg (or capitalized). ^^J% + Others such as pdf, bmp, tiff, eps, svg, jp2, jbig, are not allowed. ^^J% + The file extension is mandatory. Provide it, if missing.}% \fi% +} % +%% + + +%% INLINE IMAGE +%% ---------------------------------------------------------------------------- +% \InlineImage[xoffset,yoffset]{imagename.png} or jpg +% As the name implies, an inline image is used within the flow of text, rather +% than in its own block. It may be used in main body, header, and footer. +% Macros such as \imagefilename, \imagewidth, etc. +% are only set or re-set when the image in in the body. That prevents an +% intervening header/footer image from over-writing values set by% +% the most recent body image. +% Without offsets, the image is positioned with is left edge at the cursor, +% and its top edge at the text baseline. Positive offsets are right and up. +% If improperly positioned, the image can overlie (obscure) text that was +% previously placed. This is rarely desirable and may be flagged by +% some print services, because it looks wrong. +% The image will underlie anything that follows. This may be used as a +% special effect, if allowed by the print service (probably OK). +% With the un-starred command, the image occupies its natural cursor width. +% With the starred command, the image occupies zero cursor width, so that +% anything following will overlie it. +\DeclareDocumentCommand \InlineImage { s O{0pt} m }{% + \@TestImageExtension{#3}% \StrDel{#2}{\space}[\@myila]% \StrCut{\@myila}{,}{\@myilxa}{\@myilya}% \ifthenelse{\equal{\@myilxa}{} \OR \equal{\@myilxa}{0}}{% @@ -124,11 +225,13 @@ \def\@myily{0pt}}{\def\@myily{\@myilya}% }% \iftoggle{@inheadfoot}{}{\gdef\imagefilename{#3}}% for possible later use - \gdef\my@graphic{\novel@includegraphics[draft=false]{#3}}% - \setlength\@imagewidth{\widthof{\my@graphic}}% + \global\@UsingNovelCommandtrue% + \gdef\@mygraphic{\novel@sub@inclgr{#3}}% + \gdef\@mygraphicname{#3}% + \setlength\@imagewidth{\widthof{\@mygraphic}}% \global\@imagewidth=\@imagewidth% \iftoggle{@inheadfoot}{}{\setlength\imagewidth{\@imagewidth}}% - \setlength\@imageheight{\heightof{\my@graphic}}% + \setlength\@imageheight{\heightof{\@mygraphic}}% \global\@imageheight=\@imageheight% \iftoggle{@inheadfoot}{}{% \setlength\imageheight{\@imageheight}% @@ -153,137 +256,157 @@ \iftoggle{@inheadfoot}{}{\gdef\imagestarred{true}}% \makebox[0pt][l]{% \hspace{\@imagehoffset}% - \stake\smash{\raisebox{\@imagevoffset}{\my@graphic}}% + \stake\smash{\raisebox{\@imagevoffset}{\@mygraphic}}% }% }% % unstarred: {% \iftoggle{@inheadfoot}{}{\gdef\imagestarred{false}}% \hspace{\@imagehoffset}% - \stake\smash{\raisebox{\@imagevoffset}{\my@graphic}}% + \stake\smash{\raisebox{\@imagevoffset}{\@mygraphic}}% }% end IfBooleanTF{#1} \iftoggle{@inheadfoot}{}{\setlength\imagehoffset{\@imagehoffset}}% \iftoggle{@inheadfoot}{}{\setlength\imagevoffset{\@imagevoffset}}% -} % end DeclareDocumentCommand \InlineImage -\ExplSyntaxOff -% + \global\@UsingNovelCommandfalse% +} % +% end Inline Image %% -%% RE-DEFINED in V. 1.46. Now must be placed within linegap environment. -%% \BlockImage[alignment]{image}[text] -% Alignment may have up to 3 comma-separated values. Default is [c] -% First alignment: l, c, r (left, center, right). -% Second alignment: x-offset of image (not text). Default 0pt. May use 0. -% Third alignment: y-offset of image (not text). Default 0pt. May use 0. -% Offsets are positive right and up. -% The optional text, if used, must have its opening bracket immediately -% follow the image closing brace, without intervening space. -% Text may have line break or more than one paragraph, and may be styled. -% But any font family change must go outside this command, not within the text. -% The text will begin in the same block of vertical space as the image. -% If image is centered, the text will automatically be centered, so that -% it necessarily overlies the image. -% \forceindent or \backindent may be needed. Text may have several paragraphs. -% Beware of using this command near bottom of page. -% Use linegap environment to clear both image and accompanying text. -% To displace accompanying text, begin it with \vspace*{length}\par. -% Use adjustwidth environment between linegap and BlockImage centered, -% if you have accompanying text that you wish to confine in width. -\ExplSyntaxOn -\DeclareDocumentCommand \BlockImage { O{c} m +O{} }{ + +%% FLOAT IMAGE +%% ---------------------------------------------------------------------------- +%% New in v.1.50. \FloatImage. Centered unless offset. +% \FloatImage[floatmethod,xoffset,yoffset]{yourimagename.png} % or jpg +% This is a substitute for other floats. Does not require `float' package. +% Default: [ht,0pt,\nfs]. +% Method ht attempts to place the image where the code is written. But if it +% doesn't fit on that page, it will float to the top of the next page. +% Method b attempts to place the image on the bottom of the page where the +% code is written. If not, it floats to the bottom of the next page. +% Allowed float methods: ht hb t b. Equivalent to LaTeX floats with !. +% Parsing the optional argument: comma-separated values, ignoring space. +% May be empty before or between commas. +% Example: [,,2em] is read as default method, xoffset 0pt, yoffset 2em. +% Example: [b] is valid, because a single value is read as method. +\providecommand*\floatlocation[2]{\@namedef{fps@#1}{#2}} +\floatlocation{figure}{!ht} % default +\gdef\ftype@figure{1} % mystery TeX code +\DeclareDocumentCommand \FloatImage { s O{ht} m } {% starred not in use \iftoggle{@inheadfoot}{% - \ClassError{novel}{Cannot~use~BlockImage~in~header~or~footer}% - {Header~footer~allow~InlineImage~but~not~BlockImage.}% + \ClassError{novel}{Cannot use \string\FloatImage\space in header/footer}% + {Header footer allow \string\InlineImage, but not \string\FloatImage.}% }{}% - \@imgExtOKfalse% - \IfEndWith{#2}{png}{\@imgExtOKtrue}{}% - \IfEndWith{#2}{PNG}{\@imgExtOKtrue}{}% - \IfEndWith{#2}{jpg}{\@imgExtOKtrue}{}% - \IfEndWith{#2}{JPG}{\@imgExtOKtrue}{}% - \IfEndWith{#2}{jpeg}{\@imgExtOKtrue}{}% - \IfEndWith{#2}{JPEG}{\@imgExtOKtrue}{}% - \if@imgExtOK\else% - \ClassError{novel}{^^JImage~`#2'~format~not~allowed,~page~\thepage}% - {^^JImage~`#2'~has~file~type~not~allowed~in~`novel'~class.^^J% - Must~have~file~extension~png,~jpg,~jpeg,~(or~capitalized).^^J% - Others~such~as~bmp,~tiff,~pdf,~eps,~svg~are~not~allowed.^^J}% - \fi% - % Allows empty or blank to be used, and still provide default values: - \ifthenelse{\equal{#1}{} \OR \equal{#1}{\space}}{% - \def\@myargs{c}}{\def\@myargs{#1}% - } - \StrDel{\@myargs}{\space}[\@myargsns] % needs {\space} not { } - \StrCut{\@myargsns}{,}{\@myalign}{\@mycoord} - \StrCut{\@mycoord}{,}{\@myxt}{\@myyt} - \ifthenelse{\equal{\@myxt}{}\OR\equal{\@myxt}{0}}{% - \def\@myx{0pt}}{\def\@myx{\@myxt}% - } - \ifthenelse{\equal{\@myyt}{}\OR\equal{\@myyt}{0}}{% - \def\@myy{0pt}}{\def\@myy{\@myyt}% - } - % - \gdef\my@graphic{\novel@includegraphics[draft=false]{#2}}% - \setlength\@imagewidth{\widthof{\my@graphic}}% - \global\@imagewidth=\@imagewidth% - \setlength\@imageheight{\heightof{\my@graphic}}% - \global\@imageheight=\@imageheight% - \setlength\@imagehoffset{\@myx}% - \IfBeginWith{\@myy}{b}{% - \ClassError{novel}{Cannot~use~voffset~`b'~in~\stringBlockImage,~page~\thepage}% - {The~`b'~voffset~only~works~with~\string\InlineImage\space,~not~\string\BlockImage.} + \@TestImageExtension{#3}% + % Sadly, parsing with `xstring' involves roundabout code: + \StrDel{#2}{\space}[\@tempArgs]% + \StrCut{\@tempArgs}{,}{\@tempArgA}{\@tempArgX}% + \StrCut{\@tempArgX}{,}{\@tempArgB}{\@tempArgC}% + \ifthenelse{\equal{\@tempArgA}{}}{% + \def\@tempArgAa{ht}% }{% - \setlength\@imagevoffset{-\@imageheight}% - \addtolength\@imagevoffset{\@myy}% + \def\@tempArgAa{\@tempArgA}% }% - % - \setlength\@mytotalht{0pt}% - \addtolength\@mytotalht{\@imageheight}% - \addtolength\@mytotalht{-\@myy}% - \addtolength\@mytotalht{1em}% - \def\@mytotalhtnum{\strip@pt\@mytotalht}% - \FPdiv{\@mytotalhtnum}{\@mytotalhtnum}{\nbsnum}% - \FPadd{\@mytotalhtnum}{\@mytotalhtnum}{0.5}% - \FPround{\@mytotalhtnum}{\@mytotalhtnum}{0}% - % - \begin{linegap}{\@mytotalhtnum}% - % - \ifthenelse{\equal{\@myalign}{c}\OR\equal{\@myalign}{}}{% + \ifthenelse{\equal{\@tempArgB}{0}\OR\equal{\@tempArgB}{}}{% + \def\@tempArgBb{0pt}% + }{% + \def\@tempArgBb{\@tempArgB}% + }% + \ifthenelse{\equal{\@tempArgC}{0}\OR\equal{\@tempArgC}{}}{% + \def\@tempArgCc{0pt}% + }{% + \def\@tempArgCc{\@tempArgC}% + }% + \StrDel{\@tempArgAa}{!}[\@tempArgAa]% + \@tempTFfalse% + \ifthenelse{\equal{\@tempArgAa}{ht}}{\@tempTFtrue}{}% + \ifthenelse{\equal{\@tempArgAa}{hb}}{\@tempTFtrue}{}% + \ifthenelse{\equal{\@tempArgAa}{t}}{\@tempTFtrue}{}% + \ifthenelse{\equal{\@tempArgAa}{b}}{\@tempTFtrue}{}% + \if@tempTF\else% + \ClassWarning{novel}{Incorrect position for \string\FloatImage, ^^J% + page \thepage. Default position ht substituted.}% + \fi% + \floatlocation{figure}{!\@tempArgAa}% enable current float method + %\vfil% One l. + \@float{figure}% + \@FloatImage{\@tempArgBb}{\@tempArgCc}{#3}% + \end@float\par% + \floatlocation{figure}{!ht}% restore default float method + \null% + \vspace{-\nbs}% + \vspace{\@NovelCaulk}% +} % +% +\DeclareDocumentCommand \@FloatImage { m m m }{% DO NOT CALL DIRECTLY + \global\@UsingNovelCommandtrue% + \gdef\@mygraphic{\novel@sub@inclgr[scale=\@TMratio]{#3}}% + \gdef\@mygraphicname{#3}% + \gsetlength\@imagewidth{\widthof{\@mygraphic}}% + \gsetlength\@imageheight{\heightof{\@mygraphic}}% + \setlength\@imagehoffset{#1}% + \setlength\@imagevoffset{#2-\@imageheight+\normalXheight}% + \setlength\@mytotalht{\@imageheight+0.3\nbs}% + \FPdiv{\@mytotalhtN}{\strip@pt\@mytotalht}{\strip@pt\nbs}% + \FPadd{\@mytotalhtN}{\@mytotalhtN}{0.5}% round upward + \FPround{\@mytotalhtN}{\@mytotalhtN}{0}% to integer + \FPmin{\@allowmyoverflow}{\@mytotalhtN}{\@LinesPerPage}% not exceeding lpp + % If a full-page image is too tall for a page, standard TeX float will + % delay it until the time that floats are cleared, typically by \clearpage. + % That would probably be at the end of a chapter. + % In `novel' this behaivor is hacked. Regardless of the image's actual + % height, it is treated as if its height does not exceed whatever will + % fit on a single page. Then, a full-page float will appear at the first + % opportunity, rather than being delayed. As a consquence, an oversized + % full-page float may overflow into the footer or bottom margin. + % To fix that (if it matters), you need to edit the image in graphics. + \begin{linegap}{\@allowmyoverflow}% + \vspace*{-\nfs}% + \null% {\centering% \makebox[0pt][l]{% - \hspace{\dimexpr\@myx-0.5\@imagewidth}% - \stake\smash{\raisebox{\dimexpr\@myy-\@imageheight}{\my@graphic}}% + \hspace{\dimexpr\@imagehoffset-0.5\@imagewidth}% + \stake\smash{\raisebox{\@imagevoffset}{\@mygraphic}}% }% - \par}% - \vspace*{-\nbs}% - {\centering #3\par}% - }{}% - \ifthenelse{\equal{\@myalign}{r}}{% - \noindent\makebox[0pt][l]{% - \hspace{\dimexpr\textwidth+\@myx-\@imagewidth}% - \stake\smash{\raisebox{\dimexpr\@myy-\@imageheight}{\my@graphic}}% - }\par% - \vspace{-2\nbs}% - \begin{adjustwidth}{0pt}{\@imagewidth+\parindent}% - \strut\par #3\par% - \end{adjustwidth}% - }{}% - \ifthenelse{\equal{\@myalign}{l}}{% - \noindent\makebox[0pt][l]{% - \hspace{\@myx}% - \stake\smash{\raisebox{\dimexpr\@myy-\@imageheight}{\my@graphic}}% - }\par% - \vspace{-2\nbs}% - \begin{adjustwidth}{\@imagewidth+\parindent}{0pt}% - \strut\par #3\par% - \end{adjustwidth}% - }{}% + \par% + }% \end{linegap}% -} % end \BlockImage -\ExplSyntaxOff + \global\@UsingNovelCommandfalse% +} % +% end Float Image %% +%% WRAP IMAGE +%% New in v. 1.50. Wraps text around an image, with limited float support. +% This is a shim to `wrapfig' package. Since `novel' uses its own method for +% placing images, environments defined in `wrapfig' cannot be used directly. +% \WrapImage[position]{image} % default position r +% Optional position is same as with `wrapfig': +% l r o i places image "exactly here", left, right, outside, inside. +% L R O I allows image to float. +% Since novel's \InlineImage normally can be over-written by following text, +% it needs an accompanying \rule to act as a strut. +% +\RequirePackage{wrapfig} +% +\DeclareDocumentCommand\WrapImage { O{r} m } {% + \begin{wrapfloat}{figure}{#1}{0pt}% + \InlineImage[0pt,\normalXheight]{#2}% + \rule[\dimexpr\normalXheight-\imageheight]{0pt}% + {\dimexpr\imageheight-\normalXheight+0.3\nfs}% + \end{wrapfloat}% +}% +\LetLtxMacro\wrapimage\WrapImage\relax +% end Wrap Image. +%% + + + + + +%% +\endinput %% %% End of file `novel-Images.sty'. diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-JC200103.clo b/Master/texmf-dist/tex/lualatex/novel/novel-JC200103.clo index 20f0ab0b1a3..578f883adb8 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-JC200103.clo +++ b/Master/texmf-dist/tex/lualatex/novel/novel-JC200103.clo @@ -1,14 +1,27 @@ -% Typically used in Japan. Novel file version 1.46.2 +%% +%% This is file `novel-JC200103.clo', part of `novel' document class. +%% The values of the arguments are public industry standards. +\ProvidesFile{novel-JC200103.clo}% +[2018/01/14 any version. (novel Output Intent JC200103)] +%% -% The values of the arguments are public industry standards. + +% Typically used in Japan. % Remember: TeX special characters must be backslashed here. % You may see % or # or _ in the data or file names. % Be sure that they are written as \% \# \_ or there will be trouble. +% If any line is long, let it wrap. Do not attempt to break it onto multiple lines. + \gdef\@OIidentifier{JC200103} % also called "reference name" \gdef\@OIcondition{Japan Color 2001 Coated: Printing process definition: ISO 12647-2:2004, sheet-fed offset printing, positive plates, paper type 3 (coated, 105 gsm), screen frequency 69/cm.} \gdef\@OIinfo{Japan Color 2001 Coated} \gdef\@OIregistry{http://www.color.org} \gdef\@OIprofile{JapanColor2001Coated.icc} +%% +\endinput +%% +%% end of file `novel-JC200103.clo' + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty b/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty index dc4d3d2cb52..d4f1e09bac6 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-LayoutSettings.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-LayoutSettings.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% 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 @@ -13,427 +13,208 @@ %% %% \ProvidesFile{novel-LayoutSettings.sty}% -[2018/01/14 v1.46.2 LaTeX file (layout settings)] +[2018/03/28 v1.50 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 -\newlength\normalscxheight -\newlength\normalAringheight -\newlength\normaldescender -%% %% 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. +%% 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. -% -% \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 -} -% -\newcommand\ReworkTrimSize[2]{% DEPRECATED. Works, but removed from docs. - \if@coverart % - \ClassError{novel}{Rework command cannot be used with coverart option}% - {Instead of reworking document size, you must re-do the artwork.} - \else - \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}% - \fi -} +% 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. -% Inside margin generally greater than outside, due to gutter. +% Inner margin generally greater than Outer, 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} -} -\newcommand\ReworkMargins[4]{ % DEPRECATED. Works, but removed from docs. - \if@coverart % New in version 1.2 - \ClassError{novel}{Rework command cannot be used with coverart option}% - {Instead of reworking document size, you must re-do the artwork.} - \else - \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}% - \fi -} -% \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'.}% - } - \if@coverart\else % new in version 1.2 - \ifthenelse{\equal{#1}{edge}}{\global\@offcenterTrimtrue}{} - \fi -} -% \SetLinesPerPage{} 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 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/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 -% New in version 1.2, coverart. -\if@coverart % cover art has no header or footer - \gdef\SetHeadFootStyle#1{\gdef\my@HeadFootStyle{0}} - \gdef\SetHeadStyle#1{\gdef\my@HeadFootStyle{0}} % deprecated - \SetHeadFootStyle{0} -\else - % See docs for available layout choices: - \gdef\SetHeadFootStyle#1{\gdef\my@HeadFootStyle{#1}} - \gdef\SetHeadStyle#1{\gdef\my@HeadFootStyle{#1}} % deprecated -\fi -% See docs 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{{\addfontfeature{Letters=ResetAll}#1}}} - -% See novel.cls for the accompanying AtBeginDocument routine. - -% -\newif \if@gotHeader -\newif \if@gotFooter -\newif \if@styledHeader -\newif \if@styledFooter -\newif \if@validHF -% -\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 ChapterStart environment: -\gdef\SetChapterStartStyle#1{\gdef\@setchapterstart{#1}} % from v1.40.3. -\let\SetChapterStart\SetChapterStartStyle\relax % deprecated from v1.40.3. -\SetChapterStartStyle{footer} % default -% New in version 1.40.2: -\gdef\SetChapterStartHeight#1{% - \FPifint{#1}\else% - \ClassError{novel}{\string\SetChapterStartHeight\space must be integer GTE 4}% - {Height of ChapterStart must be integer, greater than or equal to 4}% - \fi% - \FPiflt{#1}{4}% - \ClassError{novel}{\string\SetChapterStartHeight\space must be integer GTE 4}% - {Height of ChapterStart must be integer, greater than or equal to 4}% - \else\fi% - \gdef\@setchapterstartheight{#1}% -} -\SetChapterStartHeight{10} % default -% See novel.cls for the accompanying AtBeginDocument routine. -% Scene breaks: -\newif\if@indentAfterScenebreak \@indentAfterScenebreakfalse -\newcommand\IndentAfterScenebreak{\@indentAfterScenebreaktrue} % deprected from v. 1.40.3 -% \SetScenebreakIndent controls whether line after \scenebreak, \sceneline, or \scenestars -% will be indented. Set true or false, default false. -\newcommand\SetScenebreakIndent[1]{% true or false, default false. From v. 1.40.3 - \def\ngoodarg{no} - \ifthenelse{\equal{#1}{true}}{% - \def\ngoodarg{yes} - \@indentAfterScenebreaktrue - }{}% - \ifthenelse{\equal{#1}{false}}{% - \def\ngoodarg{yes} - \@indentAfterScenebreakfalse - }{}% - \ifthenelse{\equal{\ngoodarg}{no}}{% - \ClassError{novel}{Bad argument for \string\SetScenebreakIndent\space}% - {\string\SetScenebreakIndent\space argument must be true or false.}% - }{}% -} -\SetScenebreakIndent{false} % default -% -%% End reserve space for header/footer and set default ChapterStart - - -%% New in version 1.2: cover image. -\newcommand\SetCoverImage[1]{ - \def\coverimageok{false} - \IfSubStr{#1}{jpg}{\def\coverimageok{true}}{} - \IfSubStr{#1}{jpeg}{\def\coverimageok{true}}{} - \IfSubStr{#1}{JPG}{\def\coverimageok{true}}{} - \IfSubStr{#1}{JPEG}{\def\coverimageok{true}}{} - \ifthenelse{\equal{\coverimageok}{true}}{% - \gdef\novelcoverimage{#1} - }{% - \ClassError{novel}{Cover image has wrong file extension}% - {Cover image must be jpg, JPG, jpeg, or JPEG.} - }% -} +\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.44: flexible images (without built-in resolution dpi) -\gdef\@novimgres{300} % default (can only be set once) -\gdef\@novereserror{% - \ClassError{novel}{\string\SetFlexResolution\space bad value}% - {Resolution must be integer from 200 to 9600. Default 300.}% -} -\newcommand\SetFlexResolution[1]{ - \IfInteger{#1}{ % - \FPiflt{#1}{200}\@novereserror\else\fi % - \FPifgt{#1}{9600}\@novereserror\else\fi % - \gdef\@novimgres{#1} % - }{\@novreserror} -} -% +%% 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 +%% -%% Markers (superscript, subscripts): -\newtoggle{@usesymbolmark} % true when footnote markers are symbolic -\newtoggle{@realmarker} % true when OT features sups, sinf, subs requested -% -% \SetMarkerStyle 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.}% - }{} -} -\LetLtxMacro{\SetMarkers}{\SetMarkerStyle} % backwards compatibilty pre-v1.40.3. -% -\SetMarkerStyle[real]{asterisk} % default +% 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[]{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 %% -%% Sets the gap between cropmarks and trim area: -\newlength\@mygap -\def\SetCropmarkGap#1{ - \ifthenelse{\lengthtest{#1 < 0pt}}{ - \setlength\@mygap{0pt} - }{ - \setlength\@mygap{#1} +%% 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.}% } -} -\SetCropmarkGap{0.125in} % default + \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 %% - -%% Fake \microtypesetup until package is loaded later: -\newif \if@setmicrotype -\gdef\microtypesetup#1{ - \gdef\@mymicrotypesetup{#1} % used in novel-FontDefaults.sty - \global\@setmicrotypetrue -} +%% \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 % -\abovedisplayskip \z@ -\abovedisplayshortskip \z@ -\belowdisplayshortskip \z@ -\belowdisplayskip \abovedisplayskip +\setlength\abovedisplayskip{0pt} +\setlength\abovedisplayshortskip{0pt} +\setlength\belowdisplayshortskip{0pt} +\setlength\belowdisplayskip{0pt} \global\@topnum \z@ % \setlength\smallskipamount{0pt} @@ -445,9 +226,14 @@ \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 @@ -455,7 +241,7 @@ \@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 -% +% Floats not allowed, but just in case: \setcounter{topnumber}{2} \renewcommand\topfraction{.7} \setcounter{bottomnumber}{1} @@ -479,199 +265,38 @@ \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 +\flushbottom % best for continuous text % %% 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 PARENT AND OTHER FONTS -%% -------------------------------------------------------------------------- -%% Prior to v. 1.1, parentfont was known as masterfont. Backwards compatible. -% -% These are the LaTeX defaults, which should already be built-in by now. -% But just in case they are undefined, here they are set to LaTeX defaults: -\providecommand\rmdefault{lmr} -\providecommand\sfdefault{lmss} -\providecommand\ttdefault{lmtt} -% 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 -\defaultfontfeatures{SmallCapsFeatures={Renderer=Basic},Ligatures=TeX,} -% Main and sans fonts: kerning, ligatures, and OldStyle numbers if available: -\defaultfontfeatures[\rmfamily,\sffamily]{Kerning=On,Numbers=OldStyle,Ligatures=Common} -% Package `unicode-math' uses Latin Modern Math as default math font: -\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. -%% Store settings for the parent font: -% \AtEndPreamble, the parent font becomes becomes -% the default ancestor of all novel-defined fonts, except the deco font. -\newif \if@parentfontset -\gdef\parentfontfeatures{} -\gdef\parentfontname{} -\DeclareDocumentCommand \SetParentFont { O{} m O{} } {% from version 1.1. - \novel@checkfeatures{#1,#3} - \gdef\parentfontfeatures{#1,#3} - \gdef\parentfontname{#2} - \global\@parentfontsettrue -}% -\DeclareDocumentCommand \SetMasterFont { O{} m O{} } {% DEPRECATED - \novel@checkfeatures{#1,#3} - \gdef\parentfontfeatures{#1,#3} - \gdef\parentfontname{#2} - \global\@parentfontsettrue -}% - -%% 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{Numbers=Lining,#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{Numbers=Lining,#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{} } {% revised v 1.40.3 - \novel@checkfeatures{#1,#3} - \gdef\@headfontfeatures{Numbers=Lining,% - WordSpace=\@looseheadword,LetterSpace=\@loosehead,#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\@decofontname{#2} - \global\@decofontsettrue - \global\@gotdecotrue - \newfontface\decofont[#1,#3]{#2} -}% -%% For syntax consistency: -\ExplSyntaxOn -\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 -\ExplSyntaxOff -%% -%% \CreateFontFeature{substitutions}{feature code} -% Problem: 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): -% \SetParentFont[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. -%% -%% end definition of parent and other fonts. %% FRONTMATTER, MAINMATTER. BUT NO BACKMATTER! -%% -------------------------------------------------------------------------- -% -\newif \ifWithinFrontmatter \WithinFrontmatterfalse -\newif \ifWithinMainmatter \WithinMainmatterfalse -\newcounter{frontmatterpages} -\newcounter{runningpages} +%% ---------------------------------------------------------------------------- % % 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.^^J}% + {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.^^J}% + {In order: \string\frontmatter\ \string\mainmatter ^^J% + but you do not need both of them.}% \fi - \WithinFrontmattertrue\WithinMainmatterfalse + \global\WithinFrontmattertrue\global\WithinMainmatterfalse \clearpage \pagenumbering{roman} \setcounter{page}{1} - \setcounter{frontmatterpages}{1} } % \def\mainmatter{ % restarts page to 1, arabic numbers; freeze frontpagecount @@ -680,39 +305,38 @@ {You issued \string\mainmatter\ more than once.}% \fi \cleartorecto % added v. 1.40.1 - \WithinFrontmatterfalse\WithinMainmattertrue - \setcounter{frontmatterpages}{\value{page}} - \addtocounter{frontmatterpages}{-1} + \global\WithinFrontmatterfalse\global\WithinMainmattertrue \pagenumbering{arabic} \setcounter{page}{1} } % -\def\backmatter{\@ifstar\@backmatterst\@backmatterns} % asterisk obsolete from v. 1.40. +\def\backmatter{\@ifstar\@backmatterst\@backmatterns} % asterisk obsolete \def\@backmatterst{% - \ClassWarning{novel}{Command \string\backmatter*\ ignored. Do not use.^^J}% + \ClassWarning{novel}{^^J\string\backmatter*\ ignored. Do not use. ^^J}% } % \def\@backmatterns{% \cleartorecto% v. 1.40.2 - \typeout{Class `novel' Alert: \string\backmatter\space merely clears to recto. See docs.^^J}% v. 1.42 + \typeout{^^JClass `novel' Alert: \string\backmatter\space merely % + clears to recto. See docs. ^^J}% v. 1.42 % } % -\def\Backmatter{\@ifstar\@Backmatterst\@Backmatterns} % obsolete from v. 1.40. +\def\Backmatter{\@ifstar\@Backmatterst\@Backmatterns} % obsolete % \def\@Backmatterst{% continues frontmatter count w/ uppercase Roman numerals - \ClassWarning{novel}{Command \string\Backmatter*\ ignored. Do not use.^^J}% + \ClassWarning{novel}{^^J\string\Backmatter*\ ignored. Do not use. ^^J}% } % \def\@Backmatterns{% - \ClassWarning{novel}{Command \string\Backmatter\ ignored. Do not use.^^J}% + \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, @@ -722,17 +346,19 @@ \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 +\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} @@ -741,10 +367,12 @@ \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: -\gdef\@nodocommand#1{ - \ClassError{novel}{No command `\string\#1' in this class}% - {The `\string\#1' command is not implemented in `novel' class.^^J}% +\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} @@ -752,24 +380,33 @@ \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. -%% polyglossia -% Language-specific settings: -\if@polyoff % polyoff is new in v 1.44. - \ClassWarning{novel}{^^JYou chose the `polyoff' class option.^^J% - So, the polyglossia package was not loaded. But like it or not,^^J% - the babel package was loaded, with generic hyphenation.^^J% - This behavior, or choice of language, cannot be changed.^^J% - If you want a specific language, you will have to use polyglossia.^^J}% -\else - \RequirePackage{polyglossia} % loading order changed in v. 1.40.3. -\fi -%% end polyglossia +%% 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'. + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-Obsolete.sty b/Master/texmf-dist/tex/lualatex/novel/novel-Obsolete.sty new file mode 100644 index 00000000000..b848c005705 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-Obsolete.sty @@ -0,0 +1,453 @@ +%% +%% This is file `novel-Obsolete.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-Obsolete.sty}% +[2018/03/28 v1.50 LaTeX file (obsolete macros)] +%% + + +%% OBSOLETE MACROS !!! +%% +%% Prior to version 1.50, `novel' contained some macros or features that +%% worked but were hard to maintain, or worked in a fashion that was +%% user-unfriendly, or was not as good as some better code. +%% These macros have been gathered here. DO NOT USE THEM IN NEW DOCUMENTS. +%% They have only been retained for backwards-compatibility. +%% If you find a bug -- too bad! Anything here is "won't fix." +%% + + +%% OBSOLETE +\gdef\SetCropmarkGap#1{} % simply ignored +%% + + +%% OBSOLETE +\newcommand\pushtextdown[1]{% OBSOLETE + \ifthenelse{\equal{#1}{} \OR \equal{#1}{ } \OR \equal{#1}{0}}{% + \def\@howmuchdown{0em}% + }{% + \def\@howmuchdown{#1}% + }% + ~\par\vspace*{-\nbs}\vspace*{\@howmuchdown}\par% +} +%% + + +%% OBSOLETE +%% \squeeze{} and \crush{} slightly shrink the horizonal dimension of the +% enclosed text. May span paragraphs. Emergency only! No compounding. +\long\gdef\squeeze#1{{\addfontfeature{FakeStretch=0.99}#1}} +\long\gdef\crush#1{{\addfontfeature{FakeStretch=0.98}#1}} +%% + + +%% OBSOLETE +\gdef\specialblankline{\null} % deprecated +%% + + +%% OBSOLETE. +%%Replaced by better method. Will be honored, but not documented. +\newcommand\TestCoverImage[1]{% + \@tempTFfalse% + \IfSubStr{#1}{jpg}{\@tempTFtrue}{}% + \IfSubStr{#1}{jpeg}{\@tempTFtrue}{}% + \IfSubStr{#1}{JPG}{\@tempTFtrue}{}% + \IfSubStr{#1}{JPEG}{\@tempTFtrue}{}% + \IfSubStr{#1}{png}{% + \@tempTFtrue + \if@pdfxISoff\else + \ifthenelse{\equal{\@PDFversion}{PDF/X-1}}{ + \ClassError{novel}{Cannot use png cover image with PDF/X-1a}% + {PDF/X-1a requires CMYK image. But png format is always RGB.}% + }{} + \fi + \ClassWarning{novel}{^^JCover image is png file type. ^^J% + Format png only supports RGB, not CMYK. ^^J% + This might be OK if you are not using PDF/X-1a, ^^J% + and if your print service accepts RGB artwork. ^^J% + But in many cases, not OK. Did you need CMYK? ^^J}% + }{}% + \IfSubStr{#1}{PNG}{% + \@tempTFtrue + \if@pdfxISoff\else + \ifthenelse{\equal{\@PDFversion}{PDF/X-1}}{ + \ClassError{novel}{Cannot use png cover image with PDF/X-1a}% + {PDF/X-1a requires CMYK image. But png format is always RGB.}% + }{} + \fi + \ClassWarning{novel}{^^JCover image is png file type. ^^J% + Format png only supports RGB, not CMYK. ^^J% + This might be OK if you are not using PDF/X-1a, ^^J% + and if your print service accepts RGB artwork. ^^J% + But in many cases, not OK. Did you need CMYK? ^^J}% + }{}% + \if@tempTF\else% + \ClassError{novel}{Cover image has wrong file extension}% + {Cover image must be jpg, JPG, jpeg, JPEG. ^^J% + Can also use png or PNG if CMYK not required.}% + \fi% +} % end \TestCoverImage +%% +\newcommand\SetCoverImage[1]{% + \if@coverart% + \ClassWarning{novel}{^^J\string\SetCoverImage\space is obsolete. ^^J% + It will be honored, but not documented. From `novel' version 1.50 use ^^J% + novel-scripts, then \ScriptCoverImage\space instead. ^^J}% + \TestCoverImage{#1}% + \AddToShipoutPictureBG{% + \AtPageUpperLeft{% + \InlineImage{#1}% + }% + }% + \null% without this, page has no "content" + \else% + \ClassError{novel}{\string\SetCoverImage\space requires `coverart' option}% + {You must use the `coverart' document class option, for cover image.}% + \fi% +} % end \SetCoverImage +%% + + +%% OBSOLETE +\newif \if@FlexResolutionSet +\gdef\@novereserror{% + \ClassError{novel}{\string\SetFlexResolution\space bad value}% + {Resolution dpi must be integer from 200 to 9600. Default 300.}% +} +\newcommand\SetFlexResolution[1]{ + \IfInteger{#1}{ % + \FPiflt{#1}{200}\@novereserror\else\fi % not enough + \FPifgt{#1}{9600}\@novereserror\else\fi % too much + \gdef\@novimgres{#1} % + }{ % + \@novreserror % + } % + \@FlexResolutionSettrue % +}% +% +\AtEndPreamble{% called by `novel.cls' \AtEndPreamble + \if@FlexResolutionSet % + \pdfimageresolution=\@novimgres % from \SetFlexResolution. Default 300. + \fi % +}% +%% + + +%% BLOCK IMAGE (OBSOLETE) +%% ---------------------------------------------------------------------------- +%% \BlockImage[alignment]{image}[text] +%% OBSOLETE FROM VERSION 1.50. Use \FloatImage instead. +\DeclareDocumentCommand \BlockImage { O{c} m +O{} }{% + \ClassWarning{novel}{^^J\string\BlockImage\space command is obsolete. ^^J% + It will remain in effect for existing documents that have it. ^^J% + New documents: Use \string\FloatImage, or \string\WrapImage, instead. ^^J% + Purpose and syntax is slightly different. See docs. ^^J}% + \iftoggle{@inheadfoot}{% + \ClassError{novel}{Cannot use \string\BlockImage\space in header/footer}% + {Header footer allow \string\InlineImage, but not \string\BlockImage.}% + }{}% + \@TestImageExtension{#2}% + % Allows empty or blank to be used, and still provide default values: + \ifthenelse{\equal{#1}{} \OR \equal{#1}{\space}}{% + \def\@myargs{c}}{\def\@myargs{#1}% + }% + \StrDel{\@myargs}{\space}[\@myargsns]% needs {\space} not { } + \StrCut{\@myargsns}{,}{\@myalign}{\@mycoord}% + \StrCut{\@mycoord}{,}{\@myxt}{\@myyt}% + \ifthenelse{\equal{\@myxt}{}\OR\equal{\@myxt}{0}}{% + \def\@myx{0pt}}{\def\@myx{\@myxt}% + }% + \ifthenelse{\equal{\@myyt}{}\OR\equal{\@myyt}{0}}{% + \def\@myy{0pt}}{\def\@myy{\@myyt}% + }% + % + \global\@UsingNovelCommandtrue% + \gdef\@mygraphic{\novel@sub@inclgr{#2}}% + \gdef\@mygraphicname{#2}% + \setlength\@imagewidth{\widthof{\@mygraphic}}% + \global\@imagewidth=\@imagewidth% + \setlength\@imageheight{\heightof{\@mygraphic}}% + \global\@imageheight=\@imageheight% + \setlength\@imagehoffset{\@myx}% + \IfBeginWith{\@myy}{b}{% + \ClassError{novel}{Cannot use voffset `b' on % + \string\BlockImage, page \thepage}% + {The `b' voffset only works with \string\InlineImage, % + not \string\BlockImage.}% + }{% + \setlength\@imagevoffset{-\@imageheight}% + \addtolength\@imagevoffset{\@myy}% + }% + % + \setlength\@mytotalht{0pt}% + \addtolength\@mytotalht{\@imageheight}% + \addtolength\@mytotalht{-\@myy}% + \addtolength\@mytotalht{1em}% + \def\@mytotalhtN{\strip@pt\@mytotalht}% + \FPdiv{\@mytotalhtN}{\@mytotalhtN}{\strip@pt\nbs}% + \FPadd{\@mytotalhtN}{\@mytotalhtN}{0.5}% + \FPround{\@mytotalhtN}{\@mytotalhtN}{0}% + % + \begin{linegap}{\@mytotalhtN}% + % + \ifthenelse{\equal{\@myalign}{c}\OR\equal{\@myalign}{}}{% + {\centering% + \makebox[0pt][l]{% + \hspace{\dimexpr\@myx-0.5\@imagewidth}% + \stake\smash{\raisebox{\dimexpr\@myy-\@imageheight}{\@mygraphic}}% + }% + \par% + } + \vspace*{-\nbs}% + {\centering #3\par}% + }{}% + \ifthenelse{\equal{\@myalign}{r}}{% + \noindent\makebox[0pt][l]{% + \hspace{\dimexpr\textwidth+\@myx-\@imagewidth}% + \stake\smash{\raisebox{\dimexpr\@myy-\@imageheight}{\@mygraphic}}% + }\par% + \vspace{-2\nbs}% + \begin{adjustwidth}{0pt}{\@imagewidth+\parindent}% + \strut\par% + #3\par% + \end{adjustwidth}% + }{}% + \ifthenelse{\equal{\@myalign}{l}}{% + \noindent\makebox[0pt][l]{% + \hspace{\@myx}% + \stake\smash{\raisebox{\dimexpr\@myy-\@imageheight}{\@mygraphic}}% + }% + \par% + \vspace{-2\nbs}% + \begin{adjustwidth}{\@imagewidth+\parindent}{0pt}% + \strut\par% + #3\par% + \end{adjustwidth}% + }{}% + \end{linegap}% + \global\@UsingNovelCommandfalse% +} % end \BlockImage (OBSOLETE) +%% + + +%% REWORK IS OBSOLETE CODE. NOT DOCUMENTED. +%% ---------------------------------------------------------------------------- +%% \ReworkTrimSize retroactively changes Trim Size after layout. +% If you use \ReworkTrimSize, you must first use \SetTrimSize (not defaults): +\newlength\@NewTrimWidth +\newlength\@NewTrimHeight +\newif \if@ReworkTrimSize +\newcommand\ReworkTrimSize[2]{% width, height + \ClassWarning{novel}{\string\Rework\space commands are obsolete. ^^J% + The \string\Rework\space commands are still effective for old documents, ^^J% + but should not be used for new documents, due to potential layout issues.}% + \if@SetTrimSize\else + \ClassError{novel}{Must use \string\SetTrimSize\space % + before \string\ReworkTrimSize}% + {\string\ReworkTrimSize\space cannot be applied to default Trim Size. ^^J% + You must manually \string\SetTrimSize\space prior to % + \string\ReworkTrimSize.}% + \fi + \if@coverart % New in version 1.2 + \ClassError{novel}{\string\Rework\space commands cannot be used % + with `coverart' option}% + {Instead of \string\Rework, you must re-do the graphics artwork.} + \else + \global\@ReworkTrimSizetrue + \gsetlength\@NewTrimWidth{#1} + \gsetlength\@NewTrimHeight{#2} + \typeout{^^J Class `novel' Alert: % + Used \string\ReworkTrimSize\space command. ^^J% + Carefully review your PDF to ensure that line breaks, paragraphs, ^^J% + and page breaks are where you expect them to be. ^^J}% + \fi +}% end \ReworkTrimSize +%% + + +%% REWORK IS OBSOLETE CODE. NOT DOCUMENTED. +%% Retroactively change margins after layout. See documentation. +% If you use \ReworkMargins, you must first use \SetMargins (not defaults): +\newlength\@NewTopMargin +\newlength\@NewOuterMargin +\newlength\@NewBottomMargin +\newlength\@NewInnerMargin +\newif \if@ReworkMargins +\newcommand\ReworkMargins[4]{ % top, outer, bottom, inner + \ClassWarning{novel}{\string\Rework\space commands are obsolete. ^^J% + The \string\Rework\space commands are still effective for old documents, ^^J% + but should not be used for new documents, due to potential layout issues.}% + \if@coverart % New in version 1.2 + \ClassError{novel}{\string\Rework\space commands cannot be used % + with coverart option}% + {Instead of \string\Rework, you must re-do the graphics artwork.} + \else + \global\@ReworkMarginstrue + \gsetlength\@NewTopMargin{#1} + \gsetlength\@NewOuterMargin{#2} + \gsetlength\@NewBottomMargin{#3} + \gsetlength\@NewInnerMargin{#4} + \typeout{^^JClass novel Alert: Used \string\ReworkMargins. ^^J% + Carefully review your PDF to ensure that line breaks, paragraphs, ^^J% + and page breaks are where you expect them to be. ^^J}% + \fi +}% end \ReworkMargins +\LetLtxMacro\ReworkMargin{\ReworkMargins}\relax % for those who mis-type +%% When \Rework, should result honor new margins (if possible), or should +% result maintain original aspect ratio? +\newif \if@AspectPriority +\newcommand\ReworkPriority[1]{% + \@tempTFfalse + \ifthenelse{\equal{#1}{aspect}}{\@AspectPrioritytrue\@tempTFtrue}{} + \ifthenelse{\equal{#1}{margins}}{\@AspectPriorityfalse\@tempTFtrue}{} + \ifthenelse{\equal{#1}{margin}}{\@AspectPriorityfalse\@tempTFtrue}{} + \if@tempTF\else + \ClassError{novel}{Bad choice for \string\ReworkPriority}% + {Rework priority choices: aspect, margins (default margins).}% + \fi +} +\ReworkPriority{margins} % default +%% + + +%% REWORK IS OBSOLETE CODE. NOT DOCUMENTED. +\gdef\ObsoleteRework{ % +% A few values from the original calculation must be stored: +\newlength\@OriginalEmSize + \gsetlength\@OriginalEmSize{\@SetFontSize} +\newlength\@OriginalTextWidth % same as original available width + \gsetlength\@OriginalTextWidth{\textwidth} +\newlength\@OriginalHeight % includes header/footer + \gsetlength\@OriginalHeight{\@AvailableHeight} +\newlength\@OriginalBaselineSkip + \gsetlength\@OriginalBaselineSkip{\baselineskip} +% Change the values of trim size and margins, as requested. +% If not changed, same as before: +\if@ReworkTrimSize + \gsetlength\@TrimWidth{\@NewTrimWidth} + \gsetlength\@TrimHeight{\@NewTrimHeight} +\fi +\if@ReworkMargins + \gsetlength\@TopMargin{\@NewTopMargin} + \gsetlength\@OuterMargin{\@NewOuterMargin} + \gsetlength\@BottomMargin{\@NewBottomMargin} + \gsetlength\@InnerMargin{\@NewInnerMargin} +\fi +% Re-calculate: +\gsetlength\@AvailableWidth{\@TrimWidth-\@OuterMargin-\@InnerMargin} +\gsetlength\@AvailableHeight{\@TrimHeight-\@TopMargin-\@BottomMargin} +%% +\xdef\@TWratio{\fpeval{\@AvailableWidth/\@OriginalTextWidth}} +\xdef\@THratio{\fpeval{\@AvailableHeight/\@OriginalHeight}} +\FPmin{\@TMratio}{\@TWratio}{\@THratio} +%% +\if@AspectPriority + \gsetlength\textwidth{\@TMratio\@OriginalTextWidth} + \gsetlength\@SetFontSize{\@TMratio\@OriginalEmSize} + \gsetlength\baselineskip{\@TMratio\@OriginalBaselineSkip} + % Find whether limiting factor is width or height: + \ifnumcomp{\@TWratio}{<}{\@THratio}{% + \setlength\@tempLength{\@AvailableHeight-\@AdjLPP\baselineskip} + \setlength\@tempLength{\@tempLength-\baselineskip+\@SetFontSize} + \setlength\@tempLength{0.5\@tempLength} + \gsetlength{\@TopMargin}{\@TopMargin+\@tempLength} + \gsetlength{\@BottomMargin}{\@BottomMargin+\@tempLength} + \FPround{\@tempN}{\strip@pt\@tempLength}{2} + \setlength\@tempLength{\@tempN pt} + \FPround{\@tempN}{\@TMratio}{4} + \typeout{^^JClass `novel' Info: Rework preserving aspect ratio. ^^J Each% + vertical margin \the\@tempLength\space over requested rework value. ^^J% + Scale \@tempN\space applied to text size and baselineskip. ^^J% + } % + }{% + \gsetlength\@OuterMargin{\@OuterMargin+0.5\@AvailableWidth-0.5\textwidth} + \gsetlength\@InnerMargin{\@InnerMargin+0.5\@AvailableWidth-0.5\textwidth} + \setlength\@tempLength{0.5\@AvailableWidth-0.5\textwidth} + \FPround{\@tempN}{\strip@pt\@tempLength}{2} + \setlength\@tempLength{\@tempN pt} + \FPround{\@tempN}{\@TMratio}{4} + \typeout{^^JClass `novel' Info: Rework preserving aspect ratio. ^^J% + Each side margin \the\@tempLength\space over requested rework value. ^^J% + Scale \@tempN\space applied to text size and baselineskip. ^^J% + } % + } % end \ifnumcomp +\else % margins priority: + % Discover what happens if scaled according to text width: + \gsetlength\textwidth{\@AvailableWidth} + \gsetlength\@SetFontSize{\@TWratio\@OriginalEmSize} + \gsetlength\baselineskip{1.2\@SetFontSize} % test for least allowable + \setlength\@tempLength{\@AdjLPP\baselineskip} + \ifdimcomp{\@AvailableHeight-\@tempLength}{<}{0pt}{% + % Will not fit vertically, so will need to re-scale \@SetFontSize. + \gsetlength\@SetFontSize{\@OriginalEmSize} + \gsetlength\baselineskip{\fpeval{\@AvailableHeight/(\@AdjLPP+1.3)}pt} + \FPdiv\@THratio{\strip@pt\baselineskip}{\strip@pt\@OriginalBaselineSkip} + \gsetlength\@SetFontSize{0.8333\baselineskip} % 0.8333 = 1/1.2, tight skip + \FPdiv{\@tempN}{\strip@pt\@SetFontSize}{\strip@pt\@OriginalEmSize} + \gsetlength\textwidth{\@tempN\@OriginalTextWidth} + \gsetlength\@OuterMargin{% + 0.5\@OuterMargin+0.5\@TrimWidth-0.5\@InnerMargin-0.5\textwidth% + } + \gsetlength\@InnerMargin{% + 0.5\@InnerMargin+0.5\@TrimWidth-0.5\@OuterMargin-0.5\textwidth% + } + \FPround{\@ActualOuterN}{\strip@pt\@OuterMargin}{2} + \FPround{\@ActualInnerN}{\strip@pt\@InnerMargin}{2} + \FPmul{\@TWratio}{\@TWratio}{\@THratio} + \FPmul{\@THratio}{\@TWratio}{1.2} + \FPround{\@TWratio}{\@TWratio}{4} + \FPround{\@THratio}{\@THratio}{4} + \typeout{^^JClass `novel' Info: Reworked side margins enlarged. ^^J% + Actual Outer Margin is now \@ActualOuterN pt. ^^J% + Actual Inner Margin is now \@ActualInnerN pt. ^^J% + Scale \@TWratio\space applied to text, ^^J% + \@THratio\space applied to baselineskip. ^^J% + } % + }{% Fits vertically. Keep \@SetFontSize. Calculate \baselineskip to fit: + \gsetlength\baselineskip{% + \fpeval{(\@AvailableHeight-1.3*\@SetFontSize)/\@AdjLPP}pt% + } % + \FPdiv{\@BLratio}{\strip@pt\baselineskip}{\strip@pt\@OriginalBaselineSkip} + \FPround{\@BLratio}{\@BLratio}{4} + \FPround{\@TWratio}{\@TWratio}{4} + \typeout{^^JClass `novel' Info: Rework was able to fit new margins. ^^J% + Scale applied to font size: \@TWratio. ^^J% + Scale applied to baselineskip: \@BLratio. ^^J% + } % + }% end \ifdimcomp. +\fi +} % end ObsoleteRework. +%% + + +%% +\AtBeginDocument{% + \LetLtxMacro\ReworkTrimSize\relax + \LetLtxMacro\ReworkMargins\relax + \LetLtxMacro\ReworkPriority\relax + \LetLtxMacro\SetFlexResolution\relax % cannot use past Preamble + \providecommand\acronym[1]{\midcase{#1}}% acronym deprecated +} % +%% + + + +%% +\endinput +%% +%% End of file `novel-Obsolete.sty'. + + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-PostLayout.sty b/Master/texmf-dist/tex/lualatex/novel/novel-PostLayout.sty new file mode 100644 index 00000000000..b2bcc27c030 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-PostLayout.sty @@ -0,0 +1,263 @@ +%% +%% This is file `novel-PostLayout.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. +%% +%% It 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-PostLayout.sty}% +[2018/03/28 v1.50 LaTeX file (post-layout modifications)] +%% + +%% +%% This file is loaded \AtEndPreamble, which precedes \AtBeginDocument. +%% + + + +% \@getPageXY is used by `shademargins' and `cropmarks' options. +% The 72.27pt compensates for built-in 1in TeX offsets. +% Position of left edge of TrimBox, rightwards from left edge of MediaBox: +\newlength\Trim@Left +% Position of bottom of TrimBox, upwards from bottom of MediaBox: +\newlength\Trim@Bottom +\gdef\@getPageXY{% + \ifodd\c@page% Adjusts for left-right margin switching, verso/recto, + % and also for horizontal position of TrimBox within MediaBox: + \gsetlength\Trim@Left{\oddsidemargin-\@InnerMargin+72.27pt}% + \else% + \gsetlength\Trim@Left{\evensidemargin-\@OuterMargin+72.27pt}% + \fi% + % Adjusts for vertical position of TrimBox within MediaBox: + + \gsetlength\Trim@Bottom{0.5\paperheight-0.5\@TrimHeight+\hoffset}% + +}% +%% end \@getPageXY. + + +%% ACTIVATE CLOSECROP CLASS OPTION +%% ---------------------------------------------------------------------------- +% The `closecrop' class option is only effective in draft mode. +% It preserves the text layout, but removes most of the margin white space. +% The resulting file is more easily readable on a hand-held device. +% However, the cropped file is not suitable for distribution as an E-book, +% as it is missing reflow information, marketing metadata, etc. +\if@closecrop + \gsetlength\paperwidth{\textwidth+0.2in} + \if@HasHeader + \gsetlength\topmargin{-1in} + \else + \gsetlength\topmargin{-0.9in} + \fi + \if@HasFooter + \if@HasHeader + \gsetlength\paperheight{% + \textheight+\headsep+\headheight+\@FootJump\baselineskip+1pt% + } + \else + \gsetlength\paperheight{% + \textheight+\headsep+\headheight+\@FootJump\baselineskip+\@SetFontSize% + } + \fi + \else + \gsetlength\paperheight{\textheight+\headsep+\headheight+0.1in} + \fi +\fi +%% end closecrop + + +%% ACTIVATE SHADEMARGINS CLASS OPTION (Includes Unsafe Zone) +%% ---------------------------------------------------------------------------- +%% With class option `shademargins' (only effective in draft mode): +% Based on code by Ulrike Fischer at tex.stackexchange.com, CC-by-sa-3.0: +% 0.542763, 0.883215 and 0.949123 are unlikely user choices. +% The re-defined \color command makes an exception for those values. +\definecolor[named]{hingledingle}{gray}{1} % fake white, when white disallowed +% +\if@shademargins + % Margins are visualized by filling the TrimBox background with gray. + % Then, the rectangle defining the Englosed area is filled with white. + % Then header and/or footer are filled with a lighter gray background. + % Then Unsafe Zone (UZ) sits atop the other background fills, as darker gray. + % The UZ is constructed from four strips, one at each side. + \AddToShipoutPictureBG{% fills trim area with medium gray + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.883215}% + \hspace{\Trim@Left}% + \rule[\Trim@Bottom]{\@TrimWidth}{\@TrimHeight}% + }% + }% + % + \AddToShipoutPictureBG{% fills enclosed area with white + \@getPageXY% + \AtPageLowerLeft{\color{hingledingle}% + \ifodd\c@page% + \hspace{\dimexpr\oddsidemargin+72.27pt}% + \else% + \hspace{\dimexpr\evensidemargin+72.27pt}% + \fi% + \rule[\dimexpr\Trim@Bottom+\@BottomMargin]% + {\textwidth}{\dimexpr\@TrimHeight-\@TopMargin-\@BottomMargin} + }% + }% + \if@HasHeader% fills header (and its jump) with light gray + \AddToShipoutPictureBG{% + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.949123}% + \ifodd\c@page% + \hspace{\dimexpr\oddsidemargin+72.27pt}% + \else% + \hspace{\dimexpr\evensidemargin+72.27pt}% + \fi% + \rule[\Trim@Bottom+\@TrimHeight-\@TopMargin-\@HeadJump\nbs]% + {\@TrimWidth-\@OuterMargin-\@InnerMargin}{\@HeadJump\nbs}% + }% + }% + \fi% + % + \if@HasFooter% fills footer (and its jump) with light gray + \AddToShipoutPictureBG{% + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.949123}% + \ifodd\c@page% + \hspace{\dimexpr\oddsidemargin+72.27pt}% + \else% + \hspace{\dimexpr\evensidemargin+72.27pt}% + \fi% + \rule[\Trim@Bottom+\@BottomMargin]% + {\@TrimWidth-\@OuterMargin-\@InnerMargin}{\@FootJump\nbs}% + }% + }% + \fi% + % + \if@UnsafeZone% fills unsafe zones with dark gray + \AddToShipoutPictureBG{% top unsafe zone + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.542763}% + \hspace{\Trim@Left}% + \rule[\Trim@Bottom+\@TrimHeight-\@TopUZWidth]% + {\@TrimWidth}{\@TopUZWidth}% + }% + }% + \AddToShipoutPictureBG{% outer unsafe zone + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.542763}% + \ifodd\c@page% + \hspace{\dimexpr\Trim@Left+\@TrimWidth-\@OuterUZWidth}% + \rule[\Trim@Bottom]{\@OuterUZWidth}{\@TrimHeight}% + \else% + \hspace{\dimexpr\Trim@Left+\@TrimWidth-\@InnerUZWidth}% + \rule[\Trim@Bottom]{\@InnerUZWidth}{\@TrimHeight}% + \fi% + }% + }% + \AddToShipoutPictureBG{% bottom unsafe zone + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.542763}% + \hspace{\Trim@Left}% + \rule[\Trim@Bottom]{\@TrimWidth}{\@BottomUZWidth}% + }% + }% + \AddToShipoutPictureBG{% inner unsafe zone + \@getPageXY% + \AtPageLowerLeft{\color[gray]{0.542763}% + \hspace{\Trim@Left}% + \ifodd\c@page% + \rule[\Trim@Bottom]{\@InnerUZWidth}{\@TrimHeight}% + \else% + \rule[\Trim@Bottom]{\@OuterUZWidth}{\@TrimHeight}% + \fi% + }% + }% + \fi% end \if@UnsafeZone + % +\fi % end \if@shademargins +% +%% end shademargins and unsafe zone + + +%% LABEL DRAFT OPTION +%% ---------------------------------------------------------------------------- +% Writes DRAFT inside upper left of TrimBox, when in draft mode. +% This macro must go here, in order, so that the label is not over-shaded. +\ifdraftdoc + \AddToShipoutPictureBG{% + \@getPageXY% + \AtPageUpperLeft{% + \raisebox{-\@SetFontSize}{\textbf{~DRAFT}}% + }% + }% +\fi +%% end label draft. + + +%% ACTIVATE CROPMARKS CLASS OPTION +%% ---------------------------------------------------------------------------- +% Cropmarks (trim marks, really) are not important in this document class. +% That's because the targeted printing services generally do not want them. +% But a minimal capability was easy to add. The far end of each mark is +% 0.25in from the trim area. The close end is separated by 0.125in. +% So the length of the marks essentially 1/8in. Width 0.25bp. +% The marks are turned on using `cropmarks' class option. +% When Media Size = Trim Size, cropmarks are disabled. +% Too late for \@cropviewfalse; OK since CropBox already calculated properly. +\ifthenelse{% + \dimtest{\@TrimWidth}{=}{\paperwidth} % + \AND \dimtest{\@TrimHeight}{=}{\paperheight}% +}{\global\@cropmarksfalse}{} +% +\if@cropmarks% Cropmark begins 0.125in from TrimBox, ends 0.25in from TrimBox. + % H top left: + \AddToShipoutPictureBG{\@getPageXY% + \AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left-0.25in}% + \rule[0.5\paperheight+0.5\@TrimHeight]{0.25in-0.125in}{0.25bp}}} + % H bottom left: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left-0.25in}% + \rule[\Trim@Bottom-0.5pt]{0.25in-0.125in}{0.25bp}}} + % H top right: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left+\@TrimWidth+0.125in}% + \rule[0.5\paperheight+0.5\@TrimHeight]{0.25in-0.125in}{0.25bp}}} + % H bottom right: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left+\@TrimWidth+0.125in}% + \rule[\Trim@Bottom-0.25bp]{0.25in-0.125in}{0.25bp}}} + % V top left: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left-0.25bp}% + \rule[0.5\paperheight+0.5\@TrimHeight+0.125in]% + {0.25bp}{0.25in-0.125in}}} + % V bottom left: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left-0.25bp}% + \rule[\Trim@Bottom-0.25in]{0.25bp}{0.25in-0.125in}}} + % V top right: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left+\@TrimWidth}% + \rule[0.5\paperheight+0.5\@TrimHeight+0.125in]% + {0.25bp}{0.25in-0.125in}}} + % V bottom right: + \AddToShipoutPictureBG{\@getPageXY\AtPageLowerLeft{% + \hspace{\dimexpr\Trim@Left+\@TrimWidth}% + \rule[\Trim@Bottom-0.25in]{0.25bp}{0.25in-0.125in}}} +\fi +% +%% end cropmarks + + + +%% +\endinput +%% +%% End of file `novel-PostLayout.sty'. + + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-Sandbox.sty b/Master/texmf-dist/tex/lualatex/novel/novel-Sandbox.sty new file mode 100644 index 00000000000..16f888ea51d --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-Sandbox.sty @@ -0,0 +1,143 @@ +%% +%% This is file `novel-Sandbox.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. +%% +%% Material extracted from `article.cls', a LaTeX document class. +%% Copyright 1993-2016 +%% The LaTeX3 Project and any individual authors listed elsewhere +%% in this file. +%% +%% It 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-Sandbox.sty}% +[2018/03/28 v1.50 LaTeX file (used only with sandbox class option)] +%% + +%% +%% This file is only loaded when the `sandbox' document class is used. +%% It provides support for tables, and a few other things that ordinarily +%% would be prohibited in `novel' due to possible layout incompatibility. +%% + + + + + + +\setlength\leftmargini {2.5em} +\leftmargin \leftmargini +\setlength\leftmarginii {2.2em} +\setlength\leftmarginiii {1.87em} +\setlength\leftmarginiv {1.7em} +\setlength\leftmarginv {1em} +\setlength\leftmarginvi {1em} +\setlength \labelsep {.5em} +\setlength \labelwidth{\leftmargini} +\addtolength\labelwidth{-\labelsep} +\@beginparpenalty -\@lowpenalty +\@endparpenalty -\@lowpenalty +\@itempenalty -\@lowpenalty +\renewcommand\theenumi{\@arabic\c@enumi} +\renewcommand\theenumii{\@alph\c@enumii} +\renewcommand\theenumiii{\@roman\c@enumiii} +\renewcommand\theenumiv{\@Alph\c@enumiv} +\newcommand\labelenumi{\theenumi.} +\newcommand\labelenumii{(\theenumii)} +\newcommand\labelenumiii{\theenumiii.} +\newcommand\labelenumiv{\theenumiv.} +\renewcommand\p@enumii{\theenumi} +\renewcommand\p@enumiii{\theenumi(\theenumii)} +\renewcommand\p@enumiv{\p@enumiii\theenumiii} +\newcommand\labelitemi{\textbullet} +\newcommand\labelitemii{\normalfont\bfseries \textendash} +\newcommand\labelitemiii{\textasteriskcentered} +\newcommand\labelitemiv{\textperiodcentered} +\newenvironment{description} + {\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\descriptionlabel}} + {\endlist} +\newcommand*\descriptionlabel[1]{\hspace\labelsep + \normalfont\bfseries #1} + + + +\setlength\tabcolsep{6pt} +\setlength\arrayrulewidth{.4pt} +\setlength\doublerulesep{2pt} +\setlength\tabbingsep{\labelsep} + + +\newcounter{figure} +\renewcommand \thefigure {\@arabic\c@figure} +\def\fps@figure{tbp} +\def\ftype@figure{1} +\def\ext@figure{lof} +\def\fnum@figure{\figurename\nobreakspace\thefigure} + +\newenvironment{figure} + {\@float{figure}} + {\end@float} +\newenvironment{figure*} + {\@float{figure}} + {\end@float} + + + +\newcounter{table} +\renewcommand\thetable{\@arabic\c@table} +\def\fps@table{tbp} +\def\ftype@table{2} +\def\ext@table{lot} +\def\fnum@table{\tablename\nobreakspace\thetable} + +\newenvironment{table} + {\@float{table}} + {\end@float} +\newenvironment{table*} + {\@float{table}} + {\end@float} + + + +\newlength\abovecaptionskip +\newlength\belowcaptionskip + +\setlength\abovecaptionskip{\nbs} + +\setlength\belowcaptionskip{0pt} + +\long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1: #2}% + \ifdim \wd\@tempboxa >\hsize + #1: #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip} + + + + + + + +\def\today{\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year} + + + +\endinput + +%% end of file `novel-Sandbox.sty'. + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-TextMacros.sty b/Master/texmf-dist/tex/lualatex/novel/novel-TextMacros.sty index 32f874c2348..90d92edba5e 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-TextMacros.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-TextMacros.sty @@ -1,6 +1,6 @@ %% -%% This is file `novel-TextMacros.sty', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. +%% This is file `novel-TextMacros.sty', part of `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. %% %% %% This file may be distributed and/or modified under the @@ -13,156 +13,170 @@ %% %% \ProvidesFile{novel-TextMacros.sty}% -[2018/01/14 v1.46.2 LaTeX file (text macros usable within document body)] +[2018/03/28 v1.50 LaTeX file (text macros usable within document body)] %% -%% This file contains various commands that are usable within the document body, -%% for styling and otherwise manipulating text. +%% This file contains various commands usable within the document body, +%% for styling and otherwise manipulating text. %% These are not commands used in Preamble for setup, although a few of them -%% can be used in Preamble for setup, then again in body for change. +%% can be used in Preamble for setup, then again in body for change. + %% The following commands are BANNED. -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- % 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). +% repeating their arguments. In some cases, they request functionality +% not implemented in `novel'. In other cases, the function is part of core, +% but would interfere with the `novel' emphasis on constant line skip. +% You may re-define the commands via your own code in Preamble (discouraged). % %% Standard LaTeX font sizes are ineffective. Use novel's own methods. % If you write one of these size commands, it will silently be ignored: -% \small, \footnotesize, \scriptsize, \tiny, -% \large, \Large, \LARGE, \huge, \Huge, \HUGE. +% \small, \footnotesize, \scriptsize, \tiny, +% \ large, \Large, \LARGE, \huge, \Huge, \HUGE, \textls % %% Internal subdivisions are ineffective. % The command will merely echo its argument, without any functionality: -% \part{}, \chapter{}, \section{}, \subsection{}, \subsubsection{}, \paragraph{}, \subparagraph{} +% \part, \chapter, \section, \subsection, \subsubsection, +% \paragraph, \subparagraph. % -%% Certain commands will generate an error, so that you know they cannot be used: -% \maketitle, \makeindex, \tableofcontents, \listoftables, \listoffigures, \textls +%% Some commands will generate an error, so that you know they cannot be used: +% \maketitle, \makeindex, \tableofcontents, \listoftables, \listoffigures, % -%% You cannot use \includepdf (package: pdfpages). +%% You can only use \includepdf (package: pdfpages) for pdf files pre-processed +%% by novel-scripts. % %% You cannot use \includegraphics. Instead use novel's own image commands. % -%% Commands normally provided in other classes, pertaining to floats, figures, and tables, -%% are not defined in `novel' class. If you attempt to use them, an error will result. - +%% Commands normally provided in other classes, pertaining to floats, figures, +% and tables, are not defined in `novel' class. +% If you attempt to use them, an error will result. +%% %% AND NOW TO THE GOOD STUFF -%% ----------------------------------------------------------------------------- -% +%% ---------------------------------------------------------------------------- + +%% +% New in version 1.38, \straightquote and \straightdblquote: +\gdef\straightquote{{\addfontfeature{Ligatures=ResetAll}'}} +\gdef\straightdblquote{{\addfontfeature{Ligatures=ResetAll}"}} +%% + +%% Acronyms often look too big in regular capitals, but too small in +% small caps. Command \midcase{} provides an intermediate size: +\gdef\midcase#1{% + \if@HasDecoFont% + {\decofont{#1}}% + \else% + #1% simply echo the argument, if no decofont + \fi% +}% +%% + +%% Deco glyphs are decorative elements chosen from the decofont by code. +% They are documented in file NovelDeco-glyphs.pdf, in the `extras' folder. +\gdef\decoglyph#1{% + \if@HasDecoFont% + \IfBeginWith{#1}{n}{% normal weight symbol (same as regular) + \StrBehind{#1}{n}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{r}{% regular weight symbol + \StrBehind{#1}{r}[\@tempdecoglyph]{\@decoglyph\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{l}{% light weight symbol + \StrBehind{#1}{l}[\@tempdecoglyph]{\@decoglypha\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{e}{% extra light weight symbol + \StrBehind{#1}{e}[\@tempdecoglyph]{\@decoglyphb\symbol{\@tempdecoglyph}}% + }{}% + \IfBeginWith{#1}{t}{% thin weight symbol + \StrBehind{#1}{t}[\@tempdecoglyph]{\@decoglyphc\symbol{\@tempdecoglyph}}% + }{}% + \else% + ~% non-breaking space, if no decofont + \fi% +}% +%% + %% \memo{} does not print or save its argument. % Useful when you wish to put a note to yourself in the *.tex document. % Not the same as % comment, because anything after the braces will print. \long\gdef\memo#1{} -% -\gdef\stake{\rule{0pt}{1pt}} % placeholder -% -% \forceindent and \backindent perform or remove indent, using \hspace{}. -% Rationale: Sometimes \indent and \noindent are neutralized by another command. -\newlength\forceparlength % holds default value, even when \parindent changed - -% See novel.cls for accompanying AtBeginDocument routine. +%% +%% \stake is like \strut, but does not occupy uch vertical space. +\gdef\stake{\rule{0pt}{1pt}} % placeholder %% -% \smcp{} and \textsc{} small caps (Open Type) and \allsmcp{}: -% + +%% \smcp{} and \textsc{} small caps (Open Type) and \allsmcp{}: \ExplSyntaxOn -% -\DeclareDocumentCommand \smcp { +m } - {% +\DeclareDocumentCommand \smcp { +m } {% lowercase to small caps {\addfontfeature{Letters=SmallCaps}#1}% - } -% -\DeclareDocumentCommand \allsmcp { +m } - {% +} +\DeclareDocumentCommand \allsmcp { +m } {% lowercase+uppercase to small caps \fontspec_if_feature:nTF {c2sc}{% {\addfontfeatures{Letters=UppercaseSmallCaps, Letters=SmallCaps}#1}% }{% {\addfontfeature{Letters=SmallCaps}\MakeLowercase{#1}}% }% } -% \ExplSyntaxOff -% \let\textsc\smcp\relax % unified \let\oldscshape\scshape\relax % in case needed later \let\scshape\smcp\relax % unified -% \providecommand\FirstLineFont{\smcp} % package `magaz' \renewcommand\FirstLineFont{\smcp} %% -%% The `novel' class normally allows only black text on white paper. +%% `novel' class normally allows only black or grayscale text on white paper. %% In draft mode, option `shademargins` provides light gray margins, %% but still black text on white paper. -%% However, with option `graytext' (in any mode) then grayscale text -%% is allowed. Images are always allowed grayscale. %% Just in case `xcolor' re-defines its internals, to prevent code bomb: \ProvideDocumentCommand\@declaredcolor { m } {} \ProvideDocumentCommand\@undeclaredcolor { o m } {} +% For convenience: +\definecolor[named]{gray1}{gray}{0.15} % ten percent gray, etc. +\definecolor[named]{gray2}{gray}{0.25} +\definecolor[named]{gray3}{gray}{0.33} +\definecolor[named]{gray4}{gray}{0.4} +\definecolor[named]{gray5}{gray}{0.5} +\definecolor[named]{gray6}{gray}{0.6} +\definecolor[named]{gray7}{gray}{0.68} +\definecolor[named]{gray8}{gray}{0.75} +\definecolor[named]{gray9}{gray}{0.87} %% -\if@graytext % and the usual colors, including black and white. - \definecolor[named]{gray1}{gray}{0.15} % ten percent gray, etc. - \definecolor[named]{gray2}{gray}{0.25} - \definecolor[named]{gray3}{gray}{0.33} - \definecolor[named]{gray4}{gray}{0.4} - \definecolor[named]{gray5}{gray}{0.5} - \definecolor[named]{gray6}{gray}{0.6} - \definecolor[named]{gray7}{gray}{0.68} - \definecolor[named]{gray8}{gray}{0.75} - \definecolor[named]{gray9}{gray}{0.87} -\else - \let\my@color\color\relax - \let\color\relax - \DeclareDocumentCommand \color { o m } - {% - \ifthenelse{\equal{#1}{gray} \AND \equal{#2}{0.903215}}{\@undeclaredcolor[gray]{0.903215}}{}% shademargins - \ifthenelse{\equal{#2}{hingledingle}}{\@declaredcolor{white}}{}% hingledingle is internal alias for white - } -\fi -%% - - % This code is slightly modified from package `etextools' by Florent Chervet. % Its license: "This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 of this % license or (at your option) any later version." % My rationale for not simply loading the package: Other parts of the package -% generate warning messages, but the warnings do not apply. Also, I might -% wish to hack the code at some point. +% generate warning messages, but the warnings do not apply in `novel' +% Also, I might wish to hack the code at some point. \newcount\nov@ettl@fter \newrobustcmd\nov@AfterGroup{% \@ifstar{\nov@ettl@AfterGroup\@firstofone}{\nov@ettl@AfterGroup\unexpanded}% } \newrobustcmd\nov@ettl@AfterGroup[2]{% - \csxdef{nov@ettl@fterGroup\number\numexpr\the\nov@ettl@fter+1}% - {\global\csundef{nov@ettl@fterGroup\number\numexpr\the\nov@ettl@fter+1}#1{#2}}% - \global\advance\nov@ettl@fter\@ne% - \expandafter\aftergroup\csname nov@ettl@fterGroup\the\nov@ettl@fter\endcsname% +\csxdef{nov@ettl@fterGroup\number\numexpr\the\nov@ettl@fter+1}% +{\global\csundef{nov@ettl@fterGroup\number\numexpr\the\nov@ettl@fter+1}#1{#2}}% +\global\advance\nov@ettl@fter\@ne% +\expandafter\aftergroup\csname nov@ettl@fterGroup\the\nov@ettl@fter\endcsname% } -% End code from `etextools`. - - - +%% End code from `etextools`. %% \flexbox based on code by Werner at tex.stackexchange.com, CC-by-sa-3.0: % Optional first argument is minimum width of box. % Second argument is contents of box. % Box width will be the greater of #1 or the width of #2. -\newlength\@mylen \newcommand{\flexbox}[2][\parindent]{% - \settowidth{\@mylen}{#2}% - \ifdim\@mylen < #1% - \makebox[#1][l]{#2}% - \else% - #2% - \fi% + \settowidth{\@tempLength}{#2}% + \ifdimcomp{\@tempLength}{<}{#1}{\makebox[#1][l]{#2}}{#2}% } +%% + %% \bigemdash inspired by code by RTBarnard at stackoverflow.com, CC-by-sa-3.0: % Allows a rule of variable length to fill available space at its right. % There must be a "right-hand limit" imposed by something, such as by enclosing @@ -172,25 +186,30 @@ % Takes a single optional argument: Comma-separated raise, line thickness. % If no argument or empty, defaults to [1,1]. % Without comma, argument defaults to [argument,1]. -% First number: Scales the raise up or down. 1 = raise of emdash in typical fonts. -% Second number: Scales the line thickness. 1 = thickness of emdash in typical fonts. +% First number: Scales raise/down. 1 = raise of emdash in typical fonts. +% Second number: Scales line thickness. 1 = emdash in typical fonts. % NOTE: Built-in TeX PDF viewer might show the line at slightly incorrect % width and height. Best seen in a "real" PDF viewer. \DeclareDocumentCommand \bigemdash { O{1,1} } {% - \ifthenelse{\equal{#1}{}\OR\equal{#1}{\space}}{\def\@myargsi{1,1}}{\def\@myargsi{#1}}% + \ifthenelse{\equal{#1}{}\OR\equal{#1}{\space}}{% + \def\@myargsi{1,1}}{\def\@myargsi{#1}% + }% \StrDel{\@myargsi}{\space}[\@myargs]% \StrCut{\@myargs}{,}{\@myraisei}{\@mythicki}% - \ifthenelse{\equal{\@myraisei}{}\OR\equal{\@myraisei}{\space}}{\def\@myraise{1}}{\def\@myraise{\@myraisei}}% - \ifthenelse{\equal{\@mythicki}{}\OR\equal{\@mythicki}{\space}}{\def\@mythick{1}}{\def\@mythick{\@mythicki}}% + \ifthenelse{\equal{\@myraisei}{}\OR\equal{\@myraisei}{\space}}{% + \def\@myraise{1}}{\def\@myraise{\@myraisei}% + }% + \ifthenelse{\equal{\@mythicki}{}\OR\equal{\@mythicki}{\space}}{% + \def\@mythick{1}}{\def\@mythick{\@mythicki}% + }% \FPmul{\@myraise}{\@myraise}{0.56}% ex, typical font emdash raise \FPmul{\@mythick}{\@mythick}{0.049}% em, typical font emdash thickness {\leaders\hbox{\rule[\@myraise ex]{1pt}{\@mythick em}}\hfill\stake}% } %% -%% -% \charscale[scale,x,y]{text} and starred version +%% \charscale[scale,x,y]{text} and starred version % This is an "in-line" means of adjusting font size % and position, without changing the baselineskip. % If the optional argument is unused or empty, then the text is not scaled @@ -200,46 +219,63 @@ % First argument is scale. Number>=0.5. Default 1. Relative to what the size % would otherwise be. May multiply with an already-scaled font. % Second and third arguments are x-offset and y-offset, respectively. -% Offsets are lengths, best measured in em or \nfs for x, -% and em or \nfs or \nbs for y. Default 0pt. Can abbreviate as 0. -% Posiive offsets are x right, y up. +% Offsets are lengths, best measured in em or \nfs for horizontal, +% and em or \nfs or \nbs for vertical. Default 0pt. Can abbreviate as 0. +% Posiive offsets are horizontal right, vertical up. % Text is "smashed" and may go anywhere, even overlying other text or image. % The unstarred command occupies width equal to the scaled text, % thus leaving a "hole" where the text would have been. % The starred command occupies zero width, thus no hole. Consecutive starred % commands, without intervening space, displace from same origin. % The text must be on a single line, without break or wrap. -% Do not use \\ or \par inside \charscale, but you sometimes need \par after it. +% Do not use \\ or \par inside \charscale. Sometimes you need \par after it. % If the text is in a font other than usual, place the font command % outside \charscale, not inside. \ExplSyntaxOn -\DeclareDocumentCommand \charscale { s O{1} m } - { +\DeclareDocumentCommand \charscale { s O{1} m } {% % Allows empty or blank to be used, and still provide default values: - \ifthenelse{\equal{#2}{}\OR\equal{#2}{\space}}{\def\@myargs{1}}{\def\@myargs{#2}} - \StrDel{\@myargs}{\space}[\@myargsns] % needs {\space} not { } - \StrCut{\@myargsns}{,}{\@myscalet}{\@mycoord} - \ifthenelse{\equal{\@myscalet}{}}{\def\@myscale{1}}{\def\@myscale{\@myscalet}} + \ifthenelse{\equal{#2}{}\OR\equal{#2}{\space}}{% + \def\@myargs{1}% + }{% + \def\@myargs{#2}% + }% + \StrDel{\@myargs}{\space}[\@myargsns]% needs {\space} not { } + \StrCut{\@myargsns}{,}{\@myscalet}{\@mycoord}% + \ifthenelse{\equal{\@myscalet}{}}{% + \def\@myscale{1}% + }{% + \def\@myscale{\@myscalet}% + }% \FPmax{\@myscale}{\@myscale}{0.5}% not permitted below this scale - \StrCut{\@mycoord}{,}{\@myxt}{\@myyt} - \ifthenelse{\equal{\@myxt}{}\OR\equal{\@myxt}{0}}{\def\@myx{0pt}}{\def\@myx{\@myxt}} - \ifthenelse{\equal{\@myyt}{}\OR\equal{\@myyt}{0}}{\def\@myy{0pt}}{\def\@myy{\@myyt}} - \IfBooleanTF{#1} + \StrCut{\@mycoord}{,}{\@myxt}{\@myyt}% + \ifthenelse{\equal{\@myxt}{}\OR\equal{\@myxt}{0}}{% + \def\@myx{0pt}% + }{% + \def\@myx{\@myxt}% + }% + \ifthenelse{\equal{\@myyt}{}\OR\equal{\@myyt}{0}}{% + \def\@myy{0pt}% + }{% + \def\@myy{\@myyt}% + }% + \IfBooleanTF{#1}% {% starred \ifvmode\else\unskip\fi% - \stake\makebox[0pt][l]{\smash{\hspace{\@myx}\raisebox{\@myy}{\scalebox{\@myscale}{#3}}}}% + \stake\makebox[0pt][l]{% + \smash{\hspace{\@myx}\raisebox{\@myy}{\scalebox{\@myscale}{#3}}}% + }% }{% unstarred - \stake\makebox[0pt][l]{\smash{\hspace{\@myx}\raisebox{\@myy}{\scalebox{\@myscale}{#3}}}}% + \stake\makebox[0pt][l]{% + \smash{\hspace{\@myx}\raisebox{\@myy}{\scalebox{\@myscale}{#3}}}% + }% \smash{\phantom{\scalebox{\@myscale}{#3}}}% - } - } + }% + }% end \charscale \ExplSyntaxOff %% - - -%% -% If you really must change the font size and baselineskip on a paragraph basis, +%% Environment parascale. +% If you really must change font size and baselineskip on a paragraph basis, % then use an environment. For example, the text on your Copyright page might % be smaller (and less baselineskip) than normal. % The following environment takes an optional argument, which is the scale @@ -259,16 +295,17 @@ % do the calculations yourself. \newenvironment{parascale}[1][1] {\begingroup% -\FPmax{\my@tempDetailsNum}{#1}{0.5}% must be at least half normal. -\FPmul{\my@tempDetailsFontNum}{\my@tempDetailsNum}{\Current@FontSizeNum}% -\FPround{\my@tempDetailsFontNum}{\my@tempDetailsFontNum}{2}% -\FPmul{\my@tempDetailsSkipNum}{\my@tempDetailsNum}{\Current@BaselineSkipNum}% -\FPround{\my@tempDetailsSkipNum}{\my@tempDetailsSkipNum}{2}% -\fontsize{\my@tempDetailsFontNum pt}{\my@tempDetailsSkipNum pt}\selectfont}% +\FPmax{\@mytempDetailsN}{#1}{0.5}% must be at least half normal. +\FPmul{\@mytempDetailsFontN}{\@mytempDetailsN}{\strip@pt\@SetFontSize}% +\FPround{\@mytempDetailsFontN}{\@mytempDetailsFontN}{2}% +\FPmul{\@mytempDetailsSkipN}{\@mytempDetailsN}{\strip@pt\baselineskip}% +\FPround{\@mytempDetailsSkipN}{\@mytempDetailsSkipN}{2}% +\fontsize{\@mytempDetailsFontN pt}{\@mytempDetailsSkipN pt}\selectfont% +}% {\endgroup} -% %% -% Environment toc (alternative table of contents): + +%% Environment toc (alternative table of contents): % optional argument: additional vspace (\nbs) after each \tocitem entry. % required: LR margin increase, to narrow the table (0pt = full textwidth). \newlength\@tocnumwid @@ -276,14 +313,15 @@ \newenvironment{toc}[2][0]% {% \begin{adjustwidth}{#2}{#2}% - \begingroup% lengths not global - \setlength\parindent{0pt}% - \setlength\@tocnumwid{\widthof{00.~}}% - \setlength\@tocskip{#1\nbs}% + \begingroup% + \setlength\parindent{0pt}% local + \setlength\@tocnumwid{\widthof{00.~}}% local + \setlength\@tocskip{#1\nbs}% local }{% - \endgroup\end{adjustwidth}\par% + \endgroup% + \end{adjustwidth}\par% }% -%% \tocitem[number]{description}{page} provides a one-line table entry in toc. +% \tocitem[number]{description}{page} provides a one-line table entry in toc. % optional number might be chapter number. Can use ~ to offset. % unstarred: distance between description and page is not decorated. % starred (better): distance between description and page has dotted line. @@ -297,7 +335,8 @@ }% }% #2\,% - \dotfill% + %%%%%\dotfill% + \leaders\hbox to 0.3em{\hfil.\hfil}\hfill% Thanks to user daniel-j via GitHub. \,#3\par\vspace{\@tocskip}% }% % @@ -314,7 +353,7 @@ #3\par\vspace{\@tocskip}% }% %% end toc and \tocitem. -%% + %% legalese environment. Certain info, such as Copyright page, customarily is % neither justified nor hyphenated. Can be used wherever desired, of course. \newenvironment{legalese} @@ -322,144 +361,160 @@ {} % \gdef\hangleft#1{% places content to left of usual position. - \newlength\@temphangl% - \setlength\@temphangl{\widthof{#1}}% - \stake\hspace{-\@temphangl}#1% + \setlength\@tempLength{\widthof{#1}}% local + \stake\hspace{-\@tempLength}#1% } %% -% \showlength[decimal places]{length}{units} -% Returns the length as a string with the units, but does not change the length. + +%% \showlength[decimal places]{length}{units} +% Returns length as a string with the units, but does not change the length. % length is any existing length % units may be pt, bp, mm, cm, in % decimal places for rounding (0=integer, 1=one decimal point, etc.) % Example: \showlength[3]{17bp}{in} returns 0.236in -\newlength{\temp@showlength} \newcommand\showlength[3][]{% - \setlength\temp@showlength{#2}% - \def\temp@lengthnum{\strip@pt\temp@showlength}% + \setlength\@tempLength{#2}% + \def\@tempLengthN{\strip@pt\@tempLength}% \ifthenelse{\equal{#3}{bp}}{% - \FPmul{\temp@lengthnum}{\temp@lengthnum}{0.99626401}% + \FPmul{\@tempLengthN}{\@tempLengthN}{0.99626401}% }{}% \ifthenelse{\equal{#3}{mm}}{% - \FPmul{\temp@lengthnum}{\temp@lengthnum}{0.351459804}% + \FPmul{\@tempLengthN}{\@tempLengthN}{0.351459804}% }{}% \ifthenelse{\equal{#3}{cm}}{% - \FPmul{\temp@lengthnum}{\temp@lengthnum}{0.0351459804}% + \FPmul{\@tempLengthN}{\@tempLengthN}{0.0351459804}% }{}% \ifthenelse{\equal{#3}{in}}{% - \FPmul{\temp@lengthnum}{\temp@lengthnum}{0.013837}% + \FPmul{\@tempLengthN}{\@tempLengthN}{0.013837}% }{}% - \ifthenelse{\equal{#1}{}}{}{\FPround{\temp@lengthnum}{\temp@lengthnum}{#1}}% - \temp@lengthnum#3% + \ifthenelse{\equal{#1}{}}{}{\FPround{\@tempLengthN}{\@tempLengthN}{#1}}% + \@tempLengthN{#3}% } %% end \showlength - -%% \squeeze{} and \crush{} slightly shrink the horizonal dimension of the -% enclosed text. May span paragraphs. Emergency only! No compounding. -\long\gdef\squeeze#1{{\addfontfeature{FakeStretch=0.99}#1}} -\long\gdef\crush#1{{\addfontfeature{FakeStretch=0.98}#1}} -%% - - %% \lnum for lining numbers. \gdef\lnum#1{{\addfontfeature{Numbers=Lining}#1}} %% - -%% superscripts and subscripts -\let\subs\relax -\let\sups\relax -\let\textsuperscript\relax -\let\textsubscript\relax -\newlength\@hoAhl % measured when needed. -% Perhaps superscripts and subscripts (scientific) are in the font, or not. -% Problem: The best fonts have these characters at size/weight designed -% to mingle with normal size. But many fonts merely scaled characters, -% which will be too light at the small size. -% The unstarred version of these commands use the Open Type features when -% they are present, then faking (auto scale/raise) if features not present. -% The starred version just fakes, without regard for features. -% - -% Note that the effect of these commands continues, not just one-shot: -\gdef\realmarker{\toggletrue{@realmarker}} % anywhere in text -\gdef\fakemarker{\togglefalse{@realmarker}} % anywhere in text -%% -\ExplSyntaxOn -% -\DeclareDocumentCommand \sups { m } - {% - \iftoggle{@realmarker}{% - \fontspec_if_feature:nTF {sups}{% - \ifvmode\else\unskip\fi{\addfontfeature{VerticalPosition=Superior}\smash{#1}}% - }{% - \setlength\@hoAhl{\heightof{Ahl}}% - \ifvmode\else\unskip\fi\charscale[0.7,0pt,0.5\@hoAhl]{#1}% - }% - }{% - \setlength\@hoAhl{\heightof{Ahl}}% - \ifvmode\else\unskip\fi{\addfontfeature{Numbers=Lining}\charscale[0.7,0pt,0.5\@hoAhl]{#1}}% - }% - }% end \sups -% -\DeclareDocumentCommand \subs { m } - {% - \iftoggle{@realmarker}{% - \fontspec_if_feature:nTF {sinf}{% - \ifvmode\else\unskip\fi{\addfontfeature{VerticalPosition=ScientificInferior}\smash{#1}}% - }{% - \fontspec_if_feature:nTF {subs}{% - \ifvmode\else\unskip\fi{\addfontfeature{VerticalPosition=Inferior}\smash{#1}}% - }{% - \setlength\@hoAhl{\heightof{Ahl}}% - \ifvmode\else\unskip\fi\charscale[0.7,0pt,-0.2\@hoAhl]{#1}% - }% - }% - }{% - \setlength\@hoAhl{\heightof{Ahl}}% - \ifvmode\else\unskip\fi{\addfontfeature{Numbers=Lining}\charscale[0.7,0pt,-0.2\@hoAhl]{#1}}% - }% - }% end \subs -% -\cs_new_eq:NN \textsuperscript \sups -\cs_new_eq:NN \textsubscript \subs -\ExplSyntaxOff -%% -\gdef\specialblankline{\null} % deprecated -%% - - -%% New in v. 1.46: Allows text to be placed (potentially) off-grid, with grid resuming after. -\newcounter{currentlinegap} % 0 when not within a linegap environment, >0 otherwise. -\ExplSyntaxOn +%% Environment linegap. +% Allows text to be placed (potentially) off-grid, with grid resuming after. +\newif \if@WithinLinegap % true within linegap environment +\newcounter{currentlinegap} % 0 when not within linegap, >0 otherwise. +\ExplSyntaxOn % absorbs line returns here: \DeclareDocumentEnvironment {linegap} { m } {% - \FPifint{#1}\else% + \FPifint{#1}\else \ClassError{novel}{Non-integer~linegap~on~page~\thepage}% {Only~integer~>=~1~allowed~for~linegap.}% - \fi% - \FPiflt{#1}{1}% + \fi + \FPiflt{#1}{1} \ClassError{novel}{Insufficient~linegap~on~page~\thepage}% {Only~integer~>=~1~allowed~for~linegap.}% - \fi% - \par% - \null% - \vspace*{-\nbs}% - \begin{textblock*}{\textwidth}[0,0](0pt,0pt)% - \setcounter{currentlinegap}{#1}% - \strut\par% - \vspace*{-\nbs}% + \fi + \par + \null + \vspace*{-\nbs} + \global\@WithinLinegaptrue + \begin{textblock*}{\textwidth}[0,0](0pt,0pt) + \setcounter{currentlinegap}{#1} + \strut\par + \vspace*{-\nbs} }{% close the environment: - \end{textblock*}% - \par% - \vspace*{#1\nbs}% - \setcounter{currentlinegap}{0}% -} -\ExplSyntaxOff % end linegap environment + \end{textblock*} + \global\@WithinLinegapfalse + \par + \vspace*{#1\nbs} + \setcounter{currentlinegap}{0} +} % +\ExplSyntaxOff +%% + + +%% New in version 1.50: two columns, cannot cross page break. +%% \sidebyside[a,b,c,d]{column 1 content}{column 2 content} % a,b,c,d lengths +% a = left margin to left edge of left column (left indent) +% b = left margin to right edge of left column ( = a + column width) +% c = left margin to left edge of right column ( = a + b + gap) +% d = left margin to right edge of right column ( = textwidth - right indent) +% Thus 0pt <= a < b < c < d <= \textwidth. +% Default: no indents, equal column widths, separated by \normalparindent. +\DeclareDocumentCommand\sidebyside { O{} +m +m } {% no ExplSyntax, no more %: + \StrDel{#1}{\space}[\@argsns] + \StrCut{\@argsns}{,}{\@argsone}{\@argsothera} + \StrCut{\@argsothera}{,}{\@argstwo}{\@argsotherb} + \StrCut{\@argsotherb}{,}{\@argsthree}{\@argsfour} + \ifthenelse{\equal{\@argsone}{}}{% + \def\@sbsll{0pt} + }{% + \def\@sbsll{\@argsone} + }% + \setlength\@tempLength{0.5\textwidth-0.5\normalparindent} + \ifthenelse{\equal{\@argstwo}{}}{% + \edef\@sbslr{\the\@tempLength} + }{% + \edef\@sbslr{\@argstwo} + }% + \setlength\@tempLength{0.5\textwidth+0.5\normalparindent} + \ifthenelse{\equal{\@argsthree}{}}{% + \edef\@sbsrl{\the\@tempLength} + }{% + \edef\@sbsrl{\@argsthree} + }% + \ifthenelse{\equal{\@argsfour}{}}{% + \edef\@sbsrr{\the\textwidth} + }{% + \edef\@sbsrr{\@argsfour} + }% + \null\vspace{-\baselineskip} + \begin{adjustwidth}{\@sbsll}{\dimexpr\textwidth-\@sbsrr} + \noindent\begin{minipage}[t]{\dimexpr\@sbslr-\@sbsll} + \strut #2\strut + \end{minipage}\hspace{\normalparindent}\begin{minipage}[t]{\dimexpr\@sbsrr-\@sbsrl} + \strut #3\strut + \end{minipage} + \end{adjustwidth} + \null\vspace{-\baselineskip} +} % +%% end \sidebyside + + + +%% Some things must wait until after layout calculations: +\gdef\@ActivateTextLengths{% called by `novel.cls' \AtEndPreamble + % Store some normal values (main font) for global use in document body: + \newlength\nfs % abbreviation for normal font point size + \gsetlength\nfs{\@SetFontSize} + \newlength\nbs % abbreviation for normal baselineskip + \gsetlength\nbs{\baselineskip} + \gsetlength\parindent{1.5em} % may be locally changed + \newlength\normalparindent + \gsetlength\normalparindent{\parindent} + \newlength\normalxheight % height of lowercase x + \gsetlength\normalxheight{\heightof{x}} + \newlength\normalXheight % height of uppercase X + \gsetlength\normalXheight{\heightof{X}} + \newlength\normalscxheight % height of small cap x + \gsetlength\normalscxheight{\heightof{\textsc{x}}} + \newlength\normalAringheight % height of Å (usually tallest in Latin-1) + \gsetlength\normalAringheight{\heightof{Å}} + \newlength\normaldescender % depth of lowercase gjpqy + \gsetlength\normaldescender{\depthof{gjpqy}} + \newlength\@NovelCaulk % fills gaps that would cause underfull vbox + \gsetlength{\@NovelCaulk}{0pt plus 0.999\nbs minus 1pt} +}% end \@ActivateTextLengths %% +%% More things that must wait: +\gdef\@ActivateTextMacros{% called by `novel.cls' \AtBeginDocument + % \forceindent and \backindent perform or remove indent, using \hspace{}. + % Rationale: Sometimes \indent and \noindent neutralized by another command. + \gdef\forceindent{\ifvmode\else\unskip\fi\stake\hspace{\normalparindent}} + \gdef\backindent{\ifvmode\else\unskip\fi\hspace{-\normalparindent}} +}% end \@ActivateTextMacros +%% +%% +\endinput %% %% End of file `novel-TextMacros.sty'. diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-microtype.cfg b/Master/texmf-dist/tex/lualatex/novel/novel-microtype.cfg index 0b3d8440ea2..d5bb8e639ff 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-microtype.cfg +++ b/Master/texmf-dist/tex/lualatex/novel/novel-microtype.cfg @@ -1,5 +1,6 @@ %% -%% This is file `novel-microtype.cfg', modified for `novel' document class. +%% This is file `novel-microtype.cfg', part of `novel' document class. +%% Modified from file `microtype.cfg' by Robert Allgeyer, 2017-2018. %% %% Original notice from `microtype.cfg' follows. %% Same license for `novel-microtype.cfg'. @@ -17,11 +18,10 @@ %% When modifying this file, also change the identification line below. %% ------------------------------------------------------------------------ %% -\NeedsTeXFormat{LaTeX2e} \ProvidesFile{novel-microtype.cfg}% -[2018/01/14 v1.46.2 LaTeX file (microtype configuration file for novel class)] +[2018/01/14 any version. (default microtype configuration for novel class)] -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% FONT SETS \DeclareMicrotypeSet{all} @@ -51,7 +51,7 @@ \DeclareMicrotypeSet{normalfont} { font = */*/*/*/* } -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% DEFAULT SETS \DeclareMicrotypeSetDefault[protrusion]{alltext} @@ -60,7 +60,7 @@ \DeclareMicrotypeSetDefault[kerning] {alltext} \DeclareMicrotypeSetDefault[tracking] {smallcaps} -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% FONT VARIANTS AND ALIASES \DeclareMicrotypeVariants{x,j,w,a,d,0,1} @@ -68,7 +68,7 @@ \DeclareMicrotypeAlias{lmr} {Latin Modern Roman} \DeclareMicrotypeAlias{lmm} {Latin Modern Math} -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% INTERACTION WITH THE `babel' PACKAGE \DeclareMicrotypeBabelHook @@ -83,7 +83,7 @@ {turkish} {kerning=turkish, spacing=} -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% CHARACTER INHERITANCE \DeclareCharacterInheritance @@ -120,7 +120,7 @@ z = {\'z,\.z,\v z}, } -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% TRACKING/LETTERSPACING \SetTracking @@ -129,7 +129,7 @@ { encoding = * } { } -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% EXPANSION \SetExpansion @@ -166,7 +166,7 @@ -%%% ----------------------------------------------------------------------- +%%% --------------------------------------------------------------------------- %%% PROTRUSION \SetProtrusion @@ -249,3 +249,4 @@ \endinput %% %% End of file `novel-microtype.cfg'. + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-pdfx.sty b/Master/texmf-dist/tex/lualatex/novel/novel-pdfx.sty index 524c04620a3..8c2bf9823bd 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel-pdfx.sty +++ b/Master/texmf-dist/tex/lualatex/novel/novel-pdfx.sty @@ -1,44 +1,64 @@ %% %% This is file `novel-pdfx.sty', part of `novel' document class. -%% -%% Copyright (c) 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: -%% +%% Copyright (c) 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. %% -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% %% File `novel-pdfx.sty' uses code, directly copied or modified, %% from file `pdfx.sty', part of LaTeX package `pdfx': Copyright (c) 2015, %% CV Radhakrishnan, Han The Thanh, Ross Moore, Peter Selinger. %% Licensed LPPL 1.2+. %% -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \ProvidesFile{novel-pdfx.sty}% -[2018/01/14 v1.46.2 LaTeX file (PDF/X support for novel class)] +[2018/03/28 v1.50 LaTeX file (PDF/X support for novel class)] % This package supports, and is part of, class `novel'. % No support for anything but LuaLaTeX. +% DO NOT ATTEMPT TO USE OUTSIDE `NOVEL' DOCUMENT CLASS. +% Reason: Other files in this class define stuff that is used here. %% %% This file is loaded \AtEndPreamble. %% - +%% Preliminary tests for cases forbidding PDF/X: +\ifdraftdoc + \global\@pdfxISofftrue +\fi +\if@sandbox + \global\@pdfxISofftrue +\fi % +\AtBeginDocument{% + \if@pdfxSEToff\else + \ifdraftdoc + \typeout{^^JClass `novel' Alert: No PDF/X in draft mode. ^^J% + Your document was processed with \string\SetPDFX\{off\}. ^^J}% + \fi + \if@sandbox + \typeout{^^JClass `novel' Alert: No PDF/X with sandbox option. ^^J% + Your document was processed with \string\SetPDFX\{off\}. ^^J}% + \fi + \fi +} % +%% + + % Hyperref options for PDF/X with LuaLaTeX: \def\pdfx@pdfX@opts@luatex{% - draft,pdftex,pdfpagemode=UseNone,bookmarks=false,hyperfootnotes=false,% + draft,pdfpagemode=UseNone,bookmarks=false,hyperfootnotes=false,% hyperindex=false,implicit=false,pdfversion=1.\the\pdfminorversion,% pdfpagelabels=true,pageanchor=false,pdfstartview=} % @@ -50,25 +70,29 @@ \fi \Hy@bookmarksfalse % -\newif \if@gottitle \@gottitlefalse % refers to PDF File Data -% Was \SetTitle{} called prior to this step? If so: -\ifthenelse{\equal{\@title}{} \OR \equal{\@title}{ }}{}{\@gottitletrue} +\ifthenelse{\equal{\@title}{} \OR \equal{\@title}{ }}{% + \global\@HasTitlefalse}{\global\@HasTitletrue% +} +\ifthenelse{\equal{\@title}{IMPORTANT: Provide Book Title}}{% + \ClassWarning{novel}{^^JDid not provide title using \string\SetTitle. ^^J% + Default used: `IMPORTANT: Provide Book Title'. Be sure to change it! ^^J}% +}{}% % % Sanity check: If title is missing at this step, then compliance must be off: -\ifpdfx@isOFF\else - \if@gottitle\else - \ClassError{novel}{PDF/X requires \string\SetTitle\space first}% +\if@pdfxISoff\else + \if@HasTitle\else + \ClassError{novel}{PDF/X requires non-empty \string\SetTitle\space}% {Unless \string\SetPDFX\space is off, must use \string\SetTitle\space ^^J% - before using \string\SetPDFX.^^J} + with non-empty title. Blank space counts as empty.}% \fi \fi % -\if@gottitle\else - \ClassWarning{novel}{Your file has been compiled without standard^^J % - PDF internal metadata, such as the title. This is allowable, and in ^^J % - some cases desirable. But in most cases it is not what you intended. ^^J % - If you want title and other metadata to be in PDF internal metadata, ^^J % - then you must place them prior to the \string\SetPDFX.^^J} +\if@HasTitle\else + \ClassWarning{novel}{^^JYour file has been compiled without standard ^^J% + PDF internal metadata, such as the title. This is allowable, and in ^^J% + some cases desirable. But in most cases it is not what you intended. ^^J% + If you want title and other metadata to be in PDF internal metadata, ^^J% + then you must place them prior to the \string\SetPDFX. ^^J} \fi % \expandafter\ifx\csname pdfresetpageorigin\endcsname\relax\else @@ -81,7 +105,7 @@ %% CALCULATE AND SPECIFY CROPBOX AND TRIMBOX -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% % The MediaBox is automatically provided, so there is no need to write % MediaBox in /pdfInfo (because it would be a duplicate). @@ -90,54 +114,54 @@ % by professional PDF software. For that reason, and for proper centering % of TrimBox when MediaBox is larger, CropBox is created (= MediaBox). % -\newcommand\my@MWnum{\strip@pt\New@MediaWidth} -\FPmul{\my@MWnum}{\my@MWnum}{0.99626401} -\FPround{\my@MWnum}{\my@MWnum}{3} -\FPclip{\my@MWnum}{\my@MWnum} -\newcommand\my@MHnum{\strip@pt\New@MediaHeight} -\FPmul{\my@MHnum}{\my@MHnum}{0.99626401} -\FPround{\my@MHnum}{\my@MHnum}{3} -\FPclip{\my@MHnum}{\my@MHnum} -\newcommand\my@TWnum{\strip@pt\New@TrimWidth} -\FPmul{\my@TWnum}{\my@TWnum}{0.99626401} -\FPround{\my@TWnum}{\my@TWnum}{3} -\newcommand\my@THnum{\strip@pt\New@TrimHeight} -\FPmul{\my@THnum}{\my@THnum}{0.99626401} -\FPround{\my@THnum}{\my@THnum}{3} -% -\FPsub{\my@TWorigin}{\my@MWnum}{\my@TWnum} -\FPmul{\my@TWorigin}{\my@TWorigin}{0.5} -\FPround{\my@TWorigin}{\my@TWorigin}{3} -\FPadd{\my@TWcorner}{\my@TWorigin}{\my@TWnum} -\FPround{\my@TWcorner}{\my@TWcorner}{3} -\FPsub{\my@THorigin}{\my@MHnum}{\my@THnum} -\FPmul{\my@THorigin}{\my@THorigin}{0.5} -\FPround{\my@THorigin}{\my@THorigin}{3} -\FPadd{\my@THcorner}{\my@THorigin}{\my@THnum} -\FPround{\my@THcorner}{\my@THcorner}{3} -% -\FPclip{\my@TWorigin}{\my@TWorigin} -\FPclip{\my@TWcorner}{\my@TWcorner} -\FPclip{\my@THorigin}{\my@THorigin} -\FPclip{\my@THcorner}{\my@THcorner} +\newcommand\@myMWN{\strip@pt\paperwidth} +\FPmul{\@myMWN}{\@myMWN}{0.99626401} +\FPround{\@myMWN}{\@myMWN}{3} +\FPclip{\@myMWN}{\@myMWN} +\newcommand\@myMHN{\strip@pt\paperheight} +\FPmul{\@myMHN}{\@myMHN}{0.99626401} +\FPround{\@myMHN}{\@myMHN}{3} +\FPclip{\@myMHN}{\@myMHN} +\newcommand\@myTWN{\strip@pt\@TrimWidth} +\FPmul{\@myTWN}{\@myTWN}{0.99626401} +\FPround{\@myTWN}{\@myTWN}{3} +\newcommand\@myTHN{\strip@pt\@TrimHeight} +\FPmul{\@myTHN}{\@myTHN}{0.99626401} +\FPround{\@myTHN}{\@myTHN}{3} +% +\FPsub{\@myTWorigin}{\@myMWN}{\@myTWN} +\FPmul{\@myTWorigin}{\@myTWorigin}{0.5} +\FPround{\@myTWorigin}{\@myTWorigin}{3} +\FPadd{\@myTWcorner}{\@myTWorigin}{\@myTWN} +\FPround{\@myTWcorner}{\@myTWcorner}{3} +\FPsub{\@myTHorigin}{\@myMHN}{\@myTHN} +\FPmul{\@myTHorigin}{\@myTHorigin}{0.5} +\FPround{\@myTHorigin}{\@myTHorigin}{3} +\FPadd{\@myTHcorner}{\@myTHorigin}{\@myTHN} +\FPround{\@myTHcorner}{\@myTHcorner}{3} +% +\FPclip{\@myTWorigin}{\@myTWorigin} +\FPclip{\@myTWcorner}{\@myTWcorner} +\FPclip{\@myTHorigin}{\@myTHorigin} +\FPclip{\@myTHcorner}{\@myTHcorner} % \newcommand\novel@CropBox{% \if@cropview% - /CropBox[\my@TWorigin\space\my@THorigin\space\my@TWcorner\space\my@THcorner]% + /CropBox[\@myTWorigin\space\@myTHorigin\space\@myTWcorner\space\@myTHcorner]% \else% - /CropBox[0\space0\space\my@MWnum\space\my@MHnum]% + /CropBox[0\space0\space\@myMWN\space\@myMHN]% \fi% } % \newcommand\novel@TrimBox{% - /TrimBox[\my@TWorigin\space\my@THorigin\space\my@TWcorner\space\my@THcorner]% + /TrimBox[\@myTWorigin\space\@myTHorigin\space\@myTWcorner\space\@myTHcorner]% } % % New in version 1.2: BleedBox, only for cover art. Same size as MediaBox. \newcommand\novel@BleedBox{% \if@coverart% - /BleedBox[0\space0\space\my@MWnum\space\my@MHnum]% - \else\fi% + /BleedBox[0\space0\space\@myMWN\space\@myMHN]% + \fi% } % \begingroup\edef\next{% @@ -147,44 +171,8 @@ -%% DISABLE HYPERLINKS AND BOOKMARKS -%% ----------------------------------------------------------------------------- -% -% Files for PDF/X cannot have hyperlinks. If your document has any, -% they will be functionally disabled. However, it is still necessary -% to ensure that you do not specify them in the wrong color space. -% Since `novel' class disallows any kind of color, `xcolor' is loaded with -% `monochrome' or `gray' option, prior to loading `hyperref'. -% -% Your text will be K black, rather than CMYK `rich black'. This is best. -% If you use a grayscale image anywhere, ask your print service whether it may -% be directly placed as grayscale (and they will convert to halftone) -% or whether you must convert it to halftone yourself, and place it that way. -% -% Note that LaTeX cannot detect any erroneous placement of a color image. -% -% The pagegrid package can only be used in draft mode, without PDF/X: -\gdef\@reallyOFF{off} -\@ifpackageloaded{pagegrid}{ - \if@useDraftMode\else - \ClassError{novel}{\string\pagegrid\space needs `draft' mode^^J}% - {\string\pagegrid\space may only be used with class option `draft'^^J}% - \fi - \ifpdfx@isOFF\else - \pdfx@isOFFtrue % cancels pdfx when using pagegrid (in draft mode) - \gdef\@reallyOFF{re-set to off by pagegrid package.} - \ClassWarning{novel}{You requested PDF/X compliance.^^J% - But you also used the \string\pagegrid\space package. Cannot have both.^^J% - So instead, your document was processed with \string\SetPDFX\space off.^^J% - Reason: The grid and text are in layers. No layers allowed.^^J}% - \fi -}{} -%% End disable hyperlinks and bookmarks. - - - %% GENERAL PDF INTERNAL METADATA PREPARATION -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- % % Create hashes that will be used for uuid data. Does not need to be fancy: \edef\xmp@docid{\pdfx@mdfivesum{jobname.pdf}} @@ -195,7 +183,7 @@ %% PREPARATION OF XMP METADATA -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% Data prepared here, will later be inserted into the XMP packet template, %% then the processed template will be incuded in the PDF. %% XMP metadata is in utf-8 encoding. @@ -245,18 +233,19 @@ % \def\@pdfVersion{1.\the\pdfminorversion} % -\ifpdfx@isOFF +\if@pdfxISoff \gdef\@verconfString{}% \else \gdef\@verconfString{ \pad@vi\@PDFXversion^^J - \if@gotConformance - \pad@vi\@PDFXconformance^^J + \if@HasConformance + \pad@vi% + \@PDFXconformance^^J \fi } \fi % -\ifpdfx@isOFF +\if@pdfxISoff \gdef\@pdfidString{}% \else \gdef\@pdfidString{ @@ -267,28 +256,30 @@ \ifthenelse{\equal{\@novelApplication}{} \OR \equal{\@novelApplication}{ }}{ \gdef\@applicationString{}% }{ - \gdef\@applicationString{\pad@vi\@novelApplication^^J}% + \gdef\@applicationString{\pad@vi% + \@novelApplication^^J}% } % \ifthenelse{\equal{\@novelProducer}{} \OR \equal{\@novelProducer}{ }}{ \gdef\@producerString{}% }{ - \gdef\@producerString{\pad@vi\@novelProducer^^J}% + \gdef\@producerString{\pad@vi% + \@novelProducer^^J}% } % % Calculation of Dates and Times, which must be in a specific format. % Each time you process to PDF, the current date/time is used, % for all of the several metadata date/time strings. -% The date string begins with D: then 4 digits of year, etc. -% This definition removes the D: from front: -\gdef\pdfx@getYear#1#2#3#4#5#6{\edef\pdfx@xYear{#3#4#5#6}\pdfx@getMonth} +\def\xmp@cDate{\pdfx@getYear} +{\catcode`\D=12 \catcode`\:=12 + \gdef\pdfx@getYear D:#1#2#3#4{\edef\pdfx@xYear{#1#2#3#4}\pdfx@getMonth} +} \def\pdfx@getMonth#1#2{\edef\pdfx@xMonth{#1#2}\pdfx@getDay} \def\pdfx@getDay#1#2{\edef\pdfx@xDay{#1#2}\pdfx@getHour} \def\pdfx@getHour#1#2{\edef\pdfx@xHour{#1#2}\pdfx@getMin} \def\pdfx@getMin#1#2{\edef\pdfx@xMin{#1#2}\pdfx@getSec} \def\pdfx@getSec#1#2{\edef\pdfx@xSec{#1#2}\pdfx@getTZh} \def\pdfx@getTZh{\futurelet\pdfx@next\pdfx@getTzh@branches} -\def\xmp@cDate{\pdfx@getYear} % {\catcode`\@=11 \catcode`\Z=12 \catcode`\+=12 \catcode`\-=12 % ends below \gdef\pdfx@getTzh@branches{% @@ -327,37 +318,44 @@ %% WRITE THE XMP METADATA, UNLESS PDF/X IS OFF OR NO TITLE -%%------------------------------------------------------------------------------ +%%----------------------------------------------------------------------------- %% Inserts the prepared XMP metadata into XMP packet template, then writes %% the result at the start of the PDF, right now, before the document. % -\ifpdfx@isOFF\else - \if@gottitle - \begingroup - \makeatletter - \input{novel-xmppacket.sty} - \global\let\@xmpData\@xmpPacket % from the above file - \begingroup - \pdfcompresslevel=0 - \immediate\pdfobj stream attr {/Type /Metadata /Subtype /XML} {\@xmpData} - \pdfcatalog{/Metadata \the\pdflastobj\space 0 R} - \endgroup - \endgroup - % Creates external xml file, if requested: - \if@wantXMPasXML - \newwrite\file - \immediate\openout\file=\jobname-XMPasXML.xml - \immediate\write\file{^^J} - \immediate\write\file{^^J} - \immediate\write\file{^^J} - \immediate\write\file{^^J} - \immediate\write\file{^^J} - \immediate\write\file{^^J} - \immediate\write\file{^^J} - \immediate\write\file{\@xmpData^^J} - \closeout\file - \fi - \fi +\if@pdfxISoff\else + \if@HasTitle + \begingroup + \makeatletter + \input{novel-xmppacket.sty} + \global\let\@xmpData\@xmpPacket % from the above file + \begingroup + \pdfcompresslevel=0 + \immediate\pdfobj stream attr {/Type /Metadata /Subtype /XML} {\@xmpData} + \pdfcatalog{/Metadata \the\pdflastobj\space 0 R} + \endgroup + \endgroup + % Creates external xml file, if requested: + \if@wantXMPasXML + \newwrite\file + \immediate\openout\file=\jobname-XMPasXML.xml + \immediate\write\file{^^J} + \immediate\write\file{^^J} + \immediate\write\file{^^J} + \immediate\write\file{^^J} + \immediate\write\file{^^J} + \immediate\write\file{^^J} + \immediate\write\file{^^J} + \immediate\write\file{\@xmpData^^J} + \closeout\file + \fi + \fi \fi % % @@ -366,7 +364,7 @@ %% PREPARE PDF /INFO METADATA -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% PDF /Info is another form of metadata, older than XMP but still used. %% It is NOT in utf-8 encoding. Depending on content, one of two encodings %% will be automatically used: PDFDoc encoding if metadata uses only @@ -402,9 +400,9 @@ %% WRITE THE OUTPUT INTENT, UNLESS PDFX IS OFF. -%% ----------------------------------------------------------------------------- -% -\ifpdfx@isOFF\else +%% ---------------------------------------------------------------------------- +% Data for CGATS TR 001, FOGRA39, and JC200103 are in file novel-FileData.sty. +\if@pdfxISoff\else \begingroup \edef\@pctchar{\expandafter\@gobble\string\%} % Escaped in TeX, not PDF. \edef\@bchar{\expandafter\@gobble\string\\} % For use as escape, below. @@ -413,15 +411,16 @@ \edef\){\string\)} % PDF Catalog requires escaped parentheses. \catcode`\_ 12 % The icc file name might contain underscores. % - \if@noembedicc\else + \if@EmbedICC \IfFileExists{\@OIprofile}{% \immediate\pdfobj stream attr{/N 4} file{\@OIprofile}% \edef\OBJ@OI{\the\pdflastobj\space 0 R}% }{% \ClassError{novel}{Requested icc color profile not found}% - {You used the starred \string\SetPDFX*\space which embeds the^^J% - associated icc color profile. But the file could not be located.^^J% - If necessary, place it in the same folder as your *.tex document.}% + {You used the starred \string\SetPDFX*\space which embeds the ^^J% + associated icc color profile. But the file could not be located. ^^J% + If necessary, put it in the same folder as your *.tex document. ^^J% + Incidentally: Do you really need to embed the profile?}% } \fi \ifthenelse{\equal{\@OIcondition}{}}{ @@ -452,7 +451,7 @@ \@OIidentifierString% \@OIinfoString% \@OIregistryString% - \if@noembedicc\else/DestOutputProfile \OBJ@OI\fi% + \if@EmbedICC/DestOutputProfile \OBJ@OI\fi% >> ]% }% \endgroup @@ -463,7 +462,7 @@ %% DISABLE HYPERREF OPTIONS -%%------------------------------------------------------------------------------ +%%----------------------------------------------------------------------------- %% Prevents changes that will cause an incompatibility. % \Hy@DisableOption{pdfauthor}% @@ -480,12 +479,9 @@ %% PREPARE PDF/Info -%% ----------------------------------------------------------------------------- -%% The \novel@PDFinfo command is used AtBeginDocument in novel.cls. -% -\gdef\@novelPDFinfo{ % rather than \PDF@FinishDoc - \if@gottitle - \Hy@UseMaketitleInfos +%% ---------------------------------------------------------------------------- +\gdef\@ActivatePDFInfo{% called by `novel.cls' \AtBeginDocument + \if@HasTitle \pdfinfo{ \ifx\@infotitle\@empty\else /Title(\@infotitle)\fi \ifx\@infoauthor\@empty\else /Author(\@infoauthor)\fi @@ -502,18 +498,20 @@ \fi \ifx\@infoproducer\@empty\else /Producer(\@infoproducer)\fi% /Trapped/False% - \ifpdfx@isOFF\else + \if@pdfxISoff\else /GTS_PDFXVersion(\@PDFXversion)% - \if@gotConformance /GTS_PDFXConformance(\@PDFXconformance)\fi% + \if@HasConformance /GTS_PDFXConformance(\@PDFXconformance)\fi% \fi } \fi -} -% -%% End prepare PDF/Info. +}% +%% End \@ActivatePDFInfo. +%% +\endinput %% %% End of file `novel-pdfx.sty'. + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.clo b/Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.clo new file mode 100644 index 00000000000..6aa0e0dc849 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.clo @@ -0,0 +1,186 @@ +%% +%% This is file `novel-xmppacket.clo', 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. +%% +%% +%% ---------------------------------------------------------------------------- +%% +%% The descriptive properties of the namespaces, and the general format of XMP, +%% are public standards released by Adobe Systems Incorporated. +%% See http://www.adobe.com/products/xmp.html +%% +%% ---------------------------------------------------------------------------- +%% +%% +\ProvidesFile{novel-xmppacket.clo}% +[2018/01/14 any version. (novel XMP packet template)] +%% + + + +% This packet uses utf-8 BOM. +% The catcodes allow # _ ~ $ % & to be used as ordinary characters. +% \edef and \let get rid of escape backslashes in front of those characters. +% NO COMMENTS AFTER THIS! Until \endgroup. + + + + + +\begingroup +\catcode`\¤=12\relax +\lccode`\¤="FEFF +\lowercase{\gdef\@novelBOM{¤}} +\catcode`\#=12 +\catcode`\_=12 +\catcode`\~=12 +\catcode`\$=12 +\catcode`\%=12 +\catcode`\&=12 + +\edef\@pctchar{\expandafter\@gobble\string\%} +\let\%\@pctchar +\edef\@hashchar{\expandafter\@gobble\string\#} +\let\#\@hashchar +\edef\@ampchar{\expandafter\@gobble\string\&} +\let\&\@ampchar +\edef\@dollarchar{\expandafter\@gobble\string\$} +\let\$\@dollarchar +\edef\@underchar{\expandafter\@gobble\string\_} +\let\_\@underchar +\edef\@tildechar{\expandafter\@gobble\string\~} +\let\~\@tildechar + +\xdef\@xmpPacket{^^J +^^J +\pad@ii^^J +\pad@iv^^J +\pad@vi\@modifyDate^^J +\pad@vi\@createDate^^J +\@applicationString +\pad@vi\@metadataDate^^J +\pad@iv^^J +\pad@iv^^J +\pad@viapplication/pdf^^J +\@titleString +\@authorString +\pad@iv^^J +\pad@iv^^J +\pad@vi\@documentID^^J +\pad@vi\@instanceID^^J +\pad@videfault^^J +\pad@vi1^^J +\pad@iv^^J +\pad@iv^^J +\@producerString +\pad@viFalse^^J +\pad@iv^^J +\pad@iv^^J +\@verconfString +\pad@iv^^J +\pad@iv^^J +\@pdfidString +\pad@iv^^J +\pad@iv^^J +\pad@vi^^J +\pad@viii^^J +\pad@x^^J +\pad@xiihttp://ns.adobe.com/pdf/\@pdfVersion/^^J +\pad@xiipdf^^J +\pad@xiiAdobe PDF Schema^^J +\pad@xii^^J +\pad@xiv^^J +\pad@xvi^^J +\pad@xviiiinternal^^J +\pad@xviiiA name object indicating whether the document has been modified to include trapping information^^J +\pad@xviiiTrapped^^J +\pad@xviiiText^^J +\pad@xvi^^J +\pad@xiv^^J +\pad@xii^^J +\pad@x^^J +\pad@x^^J +\pad@xiihttp://ns.adobe.com/pdfx/\@pdfVersion/^^J +\pad@xiipdfx^^J +\pad@xiiPDF/X ID Schema^^J +\pad@xii^^J +\pad@xiv^^J +\pad@xvi^^J +\pad@xviiiinternal^^J +\pad@xviiiID of PDF/X standard^^J +\pad@xviiiGTS_PDFXVersion^^J +\pad@xviiiText^^J +\pad@xvi^^J +\pad@xvi^^J +\pad@xviiiinternal^^J +\pad@xviiiConformance level of PDF/X standard^^J +\pad@xviiiGTS_PDFXConformance^^J +\pad@xviiiText^^J +\pad@xvi^^J +\pad@xiv^^J +\pad@xii^^J +\pad@x^^J +\pad@x^^J +\pad@xiihttp://ns.adobe.com/xap/1.0/mm/^^J +\pad@xiixmpMM^^J +\pad@xiiXMP Media Management Schema^^J +\pad@xii^^J +\pad@xiv^^J +\pad@xvi^^J +\pad@xviiiinternal^^J +\pad@xviiiUUID based identifier for specific incarnation of a document^^J +\pad@xviiiInstanceID^^J +\pad@xviiiURI^^J +\pad@xvi^^J +\pad@xiv^^J +\pad@xii^^J +\pad@x^^J +\pad@x^^J +\pad@xiihttp://www.npes.org/pdfx/ns/id/^^J +\pad@xiipdfxid^^J +\pad@xiiPDF/X ID Schema^^J +\pad@xii^^J +\pad@xiv^^J +\pad@xvi^^J +\pad@xviiiinternal^^J +\pad@xviiiID of PDF/X standard^^J +\pad@xviiiGTS_PDFXVersion^^J +\pad@xviiiText^^J +\pad@xvi^^J +\pad@xiv^^J +\pad@xii^^J +\pad@x^^J +\pad@viii^^J +\pad@vi^^J +\pad@iv^^J +\pad@ii^^J +^^J +\pad@dxii +} +\endgroup + + +% OK to use comments now. +%% +\endinput +%% +%% End of file `novel-xmppacket.clo'. + diff --git a/Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.sty b/Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.sty deleted file mode 100644 index 0a75df000f2..00000000000 --- a/Master/texmf-dist/tex/lualatex/novel/novel-xmppacket.sty +++ /dev/null @@ -1,183 +0,0 @@ -%% -%% This is file `novel-xmppacket.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. -%% -%% -%% ----------------------------------------------------------------------------- -%% -%% The descriptive properties of the namespaces, and the general format of XMP, -%% are public standards released by Adobe Systems Incorporated. -%% See http://www.adobe.com/products/xmp.html -%% -%% ----------------------------------------------------------------------------- -%% -%% -\ProvidesFile{novel-xmppacket.sty}% -[2018/01/14 v1.46.2 LaTeX file (novel XMP packet template)] -%% - - - -% This packet uses utf-8 BOM. -% The catcodes allow # _ ~ $ % & to be used as ordinary characters. -% The \edef and \let get rid of escape backslashes in front of those characters. -% NO COMMENTS AFTER THIS! Until \endgroup. - - - - - -\begingroup -\catcode`\¤=12\relax -\lccode`\¤="FEFF -\lowercase{\gdef\@novelBOM{¤}} -\catcode`\#=12 -\catcode`\_=12 -\catcode`\~=12 -\catcode`\$=12 -\catcode`\%=12 -\catcode`\&=12 - -\edef\@pctchar{\expandafter\@gobble\string\%} -\let\%\@pctchar -\edef\@hashchar{\expandafter\@gobble\string\#} -\let\#\@hashchar -\edef\@ampchar{\expandafter\@gobble\string\&} -\let\&\@ampchar -\edef\@dollarchar{\expandafter\@gobble\string\$} -\let\$\@dollarchar -\edef\@underchar{\expandafter\@gobble\string\_} -\let\_\@underchar -\edef\@tildechar{\expandafter\@gobble\string\~} -\let\~\@tildechar - -\xdef\@xmpPacket{^^J -^^J -\pad@ii^^J -\pad@iv^^J -\pad@vi\@modifyDate^^J -\pad@vi\@createDate^^J -\@applicationString -\pad@vi\@metadataDate^^J -\pad@iv^^J -\pad@iv^^J -\pad@viapplication/pdf^^J -\@titleString -\@authorString -\pad@iv^^J -\pad@iv^^J -\pad@vi\@documentID^^J -\pad@vi\@instanceID^^J -\pad@videfault^^J -\pad@vi1^^J -\pad@iv^^J -\pad@iv^^J -\@producerString -\pad@viFalse^^J -\pad@iv^^J -\pad@iv^^J -\@verconfString -\pad@iv^^J -\pad@iv^^J -\@pdfidString -\pad@iv^^J -\pad@iv^^J -\pad@vi^^J -\pad@viii^^J -\pad@x^^J -\pad@xiihttp://ns.adobe.com/pdf/\@pdfVersion/^^J -\pad@xiipdf^^J -\pad@xiiAdobe PDF Schema^^J -\pad@xii^^J -\pad@xiv^^J -\pad@xvi^^J -\pad@xviiiinternal^^J -\pad@xviiiA name object indicating whether the document has been modified to include trapping information^^J -\pad@xviiiTrapped^^J -\pad@xviiiText^^J -\pad@xvi^^J -\pad@xiv^^J -\pad@xii^^J -\pad@x^^J -\pad@x^^J -\pad@xiihttp://ns.adobe.com/pdfx/\@pdfVersion/^^J -\pad@xiipdfx^^J -\pad@xiiPDF/X ID Schema^^J -\pad@xii^^J -\pad@xiv^^J -\pad@xvi^^J -\pad@xviiiinternal^^J -\pad@xviiiID of PDF/X standard^^J -\pad@xviiiGTS_PDFXVersion^^J -\pad@xviiiText^^J -\pad@xvi^^J -\pad@xvi^^J -\pad@xviiiinternal^^J -\pad@xviiiConformance level of PDF/X standard^^J -\pad@xviiiGTS_PDFXConformance^^J -\pad@xviiiText^^J -\pad@xvi^^J -\pad@xiv^^J -\pad@xii^^J -\pad@x^^J -\pad@x^^J -\pad@xiihttp://ns.adobe.com/xap/1.0/mm/^^J -\pad@xiixmpMM^^J -\pad@xiiXMP Media Management Schema^^J -\pad@xii^^J -\pad@xiv^^J -\pad@xvi^^J -\pad@xviiiinternal^^J -\pad@xviiiUUID based identifier for specific incarnation of a document^^J -\pad@xviiiInstanceID^^J -\pad@xviiiURI^^J -\pad@xvi^^J -\pad@xiv^^J -\pad@xii^^J -\pad@x^^J -\pad@x^^J -\pad@xiihttp://www.npes.org/pdfx/ns/id/^^J -\pad@xiipdfxid^^J -\pad@xiiPDF/X ID Schema^^J -\pad@xii^^J -\pad@xiv^^J -\pad@xvi^^J -\pad@xviiiinternal^^J -\pad@xviiiID of PDF/X standard^^J -\pad@xviiiGTS_PDFXVersion^^J -\pad@xviiiText^^J -\pad@xvi^^J -\pad@xiv^^J -\pad@xii^^J -\pad@x^^J -\pad@viii^^J -\pad@vi^^J -\pad@iv^^J -\pad@ii^^J -^^J -\pad@dxii -} -\endgroup - - -%% -%% End of file `novel-xmppacket.sty'. - diff --git a/Master/texmf-dist/tex/lualatex/novel/novel.cls b/Master/texmf-dist/tex/lualatex/novel/novel.cls index 78bdd95fbc8..23989dc380b 100644 --- a/Master/texmf-dist/tex/lualatex/novel/novel.cls +++ b/Master/texmf-dist/tex/lualatex/novel/novel.cls @@ -1,10 +1,6 @@ %% -%% This is file `novel.cls', part of class `novel'. -%% Copyright 2017 Robert Allgeyer. Contact: anytthree [at] gmail.com -%% -%% Wanted: Replacement maintainer. The original creator wants to move on. -%% AFAIK this code is tested and suitable for general use. -%% Contact CTAN (and me) if interested in taking over the maintenance. +%% This is file `novel.cls', LuaLaTeX `novel' document class. +%% Copyright 2017-2018 Robert Allgeyer. Contact: anytthree [at] gmail.com %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c @@ -17,9 +13,10 @@ %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] % Actually needs LuaLaTeX, at least version 0.95 from TeXLive 2016. -\ProvidesClass{novel}[2018/01/14 v1.46.2 LaTeX document class] +\ProvidesClass{novel}[2018/03/28 v1.50 LaTeX document class] %% -%% Version 1.46: Possibly final version. +%% Version 1.50: Improved image handled, sandbox, scripts. +%% Version 1.46.2: Now called "novel-old" version. %% Version 1.43: General cleanup of docs and code, for improved readbaility. %% Version 1.42: Greatly improved HTML documentation. %% Version 1.41: Improved HTML documentation. @@ -38,7 +35,7 @@ %% DESCRIPTION: -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% Class `novel' is designed for print fiction: novels or short stories. %% It cannot be used for e-books or for journal publication. %% It is not suitable for most non-fiction, because routine academic features @@ -63,25 +60,28 @@ %% REQUIRE LUATEX and do some preliminary setup. -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% These are not user settings. % \RequirePackage{ifluatex} % LuaTeX is required. Not XeTeX, dvips, or pdfTeX. \RequirePackage{ifxetex} % For occasional hacks (hiss, boo). -\RequirePackage{luatex85} % Needed for compatibility when using LuaTeX 0.95 etc. +\RequirePackage{luatex85} % Needed for compatibility with LuaTeX 0.95 etc. \RequirePackage{pdftexcmds} % compatibility \ifluatex % New with TeXlive 2016. Removes unnecessary File Data: \pdfvariable suppressoptionalinfo 511 % writes only ID to PDF Catalog \else - \ClassError{novel}{Must compile with LuaLaTeX 0.95+}{Sorry, LuaLaTeX only.% - No pdfTeX, dvips, or XeTeX.} + \ClassError{novel}{Must compile with LuaLaTeX 0.95+}% + {Sorry, LuaLaTeX only. No pdfTeX, dvips, or XeTeX.} \fi +\pdfimageresolution=300 % default dpi if image does not say % \RequirePackage{etoolbox} % general good stuff \RequirePackage{xifthen} % improved ifthenelse handling \RequirePackage{xstring} % parses strings \RequirePackage{fp} % used everywhere for math calculations +\RequirePackage{xfp} % more math calculations +\RequirePackage{keyval} % used by drop cap \FPmessagesfalse % eliminates numerous friendly messages from the log % \pdfminorversion=3 % might be reset later, depending on settings @@ -90,26 +90,23 @@ \RequirePackage{silence} % Used here: % hyperref draft mode is always on, even when novel is not in draft mode: \WarningFilter{hyperref}{Draft mode on} % So, get rid of the hyperref warning. -% Prevent complaints about no protrusion list for cmr, cmm, etc. in decimal pts: +% Prevent complaints about no protrusion list for cmr, cmm, etc. in decimal pt: \WarningFilter{microtype}{I cannot find a protrusion list} % It's not there! % \WarningsOff[Fancyhdr,fancyhdr] % complains about headheight when no header \RequirePackage[relative]{textpos} % for inserting images -\RequirePackage{noindentafter} % for unindented chapter and scene starts \RequirePackage{calc} % allows length expression calculations -\RequirePackage{changepage} % provides block indents, etc. Do not use strict! -\RequirePackage{atbegshi} % for one-page header changes. Also used by hyperref. -\RequirePackage{letltxmacro} % for re-defining some macros -\RequirePackage{magaz} % special treatment of first lines +\RequirePackage{atbegshi} % in oberdiek bundle. For one-page header changes. Also used by hyperref. +\RequirePackage{letltxmacro} % in oberdiek bundle. For re-defining some macros \RequirePackage{xparse} % for writing cool-looking commands % -% In addition, the following packages are required, but they are not loaded now. -% They must wait for something else to happen first. They will be loaded -% with suitable arguments, when the time comes: +% In addition, the following packages are required, but not loaded yet. +% They must wait for something else to happen first. Then they will be loaded +% with suitable arguments, when the time comes: % fontspec -- in novel-LayoutSettings.sty % unicode-math -- in novel-LayoutSettings.sty % polyglossia -- in novel-LayoutSettings.sty -% microtype -- in novel-FontDefaults.sty +% microtype -- in novel-Fonts.sty % hyperref -- in novel-pdfx.sty % fancyhdr -- in novel.HeadFootStyles.sty % xcolor -- lower in this page @@ -119,11 +116,28 @@ %% +\newlength\@tempLength % scratch length for local calculations +\newif \if@tempTF % scratch boolean for local tests + + +%% Global lengths are often passed around in `novel'. +%% But \setlength is not always global in effect. +%% This code defines a global command. +%% Via Heiko Oberdiek at tex.stackexchange.com: +\gdef\gsetlength#1#2{% #1 is the length command, #2 is the length value + \begingroup% + \setlength\skip@{#2}% Local assignment to a TeX scratch register. + \global#1=\skip@% Global assignment to #1 + \endgroup% \skip@ is restored by end of group. +}% end \gsetlength +%% + + %% Process document class options. -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- % Allowed option list: -% draft xml shademargins graytext greytext cropmarks cropview closecrop -% coverart unblock +% draft xml shademargins cropmarks cropview closecrop +% coverart sandbox unblock mtoff polyoff test % Yes, I realize that this could have been done another way, but I want % to issue error messages from `novel' rather than (say) `keyval': \gdef\@mycol{\@classoptionslist} @@ -132,8 +146,8 @@ \StrDel{\@mycol}{draft}[\@mycol] \StrDel{\@mycol}{xml}[\@mycol] \StrDel{\@mycol}{shademargins}[\@mycol] -\StrDel{\@mycol}{graytext}[\@mycol] -\StrDel{\@mycol}{greytext}[\@mycol] +\StrDel{\@mycol}{graytext}[\@mycol] % Obsolete. Now always allows graytext. +\StrDel{\@mycol}{greytext}[\@mycol] % See above. \StrDel{\@mycol}{cropmarks}[\@mycol] \StrDel{\@mycol}{cropview}[\@mycol] \StrDel{\@mycol}{closecrop}[\@mycol] @@ -141,65 +155,53 @@ \StrDel{\@mycol}{unblock}[\@mycol] \StrDel{\@mycol}{mtoff}[\@mycol] \StrDel{\@mycol}{polyoff}[\@mycol] +\StrDel{\@mycol}{test}[\@mycol] +\StrDel{\@mycol}{sandbox}[\@mycol] % \ifthenelse{\equal{\@mycol}{}}{}{ - \ClassWarning{novel}{Unrecognized class option: \@mycol^^J% - The unrecognized option was ignored!^^J% - If `debug' it is obsolete from v.1.40.^^J% - Note that font size, document size, and language^^J% - are not `novel' class options. See documentation.}% + \ClassWarning{novel}{^^JUnrecognized class option: \@mycol. ^^J% + The unrecognized option was ignored! ^^J% + If `debug' it is obsolete from v.1.40. ^^J% + Note that font size, document size, and language ^^J% + are not `novel' class options. See documentation. ^^J}% } -% % If used, option `draft' shows overflow rule. -\newif \if@useDraftMode +% Prior to v. 1.46.1, the following was \if@useDraftMode. +% Changed for possible compatibility with packages that detect draft mode. +\newif \ifdraftdoc \setlength\overfullrule{0pt} \DeclareOption{draft}{ \setlength\overfullrule{6pt} - \@useDraftModetrue - \ClassWarning{novel}{Compiled using draft mode. Not for final release!^^J} + \draftdoctrue + \ClassWarning{novel}{^^JCompiled with draft mode. Not for final release! ^^J} } +\newif \ifmsdoc % manuscript, always false. Compatibility with other packages. % If used, option `xml' creates a file `\jobname-XMPasXML.xml` that contains % the XMP metadata with an xml declaration and comments at top. % Only works when \SetPDFX is not `off'. Note that you do not need to use % this option to get PDF/X. It is only for your own usage. \newif \if@wantXMPasXML -\DeclareOption{xml}{ - \@wantXMPasXMLtrue -} +\DeclareOption{xml}{\@wantXMPasXMLtrue} \DeclareOption{xmp}{ % in case you mis-type. - \ClassError{novel}{No class option `xmp'. Want `xml' ?^^J}% - {There is no class option named `xmp'. It is `xml'.^^J} + \ClassError{novel}{No class option `xmp'. Use `xml'}% + {There is no class option named `xmp'. It is `xml'.} } % Option `shademargins' does just that. Ignored unless in draft mode. -% Does not matter if `graytext' option in use. \newif \if@shademargins -\DeclareOption{shademargins}{ - \@shademarginstrue -} -% Option `graytext' allows text in grayscale. Images unaffected. -% If this option is not used, all text will be K black. -\newif \if@graytext -\DeclareOption{graytext}{ - \@graytexttrue -} -% For the Brits: -\DeclareOption{greytext}{ - \@graytexttrue -} +\DeclareOption{shademargins}{\@shademarginstrue} +% +\newif \if@graytext % remains here for backwards compatibility +\@graytexttrue % from v.1.50 always true, no longer an option. +% % Usually you do NOT want crop (trim) marks! -% Configurable by \SetCropMarks[]{}. \newif \if@cropmarks -\DeclareOption{cropmarks}{ - \@cropmarkstrue -} +\DeclareOption{cropmarks}{\@cropmarkstrue} % PDF viewers display CropBox, which normally is identical to MediaBox. % Option `cropview', sets CropBox to TrimBox instead, so that's all you see. % Only makes a difference when MediaBox is larger than TrimBox. % Ignored unless in draft mode. \newif \if@cropview -\DeclareOption{cropview}{ - \@cropviewtrue -} +\DeclareOption{cropview}{\@cropviewtrue} % With `closecrop', the TrimSize and margins are re-sized, to preserve the % live area, but with reduced margins on all sides (same for verso/recto). % This option is available only in draft mode, and disables shademargins. @@ -207,53 +209,43 @@ % so you can think about edits while traveling. It is NOT an e-book, since % it has no hyperlinks and is missing some features that an e-book should have. \newif \if@closecrop -\DeclareOption{closecrop}{ - \@cropviewtrue\@closecroptrue -} +\DeclareOption{closecrop}{\@cropviewtrue\@closecroptrue} % New in version 1.2: `coverart' option. See documentation. % This is used to create a 1-page file with no text, just an image. % Intended purpose is PDF/X for novel cover. \newif \if@coverart -\DeclareOption{coverart}{ - \@coverarttrue -} +\DeclareOption{coverart}{\@coverarttrue} % New in version 1.34: unblock option, for developer use only. -% Normally, a number of packages known to be incompatible with this document class +% Normally, a number of packages known to be incompatible with `novel' % are blocked from loading. If the user tries to get them via \usepackage % or \RequirePackage, or if they are called within some other loaded package, % then compile halts with an error. The `unblock' option turns off blocking, % and allows incompatible packages to load. Use only at own risk! \newif \if@novelunblock % For developer use. -\DeclareOption{unblock}{ - \@novelunblocktrue -} +\DeclareOption{unblock}{\@novelunblocktrue} % New in version 1.44: mtoff option, primarily for developer use. % With mtoff, the microtype package is not loaded. \newif \if@mtoff -\DeclareOption{mtoff}{ - \@mtofftrue -} +\DeclareOption{mtoff}{\@mtofftrue} % New in version 1.44: polyoff option, primarily for developer use. % With polyoff, the polyglossia package is not loaded. % You may need to load babel, or not, via \RequirePackage[options]{babel}. \newif \if@polyoff -\DeclareOption{polyoff}{ - \@polyofftrue -} +\DeclareOption{polyoff}{\@polyofftrue} % New in version 1.46: test option, primarily for developer use. -% Throws error if Liberintus and Latin Modern Roman fonts are unavailable. -% Throws error is file novel-testimage.png is not in same folder. -% Lets \lettrine relax if `lettrine' package not loaded. \newif \if@testsuite -\DeclareOption{test}{ - \@testsuitetrue -} +\DeclareOption{test}{\@testsuitetrue} +% +% New in version 1.50: sandbox option, for artwork and tables. Max 4 pages. +\newif \if@sandbox +\DeclareOption{sandbox}{\@sandbox} +% %% Note that document size and normal font size are not class options. %% They are set by commands in the Preamble, and have default values. % \ProcessOptions\relax % Disable some options, depending on compatibilities: -\if@useDraftMode\else +\ifdraftdoc\else \global\@shademarginsfalse \global\@cropviewfalse \global\@closecropfalse @@ -270,64 +262,81 @@ \fi % \if@coverart - \global\@useDraftModefalse + \global\draftdocfalse \global\@shademarginsfalse \global\@cropviewfalse \global\@closecropfalse - \global\@graytextfalse + \global\@sandboxfalse +\fi +% +\if@sandbox + % Thanks to user Compholio at stackexchange.com: + \newcounter{sandboxcount} + \ifx\latex@outputpage\@undefined\relax% + \global\let\latex@outputpage\@outputpage% + \fi% + \gdef\@outputpage{% + \addtocounter{sandboxcount}{1}% + \ifnum\value{sandboxcount}>4\relax% no output after 4 pages + \else% + \latex@outputpage% + \fi% + }% + \AtEndPreamble{% + \gdef\@title{untitled interior artwork}% + }% + \AfterEndPreamble{% + \ifdraftdoc\else\thispagestyle{empty}\fi% + }% \fi %% end class options + +\RequirePackage{noindentafter} % for unindented chapter and scene starts +\RequirePackage{changepage} % provides block indents, etc. Do not use strict! +\RequirePackage{magaz} % special treatment of first lines + + %% Activate xcolor, adjustbox, and eso-pic: -%% ----------------------------------------------------------------------------- -% The final book must be monochrome (black and white only) for all text, -% unless option `graytext' is used. Then, grayscale text is permitted. -% Interior images must be raster monochrome or grayscale, whether or not -% the `graytext' option is used. See documentation. +%% ---------------------------------------------------------------------------- +% The final book must be black/white and gray only, for all text. +% Interior images must be raster black/white or grayscale. See documentation. % Vector graphics are strongly discouraged, in any case. % In draft mode only, the `shademargins' option requires `grayscale', % which will be temporarily enabled, even if not specifically requested. -\newif \if@grayenabled % -\if@useDraftMode - \RequirePackage[gray,hyperref]{xcolor} % allows some layout checks - \global\@grayenabledtrue -\else - \if@graytext - \RequirePackage[gray,hyperref]{xcolor} % black/white book block - \global\@grayenabledtrue - \else - \RequirePackage[monochrome,hyperref]{xcolor} % black/white book block - \fi -\fi +\RequirePackage[gray,hyperref]{xcolor} +% % adjustbox and eso-pic cannot precede xcolor. \RequirePackage{adjustbox} % for scaling and moving \RequirePackage{eso-pic} % background effects in draft mode -% +\RequirePackage{pdfpages} % only used for pdf pre-processed by novel-scripts %% end activate xcolor and adjustbox -%% Temporary normal font size -%% ----------------------------------------------------------------------------- +%% Temporary normal font size, baselineskip, and fontspec +%% ---------------------------------------------------------------------------- %% This normalsize is temporary, so that packages can load without complaint. %% It will be modified later, during layout calculations. %% Actual default font size will be 11pt-12pt, with 11.4pt average. -%% But that is for typical book-weight fonts. The closest LMR eqivalent is 10pt. -\def\Current@FontSizeNum{10} -\def\Current@BaselineSkipNum{13} +%% The small temporary size is to ensure that overly-large struts and skips +%% are not created prior to page layout calculation. +\gdef\@TentativeEmN{10} +\gdef\@TentativeBLSkipN{13} \renewcommand\normalsize{% - \@setfontsize\normalsize{\Current@FontSizeNum}{\Current@BaselineSkipNum}% + \@setfontsize\normalsize{\@TentativeEmN}{\@TentativeBLSkipN}% } \normalsize -% -\RequirePackage{lipsum} % generates dummy text for examples -% -%% end temporary normal point size and baselineskip +\RequirePackage[no-math]{fontspec} % For LuaLaTeX. NOT package `fontenc'. +% The `novel' class is not intended for math. But TeX assumes you do math, +% so it needs a math font, whether you like it or not. +\RequirePackage{unicode-math} +%% end temporary normal point size, baselineskip, and fontspec. %% Define commands used for File Data, including PDF/X Settings. -%% ----------------------------------------------------------------------------- +%% ---------------------------------------------------------------------------- %% As used here, `File Data' refers to PDF metadata as found in PDF/Info %% and in XMP. This class does not write it to the PDF Catalog. \RequirePackage{novel-FileData} @@ -335,18 +344,39 @@ %% Physical Layout Commands and Settings. -%% ----------------------------------------------------------------------------- -%% Define user commands that over-ride the class option pre-configured settings. +%% ---------------------------------------------------------------------------- +%% Define user commands that over-ride class option pre-configured settings. %% Also sets a variety of miscellaneous lengths:s \parsep, \parindent, etc. \RequirePackage{novel-LayoutSettings} -%% -%% Additional Preamble Settings and Commands. -%% ----------------------------------------------------------------------------- +%% Polyglossia. +%% ---------------------------------------------------------------------------- +% Language-specific settings: +\if@polyoff % polyoff is new in v 1.44. + \ClassWarning{novel}{^^JYou chose the `polyoff' class option. ^^J% + So, the polyglossia package was not loaded. But like it or not, ^^J% + the babel package was loaded, with generic hyphenation. ^^J% + This behavior, or choice of language, cannot be changed. ^^J% + If you want a specific language, you will have to use polyglossia. ^^J}% +\else + \RequirePackage{polyglossia} % loading order changed in v. 1.40.3. + \setdefaultlanguage[variant=american]{english} % may be changed by user +\fi +%% end polyglossia + + +%% Additional Macros, Loaded in Preamble. +%% ---------------------------------------------------------------------------- +\RequirePackage{novel-Fonts} % font settings and defaults +\if@coverart\else\RequirePackage{lipsum}\fi % generates dummy text for examples +%% New in version 1.50: +\RequirePackage{novel-DropCap} % Macros for use in document body: \RequirePackage{novel-TextMacros} % Standard header footer styles, based on `fancyhdr': +% Each pre-configured style will set these booleans true or false: +\newif\if@HasHeader \newif\if@HasFooter \RequirePackage{novel-HeadFootStyles} % Chapter and Scene styles: \RequirePackage{novel-ChapterScene} @@ -354,240 +384,274 @@ \RequirePackage{novel-Images} % Footnotes and endnotes: \RequirePackage{novel-Footnotes} +% Obsolete code. Do not use in new documents: +\RequirePackage{novel-Obsolete} +%% + + +%% For convenience, from `article' class. +%% ---------------------------------------------------------------------------- +\newenvironment{verse}{% Not very useful. + \let\\\@centercr + \list{}{% + \itemsep\z@ + \itemindent -\parindent% + \listparindent\itemindent + \rightmargin \leftmargin + \advance\leftmargin \parindent% + }% + \item\relax% +}{% + \endlist% +} +%% +\newenvironment{quotation}{% Not very useful. + \list{}{% + \listparindent \parindent% + \itemindent \listparindent + \rightmargin \leftmargin + \parsep \z@% + }% + \item\relax% +}{% + \endlist% +} %% +\newenvironment{quote}{% Not very useful. + \list{}{% + \rightmargin\leftmargin% + }% + \item\relax% +}{% + \endlist% +} +% +%% end convenience. -%% Special features of test suite. -%% ----------------------------------------------------------------------------- + +%% Special features of test suite (for developers and error reporting) +%% ---------------------------------------------------------------------------- +% Files `novel-testsuite.tex' and `novel-testimage.png' are within the novel +% documentation extras folder. To run the test suite, copy these files to +% a writeable location (such as your home directory) and compile there. \newcommand\testsuiteoops[1]{% \ClassError{novel}{#1 missing}{Install the necessary file(s).}% } \if@testsuite - \IfFontExistsTF{libertinusserif-regular.otf}{}{\testsuiteoops{`libertinus' fonts}} + \IfFontExistsTF{libertinusserif-regular.otf}{}{% + \testsuiteoops{`libertinus' fonts}% + } \IfFileExists{lmodern.sty}{}{\testsuiteoops{`lmodern' package}} \IfFileExists{novel-testimage.png}{}{\testsuiteoops{`novel-testimage.png'}} \NewFontFamily\mustbelibertinus{Libertinus Serif} \NewFontFamily\mustbelmodern{Latin Modern Roman} \fi -\AtBeginDocument{\@ifpackageloaded{lettrine}{}% - {\DeclareDocumentCommand\lettrine{ O{} m m }{#2#3}}% -} %% end special features of test suite. -%% \AtEndPreamble sets defaults and calculates layout -%% ----------------------------------------------------------------------------- +%% \AtEndPreamble sets defaults, calculates layout, and writes PDF/X +%% ---------------------------------------------------------------------------- +% This is prior to \AtBeginDocument, and ensures that the results are available +% prior to any \AtBeginDocument routines from user macros or loaded packages. \AtEndPreamble{ - % New in v. 1.44. Sets default resolution for images without internal dpi: - \pdfimageresolution=\@novimgres % from \SetFlexResolution. Default 300. - % If user did not choose language, default is here. Sorry, Brits: - % Macro \xpg@main@language is gdef'd by \setdefaultlanguage in polyglossia. - \if@polyoff\else % polyoff v 1.44. - \@ifundefined{xpg@main@language}{\setdefaultlanguage[variant=american]{english}}{} - \fi - \RequirePackage{novel-CalculateLayout} - \RequirePackage{novel-FontDefaults} - \providecommand\textls[2][]{#2} % when mtoff option - \renewcommand\textls[2][]{#2} % nullifies this microtype command (problems) - \RequirePackage{novel-pdfx}% + \@ActivateFonts % in `novel-Fonts.sty' + \RequirePackage{novel-CalculateLayout} % may load novel-ChangeLayout.sty + \RequirePackage{novel-PostLayout} % calculates shademargins, cropmarks, etc. + \RequirePackage{novel-pdfx}% also provides an \AtBeginDocument macro + \AtEndDocument{% + \if@coverart\else% + \if@sandbox\else% + \cleartoend% adds 1 or 2 blanks, for final verso blank + \fi% + \fi% + } +}% +%% end AtEndPreamble + + +%% Messages that may be issued by \AtBeginDocument routines: +%% ---------------------------------------------------------------------------- +% +%% Dealing with known incompatible packages: +\gdef\really@no#1#2#3{ % cannot be used, even with unblock or sandbox + \@ifpackageloaded{#1}{% + \ClassError{novel}{Sorry, package `#1' cannot be used in `novel' class}% + {No exceptions. You are out of luck. ^^J% + Reason: `novel' has #2 ^^J% + See `novel' HTML documentation, section #3. ^^J% + Note: The offending package may have been loaded by another package.}% + }{}% +} % +% +%% Command or environment native to LuaLaTeX, but banned except in sandbox: +\gdef\@OnlySandbox#1{% + \ClassError{novel}{Use of `#1' page \thepage\space requires sandbox}% + {`novel' class prohibits command or environment `#1' ^^J% + unless you use class option `sandbox'. See documentation.}% } -%% +% +%% Package can be used, but Alert: +\gdef\alert@nodisp#1{% + \@ifpackageloaded{#1}{% + \typeout{^^JClass `novel' Alert: Beware of package #1. ^^J% + Commands from this package may cause mis-positioning in main text. ^^J% + Maybe, maybe not. Best if usage is confined to display pages. ^^J}% + }% +} +% +%% Dealing with blocked packages, allowed with `unblock': +\if@novelunblock + \gdef\sorry@no#1{} % no package-specific errors, when unblock + \ClassWarning{novel}{Using `unblock' class option, at your own risk. ^^J% + The `unblock' option is for developer use, not production documents. ^^J% + If the unblocked packages and commands cause problems, ^^J% + they are not bugs. Do not report them. You have been warned. ^^J% + Perhaps your document will compile without error, and perhaps the ^^J% + results are OK. But in other cases, unexpected typesetting results. ^^J}% +\else % package-specific errors, when no unblock + \gdef\sorry@no#1{ + \@ifpackageloaded{#1}{% + \ClassError{novel}{Sorry, package `#1' cannot be used in `novel' class}% + {See `novel' HTML documentation, regarding `sandbox' option. ^^J% + Note: The offending package may have been loaded by another package.}% + }{}% + } % +\fi +%% end messages. %% \AtBeginDocument finishes the setup -%% ----------------------------------------------------------------------------- -\newlength\normalparindent +%% ---------------------------------------------------------------------------- +% +\gdef\@needsandboxmsg{% + \ClassError{novel}{Need `sandbox' for picture, figure, table environments}% + {You cannot use picture, figure, or table environments in `novel' unless ^^J% + you use the `sandbox' document class option. See docs.}% +} \AtBeginDocument{ % - \@ifpackageloaded{lettrine}{% - \LettrineOnGridtrue% - \setlength\DiscardVskip{10\nbs}% effectively infinite - \global\DiscardVskip=\DiscardVskip% - \setlength\DefaultFindent{0.25em}% about one space - \global\DefaultFindent=\DefaultFindent% - \setlength\DefaultNindent{0em}% uniform gap - \global\DefaultNindent=\DefaultNindent% - \setcounter{DefaultLines}{3}% more likely than 2. - }{}% - % Find some useful measurements: - \setlength\normalparindent{\parindent} - \global\normalparindent=\parindent - \gdef\@normalxheight{\heightof{x}} - \setlength\normalxheight{\@normalxheight} - \global\normalxheight=\normalxheight - \gdef\@normalXheight{\heightof{X}} - \setlength\normalXheight{\@normalXheight} - \global\normalXheight=\normalXheight - \gdef\@normalscxheight{\heightof{\textsc{x}}} - \setlength\normalscxheight{\@normalscxheight} - \global\normalscxheight=\normalscxheight - \gdef\@normalAringheight{\heightof{Å}} - \setlength\normalAringheight{\@normalAringheight} - \global\normalAringheight=\normalAringheight - \gdef\@normaldescender{\depthof{gjpqy}} - \setlength\normaldescender{\@normaldescender} - \global\normaldescender=\normaldescender - % Activate user choice of whether or not to indent after scenebreak commands: - \if@indentAfterScenebreak\else - \NoIndentAfterCmd{\scenebreak} - \NoIndentAfterCmd{\sceneline} - \NoIndentAfterCmd{\scenestars} - \fi + %% Mostly involve settings defaults: + \@ActivateTextLengths % in `novel-TextMacros.sty' + \@ActivateDropCaps % in `novel-DropCaps.sty' + \@ActivateChapterScene % in `novel-ChapterScene.sty' + \@ActivateHeadFootStyles % in file `novel-HeadFootStyles.sty' + \@ActivatePDFInfo % in file `novel-pdfx.sty' + \@ActivateTextMacros % in `novel-TextMacros.sty' + \@ActivateFootnotes % in `novel-Footnotes.sty' + \@DisableFontSizes % in file `novel-LayoutSettings.sty' + \@DisableLayoutSettings % in file `novel-LayoutSettings.sty' + \@DisableFileDataSettings % in file `novel-FileData.sty' + \@DisableChapterSceneSettings % in file `novel-ChapterScene.sty' + \@DisableHeadFootSettings % in file `novel-HeadFootStyles.sty' + %% List of always-blocked packages (not exhaustive, since TeX has so many): + \really@no{geometry}{its own layout commands.}{4} + \really@no{pdfx}{built-in PDF/X capability.}{3.4} + \really@no{xmpincl}{built-in PDF/X capability.}{3.4} + \really@no{hyperxmp}{built-in PDF/X capability.}{3.4} + \really@no{pdfxmult}{built-in PDF/X capability.}{3.4} + \really@no{inputenc}{utf-8 encoding always.}{1.2.1} + \really@no{fontenc}{`fontspec' and utf-8 encoding always.}{1.2.1, 1.2.3} + \really@no{biblatex}{no bibiography capability.}{1.2.5} + \really@no{showkeys}{an incompatible layout method.}{1.2.5} + \really@no{booktabs}{no capability for this, due to printer specs.}{3.4} + \really@no{pax}{no capability for this, due to printer specs.}{3.4} + \really@no{bookmark}{focus on paper books, not e-books.}{(top of file)} + \really@no{endnotes}{limited, built-in endnote methods.}{6.5} + \really@no{acronym}{focus on paper books, not e-books.}{(top of file)} + \really@no{embedfile}{incompatible print requirements.}{(top of file)} % - \@activateHeadFootStyles % in file `novel-HeadFootStyles.sty' - \@novelPDFinfo % in file `novel-pdfx.sty'. - % Commands that cannot be used after Preamble: - \let\indentAfterScenebreak\relax - \let\title\relax - \let\author\relax - \let\subtitle\relax - % Dealing with known incompatible packages: - \if@novelunblock - \gdef\sorry@no#1{} % let them be used - \else % block them (default) - \gdef\sorry@no#1{\@ifpackageloaded{#1}{% - \ClassError{novel}{Sorry, package `#1' cannot be used}% - {The `novel' class does not allow use of package `#1'.^^J% - You must remove it from the Preamble, and also remove its commands^^J% - from the body of your document. In rare cases, the offending package^^J% - was loaded by some other package.^^J}% - }{}% - } - \fi - % List of blocked packages (not exhaustive, since TeX has so many): - \sorry@no{pdfx} - \sorry@no{xmpincl} - \sorry@no{hyperxmp} - \sorry@no{pdfxmult} - \sorry@no{inputenc} - \sorry@no{fontenc} - \sorry@no{showkeys} - \sorry@no{wrapfigure} - \sorry@no{wrapfig} - \sorry@no{float} - \sorry@no{morefloats} - \sorry@no{footmisc} - \sorry@no{footnote} - \sorry@no{manyfoot} - \sorry@no{caption} - \sorry@no{subcaption} - \sorry@no{multirow} - \sorry@no{tabu} - \sorry@no{tabularx} - \sorry@no{tabulary} - \sorry@no{array} - \sorry@no{booktabs} - \sorry@no{eqparbox} - \sorry@no{pdfpages} - \sorry@no{nth} - \sorry@no{engord} - \sorry@no{endnotes} - %% - %% Pertains to novel-LayoutSettings.sty: - \ifcsname pagenumberstyle\endcsname\else - \SetPageNumberStyle{\thepage} - \fi + \if@sandbox% + \RequirePackage{novel-Sandbox}% + \fi% % - \def\@setchapterstartOK{false}% - \ifthenelse{\equal{\@setchapterstart}{empty}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{plain}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{footer}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{fancyplain}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{fancy}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{forcenumber}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{dropfolioinside}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstart}{dropfoliobeneath}}{% - \def\@setchapterstartOK{true}% - }{}% - \ifthenelse{\equal{\@setchapterstartOK}{true}}{}{% - \ClassError{novel}{\string\SetChapterStartStyle\space bad argument}% - {\string\SetChapterStartStyle\space only allows certain choices.^^J}% - }% - %% - %% Pertains to novel-TextMacros.sty: - \setlength\forceparlength{\parindent} - \global\forceparlength=\forceparlength - \gdef\forceindent{\ifvmode\else\unskip\fi\stake\hspace{\forceparlength}} - \gdef\backindent{\ifvmode\else\unskip\fi\hspace{-\forceparlength}} - %% - %% Pertains to novel-footnotes.sty: - \gdef\SetFootnoteMarker#1{% - \typeout{^^JClass `novel' Alert: % - \string\SetFootnoteMarker\space ineffective after Preamble.^^J}% - } - % Must wait for \nbs to be calculated: - \setlength\footnotesep{0.8\nbs} - % Must wait for main font and its size to be active: - \newlength\@hoaring - \setlength\@hoaring{\heightof{Å}} - \global\@hoaring=\@hoaring - \newlength\@twast % tweaks asterisk - \setlength\@twast{\heightof{*}} - \addtolength\@twast{-\@hoaring} - \global\@twast=\@twast - \newlength\@twdag % tweaks dagger - \setlength\@twdag{\heightof{†}} - \addtolength\@twdag{-0.2\@twdag} - \addtolength\@twdag{-\@hoaring} - \global\@twdag=\@twdag - \newlength\@twdbldag % tweaks double dagger - \setlength\@twdbldag{\heightof{‡}} - \addtolength\@twdbldag{-0.2\@twdbldag} - \addtolength\@twdbldag{-\@hoaring} - \global\@twdbldag=\@twdbldag - \newlength\@twsect % tweaks section mark - \setlength\@twsect{\heightof{§}} - \addtolength\@twsect{-0.2\@twsect} - \addtolength\@twsect{-\@hoaring} - \global\@twsect=\@twsect - \newlength\@tweight % tweaks 8, reliably the tallest digit - \setlength\@tweight{\heightof{8}}% - \addtolength\@tweight{-0.2\@tweight}% - \addtolength\@tweight{-\@hoaring}% - \global\@tweight=\@tweight% - % Must wait to see how \SetFootnoteMarker was used: - \ifthenelse{\equal{\@myfnsymbols}{*}}{\setcounter{@maxfnsymbol}{8}}{} - \ifthenelse{\equal{\@myfnsymbols}{†}}{\setcounter{@maxfnsymbol}{6}}{} - %% -} -%% end AtBeginDocument - - -%% New in version 1.2, coverart option. See documentation. -\AfterEndPreamble{ - \if@coverart - \AddToShipoutPictureBG{% - \AtPageUpperLeft{% - \InlineImage{\novelcoverimage}% - }% - } - \null% without this, page has no "content" + %% Potential problem packages, allowed in sandbox or with unblock: + \if@sandbox\else + % Related to floats: + \sorry@no{floatflt} + \sorry@no{floatfig} + \sorry@no{flafter} + \sorry@no{float} + \sorry@no{morefloats} + \sorry@no{endfloat} + \sorry@no{placeins} + % Related to footnotes and endnotes: + \sorry@no{footmisc} + \sorry@no{footnote} + \sorry@no{manyfoot} + % Related to tables: + \sorry@no{multirow} + \sorry@no{tabu} + \sorry@no{tabularx} + \sorry@no{tabulary} + \sorry@no{longtable} + % Related to lists: + \sorry@no{array} + \sorry@no{easylist} + \sorry@no{listings} + \sorry@no{numitem} + \sorry@no{tasks} + % Related to graphics or layout: + \sorry@no{pagegrid} + \sorry@no{subfig} + \sorry@no{lpic} + \sorry@no{pinlabel} + \sorry@no{overpic} + \sorry@no{caption} + \sorry@no{sidecap} + \sorry@no{subcaption} + \sorry@no{paracol} + \sorry@no{scrextend} + \sorry@no{exsheets} + \sorry@no{eqparbox} + \sorry@no{colortbl} + \sorry@no{tikz} + \sorry@no{pstricks} + \sorry@no{xypic} + \sorry@no{xfig} + \sorry@no{pgfcalendar} + \sorry@no{pgfpages} + \sorry@no{pst-pdf} + \sorry@no{auto-pst-pdf} + \sorry@no{epstopdf} + \sorry@no{pdftricks} + \sorry@no{pdftricks2} + \sorry@no{mpgraphics} + \sorry@no{pict2e} + \sorry@no{picman} + \sorry@no{scalerel} + \sorry@no{pmgraph} + \sorry@no{reflectgraphics} + \fi % end if sandbox. + % + %% Commands and environments, only allowed in sandbox: + \if@sandbox\else + \gdef\mplibcode{\@OnlySandbox{mplibcode}} \fi -} + % + %% Alert packages, might cause minor layout problems, not enough to block: + \alert@nodisp{nth} + \alert@nodisp{engord} + \alert@nodisp{ulem} + \alert@nodisp{soul} + % end list of Alert packages. + % + %% Package `pagegrid' interacts with `shademargins' and `draft' options: + \@ifpackageloaded{pagegrid}{ % that is, if permitted by sandbox or unblock + \ifdraftdoc + \if@shademargins + \ClassWarning{novel}{^^JGrid from `pagegrid' is concealed. ^^J% + Document class option `shademargins' over-writes page grid. ^^J% + To see the grid, use `draft' but not `shademargins'. ^^J} + \else\fi + \else + \ClassError{novel}{Package `pagegrid' needs `draft' mode}% + {Package `pagegrid' only with document class option `draft'.}% + \fi + }{} % end if pagegrid +}% end \AtBeginDocument %% -%% AtBeginShipout occurs at the completion of each page layout, in document body. -\AtBeginShipout{% - \gdef\@fnafter{}% Pertains to some standard LaTeX footnote code. - \stepcounter{runningpages}% - \global\@thispagestylesetfalse% -} -%% - %% %% End of file `novel.cls' -- cgit v1.2.3