0

In our attempts to convince friends to use (La)TeX, one of them asked if it is possible to create a document like this one :

enter image description here

The code for boxes has been discussed in this page and the result is awesome.

What is missing is the header style and the margin style.

I am a beginner and I have written some basic documents. I wonder if there is a way to automate the generation of such header/margin boxes ? Any help ?

Edit :

\PassOptionsToPackage{svgnames,dvipsnames,x11names}{xcolor}


\documentclass[11pt,oneside,letter]{book}
\usepackage[top=1in,bottom=0.7in,left=0.35in,right=1in]{geometry}

\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{bidishadowtext}
\usepackage{fourier}

\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{refcount}
\usepackage{adforn}

\usepackage{fancyhdr}
 \usepackage{bidicontour}
\usetikzlibrary{arrows.meta,shapes.callouts}
\usetikzlibrary{decorations.text}


\usepackage{tabularx}
\usepackage{array}

\usetikzlibrary{decorations.shapes}




\definecolor{titlebgdark}{RGB}{0,163,243}
\definecolor{titlebglight}{RGB}{191,233,251}

\usepackage[explicit]{titlesec}







\usepackage{polyglossia}

\setdefaultlanguage{arabic}
\setotherlanguage{french}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Sakkal Majalla}

% % % 
% % % \pagestyle{fancy}
% % % 
% % % \chead{
% % % 1
% % % }
% % % 
% % % \rfoot{}
% % % \lfoot{}
% % % \cfoot{\small{\polbbbbb صفحة \fr{\textbf{\thepage}} من \fr{\textbf{\pageref{LastPage}}}}}%$\mathbf{\thepage /\pageref{LastPage}}$
    }


\usetikzlibrary{%
  arrows,%
  calc,%
  fit,%
  patterns,%
  plotmarks,%
  shapes.geometric,%
  shapes.misc,%
  shapes.symbols,%
  shapes.arrows,%
  shapes.callouts,%
  % shapes.multipart,%
  % shapes.gates.logic.US,%
  % shapes.gates.logic.IEC,%
  % er,%
  % automata,%
  backgrounds,%
  chains,%
  topaths,%
  trees,%
  petri,%
  mindmap,%
  matrix,%
  % calendar,%
  folding,%
  fadings,%
  through,%
  positioning,%
  scopes,%
  decorations.fractals,%
  decorations.shapes,%
  decorations.text,%
  decorations.pathmorphing,%
  decorations.pathreplacing,%
  decorations.footprints,%
  decorations.markings,%
  shadows}


\newcommand{\syBrisse}[6][0.99\textwidth]%[\textwidth-2\pgfkeysvalueof{/pgf/inner xsep}-4pt]
{
\begin{flushright}
\par\bigskip
\begin{tikzpicture}
\node[rounded corners, text width=#1, align=justify,
inner sep=1pt, outer sep=0] (one)
{\medskip\parbox[t]{0.99\textwidth}{\vspace*{22pt}\RTL\par #6}};
\node[anchor=north east,align=center, minimum height=20pt,
inner xsep=5pt] (two) at (one.north east) {#5 \hspace*{0.5mm}};
%%%%%
\path[top color=#3,bottom color=#3,middle color=#3!35,draw=#3]
($(one.north west)+(2cm,-4.5pt)$)
%
 [rounded corners=3pt] --
($(two.north west)+(-16.2pt,-4.5pt)$) --
($(two.south west)+(-4pt,0pt)$)
[sharp corners] --
(two.south east) [rounded corners] --
(two.north east) --
(one.north west) [sharp corners]--
($(one.north west)+(0cm,-1cm)$)[rounded corners]--
($(one.north west)+(1.2cm,-1cm)$)--cycle
;
\node[text=#2,anchor=north west,align=center, minimum height=20pt,
text height=2ex,inner sep=2cm, inner ysep=3pt] (three)
at ($(one.north west)+(0,0pt)$) {\RL #4};
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node[text=white,anchor=north east,align=center, minimum height=20pt,
inner sep=8pt,inner ysep=6.5pt] (for) at ($(one.north east)
+(0,1.5pt)$) { #5\hspace*{0.8mm}};
%
\node[text=white,anchor=north west,align=center, minimum height=5pt,
inner sep=8pt,inner ysep=3pt] at (one.north west) {\small\RL{ أضف إلى}};
%%%%%%matwiya
%
\path[draw=#2,line width=1pt]
(one.south west) [rounded corners] --
(one.south east) [rounded corners] --
(one.north east) --
(one.north west) [rounded corners] -- cycle;
\foreach \x in {10,20,...,100}
\path[opacity=\x*0.01]
($(one.north west)+(0cm,-1.03cm)$)
[rounded corners=3pt,draw=gray!\x]--
($(one.north west)+(1.2cm,-1.03cm)$)--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
($(one.north west)+(2cm,-6.5pt+\x/100)$)
[rounded corners=3pt,draw=gray!\x]
--
($(two.north west)+(-17.3pt+\x/100,-6.5pt+\x/100)$)
[rounded corners=3.5pt,draw=gray!\x] --
($(two.south west)+(-5.3pt+\x/100,-1.9pt+\x/100)$) --
($(two.south east)+(-0.4pt,-1.9pt+\x/100)$);
\path[draw=white,line width=1.1pt]
($(one.north west)+(.3cm,-1cm)$)
[rounded corners=3pt]
--
($(one.north west)+(1.2cm,-1cm)$)%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--
($(one.north west)+(2cm,-5.2pt)$) [rounded corners=3pt] --
($(two.north west)+(-17.3pt,-5.2pt)$) [rounded corners=3.5pt] --
($(two.south west)+(-4.3pt,-0.6pt)$) --
($(two.south east)+(-0.4pt,-0.6pt)$);
\begin{pgfonlayer}{background}
\path[fill=#3!5]
(one.south west) [rounded corners] --
(one.south east) [rounded corners] --
(one.north east) --
(one.north west) [rounded corners] -- cycle;
\path[opacity=0.5, top color=#3!5,bottom color=#3,middle color=#3!30]
(one.south west) [rounded corners] --
(one.south east) [sharp corners] --
($(one.south east)+(0ex,0.8cm)$) --
($(one.south west)+(0ex,0.8cm)$) [rounded corners] -- cycle;
\end{pgfonlayer}
 %
 \node[draw=white,line width=2pt,decorate,decoration={random steps ,
  amplitude = 1.2pt },middle color=white,right color=orange,minimum height=3pt,
  middle color=white, left color=yellow,text=white,anchor=north west,
  align=center,rectangle,outer sep=8pt,drop shadow={shadow scale=1.011,color=black!40},] at ($(one.north west)
+(-0.3cm,-0.3cm)$) {\RL{\scriptsize{مـعلوماتك}}};
\end{tikzpicture}
\end{flushright}
}












\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}







\titleformat{\chapter}[display]
  {\Huge}%\normalfont\huge\bfseries}
  {}
  {20pt}
  {%
    \begin{tcolorbox}[
      enhanced,
      colback=titlebgdark,
      boxrule=0.25cm,
      colframe=titlebglight,
      arc=0pt,
      outer arc=0pt,
      leftrule=0pt,
      rightrule=0pt,
      fontupper=\color{white},%\sffamily\bfseries\huge,
      enlarge left by=-1in-\hoffset-\oddsidemargin, 
      enlarge right by=-\paperwidth+1in+\hoffset+\oddsidemargin+\textwidth,
      width=\paperwidth, 
      left=1in+\hoffset+\oddsidemargin, 
      right=\paperwidth-1in-\hoffset-\oddsidemargin-\textwidth,
      top=0.6cm, 
      bottom=0.6cm,
      overlay={
        \node[
          fill=titlebgdark,
          draw=titlebglight,
          line width=0.15cm,
          inner sep=0pt,
          text width=1.7cm,
          minimum height=1.7cm,
          align=center,
          font=\color{white}%\sffamily\bfseries\fontsize{30}{36}\selectfont
        ] 
        (chapname)
        at ([xshift=-4cm]frame.north east)
        {\RL{\thechapter}};
        \node[font=\small,anchor=south,inner sep=2pt] at (chapname.north)
        {\MakeUppercase\RL{\chaptertitlename}};  
      } 
    ]
    #1
    \end{tcolorbox}%
  }
\titleformat{name=\chapter,numberless}[display]
  {\normalfont\huge\bfseries}
  {}
  {20pt}
  {%
    \begin{tcolorbox}[
      enhanced,
      colback=titlebgdark,
      boxrule=0.25cm,
      colframe=titlebglight,
      arc=0pt,
      outer arc=0pt,
      remember as=title,
      leftrule=0pt,
      rightrule=0pt,
      fontupper=\color{white}\sffamily\bfseries\huge,
      enlarge left by=-1in-\hoffset-\oddsidemargin, 
      enlarge right by=-\paperwidth+1in+\hoffset+\oddsidemargin+\textwidth,
      width=\paperwidth, 
      left=1in+\hoffset+\oddsidemargin, 
      right=\paperwidth-1in-\hoffset-\oddsidemargin-\textwidth,
      top=0.6cm, 
      bottom=0.6cm, 
    ]
    \RL{#1}
    \end{tcolorbox}%
  }
\titlespacing*{\chapter}
  {0pt}{0pt}{40pt}
% \makeatother









\begin{document}

\setromanfont[Scale=0.9]{Lato}

\chapter{الأعداد الطبيعية \textfrench{Natural Numbers}}


\syBrisse[\textwidth]{blue!85!black}{blue!90!black}{{ }}{\RL{\bfseries القسمة الإقليدية}}{

إذا كان  $a$ و $b$ عددين طبيعيين غير معدومين بحيث $a\geqslant b$ 
فإنه يوجد عددان طبيعيان $q$ و $r$ بحيث $\boxed{a=bq+r}$ مع $0\leqslant r < b$.

هذه المساواة تعبر عن \textbf{القسمة الإقليدية} للعدد  $a$ على العدد $b$ حيث $b$ هو القاسم، $q$ حاصل القسمة و $r$ هو الباقي.

}

 \label{LastPage}
\end{document} 

enter image description here

  • Done (Added a MWE). – Profahk Mar 29 at 12:08
  • Is this very difficult ? Can one get a similar style ? It doesn't matter if it is not exactly this one. – Profahk Mar 30 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.