[Tex/LaTex] Adding box filled with color and placing large text inside it

colorheader-footer

I am trying to prepare a class for my college magazine and articles. I would like to know how to place a black box on the top margin of the first page and write some huge text inside it in white color. Present style of the document looks like this,

% DOCUMENT LAYOUT
\documentclass[10pt, a4paper]{article}
\usepackage[left=5cm,right=2.5cm,top=5cm,bottom=3cm]{geometry}
\usepackage{fontspec}
\usepackage{marvosym}
\usepackage{wasysym}
% DOCUMENT LAYOUT
\setlength\parindent{0cm}
\usepackage[libertine={Ligatures=TeX,Numbers=OldStyle}]{libertineotf}
\setsansfont{Segoe UI}
% FONTS
\usepackage[usenames,dvipsnames]{color}
\usepackage{xunicode}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{pgfplots}
\usepackage{xcolor}
\usepackage{eso-pic}

% ---- CUSTOM COMMANDS
\chardef\&="E050
\newcommand{\html}[1]{\href{#1}{\scriptsize\textsc{[html]}}}
\newcommand{\pdf}[1]{\href{#1}{\scriptsize\textsc{[pdf]}}}
\newcommand{\doi}[1]{\href{#1}{\scriptsize\textsc{[doi]}}}
% ---- MARGIN YEARS
\usepackage{marginnote}
\newcommand{\amper{}}{\chardef\amper="E0BD }
\newcommand{\sides}[1]{\marginnote{\color{MidnightBlue}\sffamily #1}}
%\newcommand{\years}[1]{\marginnote{\footnotesize #1}}
%\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{0.5cm}
\reversemarginpar

% HEADINGS
\usepackage{sectsty} 
\usepackage[normalem]{ulem} 
\sectionfont{\mdseries\upshape\Large}
\subsectionfont{\mdseries\scshape\normalsize} 
\subsubsectionfont{\mdseries\upshape\large}
\usepackage{lipsum}
\usepackage{tikz}
% PDF SETUP
\usepackage[bookmarks, colorlinks, breaklinks, 
    pdftitle={Here there},
    pdfauthor={My name},
    pdfproducer={}
]{hyperref}  
\hypersetup{linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=MidnightBlue}
% DOCUMENT
\begin{document}
{\LARGE Effect of aspect ratio and others on others and ourselves}\\[3pt]
\textit{Me myself \& You}. Corr. author : \href{mailto:s.sssss@gmail.com}{\textit{s.sssss@gmail.com}}\\
\textit{Department of Mechanical Engineering.}\\[0.5cm]
{\large \bf Abstract}\\[4pt]
\lipsum[25]
{\section*{Introduction}}
\sides{I am hoping to create some proper paper using this template when i do my masters.}
\lipsum
\sides{How does a para look with this on sides. For a moment i thought it is gone}
\lipsum

%\vspace{1cm}
\vfill{}
%\hrulefill

\end{document}

Can some one suggest how to do this?
I want something like the one on the right.
enter image description here

Best Answer

You have a problem with xcolor. You need to use the option dvipsnames to use the color MidnightBlue. You don't need to load color because xcolor loads color. pgfplots loads tikz and you need to load xcolor before pgfplots.

You need to compile twice the next code. I used tikz to place a ablack rectangle on the first page.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode   
  % DOCUMENT LAYOUT
\documentclass[10pt, a4paper]{article}
\usepackage[left=5cm,right=2.5cm,top=5cm,bottom=3cm]{geometry}
\usepackage{fontspec}
\usepackage{marvosym}
\usepackage{wasysym}
% DOCUMENT LAYOUT
\setlength\parindent{0cm}
\usepackage[libertine={Ligatures=TeX,Numbers=OldStyle}]{libertineotf}
%\setsansfont{Segoe UI} 
\usepackage[dvipsnames]{xcolor} 
% FONTS
\usepackage{xunicode}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{pgfplots}

\usepackage{eso-pic}

% ---- CUSTOM COMMANDS
\chardef\&="E050
\newcommand{\html}[1]{\href{#1}{\scriptsize\textsc{[html]}}}
\newcommand{\pdf}[1]{\href{#1}{\scriptsize\textsc{[pdf]}}}
\newcommand{\doi}[1]{\href{#1}{\scriptsize\textsc{[doi]}}}
% ---- MARGIN YEARS
\usepackage{marginnote}
\newcommand{\amper{}}{\chardef\amper="E0BD }
\newcommand{\sides}[1]{\marginnote{\color{MidnightBlue}\sffamily #1}}
%\newcommand{\years}[1]{\marginnote{\footnotesize #1}}
%\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{0.5cm}
\reversemarginpar

% HEADINGS
\usepackage{sectsty} 
\usepackage[normalem]{ulem} 
\sectionfont{\mdseries\upshape\Large}
\subsectionfont{\mdseries\scshape\normalsize} 
\subsubsectionfont{\mdseries\upshape\large}
\usepackage{lipsum}
%\usepackage{tikz}
% PDF SETUP
\usepackage[bookmarks, colorlinks, breaklinks, 
    pdftitle={Here there},
    pdfauthor={My name},
    pdfproducer={}
]{hyperref}  
\hypersetup{linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=MidnightBlue}
% DOCUMENT 


\begin{document}
  \thispagestyle{empty} 
  \begin{tikzpicture}[remember picture,overlay]
  \node[anchor=north west,minimum width=21cm,minimum height=8cm,fill=black,text=white] (RB) at (current page.north west){\Huge TITLE};
\node[text=white,text width=4cm,anchor=north west] at ([shift={(3cm,2cm)}]RB.south west){\emph{Petit texte afin de tester la métode. Petit texte afin de tester la métode. Petit texte afin de tester la métode.}};
\end{tikzpicture}

\vspace*{10cm}
\lipsum[1]
\newpage 
{\LARGE Effect of aspect ratio and others on others and ourselves}\\[3pt]
\textit{Me myself \& You}. Corr. author : \href{mailto:s.sssss@gmail.com}{\textit{s.sssss@gmail.com}}\\
\textit{Department of Mechanical Engineering.}\\[0.5cm]
{\large \bf Abstract}\\[4pt]
\lipsum[25]
{\section*{Introduction}}
\sides{I am hoping to create some proper paper using this template when i do my masters.}
\lipsum
\sides{How does a para look with this on sides. For a moment i thought it is gone}
\lipsum

%\vspace{1cm}
\vfill{}
%\hrulefill

\end{document} 

enter image description here