% System/minutes_team_template.tex % --- 1. Logic Macro for Smart Attendees Display (Auto-Sort & Clean Titles) --- \newif\ifhasmen \newif\ifhaswomen \ExplSyntaxOn \seq_new:N \l_minutes_names_seq \regex_new:N \l_minutes_title_regex \regex_set:Nn \l_minutes_title_regex { ^(\s*(دکتر|مهندس|آقای|آقا|خانم|سرکار\sخانم|استاد)\s*)+ } \cs_new_protected:Npn \minutes_add_to_seq:n #1 { \tl_set:Nn \l_tmpa_tl { #1 } \tl_trim_spaces:N \l_tmpa_tl \tl_if_empty:NF \l_tmpa_tl { \tl_if_eq:NnF \l_tmpa_tl { - } { \regex_replace_once:NnN \l_minutes_title_regex { } \l_tmpa_tl \seq_put_right:NV \l_minutes_names_seq \l_tmpa_tl } } } \cs_new_protected:Npn \minutes_compare_names:nnTF #1#2#3#4 { % Split the first name by spaces and extract the last word (family name) \seq_set_split:Nnn \l_tmpa_seq { ~ } { #1 } \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl % Split the second name by spaces and extract the last word (family name) \seq_set_split:Nnn \l_tmpb_seq { ~ } { #2 } \seq_pop_right:NN \l_tmpb_seq \l_tmpb_tl % If family names are identical, compare full names; otherwise, compare family names \str_compare:eNeTF { \l_tmpa_tl } = { \l_tmpb_tl } { \str_compare:nNnTF { #1 } > { #2 } { #3 } { #4 } } { \str_compare:eNeTF { \l_tmpa_tl } > { \l_tmpb_tl } { #3 } { #4 } } } \cs_new_protected:Npn \minutes_sort_and_print:nn #1#2 { \seq_clear:N \l_minutes_names_seq \seq_set_split:Nnn \l_tmpa_seq { ؛ } { #1 } \seq_map_inline:Nn \l_tmpa_seq { \minutes_add_to_seq:n { ##1 } } \seq_set_split:Nnn \l_tmpa_seq { ؛ } { #2 } \seq_map_inline:Nn \l_tmpa_seq { \minutes_add_to_seq:n { ##1 } } \seq_if_empty:NTF \l_minutes_names_seq { - } { \seq_sort:Nn \l_minutes_names_seq { \minutes_compare_names:nnTF { ##1 } { ##2 } { \sort_return_swapped: } { \sort_return_same: } } \seq_use:Nnnn \l_minutes_names_seq { ~؛~ } { ~؛~ } { ~؛~ } } } \cs_generate_variant:Nn \minutes_sort_and_print:nn { xx } \NewDocumentCommand{\SortAndCleanList}{ m m }{ \minutes_sort_and_print:xx { #1 } { #2 } } \ExplSyntaxOff \newcommand{\PrintGroup}[5]{% \def\emptyval{} \def\dashval{-} \hasmenfalse \haswomenfalse \expandafter\def\expandafter\menlist\expandafter{#4} \ifx\menlist\emptyval\else\ifx\menlist\dashval\else\hasmentrue\fi\fi \expandafter\def\expandafter\extramen\expandafter{#2} \ifx\extramen\emptyval\else\ifx\extramen\dashval\else\hasmentrue\fi\fi \expandafter\def\expandafter\womenlist\expandafter{#5} \ifx\womenlist\emptyval\else\ifx\womenlist\dashval\else\haswomentrue\fi\fi \expandafter\def\expandafter\extrawomen\expandafter{#3} \ifx\extrawomen\emptyval\else\ifx\extrawomen\dashval\else\haswomentrue\fi\fi \ifhasmen \ifhaswomen \textbf{#1}\par\vspace{0.1cm} \textbf{آقایان / دکتر / مهندس:} \SortAndCleanList{#2}{#4} \par\vspace{0.1cm} \textbf{خانم‌ها / دکتر / مهندس:} \SortAndCleanList{#3}{#5} \else \textbf{#1 آقایان / دکتر / مهندس:} \SortAndCleanList{#2}{#4} \fi \else \ifhaswomen \textbf{#1 خانم‌ها / دکتر / مهندس:} \SortAndCleanList{#3}{#5} \else \textbf{#1} - \fi \fi } % --- 2. Consolidated Header & Meta Data Table --- \vspace*{-1cm} \begin{tcolorbox}[enhanced, width=\linewidth, colback=white, colframe=primary, boxrule=1pt, arc=3mm, auto outer arc, left=0pt, right=0pt, top=0pt, bottom=0pt, boxsep=0pt] \renewcommand{\arraystretch}{1.2} \arrayrulecolor{primary} \begin{tabular}{ >{\centering\arraybackslash}p{\dimexpr 0.18\linewidth - 2\tabcolsep - \arrayrulewidth \relax}| >{\centering\arraybackslash}p{\dimexpr 0.36\linewidth - 2\tabcolsep - \arrayrulewidth \relax}| >{\centering\arraybackslash}p{\dimexpr 0.28\linewidth - 2\tabcolsep - \arrayrulewidth \relax}| >{\centering\arraybackslash}p{\dimexpr 0.18\linewidth - 2\tabcolsep \relax}} \multirow{5}{*}{\includegraphics[height=1.8cm]{logo.png}} & % Changed \vazirfont to \nazaninfont for the main title \multirow{2}{*}{\Large \nazaninfont \textbf{\textcolor{primary}{فرم صورتجلسه}}} & \textbf{تاریخ:} \MinutesDate & % Added \raisebox to push the logo down 0.1cm \multirow{5}{*}{\raisebox{-0.1cm}{\includegraphics[height=1.8cm]{\MinutesTeamLogo}}} \\ & & \textbf{ساعت:} \MinutesStart \ \lr{--} \MinutesEnd & \\ % Changed \small to \footnotesize to shrink the T&T title & \multirow{3}{=}{\centering \footnotesize \vazirfont\MinutesGroupTitle} & \textbf{شماره:} \MinutesNumber & \\ & & \textbf{ویرایش:} \MinutesRevision & \\ & & \textbf{پیوست:} \MinutesAttachment & \\ \end{tabular}\par \vspace{-0.05cm} {\noindent\textcolor{primary}{\rule{\linewidth}{1pt}}}\par % --- Chairman and Secretary Row --- \noindent\makebox[\linewidth]{% \begin{minipage}{\dimexpr \linewidth - 0.8cm \relax} \vspace{0.2cm} {\small\faUserTie}\hspace{0.4em}\textbf{رئیس جلسه:} \MinutesChair \hfill {\small\faPenNib}\hspace{0.4em}\textbf{دبیر جلسه:} \MinutesSecretary \vspace{0.1cm} \end{minipage}% }\par {\noindent\textcolor{primary}{\rule{\linewidth}{1pt}}}\par % --- Attendees Row --- \noindent\makebox[\linewidth]{% \begin{minipage}{\dimexpr \linewidth - 0.8cm \relax} \vspace{0.2cm} \PrintGroup{حاضرین:}{\MinutesExtraMen}{\MinutesExtraWomen}{\MinutesPresentMen}{\MinutesPresentWomen} \par\vspace{0.2cm} \PrintGroup{غائبین:}{-}{-}{\MinutesAbsentMen}{\MinutesAbsentWomen} \vspace{0.2cm} \end{minipage}% }\par {\noindent\textcolor{primary}{\rule{\linewidth}{1pt}}}\par % --- Agenda Row --- \noindent\makebox[\linewidth]{% \begin{minipage}{\dimexpr \linewidth - 0.8cm \relax} \vspace{0.25cm} {\small\faListUl}\hspace{0.4em}\textbf{موضوعات جلسه:} \par\vspace{0.15cm} \MinutesAgenda \vspace{0.25cm} \end{minipage}% } \end{tcolorbox} \arrayrulecolor{black} \vspace{0.2cm} % --- Custom Command for Discussion Items --- \newcommand{\DiscussionItem}[4]{ % Removed the top \vspace to prevent stacking \noindent\textbf{\textcolor{primary}{\faAngleLeft\hspace{0.4em}#1}}\par \vspace{0.05cm} % Reduced middle spacing % --- ADDED: Indent the content and table using a minipage --- \noindent\hspace*{0.8cm}% Pushes the block inward from the right \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} % Replaced the negative space since minipage handles spacing differently } % --- 3. Meeting Content (Agenda, Resolutions, Specific Tables) --- \input{Minutes_Content/01_minutes_content.tex} % --- 4. Signatures Section --- \vspace{1cm} \begin{center} \large\textbf{\textcolor{primary}{امضای حاضرین}} \end{center} \vspace{0.2cm} \begin{table}[h!] \centering \renewcommand{\arraystretch}{1.5} % Return to normal stretch for a clean header \arrayrulecolor{black} \begin{tabular}{|>{\centering\arraybackslash}m{0.25\linewidth}|>{\centering\arraybackslash}m{0.3\linewidth}|>{\centering\arraybackslash}m{0.35\linewidth}|} \hline \rowcolor{tablehead} \textbf{رئیس جلسه} & \textbf{دبیر جلسه} & \textbf{اعضای حاضر} \\ % Added \rule[-1.5cm]{0pt}{3cm} to create an invisible 3cm tall box that centers text \rule[-1.5cm]{0pt}{3cm}\MinutesChair & \MinutesSecretary & \small \SortAndCleanList{}{\MinutesPresentMen ؛ \MinutesPresentWomen} \\ \hline \end{tabular} \end{table}