5

I would like to construct a title highlighted by two horizontal lines look like the picture below:

enter image description here

To add it to the front of document

I have the following segement of code, for example

  \documentclass[11pt,a4paper]{report}

\usepackage{amsthm}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Amiri}



    \begin{document}
    \begin{center}

    {\thickhrulefill\quad  \scshape\bfseries\textit{Mohcine} \quad \thickhrulefill}
    \rule{\textwidth}{2pt}\vspace*{-\baselineskip}\vspace*{2pt} % Thick horizontal line
    \rule{\textwidth}{0.4pt}\\[\baselineskip] % Thin horizontal line

    {\centering \LARGE \scshape\bfseries\textit{tex.stackexchange.com}  \\[0.3\baselineskip] }\\[0.2\baselineskip] % Title

    \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % Thin horizontal line
    \rule{\textwidth}{2pt}\\[\baselineskip] % Thick horizontal line
    \end{center}


    \begin{Arabic}
    \begin{description}
    \item [ \textarabic{القرآن الكريم} ]
    \end{description}
    اللّهُ لاَ إِلَهَ إِلاَّ هُوَ الْحَيُّ الْقَيُّومُ لاَ تَأْخُذُهُ سِنَةٌ وَلاَ نَوْمٌ لَّهُ مَا فِي السَّمَاوَاتِ وَمَا ‏فِي الأَرْضِ مَن ذَا الَّذِي يَشْفَعُ عِنْدَهُ إِلاَّ بِإِذْنِهِ يَعْلَمُ مَا بَيْنَ أَيْدِيهِمْ وَمَا خَلْفَهُمْ وَلاَ ‏يُحِيطُونَ بِشَيْءٍ مِّنْ عِلْمِهِ إِلاَّ بِمَا شَاء وَسِعَ كُرْسِيُّهُ السَّمَاوَاتِ وَالأَرْضَ وَلاَ يَؤُودُهُ ‏حِفْظُهُمَا وَهُوَ الْعَلِيُّ الْعَظِيمُ
    \end{Arabic}
    \begin{description}
    \item [The Holy Quran]
    \end{description}
     Allah - there is no deity except Him, the Ever-Living, the Sustainer of [all] existence. Neither drowsiness overtakes Him nor sleep. To Him belongs whatever is in the heavens and whatever is on the earth. Who is it that can intercede with Him except by His permission? He knows what is [presently] before them and what will be after them, and they encompass not a thing of His knowledge except for what He wills. His Kursi extends over the heavens and the earth, and their preservation tires Him not. And He is the Most High, the Most Great. (255) 
    \end{document}

which produces

enter image description here

  • OK, cool! So, what is your question? – Paul Gessler Feb 21 '15 at 19:08
  • Are you talking about a chapter title? – Gonzalo Medina Feb 21 '15 at 19:08
  • no not chapter just i want to add that in the front of document to looks like the picture that i provide – Educ Feb 21 '15 at 19:17
  • Which picture, the one at the top of your post or the one at the bottom? – Gonzalo Medina Feb 21 '15 at 19:20
  • the one at the top as you can see i just construct the middle of it need to add the right and the left boxes with text inside – Educ Feb 21 '15 at 19:22
5

I defined a \Title command with four arguments to produce the desired layout; for example, the title in the image below was produced using

\Title{Mohcine}{Some particular title}{Some test text}{Some other text}

enter image description here

Please, feel free to adjust the settings according to your needs.

The code:

\documentclass[11pt,a4paper]{report}
\usepackage{xhfill}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Scheherazade}

\newlength\TextBoxWd% width of the text boxes
\newlength\TextBoxSep% separation of the text boxes
\newlength\TextBoxHt% height of the text boxes

\setlength\TextBoxWd{\marginparwidth}
\setlength\TextBoxSep{\marginparsep}
\setlength\TextBoxHt{2cm}

\newcommand\ThickTitleRule{\xrfill[0.5ex]{3pt}}

\newcommand\Title[4]{%
\begingroup
  \setlength\parindent{0pt}%
  \par
  \makebox[\linewidth]{%
    \fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#3}}\hspace{\TextBoxSep}%
    \parbox[t]{\textwidth}{%
      \leavevmode
      \centering
      \ThickTitleRule\quad{\scshape\bfseries\itshape#1}\quad\ThickTitleRule\par
      \vskip-0.2\baselineskip
      \rule{\textwidth}{2pt}\par\vskip-.8\baselineskip% Thick horizontal line
      \rule{\textwidth}{0.4pt}%Thin horizontal line
      \par\vskip0.75ex
      {\LARGE\scshape\bfseries\itshape#2\par}% Title
      \rule{\textwidth}{0.4pt}\par\par\vskip-.7\baselineskip% Thin horizontal line
      \rule{\textwidth}{2pt}% Thick horizontal line
    }%
    \hspace{\TextBoxSep}\fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#4}}\par%
  }%
  \vskip\baselineskip
\endgroup
}

\begin{document}

\Title{Mohcine}{Some particular title}{Some test text}{Some other text}

\begin{Arabic}
\begin{description}
\item [ \textarabic{القرآن الكريم} ]
\end{description}
\end{Arabic}

\end{document}

Update

Added a new length to control the width of the title box:

\documentclass[11pt,a4paper]{report}
\usepackage{xhfill}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{arabic}

\setlength{\textheight}{25cm} 
\setlength{\textwidth}{18cm} 
\addtolength{\hoffset}{-3cm} 
\addtolength{\voffset}{-3cm}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Scheherazade}

\newlength\TextBoxWd% width of the text boxes
\newlength\TextBoxSep% separation of the text boxes
\newlength\TextBoxHt% height of the text boxes
\newlength\RuleWd% width of the rules

\setlength\TextBoxWd{\marginparwidth}
\setlength\TextBoxSep{\marginparsep}
\setlength\TextBoxHt{2cm}
\setlength\RuleWd{0.8\textwidth}

\newcommand\ThickTitleRule{\xrfill[0.5ex]{3pt}}

\newcommand\Title[4]{%
\begingroup
  \setlength\parindent{0pt}%
  \par
  \makebox[\linewidth]{%
    \fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#3}}\hspace{\TextBoxSep}%
    \parbox[t]{\RuleWd}{%
      \leavevmode
      \centering
      \ThickTitleRule\quad{\scshape\bfseries\itshape#1}\quad\ThickTitleRule\par
      \vskip-0.2\baselineskip
      \rule{\RuleWd}{2pt}\par\vskip-.8\baselineskip% Thick horizontal line
      \rule{\RuleWd}{0.4pt}%Thin horizontal line
      \par\vskip0.75ex
      {\LARGE\scshape\bfseries\itshape#2\par}% Title
      \rule{\RuleWd}{0.4pt}\par\par\vskip-.7\baselineskip% Thin horizontal line
      \rule{\RuleWd}{2pt}% Thick horizontal line
    }%
    \hspace{\TextBoxSep}\fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#4}}\par%
  }%
  \vskip\baselineskip
\endgroup
}


\begin{document}

\Title{Mohcine}{Some particular title}{Some test text}{Some other text}

\begin{Arabic}
\begin{description}
\item [ \textarabic{القرآن الكريم} ]
\end{description}
\end{Arabic}

\end{document}
  • thanks so much just one problem i got this !Valid XHTML because i use this \setlength{\textheight}{25cm} \setlength{\textwidth}{18cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-3cm} – Educ Feb 21 '15 at 20:17
  • @Educ change the value for \TextBoxWd to be 10pt or something like that. Change \setlength\TextBoxWd{\marginparwidth} to \setlength\TextBoxWd{10pt} but then your text will be two narrow. Do you want this? – Gonzalo Medina Feb 21 '15 at 20:24
  • @ no i don't want my text to be too narrow is there any other way – Educ Feb 21 '15 at 20:33
  • 1
    @Educ let me do some tests and in a few minutes I'll give you another suggestion. – Gonzalo Medina Feb 21 '15 at 21:44
  • 1
    @Educ Please see my updated answer under "Update". Now you can simply change \RuleWd to control the width of the middle box and rules; I used \setlength\RuleWd{0.8\textwidth} but you could also use a fixed length, for example, \setlength\RuleWd{14cm} or any other value that suits your needs. – Gonzalo Medina Feb 21 '15 at 21:53

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.