Adding box filled with color and placing large text inside it
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:[email protected]}{\textit{[email protected]}}\\
\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}
You can use fancyhdr
to place a \colorbox
in the header:
\documentclass[10pt, a4paper]{article}
\usepackage[left=5cm,right=2.5cm,top=5cm,bottom=3cm,headheight=22pt]{geometry}% http://ctan.org/pkg/geometry
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\fancypagestyle{unique}{%
\renewcommand{\headrulewidth}{0pt}% No header rule
\fancyhf{}% Clear header/footer
\fancyfoot[C]{\thepage}%
\fancyhead[C]{%
\colorbox{black}{\parbox{\dimexpr\textwidth-2\fboxsep}{%
\color{white}\LARGE Effect of aspect ratio and others on others and ourselves}}%
}%
}
\begin{document}
\thispagestyle{unique}
\lipsum[1-10]
\end{document}
You can, of course, modify the unique
page style to your liking. I've only duplicated the plain
page style and added your required header.
Modifications to the header could include stretching the box to span outside the margin. Here's a quick view on the header changes to incorporate it:
\fancypagestyle{unique}{%
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% No header rule
\fancyfoot[C]{\thepage}%
\fancyhead[C]{%
\makebox[\textwidth]{%
\colorbox{black}{\parbox{\dimexpr\textwidth+50pt-2\fboxsep}{%
\color{white}\LARGE Effect of aspect ratio and others on others and ourselves}}%
}}%
}
The above header change pushes the coloured box outward (left and right) by 25 points. It accomplishes this by placing a 50pt
overset coloured box inside a centred \textwidth
box. This avoids LaTeX complaining about an overfull \hbox
spanning more than \textwidth
.