% Created by ptxprint {config/version} at {date_}
{project/plugins}
\def\pluginlist{{{plugins_}}}
\input paratext2.tex
\input ptx-ptxprint.tex
\def\zautoBookEndDecoration{{}}
\def\zBookEndDecoration{{}}
\def\BookEndDecorationSkip{{16pt}}
\csname idf@nt\endcsname % use a locally available font (we ship this one)
{fancy/enableornaments}\stylesheet{{standardborders.sty}}
{fancy/enableornaments}\SwitchOrnamentsFamily{{pgfhan}}
{fancy/enableornaments}\SwitchOrnamentsFamily{{vectorian}}
{project/ifusepremodstex}\includeifpresent{{{/premodspath}}}
\PiclistLitPcttrue
%%%%% Aligned Diglot Switches
{document/ifdiglot}\diglottrue
{document/ifndiglot}\diglotfalse
{document/ifdiglot}\diglotcolumns
{document/ifdiglot}\diglotInnerOuter{header/mirrorlayout}
{document/ifdiglot}\diglotSepNotes{document/diglotsepnotes}
{document/ifdiglot}{document/ifdiglotcolour}\SetDiglotBGColour{{L}}{{{document/diglotcolour}}}{{}}
%\diglot \newPolyglotCol {s_}

%%%%% Stylesheets %%%%%
\stylesheet{{usfm_sb.sty}}
%{document/ifdiglot}\stylesheet{R_}{{{/ptxrpath}/usfm.sty}}
%\stylesheet{L_}{{{/ptxrpath}/usfm.sty}}
\stylesheet{{ptx2pdf.sty}}

{project/ifusecustomsty}{/nocustomsty}\stylesheet{L_}{{{/ptxrpath}/custom.sty}}

\stylesheet{L_}{{{/cfgrpath}/ptxprint.sty}}
%{document/ifdiglot}\stylesheet{R_}{{{diglot/ptxprintstyfile_}}}

{project/ifusemodssty}\stylesheet{L_}{{{/cfgrpath}/ptxprint-mods.sty}} % Left-side stylesheet override settings

%%%%% Page Setup %%%%%
% Dimensions
\PaperWidth={paper/width}
\PaperHeight={paper/height}
\CropMarks{paper/ifcropmarks}
\BookOpenLeft{cover/rtlbookbinding}
{paper/ifgrid}\def\doLines{{{paper/notelines}}}
\NoteLines{paper/ifnotelines_}
\def\NoteLineColMajor{{{majornlcolor_}}} % Colour (R G B)

%% Margins
\MarginUnit={paper/margins}mm
\def\TopMarginFactor{{{paper/topmarginfactor}}}
\def\BottomMarginFactor{{{paper/bottommarginfactor}}}
\def\SideMarginFactor{{1.0}}
\BindingGutter{paper/ifaddgutter}
\BindingGutter={paper/gutter}mm
\OuterGutter{paper/ifoutergutter}
\def\DefaultSpaceBeside{{{texpert/cutouterpadding} pt}}
\noinkinmargin{footer/noinkinmargin}

%% Columns
\TitleColumns=1
\IntroColumns=1
\BodyColumns={paper/columns}\def\mainBodyColumns{{{paper/columns}}}
\ColumnGutterRule{paper/ifverticalrule}
\ColNotesRule{notes/xrcolrule}
\def\ColumnGutterFactor{{{document/colgutterfactor}}}
\ColumnGutterRuleSkip={paper/colgutteroffset}pt
\StudyColumnGutterRuleSkip={studynotes/colgutteroffset}pt
\def\StudyGutterFactor{{{studynotes/colgutterfactor}}}
\StudyGutterRule{studynotes/ifverticalrule}
{document/marginalverses}\input ptxplus-marginalverses.tex
{document/marginalverses}\columnshift={document/columnshift}pt
{document/marginalverses}\VerseBoxWidth={document/columnshift}pt
{document/marginalverses}\def\colshiftmode{{{document/marginalposn}}}
%{document/marginalverses}\def\AfterVerseSpaceFactor{{0}}
\def\PageFullFactor{{{texpert/pagefullfactor}}}
{paper/allowunbalanced}\def\BalanceThreshold{{{texpert/bottomrag}}}

%%%%% Text Spacing %%%%%
{document/nogrid}\NoGridtrue
{document/nogrid}{document/varlinespacing}\def\ColAdjskip{{0pt plus 2pt}}
\def\LineSpaceBase{{{texpert/linespacebase}}}
\def\LineSpacingFactor{{{paragraph/linespacingfactor}}}
\def\VerticalSpaceFactor{{1.0}}
{texpert/useglyphmetrics}\XeTeXuseglyphmetrics=0

{cover/makecoverpage}\NoTransparencyfalse
%% Cross-space contextualization
\XeTeXinterwordspaceshaping={document/spacecntxtlztn}

%%%%% Fonts %%%%%
\FontSizeUnit={paper/fontfactor}pt
%% Faces
\def\regular{{"{document/fontregular}{document/script}"}}
\def\bold{{"{document/fontbold}{document/script}"}}
\def\italic{{"{document/fontitalic}{document/script}"}}
\def\bolditalic{{"{document/fontbolditalic}{document/script}"}}
{document/ifspacing}\def\SpaceStretchFactor{{{document/spacestretch}}}
{document/ifspacing}\def\SpaceShrinkFactor{{{document/spaceshrink}}}
{document/ifcolorfonts}\ColorFontsfalse

\def\UnderlineThickness{{{texpert/underlinethickness}em}}
\def\UnderlineLower{{{texpert/underlineposition}em}}
\RuleThickness={document/rulethickness}pt

%% Specify the fallback font to be used for special/missing characters
%\extrafont

\newskip\intercharskip \intercharskip=0pt plus {document/letterstretch:.4f}em minus {document/lettershrink:.4f}em
{document/ifdiglot}\def\intercharskip{L_}{{\intercharskip}}
{document/ifletter}\def\intercharspace{L_}{{\leavevmode\nobreak\hskip\intercharskip}}
{document/ifletter}\XeTeXinterchartokenstate=1
{document/ifdiglot}\addToSideHooks{{L}}{{\XeTeXinterchartokenstate={document/letterspace}}}

%%%%% Layout %%%%%
{texpert/showhboxerrorbars}\overfullrule=0pt
\RTL{document/ifrtl}   % Use right-to-left layout mode?
\RTL{L_}{document/ifrtl}
{document/toptobottom}\XeTeXupwardsmode=1     % Top-to-Bottom and Left-to-Right layout
{document/toptobottom}\rotatetrue
% Specify ISO 639-1 language code.
% XeTeX will use ICU line break info (useful for scripts which do not use word spaces).
% {document/script}

{document/iflinebreakon}\XeTeXlinebreaklocale "{document/linebreaklocale}"
% Introduce some stretchability (glue) at each potential line break
%\XeTeXlinebreakskip=0em plus 0.1em minus 0.01em
\JustifyPars{paragraph/ifjustify}
\IndentAfterHeading{document/firstparaindent}
\IndentUnit{L_}={document/indentunit}in

%%% Chapters & Verses %%%
\OmitVerseNumberOne{document/ifomitverseone}
{document/ifshowchapternums}\OmitChapterNumbertrue
\def\AfterChapterSpaceFactor{{{texpert/afterchapterspace}}}
{document/ifshowversenums}\def\AfterVerseSpaceFactor{{{texpert/afterversespace}}}
\OmitAllVersestrue {document/ifshowversenums}\OmitAllVersesfalse

%%% Poetry - Hang Verse Numbers
{document/hangpoetry}\catcode`\@=11
{document/hangpoetry}\sethook{{start}}{{q}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{q1}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{q2}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{q3}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{q4}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{qm}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{qm1}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{qm2}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{start}}{{qm3}}{{\let\printv@rse=\hangprintv@rse\hangversenumber}}
{document/hangpoetry}\sethook{{end}}{{q}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{q1}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{q2}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{q3}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{q4}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{qm}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{qm1}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{qm2}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\sethook{{end}}{{qm3}}{{\let\printv@rse=\simpleprintv@rse\hangingversefalse}}
{document/hangpoetry}\catcode`\@=12

%%%%% Notes %%%%%

%% Disable footnote rule (when line is commented out, the footnote rule will show)

%\AutoCallerStartChar=97
%\AutoCallerNumChars=26
{notes/fnresetcallers}\PageResetCallers{{f}}
{notes/fnomitcaller}\OmitCallerInNote{{f}}
{notes/fneachnewline}\ParagraphedNotes{{f}}
%\NumericCallers{{f}}
{document/ifndiglot}{notes/includefootnotes}\expandafter\def\csname f:properties\endcsname{{nonpublishable}}
%%%{notes/includefootnotes}\expandafter\def\csname f{L_}:properties\endcsname{{nonpublishable}}
%%%{ifdiglotincludefootnotes_}\expandafter\def\csname f{R_}:properties\endcsname{{nonpublishable}}

% no comments inside this catcode area. Who knows what others people will want.
\catcode`\#=12 \catcode`\%=12 \catcode`\&=12 \catcode`\^=12
\AutoCallers{{f}}{{{notes/fncallers}}}
\AutoCallers{{x}}{{{notes/xrcallers}}}
\catcode`\#=6 \catcode`\%=14 \catcode`\&=4 \catcode`\^=7
%

{notes/xrresetcallers}\PageResetCallers{{x}}
{notes/xromitcaller}\OmitCallerInNote{{x}}
{notes/xreachnewline}\ParagraphedNotes{{x}}
%\NumericCallers{{x}}
{document/ifndiglot}{notes/includexrefs}{notes/ifxrexternalist}\expandafter\def\csname x:properties\endcsname{{nonpublishable}}
{notes/xrlocation}\def\XrefNotes{{x}}\XrefNotesMargin={notes/xrguttermargin}pt \XrefNotesWidth={notes/xrcentrecolwidth}pt\def\XrefSide{{{notes/xrcolside}}}
\XrefSideAlign{notes/xrcolalign}
\ColNotes{notes/columnnotes_}
\XrefTopfill{notes/xrcolbottom}
{notes/endnotes_}\NoteAtEnd{{f}}
%%%{notes/includexrefs}\expandafter\def\csname x{L_}:properties\endcsname{{nonpublishable}}
%%%{ifdiglotincludexrefs_}\expandafter\def\csname x{R_}:properties\endcsname{{nonpublishable}}

{noterules/endnotemarkers}
{noterules/foot}
{noterules/end}
{noterules/study}
{notes/iffootnoterule}\def\FootNoteRuleThickness{{0pt}}
{notes/ifstudynoterule}\def\StudyNoteRuleThickness{{0pt}}
{notes/endnotes_}\def\EndNoteRuleThickness{{0pt}}
\InterNoteSpace={notes/internotespace}pt
\NoteGutterRule{document/diglotnotesrule}
\JoinGutterRule{document/diglotjoinvrule}
%\AboveNoteSpace=\medskipamount % but is a dimension not a skip
%\InterNoteSpace=3.5pt
%\horiznotespacing

%%%%% Extended Study Notes features
{studynotes/includextfn}\StudyNotes{{ef}}
{studynotes/showcallers}\OmitCallerInNote{{ef}}

%%%%% Running Header/Footer %%%%%
\def\HeaderPosition{{{paper/headerposition}}}
\def\FooterPosition{{{paper/footerposition}}}
{header/ifrhrule}\RHruleposition={paper/ruleposition}pt
\def\RangeSeparator{{\kern.1em{rangesep_}\kern.1em}} % what to put between first - last of a reference range
\def\ChapterVerseSeparator{{\kern.02em{chvssep_}\kern.02em}} % what to put between chapter:verse

%% Even Header
\def\RHevenleft{{{header/evenleft}}}
\def\RHevencenter{{{header/evencenter}}}
\def\RHevenright{{{header/evenright}}}

%% Odd Header
\def\RHoddleft{{{header/oddleft}}}
\def\RHoddcenter{{{header/oddcenter}}}
\def\RHoddright{{{header/oddright}}}

%% Extra Books Even Header
\def\RHnoVevenleft{{{header/noVevenleft}}}
\def\RHnoVevencenter{{{header/noVevencenter}}}
\def\RHnoVevenright{{{header/noVevenright}}}

%% Extra Books Odd Header
\def\RHnoVoddleft{{{header/noVoddleft}}}
\def\RHnoVoddcenter{{{header/noVoddcenter}}}
\def\RHnoVoddright{{{header/noVoddright}}}

\VerseRefs{header/ifshowverse}               % Include verses in reference text?
\OmitChapterNumberRH{header/ifshowchapter}   % Omit the chapter numbers in the running header (RH)
\OmitBookRef{header/ifshowbook}              % Omit the book name in the running header reference

%% Footer
\def\RFoddcenter{{{footer/oddcenter}}}
\def\RFevencenter{{{footer/oddcenter}}}
\def\RFtitleevencenter{{{footer/titleevencenter}}}
\def\RFtitleoddcenter{{{footer/titleoddcenter}}}
\def\RFnoVoddcenter{{{footer/oddcenter}}}
\def\RFnoVevencenter{{{footer/oddcenter}}}

\PBOnBody{document/ch1pagebreak}
  
% \pageno={document/startpagenum}
\pageno=-1

%%%%% Illustration and Adjustment Locations and Lists %%%%%
\IncludeFigures{document/ifinclfigs}
\SkipMissingFig{document/iffigskipmissing}
\DoCaptions{document/iffigshowcaptions}
\FigurePlaceholders{document/iffigplaceholders}
\PicPath={{{document/directory}/tmpPics/}}
{document/ifusepiclist}\PicListPath={{{project/piclists}}}
\AdjListPath={{{project/adjlists}}}
\TrigListPath={{{project/triggers}}}
{document/ifusepiclist}\openpiclist "{document/piclistfile}"
\NoTransparency{transparency_}

%%%%% Covers
\catcode`\@=11
\def\tmp{{{cover/coverartbleed}mm}}   % Art Bleed dimension
\expandafter\edef\csname cover-bleed\endcsname{{{cover/coverbleed}mm}}   % Bleed dimension
\expandafter\edef\csname cover-spine\endcsname{{{cover/spinewidth_}mm}}   % Actual spine width = book thickness, endpapers, board thickness, etc.
\expandafter\xdef\csname cover-y\endcsname{{\the\PaperHeight}} % spine/book height 
\expandafter\xdef\csname cover-x\endcsname{{\the\PaperWidth}} % Front/back cover
\expandafter\edef\csname cover-back-spinewrap\endcsname{{{cover/spineoverlapback}mm}} %  Should the graphic/colour on the spine be given extra space?
\expandafter\edef\csname cover-front-spinewrap\endcsname{{{cover/spineoverlapfront}mm}} % 

% tweak to enable blank lines
% restore page break definition (if present in USFM stylesheet, it has been re-defined and will not work)
%\def\b{{\endlastp@rstyle{{b}}\bgroup \getp@ram{{baseline}}{{b}}{{b+\styst@k}}\@@b}}
%\def\b{{\the\p@rstylehooks \par\bgroup\s@tbaseline{{b}}\vskip\baselineskip\egroup}}
%%%%% Hyphenation %%%%%
\newlanguage\langund \language\langund
\catcode`\@=11
{paragraph/ifhavehyphenate}{paragraph/ifhyphenate}\bgroup\liter@lspecials\input "{/ptxrpath}/shared/ptxprint/hyphen-{project/id}.tex" \egroup
{paragraph/ifomithyphen}\defaulthyphenchar=8203 % \u200B
{paragraph/ifnothyphenate}\hyphenpenalty=10000 \exhyphenpenalty=10000
\catcode`\@=12
\let\pb=\pagebreak
{project/interlinear}\expandafter\def\csname complex-rb\endcsname{{\ruby{project/ruby}{{rb}}{{gloss}}}}

%%%%% Set hooks to allow Poetical books more freedom when column-balancing
%\optimizepoetry

\tracingstats=1

% Extras not yet templated (if ever)
%\ExtraRMargin=0pt
%\def\SuperscriptRaise{{0.85ex}}  % in terms of the scaled-down superscript font size
%\def\SuperscriptFactor{{0.75}} % fontsize scale for a superscript char

\def\addInt{{{project/intfile}}}

%%%%% all normal settings, etc. before this line %%%%%

{document/imageCopyrights}
%\snippets

\exhyphenpenalty=\hyphenpenalty

{project/ifcolophon}\expandafter\def\csname bookend-final\endcsname{{
{project/ifcolophon}\layoutstylebreak
{project/ifcolophon}\singlecolumn
{project/ifcolophon}{project/pgbreakcolophon}\pb
{project/ifcolophon}\zcolophon\csname beenb@dyfalse\endcsname}}
% Looks in local Config folder for ptxprint-mods.tex, and drops back to shared/ptxprint .tex if not found 
{project/ifusemodstex}\includeifpresent{{{/modspath}}}% adjust/override setup parameters here

%\defzvar

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all settings need to come before this line %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% Watermark PDF file or Grid PDF etc. %%%%%
{paper/ifwatermark}\def\MergePDF{{"{paper/watermarkpdf}"}}

%%%%% Front Matter PDF file(s) get included here %%%%%
\BodyColumns=1     % Temporarily set this to Single Column for the ToC page(s)

\expandafter\font\csname font<AP>\endcsname "Source Code Pro:extend=0.8,color=007f00" at 7pt % AdjustPar

\NoBodytrue
{document/iftocleaders}\addtoinithooks{{\relax \tocleaders{document/tocleaderrule}{{{document/tocleaderstyle}}}{{3pt}} \relax}}
{document/toc}\includeifpresent{{{jobname}.toc}}
{frontincludes_}
{document/ifdiglot}\diglotfalse
\StoreAllPeriphstrue\addInt\StoreAllPeriphsfalse
\ptxfile{{{project/frontfile}}}
{document/toc}{document/hasnofront_}\preptxfile\prepusfm\id FRT -- toc
{document/toc}{document/hasnofront_}\is {document/toctitle} \ip \ztoc |main\*\ip \postptxfile
\BodyColumns={paper/columns}     % But ensure it goes back to the chosen Single/Double setting for the main body text
\useTOCone{document/usetoc1}
\useTOCtwo{document/usetoc2}
\useTOCthree{document/usetoc3}
{document/toc}\GenerateTOC[{document/toctitle}]{{{jobname}.toc}}
\NoBodyfalse

%%%%% Load Paratext USFM %%%%%
\XeTeXdefaultencoding "utf-8"
\def\closeadjlist{{\relax}}
\def\closepiclist{{\relax}}
\pageno={document/startpagenum}
{document/ifdiglot}\diglottrue
\addtoendptxhooks{{\zautoBookEndDecoration}}
% job files:
%\ptxfile{{PrintDraft/41MATprojid-draft.SFM}}

\csname final-extra\endcsname
%%%%% Back Matter PDF file(s) get included here %%%%%
{backincludes_}

\csname final-afterincludes\endcsname
{cover/makecoverpage}{document/ifdiglot}\inptxfiletrue\zglot|L\* 
{cover/makecoverpage}\csname m@kecover\endcsname
\end
