| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2026 by NAAM MOAMED (الأستاذ ناعم محمد) |
| 4 |
% ------------------------------------------------------- |
| 5 |
% [AR] هذا العمل متاح تحت شروط رخصة لاتيك العامة (LPPL)، الإصدار 1.3 أو أحدث. |
| 6 |
% [EN] This work may be distributed and/or modified under the conditions |
| 7 |
% of the LaTeX Project Public License, version 1.3 or later. |
| 8 |
% ------------------------------------------------------- |
| 9 |
% \fi |
| 10 |
% |
| 11 |
% \iffalse |
| 12 |
%<*driver> |
| 13 |
\ProvidesFile{na-fancyborders.dtx} |
| 14 |
\documentclass{ltxdoc} |
| 15 |
\usepackage{na-fancyborders} |
| 16 |
\usepackage{dashbox} |
| 17 |
\usepackage[explicit]{titlesec} |
| 18 |
\usepackage{polyglossia} |
| 19 |
\usepackage{xcolor} |
| 20 |
\usepackage{tikz} |
| 21 |
\usetikzlibrary{calc,backgrounds} |
| 22 |
% --- إعدادات اللغة العربية (من حزمتك السابقة) --- |
| 23 |
\setmainlanguage[numerals=maghrib,locale=algeria]{arabic} |
| 24 |
\setotherlanguage{english} |
| 25 |
\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Amiri} |
| 26 |
\newfontfamily\na[Script=Arabic,Scale=1.2]{Arial} |
| 27 |
\newfontfamily\arabicfontsf[Script=Arabic,Scale=1.2]{Arial} |
| 28 |
|
| 29 |
\renewcommand{\thesection}{\arabic{section}} |
| 30 |
\titleformat{\section} |
| 31 |
{\bf\Large\sffamily} |
| 32 |
{\tikzpicture[baseline=(a.base)] |
| 33 |
\node[text=white,scale=1,anchor=east,draw=blue!50!black, |
| 34 |
fill=red!50!black] (a) {\thesection}; |
| 35 |
\node [text=black,anchor=east] at (a.west) (2){\large\textarabic{\bf\sffamily #1}}; |
| 36 |
\endtikzpicture} |
| 37 |
{0pt}{} |
| 38 |
\titleformat{\subsection} |
| 39 |
{\bf} |
| 40 |
{\tikzpicture[baseline=(a.base)] |
| 41 |
\node[text=white,scale=1,anchor=east,draw=blue!50!black, |
| 42 |
fill=blue!50!black] (a) {\thesubsection}; |
| 43 |
\node [text=black,anchor=east] at (a.west) (2){\large\textarabic{\bf\sffamily #1}}; |
| 44 |
\endtikzpicture} |
| 45 |
{0pt}{} |
| 46 |
\setnonlatin |
| 47 |
\begin{document} |
| 48 |
\activateBGdefault |
| 49 |
\DocInput{na-fancyborders.dtx} |
| 50 |
\end{document} |
| 51 |
%</driver> |
| 52 |
% \fi |
| 53 |
% |
| 54 |
% \begin{center} |
| 55 |
% \lbox{\fbox{ |
| 56 |
% \begin{minipage}{0.85\textwidth} |
| 57 |
% \centering \vspace{0.5em} |
| 58 |
% \Large \textbf{\textarabic{\na حزمة الإطارات الفنية} \textsf{na-fancyborders}} \\[0.5em] |
| 59 |
% \large \textbf{\textarabic{الأستاذ ناعم محمد} \LR{(NAAM MOAMED)}} \\[0.3em] |
| 60 |
% \small \textbf{\textarabic{الإصدار 1.0 --- ماي 2026}} \vspace{0.5em} |
| 61 |
% \end{minipage} |
| 62 |
% }} |
| 63 |
% \end{center} |
| 64 |
% |
| 65 |
% \section{\textarabic{الترخيص}} |
| 66 |
% \textarabic{هذه الحزمة ملكية فكرية للأستاذ ناعم محمد. وهي مرخصة تحت رخصة LPPL الإصدار 1.3 أو أحدث.} |
| 67 |
% |
| 68 |
% \section{\textarabic{دليل الأنماط ومعاينتها}} |
| 69 |
% |
| 70 |
%\subsection{\textarabic{الإطار الافتراضي \LR{(Par Défaut)}}} |
| 71 |
% \textarabic{يعتبر هذا النمط هو الخيار القياسي للحزمة، حيث يرسم إطاراً مستطيلاً بسيطاً وأنيقاً يحيط بكامل الصفحة ليعطي مظهراً رسمياً للمستندات.} |
| 72 |
% \begin{center} |
| 73 |
% \begin{tikzpicture}[scale=0.1] |
| 74 |
% \draw[thick] (0,0) rectangle (10,14); |
| 75 |
% \end{tikzpicture} |
| 76 |
% \end{center} |
| 77 |
% \textarabic{لتفعيل هذا الإطار، استخدم الأمر:} \cs{activateBGdefault} |
| 78 |
% \subsection{\textarabic{1. النمط الهندسي} \cs{activateBGone}} |
| 79 |
% \textarabic{إطار رسمي بزوايا حادة للامتحانات.} |
| 80 |
% \begin{center} |
| 81 |
% \begin{tikzpicture}[scale=0.1] \draw (0,0) rectangle (10,14); \draw[ultra thick] (0,14)--(2,14) (0,14)--(0,12); \end{tikzpicture} |
| 82 |
% \end{center} |
| 83 |
% |
| 84 |
% \subsection{\textarabic{2. النمط المربع} \cs{activateBGtwo}} |
| 85 |
% \textarabic{إطار فني يعتمد على المربعات في الزوايا.} |
| 86 |
% \begin{center} |
| 87 |
% \begin{tikzpicture}[scale=0.1] \draw (0,0) rectangle (10,14); \fill[gray] (0,13) rectangle (1,14); \fill[gray!40] (9,0) rectangle (10,1); \end{tikzpicture} |
| 88 |
% \end{center} |
| 89 |
% |
| 90 |
% \subsection{\textarabic{3. نمط الزخرفة الوسطية} \cs{activateBGthree}} |
| 91 |
% \textarabic{مخصص لتقسيم محتوى الصفحة.} |
| 92 |
% \begin{center} |
| 93 |
% \begin{tikzpicture}[scale=0.1] \draw (0,0) rectangle (10,14); \draw (5,1)--(5,13); \fill (5,13) circle (0.5); \end{tikzpicture} |
| 94 |
% \end{center} |
| 95 |
% |
| 96 |
% \subsection{\textarabic{4. النمط الجانبي} \cs{activateBGfour}} |
| 97 |
% \textarabic{زخرفة مزدوجة على حافة الصفحة.} |
| 98 |
% \begin{center} |
| 99 |
% \begin{tikzpicture}[scale=0.1] \draw (0,0) rectangle (10,14); \draw[double] (8.5,1)--(8.5,13); \end{tikzpicture} |
| 100 |
% \end{center} |
| 101 |
% |
| 102 |
% \StopEventually{} |
| 103 |
% |
| 104 |
%<*package> |
| 105 |
\NeedsTeXFormat{LaTeX2e} |
| 106 |
\ProvidesPackage{na-fancyborders}[2026/05/09 Custom Artistic Page Frames] |
| 107 |
|
| 108 |
% المكتبات الأساسية |
| 109 |
\RequirePackage{tikz} |
| 110 |
\RequirePackage{eso-pic} |
| 111 |
\usetikzlibrary{calc} |
| 112 |
|
| 113 |
% إعدادات افتراضية |
| 114 |
\parindent=0pt |
| 115 |
|
| 116 |
% --- المحرك الداخلي للرسومات (أوامر مساعدة) --- |
| 117 |
|
| 118 |
\newcommand{\pageline}[1]{ |
| 119 |
\draw[black,line width=1pt] ([xshift=#1pt+1cm,yshift=5pt+1cm]current page.south west) -- ([xshift=#1pt+1cm,yshift=-5pt-1cm]current page.north west) arc [start angle=180, end angle=90, radius=5pt]; |
| 120 |
\draw[black,line width=1pt] ([xshift=#1pt+1cm,yshift=5pt+1cm]current page.south west) arc [start angle=180, end angle=270, radius=5pt]; |
| 121 |
\draw[black,line width=1pt] ([xshift=-#1pt-1cm,yshift=5pt+1cm]current page.south east) -- ([xshift=-#1pt-1cm,yshift=-5pt-1cm]current page.north east) arc [start angle=0, end angle=90, radius=5pt]; |
| 122 |
\draw[black,line width=1pt] ([xshift=-#1pt-1cm,yshift=5pt+1cm]current page.south east) arc [start angle=360, end angle=270, radius=5pt]; |
| 123 |
} |
| 124 |
|
| 125 |
\newcommand{\rosolle}[3]{ |
| 126 |
\foreach \i in {0.3,0.6,0.9}{ |
| 127 |
\fill[black!30!gray] ([xshift=-5pt,yshift=#1pt]$ (#2)!\i!(#3) $) -- ++ (19pt,-1.5pt) circle (4pt); |
| 128 |
\fill[black] ([xshift=-5pt,yshift=#1pt]$ (#2)!\i!(#3) $) -- ++ (20pt,-1.5pt) circle (4pt); |
| 129 |
\fill[black!30!gray] ([xshift=-25pt,yshift=#1pt]$ (#2)!\i!(#3) $) -- ++ (21pt,-1.5pt) circle (4pt); |
| 130 |
\fill[black] ([xshift=-25pt,yshift=#1pt]$ (#2)!\i!(#3) $) -- ++ (20pt,-1.5pt) circle (4pt); |
| 131 |
\fill[left color=black!70!white,right color=white] ([xshift=-5pt,yshift=#1pt]$ (#2)!\i!(#3) $) arc [start angle=90, end angle=180, radius=1pt] -- ++ (0pt,-1pt) arc [start angle=180, end angle=270, radius=1pt] -- ++ (10pt,0pt) -- ++ (0pt,3pt) -- cycle; |
| 132 |
\fill[left color=white,right color=black!70!white] ([xshift=5pt,yshift=#1pt]$ (#2)!\i!(#3) $) -- ++ (0pt,-3pt) -- ++ (10pt,0pt) arc [start angle=270, end angle=360, radius=1pt] -- ++ (0pt,1pt) arc [start angle=0, end angle=90, radius=1pt] -- cycle; |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
\newcommand{\narosolle}[2][B]{\rosolle{12}{#2}{#1}\rosolle{0}{#2}{#1}\rosolle{-12}{#2}{#1}} |
| 137 |
|
| 138 |
\newcommand{\rosol}[3]{ |
| 139 |
\fill[black!30!gray] ([xshift=-13pt,yshift=#1pt]$ (#2)!.5!(#3) $) circle (4pt); |
| 140 |
\fill[left color=black!70!white,right color=white] ([xshift=-15pt,yshift=1pt+#1pt]$ (#2)!.5!(#3) $) arc [start angle=90, end angle=180, radius=1pt] -- ++ (0pt,-1pt) arc [start angle=180, end angle=270, radius=1pt] -- ++ (10pt,0pt) -- ++ (0pt,3pt) -- cycle; |
| 141 |
\fill[left color=white,right color=black!70!white] ([xshift=-5pt,yshift=1pt+#1pt]$ (#2)!.5!(#3) $) -- ++ (0pt,-3pt) -- ++ (10pt,0pt) arc [start angle=270, end angle=360, radius=1pt] -- ++ (0pt,1pt) arc [start angle=0, end angle=90, radius=1pt] -- cycle; |
| 142 |
} |
| 143 |
|
| 144 |
\newcommand{\narosol}[2][B]{\rosol{12}{#2}{#1}\rosol{0}{#2}{#1}\rosol{-12}{#2}{#1}} |
| 145 |
|
| 146 |
% --- أوامر تفعيل الأنماط (Styles) --- |
| 147 |
|
| 148 |
\newcommand\activateBGdefault{\AddToShipoutPictureBG{\tikzpicture[overlay,remember picture] |
| 149 |
\coordinate (A) at ([yshift=-1cm]current page.north); |
| 150 |
\coordinate (B) at([yshift=-1cm,xshift=-1cm]current page.north east); |
| 151 |
\coordinate (C) at([yshift=-1cm,xshift=1cm]current page.north west); |
| 152 |
\coordinate (D) at([yshift=1cm,xshift=1cm]current page.south west); |
| 153 |
\coordinate (E) at([yshift=1cm,xshift=-1cm]current page.south east); |
| 154 |
\draw[line width=2pt](B)rectangle(D); |
| 155 |
\fill[black] ([xshift=2pt,yshift=-2pt]C) -- ++ (0pt,-8pt) arc [start angle=270, end angle=360, radius=8pt] -- cycle; |
| 156 |
\fill[black] ([xshift=-2pt,yshift=-2pt]B) -- ++ (-8pt,0pt) arc [start angle=180, end angle=270, radius=8pt] -- cycle; |
| 157 |
\fill[black] ([xshift=-2pt,yshift=2pt]E) -- ++ (0pt,8pt) arc [start angle=90, end angle=180, radius=8pt] -- cycle; |
| 158 |
\fill[black] ([xshift=2pt,yshift=2pt]D) -- ++ (8pt,0pt) arc [start angle=0, end angle=90, radius=8pt] -- cycle; |
| 159 |
\draw[black!50,line width=.5pt] ([yshift=-4pt]A|-B) -- ([xshift=-12pt,yshift=-4pt]B) arc [start angle=180, end angle=270, radius=8pt] -- ([xshift=-4pt,yshift=12pt]E) arc [start angle=90, end angle=180, radius=8pt] -- ([xshift=12pt,yshift=4pt]D) arc [start angle=0, end angle=90, radius=8pt] -- ([xshift=4pt,yshift=-12pt]C) arc [start angle=270, end angle=360, radius=8pt] -- ([yshift=-4pt]C-|A) ; |
| 160 |
\endtikzpicture}} |
| 161 |
|
| 162 |
\newcommand\activateBGone{\AddToShipoutPictureBG{\tikzpicture[overlay,remember picture] |
| 163 |
\coordinate (A) at ([yshift=-1cm]current page.north); |
| 164 |
\coordinate (B) at([yshift=-1cm,xshift=-1cm]current page.north east); |
| 165 |
\coordinate (C) at([yshift=-1cm,xshift=1cm]current page.north west); |
| 166 |
\coordinate (D) at([yshift=1cm,xshift=1cm]current page.south west); |
| 167 |
\coordinate (E) at([yshift=1cm,xshift=-1cm]current page.south east); |
| 168 |
\draw[fill=black, draw=black] (B) -- ++ (-10mm,0mm) -- ++ (.5mm,-.5mm) -- ++ (9mm,0mm) -- ++ (0mm, -9mm) -- ++ (.5mm,-.5mm) -- cycle; |
| 169 |
\draw[fill=black, draw=black] (D) -- ++ (10mm,0mm) -- ++ (-.5mm,.5mm) -- ++ (-9mm,0mm) -- ++ (0mm, 9mm) -- ++ (-.5mm,.5mm) -- cycle; |
| 170 |
\draw[thick] (A) -- (C) -- ([yshift=11mm]D)-- ++ (1.2mm,-1.2mm) -- ([xshift=1.2mm,yshift=1.2mm]D) -- ++ (8.6mm,0mm) -- ++ (1.2mm,-1.2mm) -- (E) -- ([yshift=-11mm]B)-- ++ (-1.2mm,1.2mm) -- ([xshift=-1.2mm,yshift=-1.2mm]B) -- ++ (-8.6mm,0mm) -- ++ (-1.2mm,1.2mm) -- (A); |
| 171 |
\endtikzpicture}} |
| 172 |
|
| 173 |
\newcommand\activateBGtwo{\AddToShipoutPictureBG{\tikzpicture[overlay,remember picture] |
| 174 |
\coordinate (A) at ([yshift=-1cm]current page.north); |
| 175 |
\coordinate (B) at([yshift=-1cm,xshift=-1cm]current page.north east); |
| 176 |
\coordinate (C) at([yshift=-1cm,xshift=1cm]current page.north west); |
| 177 |
\coordinate (D) at([yshift=1cm,xshift=1cm]current page.south west); |
| 178 |
\coordinate (E) at([yshift=1cm,xshift=-1cm]current page.south east); |
| 179 |
\draw[black!40!white,line width=.5pt] (A|-B)--([xshift=-3pt]B) -- ++ (0,-3pt); |
| 180 |
\draw[black!40!white,line width=.5pt] ([xshift=-3*4.5pt]B) -- ++ (0,-3*3.5pt) -- ++ (3pt,0); |
| 181 |
\draw[black!40!white,line width=.5pt] ([yshift=-3pt]A|-B)--([yshift=-3pt,xshift=-3*6pt]B); |
| 182 |
\draw[black!40!white,line width=.5pt] (A|-C)--([xshift=3pt]C) -- ([xshift=3pt,yshift=3*6pt]D); |
| 183 |
\draw[black!40!white,line width=.5pt] ([yshift=-3pt]A|-C)--([yshift=-3pt]C) -- ([yshift=3pt]D) -- ++ (3pt,0); |
| 184 |
\draw[black!40!white,line width=.5pt] ([yshift=3*4.5pt]D) -- ++ (3*3.5pt,0) -- ++ (0,-3pt); |
| 185 |
\draw[black,line width=.5pt] ([xshift=-3pt,yshift=-3pt]B) -- ++ (3pt,0) -- ([yshift=3pt]E) -- ([xshift=3*6pt,yshift=3pt]D); |
| 186 |
\draw[black,line width=.5pt] ([xshift=-3*3.5pt,yshift=-3*3.5pt]B) -- ++ (0,-3pt) -- ++ (3*3.5pt,0); |
| 187 |
\draw[black,line width=.5pt] ([xshift=-3pt,yshift=-3*6pt]B) -- ([xshift=-3pt]E) -- ([xshift=3pt]D) -- ++ (0,3pt); |
| 188 |
\draw[black,line width=.5pt] ([xshift=3*4.5pt]D) -- ++ (0,3*3.5pt) -- ++ (-3pt,0); |
| 189 |
\fill[black!70!white,line width=.5pt] ([xshift=-3pt,yshift=-3pt]B) -- ++ (0,-3*2.5pt) -- ++ (-3*2.5pt,0) -- ++ (0,3*2.5pt) -- cycle; |
| 190 |
\fill[black!70!white,line width=.5pt] ([xshift=3pt,yshift=3pt]D) -- ++ (0,3*2.5pt) -- ++ (3*2.5pt,0) -- ++ (0,-3*2.5pt) -- cycle; |
| 191 |
\endtikzpicture}} |
| 192 |
|
| 193 |
\newcommand\activateBGthree{\AddToShipoutPictureBG{\tikzpicture[overlay,remember picture] |
| 194 |
\path[fill=black!50,thick,rounded corners=5pt]([yshift=0.85cm,xshift=0.83cm] current page.south west) rectangle([yshift=-0.85cm,xshift=-0.83cm] current page.north east); |
| 195 |
\path[draw=black,fill=white,thick]([yshift=5pt+1cm,xshift=1cm]current page.south west) -- ([yshift=-5pt-1cm,xshift=1cm]current page.north west) arc [start angle=180, end angle=90, radius=5pt] -- ([xshift=-5pt-1cm,yshift=-1cm]current page.north east) arc [start angle=90, end angle=0, radius=5pt] -- ([yshift=5pt+1cm,xshift=-1cm]current page.south east) arc [start angle=360, end angle=270, radius=5pt] -- ([xshift=5pt+1cm,yshift=1cm]current page.south west) arc [start angle=270, end angle=180, radius=5pt] -- cycle; |
| 196 |
\draw[line width=3pt]([yshift=-1cm]current page.north)--([yshift=1cm]current page.south); |
| 197 |
\pageline{1.5} \pageline{3} \pageline{4.5} |
| 198 |
\coordinate (A) at ([xshift=-0.15cm,yshift=-1cm]current page.north); |
| 199 |
\coordinate (C) at ([xshift=-0.15cm,yshift=1cm]current page.south); |
| 200 |
\coordinate (B) at ($(A)!.5!(C)$); |
| 201 |
\narosolle{A} \narosolle{C} |
| 202 |
\endtikzpicture}} |
| 203 |
|
| 204 |
\newcommand\activateBGfour{\AddToShipoutPictureBG{\tikzpicture[overlay,remember picture] |
| 205 |
\coordinate (M) at([yshift=-1cm,xshift=-1cm]current page.north east); |
| 206 |
\coordinate (N) at([yshift=1cm,xshift=1cm]current page.south west); |
| 207 |
\path[fill=black!50,thick,rounded corners=5pt](M) rectangle(N); |
| 208 |
\path[fill=white,draw,thick,rounded corners=5pt]([xshift=-1mm,yshift=-1mm]M) rectangle([xshift=3mm,yshift=1mm] N); |
| 209 |
\coordinate (A) at ([yshift=-1cm,xshift=-1cm]current page.north east); |
| 210 |
\coordinate (B) at ([xshift=-1cm]current page.east); |
| 211 |
\coordinate (C) at([yshift=1cm,xshift=-1cm]current page.south east); |
| 212 |
\path ([yshift=1cm,xshift=1cm]current page.south west)--([yshift=1cm,xshift=-1cm]current page.south east); |
| 213 |
\narosol{A} \narosol{C} |
| 214 |
\endtikzpicture}} |
| 215 |
%</package> |
| 216 |
% \Finale |
| 217 |
\endinput |