Park__ReportTemplate/System/team_template.sty

271 lines
11 KiB
TeX

\ProvidesPackage{System/team_template}[2026/04/06 V1.0 Custom Team Template]
% ==========================================
% 1. Core Packages (Changed \usepackage to \RequirePackage)
% ==========================================
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{titlesec}
\RequirePackage{etoolbox}
\RequirePackage[top=2.2cm, bottom=2.5cm, left=2.5cm, right=2.5cm, headheight=25pt, headsep=0.8cm]{geometry}
\RequirePackage{setspace}
\RequirePackage{parskip}
\RequirePackage{enumitem}
\RequirePackage{array}
\RequirePackage{longtable}
\RequirePackage[table]{xcolor}
\RequirePackage{multirow}
\RequirePackage{graphicx}
\graphicspath{{Assets/Image/}}
\RequirePackage{tikz}
\RequirePackage[figure,table]{totalcount}
\usetikzlibrary{shadings, shapes.geometric}
\RequirePackage{fontawesome5}
\RequirePackage[many]{tcolorbox}
\RequirePackage[hidelinks]{hyperref}
\RequirePackage{csquotes}
\RequirePackage[backend=biber, style=numeric, defernumbers=true]{biblatex}
\RequirePackage{fancyhdr}
\RequirePackage{listings}
\RequirePackage{subcaption}
% ==========================================
% 2. Engine Variables & Flags (Initializers)
% ==========================================
\newif\ifModernShapes
\newif\ifSeparateCover
\newif\ifDefaultAuthor
\newif\ifMultiAuthor
% --- Status and Confidentiality Definitions ---
\newcommand{\ConfPublic}{\textcolor{green!70!black}{عمومی}}
\newcommand{\ConfInternal}{\textcolor{primary}{داخلی سازمان}}
\newcommand{\ConfSecret}{\textcolor{accentYellow}{محرمانه}}
\newcommand{\ConfTopSecret}{\textcolor{accentRed}{\textbf{بسیار محرمانه}}}
\newcommand{\StatusDraft}{\textcolor{gray}{پیشنویس}}
\newcommand{\StatusReview}{\textcolor{orange}{در حال بررسی}}
\newcommand{\StatusApproved}{\textcolor{green!70!black}{مصوب و اجرایی}}
\newcommand{\StatusArchived}{\textcolor{red}{آرشیو شده}}
% ==========================================
% 3. Typography & Language
% ==========================================
\RequirePackage{xepersian}
% --- Main Text Font ---
\settextfont[Path=Assets/Font/, Extension=.ttf, BoldFont=BNazanin-Bold]{BNazanin}
% --- Fix English Text (Local Font Bypass) ---
\setlatintextfont[Path=Assets/Font/, Extension=.ttf, BoldFont=timesbd, ItalicFont=timesi, BoldItalicFont=timesbi]{times}
% --- Custom Font Definitions ---
\defpersianfont\vazirfont[Path=Assets/Font/, Extension=.ttf, BoldFont=Vazirmatn-Bold]{Vazirmatn-Regular}
\defpersianfont\nazaninfont[Path=Assets/Font/, Extension=.ttf, BoldFont=BNazanin-Bold]{BNazanin}
\defpersianfont\zarfont[Path=Assets/Font/, Extension=.ttf, BoldFont=BZarBd]{BZar}
% --- Apply Fonts to Elements ---
% 1. Sections and Headings (BNazanin)
\titleformat*{\section}{\Large\bfseries\nazaninfont}
\titleformat*{\subsection}{\large\bfseries\nazaninfont}
\titleformat*{\subsubsection}{\normalsize\bfseries\nazaninfont}
% 2. Tables (BZar)
\AtBeginEnvironment{tabular}{\nazaninfont}
\AtBeginEnvironment{longtable}{\nazaninfont}
% ==========================================
% 4. Brand Colors & Formatting
% ==========================================
\definecolor{primary}{cmyk}{0.87, 0.51, 0.00, 0.64}
\definecolor{accentRed}{cmyk}{0.00, 0.79, 0.74, 0.25}
\definecolor{accentYellow}{cmyk}{0.00, 0.30, 1.00, 0.05}
\definecolor{accentTeal}{cmyk}{1.00, 0.06, 0.00, 0.35}
\definecolor{accentDark}{cmyk}{0.56, 0.33, 0.00, 0.82}
\colorlet{tablehead}{primary!15}
\colorlet{tablephase}{accentDark!8}
\setstretch{1.4}
\setlist[itemize]{itemsep=0.4em, topsep=0.2em}
% ==========================================
% 5. Custom UI Boxes & Code Snippets
% ==========================================
\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\color{primary}\bfseries,
commentstyle=\color{gray}\itshape,
stringstyle=\color{accentRed},
numbers=left,
numberstyle=\tiny\color{gray},
stepnumber=1,
numbersep=8pt,
backgroundcolor=\color{accentDark!5},
showspaces=false,
showstringspaces=false,
frame=single,
rulecolor=\color{primary!40},
tabsize=4,
captionpos=b,
breaklines=true,
breakatwhitespace=false
}
\newtcolorbox{ScoreBox}{
enhanced, colback=white, colframe=primary, boxrule=1.2pt,
arc=3mm, auto outer arc, left=10pt, right=10pt, top=8pt, bottom=8pt,
drop fuzzy shadow=black!10
}
\newtcolorbox{QuoteBox}{
enhanced, frame hidden, colback=accentYellow!10,
borderline east={4pt}{0pt}{accentYellow},
sharp corners=east, rounded corners=west, arc=3mm,
right=25pt, left=10pt, top=10pt, bottom=10pt,
overlay={
\node[anchor=north east, text=accentYellow!30, font=\Huge] at ([xshift=-8pt, yshift=-8pt]frame.north east) {\faQuoteRight};
}
}
% ==========================================
% 6. Page Geometry, Shapes, and Headers
% ==========================================
\newcommand{\FirstPageIcon}{\faCogs} % Default icon for main documents
\newcommand{\OddPageShapesA}{%
\begin{tikzpicture}[remember picture, overlay]
\fill[primary!10] (current page.north east) rectangle ++(-0.2, -\paperheight);
\fill[primary] (current page.north east) -- ++(0, -4.5) -- ++(-3.5, 4.5) -- cycle;
\fill[accentYellow] (current page.north east) ++(0, -4.5) -- ++(0, -0.4) -- ++(-3.81, 4.9) -- ++(0.4, 0) -- cycle;
\path (current page.north east) ++(-1.0, -1.5) node {\textcolor{primary!10}{\lr{\Large \FirstPageIcon}}};
\end{tikzpicture}%
}
\newcommand{\EvenPageShapesA}{%
\begin{tikzpicture}[remember picture, overlay]
\fill[primary!10] (current page.north west) rectangle ++(0.2, -\paperheight);
\fill[primary] (current page.north west) -- ++(0, -4.5) -- ++(3.5, 4.5) -- cycle;
\fill[accentYellow] (current page.north west) ++(0, -4.5) -- ++(0, -0.4) -- ++(3.81, 4.9) -- ++(-0.4, 0) -- cycle;
\path (current page.north west) ++(1.0, -1.5) node {\textcolor{primary!10}{\lr{\Large \faLightbulb}}};
\end{tikzpicture}%
}
\newcommand{\OddPageShapesB}{%
\begin{tikzpicture}[remember picture, overlay]
\fill[primary!10] (current page.north east) rectangle ++(-0.2, -\paperheight);
\fill[primary] (current page.south east) -- ++(0, 4.5) -- ++(-3.5, -4.5) -- cycle;
\fill[primary!20, opacity=0.8] (current page.south east) ++(-1, 0) -- ++(-3.5, 0) -- ++(4.5, 4.5) -- cycle;
\fill[accentYellow] (current page.south east) ++(-2.5, 0) -- ++(1, 1) -- ++(0, -1) -- cycle;
\path (current page.south east) ++(-1.2, 1.6) node {\textcolor{primary!10}{\lr{\Large \faMicrochip}}};
\end{tikzpicture}%
}
\newcommand{\EvenPageShapesB}{%
\begin{tikzpicture}[remember picture, overlay]
\fill[primary!10] (current page.north west) rectangle ++(0.2, -\paperheight);
\fill[primary] (current page.south west) -- ++(0, 4.5) -- ++(3.5, -4.5) -- cycle;
\fill[primary!20, opacity=0.8] (current page.south west) ++(1, 0) -- ++(3.5, 0) -- ++(-4.5, 4.5) -- cycle;
\fill[accentYellow] (current page.south west) ++(2.5, 0) -- ++(-1, 1) -- ++(0, -1) -- cycle;
\path (current page.south west) ++(1.2, 1.6) node {\textcolor{primary!10}{\lr{\Large \faNetworkWired}}};
\end{tikzpicture}%
}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{1.2pt}
\renewcommand{\headrule}{%
\ifodd\value{page}%
\hbox to\headwidth{\hspace{1.8cm}\color{primary}\leaders\hrule height \headrulewidth\hfill}%
\else%
\hbox to\headwidth{\color{primary}\leaders\hrule height \headrulewidth\hfill\hspace{1.8cm}}%
\fi
}
\renewcommand{\footrulewidth}{1.2pt}
\renewcommand{\footrule}{
\vspace*{0.6cm}
\hbox to\headwidth{\hfil\color{primary}\rule{0.8\headwidth}{\footrulewidth}\hfil}
\vspace*{-0.4cm}
}
% Using \AtBeginDocument ensures these headers can read variables (like \DocVersion) defined in main.tex
\AtBeginDocument{
% Clear all default headers to prevent ghosting
\fancyhead[LO]{}
\fancyhead[RE]{}
\fancyhead[RO]{}
\fancyhead[LE]{}
\fancyfoot[C]{\textcolor{gray}{صفحه \thepage}}
\fancyhead[C]{%
% 1. Draw the Background Shapes
\ifModernShapes
\pgfmathtruncatemacro{\pagecycle}{mod(int((\value{page}-1)/2), 2)}
\ifnum\pagecycle=0
\ifodd\value{page} \OddPageShapesA \else \EvenPageShapesA \fi
\else
\ifodd\value{page} \OddPageShapesB \else \EvenPageShapesB \fi
\fi
\fi
% 2. Draw the Text and Logo securely tied to the physical margins
\ifodd\value{page}%
% ODD PAGE: Shapes are on the RIGHT. Gap is on the RIGHT (1.8cm).
\makebox[\headwidth][s]{%
{\makebox[1.8cm][c]{\smash{\raisebox{-0.75cm}{\includegraphics[height=1.2cm]{logo.png}}}}%
\textcolor{primary}{\nazaninfont\textbf{\DocHeaderTitle}}}%
\hfill
{\textcolor{gray}{نسخه \lr{\DocVersion}}}%
}%
\else
% EVEN PAGE: Shapes are on the LEFT. Gap is on the LEFT (1.8cm).
\makebox[\headwidth][s]{%
{\textcolor{gray}{نسخه \lr{\DocVersion}}}%
\hfill
{\textcolor{primary}{\nazaninfont\textbf{\DocHeaderTitle}}%
\makebox[1.8cm][c]{\smash{\raisebox{-0.75cm}{\includegraphics[height=1.2cm]{logo.png}}}}}%
}%
\fi
}
}
\fancypagestyle{cover}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[C]{%
\ifModernShapes
\begin{tikzpicture}[remember picture, overlay]
\fill[primary] (current page.north west) -- ++(7.5,0) -- +
+(-5, -5.5) -- cycle;
\fill[accentYellow] (current page.north west) ++(7.5,0) -- ++(0.6,0) -- ++(-5.6, -6.1) -- ++(-0.6,0) -- cycle;
\fill[primary!10] (current page.north west) ++(0, -5.5) -- ++(2.5,0) -- ++(-2.5, -2.5) -- cycle;
\fill[primary] (current page.south east) -- ++(-8.5, 0) -- ++(6, 6.5) -- cycle;
\fill[primary!20, opacity=0.8] (current page.south east) ++(-9.5, 0) -- ++(-1.5, 0) -- ++(8.5, 9) -- ++(1.5, 0) -- cycle;
\fill[accentYellow] (current page.south east) ++(-3.5, 0) -- ++(3.5, 3.8) -- ++(0, -3.8) -- cycle;
\end{tikzpicture}%
\fi
}
}
% --- Custom Command for Discussion Items (Ported for Main Docs) ---
\newcommand{\DiscussionItem}[4]{
\noindent\textbf{\textcolor{primary}{\faAngleLeft\hspace{0.4em}#1}}\par
\vspace{0.05cm}
\noindent\hspace*{0.8cm}%
\begin{minipage}{\dimexpr\linewidth-0.8cm\relax}
\noindent #2\par
\vspace{0.1cm}
\noindent\begin{tabular}{|>{\raggedright\arraybackslash}m{\dimexpr 0.5\linewidth - 2\tabcolsep - 1.5\arrayrulewidth \relax}|>{\raggedright\arraybackslash}m{\dimexpr 0.5\linewidth - 2\tabcolsep - 1.5\arrayrulewidth \relax}|}
\hline
\rowcolor{tablehead} \textbf{مسئول اقدام:} #3 & \textbf{مهلت:} #4 \\
\hline
\end{tabular}
\end{minipage}\par
\vspace{0.5cm}
}