From 168dca350fca3aff729ef97b805db8db2fd4ee12 Mon Sep 17 00:00:00 2001 From: Joshua Lucas Date: Thu, 28 Aug 2025 16:56:27 -0500 Subject: [PATCH] Lots of changes. --- Manual.cls | 8 ++ packages/Boxout.sty | 35 ++++++-- packages/DocProperties.sty | 169 +++++++++++++++++++++++++++++++------ packages/Graphics.sty | 47 +++++++---- packages/Layout.sty | 67 ++++++++------- packages/Links.sty | 27 ++++-- packages/TitlePage.sty | 15 ++-- packages/Titles.sty | 4 +- 8 files changed, 275 insertions(+), 97 deletions(-) diff --git a/Manual.cls b/Manual.cls index f2e8e9d..686fd3f 100644 --- a/Manual.cls +++ b/Manual.cls @@ -36,6 +36,14 @@ \overfullrule = 1in } +% Option 'admin': turn on admin manual sections. +\newboolean{doRomanNumerals} +\setboolean{doRomanNumerals}{false} + +\DeclareOption{roman}{ + \setboolean{doRomanNumerals}{true} +} + \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} \ProcessOptions\relax diff --git a/packages/Boxout.sty b/packages/Boxout.sty index 400c175..33c8d6a 100644 --- a/packages/Boxout.sty +++ b/packages/Boxout.sty @@ -32,17 +32,22 @@ \NewDocumentEnvironment{@boxout}{ m m +b }{ - \label{box:#2}% - \begin{tblrBoxout}{#1}% + \label{box:#1}% + \begin{tblrBoxout}{#2}% #3% \end{tblrBoxout}% }{} \NewDocumentEnvironment{Boxout}{ - O{colspec={X[l,h]}} + % #1: Label, passed to @boxout argument #1. >{\TrimSpaces}m + % #2: Tabularray colspec, passed to @boxout argument #2. + O{colspec={X[l,h]}} + % #3: Caption. +m + % #4: [Ww] for warning box. o + % #5: Body, passed to @boxout. +b }{% \ifthenelse{\equal{#4}{w}\OR\equal{#4}{W}}{% @@ -64,22 +69,34 @@ }{} \NewDocumentEnvironment{BigBoxout}{ + % #1: Overhang, passed to BigFloat argument #1. O{\bigfloatoverhang} + % #2: Float placement, passed to BigFloat argument #2. O{htpb} + % #3: Offset ratio, passed to BigFloat argument #3. O{\bigfloatoffsetratio} - O{X[l,h]} + % #4: Label, passed to Boxout argument #1. >{\TrimSpaces}m + % #5: Tabularray colpec, passed to Boxout argument #2. + O{X[l,h]} + % #6: Caption, passed to Boxout argument #3. +m + % #7: [Ww] for warning box, if present passed to Boxout argument #4. o + % #5: Body, passed to Boxout. +b }{ - \begin{figure}[#2]% - \begin{adjustwidth}{-#1}{-#1 * \real{#3}}% - \begin{Boxout}[#4]{#5}{#6}[#7]% + \begin{BigFloat}[generic][#1][#2][#3]% + \IfNoValueTF{#7}{% + \begin{Boxout}{#4}[#5]{#6}% #8% \end{Boxout}% - \end{adjustwidth}% - \end{figure}% + }{% + \begin{Boxout}{#4}[#5]{#6}[#7]% + #8% + \end{Boxout}% + }% + \end{BigFloat}% }{} \NewDocumentEnvironment{WrapBoxout}{ diff --git a/packages/DocProperties.sty b/packages/DocProperties.sty index 736f9eb..0e4d70a 100644 --- a/packages/DocProperties.sty +++ b/packages/DocProperties.sty @@ -1,31 +1,150 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{PrimeTeX/packages/DocProperties}[2025-07-09] -% Custom document properties. -\DeclareRobustCommand*{\customer}[1]{\gdef\@customer{#1}} -\DeclareRobustCommand*{\customerFull}[1]{\gdef\@customerFull{#1}} -\DeclareRobustCommand*{\projectNumber}[1]{\gdef\@projectNumber{#1}} -\DeclareRobustCommand*{\projectDesc}[1]{\gdef\@projectDesc{#1}} -\DeclareRobustCommand*{\version}[1]{\gdef\@version{#1}} +\RequirePackage[en-US]{datetime2} -% Macros to insert document properties. -\NewDocumentCommand{\sTitle}{}{\makeatletter{\@title}} -\NewDocumentCommand{\sAuthor}{}{\makeatletter{\@author}} -\NewDocumentCommand{\sDate}{}{\makeatletter{\@date}} -\NewDocumentCommand{\sCustomer}{}{\makeatletter{\@customer}} -\NewDocumentCommand{\sCustomerFull}{}{\makeatletter{\@customerFull}} -\NewDocumentCommand{\sProjectNumber}{}{\makeatletter{\@projectNumber}} -\NewDocumentCommand{\sProjectDesc}{}{\makeatletter{\@projectDesc}} -\NewDocumentCommand{\sProjectTitle}{}{\makeatletter{Project \@projectNumber : \@projectDesc}} -\NewDocumentCommand{\sVersion}{}{\makeatletter{\@version}} - -\let\oldAuthor\author -\let\oldTitle\title -\renewcommand{\author}[1]{% - \oldAuthor{#1}% - \hypersetup{pdfauthor=#1}% +\DTMnewdatestyle{longdate}{% + \renewcommand{\DTMdisplaydate}[4]{\number##3\ \DTMenglishmonthname{##2}\ \number##1}% + \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% } -\renewcommand{\title}[1]{% - \oldTitle{#1}% - \hypersetup{pdftitle=#1}% + +\NewDocumentCommand{\FormatDate}{m m}{% + \DTMsavedate{saveDate}{#1}% + \DTMsetdatestyle{#2}% + \DTMusedate{saveDate} +} + +\RequirePackage{readarray} +\readarraysepchar{,} + +\NewDocumentCommand{\GetRevision}{m}{% + \readdef{#1}\@RevHistory% + \readarray*\@RevHistory\@RevHistoryArray[-,\ncols]% + \Version[\@RevHistoryArray[2,1]]% + \edef\eDate{\@RevHistoryArray[2,2]}% + \DTMsavedate{tempDate}{\eDate}% + \DTMsetdatestyle{default}% + \Date[\DTMusedate{tempDate}]% + \DTMsetdatestyle{longdate}% + \LongDate[\DTMusedate{tempDate}]% + \Author[\@RevHistoryArray[2,3]]% +} + +\NewDocumentCommand{\SetPDFInfo}{}{ + \hypersetup{ + pdfauthor = {\@AuthorCompany}, + pdfsubject = {\ProjectTitle}, + pdftitle = {\@Title}, + pdfkeywords = { + Customer:~\@CustomerFull~(\@Customer), + Last~Modified~By:~\@Author, + Modification~Date:~\@Date, + Revision~Number:~\@Version, + \@AuthorCompany{}~Project~Number:~\@InternalProjectNumber, + }, + } +} + +\NewExpandableDocumentCommand{\ProjectTitle}{}{% + Project \@CustomerProjectNumber{}: \@ProjectDescription% +} + +% Custom document properties. +\edef\@Author{} +\NewDocumentCommand{\Author}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@Author% + }{% + \xdef\@Author{#1}% + }% +} + +\edef\@AuthorCompany{} +\NewDocumentCommand{\AuthorCompany}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@AuthorCompany% + }{% + \xdef\@AuthorCompany{#1}% + }% +} + +\edef\@Customer{} +\NewDocumentCommand{\Customer}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@Customer% + }{% + \xdef\@Customer{#1}% + }% +} + +\edef\@CustomerFull{} +\NewDocumentCommand{\CustomerFull}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@CustomerFull% + }{% + \xdef\@CustomerFull{#1}% + }% +} + +\edef\@CustomerProjectNumber{} +\NewDocumentCommand{\CustomerProjectNumber}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@CustomerProjectNumber% + }{% + \xdef\@CustomerProjectNumber{#1}% + }% +} + +\edef\@Date{} +\NewDocumentCommand{\Date}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@Date% + }{% + \xdef\@Date{#1}% + }% +} + +\edef\@LongDate{} +\NewDocumentCommand{\LongDate}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@LongDate% + }{% + \xdef\@LongDate{#1}% + }% +} + +\edef\@InternalProjectNumber{} +\NewDocumentCommand{\InternalProjectNumber}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@InternalProjectNumber% + }{% + \xdef\@InternalProjectNumber{#1}% + }% +} + +\edef\@ProjectDescription{} +\NewDocumentCommand{\ProjectDescription}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@ProjectDescription% + }{% + \xdef\@ProjectDescription{#1}% + }% +} + +\edef\@Title{} +\NewDocumentCommand{\Title}{>{\TrimSpaces}o}{% + \IfNoValueTF{#1}{% + \@Title% + }{% + \xdef\@Title{#1}% + }% +} + +\edef\@Version{} +\NewDocumentCommand{\Version}{>{\TrimSpaces}o O{Revision: }}{% + \IfNoValueTF{#1}{% + \@Version% + }{% + \xdef\@Version{#1}% + }% } \ No newline at end of file diff --git a/packages/Graphics.sty b/packages/Graphics.sty index f42d48a..f70e981 100644 --- a/packages/Graphics.sty +++ b/packages/Graphics.sty @@ -38,12 +38,12 @@ % Caption. m }{% - \BigFloat[#1][#2][#3]{figure}{% + \begin{BigFloat}[figure][#1][#2][#3]% \captionsetup{type=figure}% \includegraphics[keepaspectratio,width=\linewidth]{#4}% \Centering\captionof{figure}{#6}%\par \label{fig:#5}% - }% + \end{BigFloat}% } \NewDocumentCommand{\doublebigfig}{% @@ -64,17 +64,17 @@ % Second Graphic caption. m }{% - \BigFloat[#1][p][#2]{figure}{% + \begin{BigFloat}[figure][#1][p][#2]% \captionsetup{type=figure}% \includegraphics[keepaspectratio,width=\textwidth]{#3}% - \Centering\captionof{figure}{#5}\par% + \Centering\captionof{figure}{#5}% \label{fig:#4} \bigskip \captionsetup{type=figure}% \includegraphics[keepaspectratio,width=\textwidth]{#6}% - \Centering\captionof{figure}{#8}\par% + \Centering\captionof{figure}{#8}% \label{fig:#7}% - }% + \end{BigFloat}% } \RequirePackage{tabularray} @@ -85,9 +85,26 @@ ] \NewDocumentCommand{\twinfig}{% - O{\bigfloatoverhang} m >{\TrimSpaces}m m m >{\TrimSpaces}m m% + % Big Float overhang. + O{\bigfloatoverhang} + % Float placement. + O{htpb} + % BigFloat offset ratio. + O{\bigfloatoffsetratio} + % First graphic file. + m + % First label. + >{\TrimSpaces}m + % First caption. + m + % Second graphic file. + m + % Second label. + >{\TrimSpaces}m + % Second caption. + m }{% - \BigFloat[#1]{table}{% + \begin{BigFloat}[generic][#1][#2][#3]% \begin{tblr}{% colspec = {*{2}{Q[c,m,wd=\twinfigwidth]}},% hlines = {0pt}, @@ -109,22 +126,22 @@ \captionsetup{type=figure}% \includegraphics[% keepaspectratio,width=\twinfigwidth% - ]{#2}% - \captionof{figure}{#4}% - \label{fig:#3} + ]{#4}% + \captionof{figure}{#6}% + \label{fig:#5} \vfill% &% \vfill \captionsetup{type=figure}% \includegraphics[% keepaspectratio,width=\twinfigwidth% - ]{#5}% - \captionof{figure}{#7}% - \label{fig:#6} + ]{#7}% + \captionof{figure}{#9}% + \label{fig:#8} \vfill% \\% \end{tblr}% - }% + \end{BigFloat}% } \NewDocumentCommand{\wrapfig}{ diff --git a/packages/Layout.sty b/packages/Layout.sty index 739aa85..9acd78a 100644 --- a/packages/Layout.sty +++ b/packages/Layout.sty @@ -28,6 +28,8 @@ footskip = 0.5in, % 36pt, ]{geometry} +\RequirePackage{float} + % Redefine the commands geometry uses to draw the page frame to customize the % color. \renewcommand{\Gm@vrule}{\color{layoutColor}\vrule width 0.2pt height\textheight depth\z@} @@ -58,14 +60,16 @@ \providelength{\marparwidth}[\marginparsep + \marginparwidth] \providelength{\contentwidth}[\textwidth + \marparwidth] -\RequirePackage[balanced]{lua-widow-control} +\RequirePackage[ + balanced, +]{lua-widow-control} \ifthenelse{\boolean{isDraft}}{ \lwcsetup{draft=false,showcolours=true} }{} % Paragraph formatting. \setlength{\parindent}{0pt} -\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex} +\setlength{\parskip}{\medskipamount} % Float Page Configuration \renewcommand{\topfraction}{0.9} % max fraction of floats at top @@ -87,43 +91,42 @@ % Line-breaking dot \NewDocumentCommand{\bdot}{}{.\zws} +\NewDocumentEnvironment{SmartAdjustWidth}{O{\boolean{isElectronic}} m m +b}{% + \ifthenelse{#1}{% + \begin{adjustwidth}{#2}{#3}% + #4% + \end{adjustwidth}% + }{% + \begin{adjustwidth*}{#2}{#3}% + #4% + \end{adjustwidth*}% + }% +}{} + \newcommand{\bigfloatoffsetratio}{2} % Maximum width adjustment to fit 2 16x9 screensots on one page. \providelength{\bigfloatoverhang}[0.54in] -\providecommand{\adjwidthtype}{} +\floatstyle{plain} +\newfloat{generic}{htpb}{lgf} -\NewDocumentCommand{\BigFloat}{ - % Overhang: the distance that the BigFloat extends into the margins. +\NewDocumentEnvironment{BigFloat}{ + % #1: Float type + O{generic} + % #2: Overhang: the distance that the BigFloat extends into the margins. O{\bigfloatoverhang} - % Float position: where the float may appear on the page. + % #3: Float position: where the float may appear on the page. O{htpb} - % Offset: the distance to offset the center of the BigFloat from the center - % of the text block. + % #4: Offset: the distance to offset the center of the BigFloat from the center + % of the text block. O{\bigfloatoffsetratio} - % Float type: figure or table. - m - % Content: what appears in the BigFloat. - +m + % #5: Body: what appears in the BigFloat. + +b }{% - \ifthenelse{\boolean{isElectronic}}{% - \@bigfloat{#1}{#2}{#3}{#4}{#5}{adjustwidth}% - }{% - \@bigfloat{#1}{#2}{#3}{#4}{#5}{adjustwidth*}% - }% -} - -\NewDocumentCommand{\@bigfloat}{ - % First 5 arguments are same as \BigFloat. - m m m m +m - % Argument 6 is the adjustwidth type: - % adjustwidth for one-sided document; adjustwidth* for two-sided. - m -}{ - \begin{#4}[#2]% figure/table - \begin{#6}{-#1}{-#1 * \real{#3}}% adjustwidth(*) - \begin{minipage}{#1 * (#3 + 1) + \textwidth}% + \begin{#1}[#3]% float environment + \begin{SmartAdjustWidth}{-#2}{-#2 * \real{#4}}% adjustwidth(*) + \begin{minipage}{\linewidth}%#2 * (#4 + 1) + \textwidth}% \ifthenelse{\boolean{isDraft}}{% {\color{layoutColor}\rule{\textwidth}{1pt}\zws}% #5% @@ -132,6 +135,6 @@ #5% }% \end{minipage}% - \end{#6}% - \end{#4}% -} \ No newline at end of file + \end{#5}% + \end{#1}% +}{} \ No newline at end of file diff --git a/packages/Links.sty b/packages/Links.sty index 95404a0..46f5d2c 100644 --- a/packages/Links.sty +++ b/packages/Links.sty @@ -4,21 +4,32 @@ \RequirePackage{PrimeTeX/packages/Color} % Use Hyperref to automatically create links in the document -\RequirePackage{hyperref} +\RequirePackage[ + final, + colorlinks = true, + pdfpagemode = UseOutlines, + pdfdisplaydoctitle = true, + bookmarksnumbered = true, + bookmarksopen = true, + bookmarksopenlevel = 2, +]{hyperref} \ifthenelse{\boolean{isElectronic}}{ \hypersetup{ - final, - colorlinks = true, - allcolors = PrimeBlue, - pdfpagemode = UseOutlines, + allcolors = PrimeBlue, } }{ \hypersetup{ - final, - colorlinks = true, - allcolors = textColor, + allcolors = textColor, + pdfduplex = true, + pdfpagelayout = TwoPageRight, } } + +\RenewDocumentCommand{\chapterautorefname}{}{Chapter} +\RenewDocumentCommand{\sectionautorefname}{}{Section} +\RenewDocumentCommand{\subsectionautorefname}{}{Subsection} +\RenewDocumentCommand{\subsubsectionautorefname}{}{Sub-subsection} +\RenewDocumentCommand{\paragraphautorefname}{}{Paragraph} \RequirePackage{hypcap} \ No newline at end of file diff --git a/packages/TitlePage.sty b/packages/TitlePage.sty index 6ec9526..9dd872e 100644 --- a/packages/TitlePage.sty +++ b/packages/TitlePage.sty @@ -10,11 +10,11 @@ {\noindent\large\raggedright \vspace*{\stretch{1}} - \sCustomerFull + \CustomerFull \medbreak - \sProjectTitle + \ProjectTitle \bigbreak - {\Huge \sTitle} + {\Huge\Title} \vfill {\leavevmode % Move the rule graphic to 0.25 in from the left edge of the @@ -28,11 +28,12 @@ } } - \sAuthor + \AuthorCompany + + Revision \Version + + \LongDate - Revision \sVersion - - \sDate \vfill } \end{sbfamily} diff --git a/packages/Titles.sty b/packages/Titles.sty index c97066f..f26daff 100644 --- a/packages/Titles.sty +++ b/packages/Titles.sty @@ -3,7 +3,9 @@ \RequirePackage[raggedright]{titlesec} -\renewcommand{\thepart}{\arabic{part}} +\ifthenelse{\NOT\boolean{doRomanNumerals}}{ + \renewcommand{\thepart}{\arabic{part}} +}{} \titleformat{\part}[display]{ \normalfont\sbfamily\huge