3

I am trying to create a front cover in a document (class article) and I have decided to 'decorate' it with boxes.

The first problem I have is that I am not sure why the title appears on the top of the box and not in the center.

The second problem I have is that the box is as large as the margins of the document whereas I would like it to cover the page from the one side to the other (like the picture at the end of this post).

The third problem is that I would like to have multiple boxes (each one has a different colour and space in the page) and I am not sure how I should make multiple boxes in latex and shuffle them in the page. An example of this is the last photo of the front covers that can be made easily in Word.

I would be grateful if you direct me to any resources on this with examples apart from the manual of the tcolorbox package.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{xcolor} % to colour the front cover
\usepackage{afterpage} % needed to colour only front cover and no other page
\usepackage{graphicx} % to be able to embed graphical content
\usepackage{tcolorbox} % needed for the text boxes
\usepackage{color} % needed to recognise hex colour

\definecolor{pink}{HTML}{FDDBC7}
\definecolor{red}{HTML}{B2182B}
\definecolor{blue}{HTML}{4393C3}

% define boxes 
%\%\%\%\%\ Title Box - box that will receive the title text
\makeatletter
\newcommand{\titlebox}[1]{%
  \setbox0=\hbox{#1}%
  \setlength{\@tempdima}{\dimexpr\wd0+13pt}%
  \begin{tcolorbox}[    colframe=red, colback=red, boxrule=0.5pt, arc=0pt, % 90degrees corners
    width=1\textwidth, height=0.5\textwidth, halign=flush center ] #1
  \end{tcolorbox}
}
\makeatother

\title{An awsome report}
\author{An awsome person}
\makeindex

\title{An awsome report}
\author{An awsome person}
\makeindex

%graphicspath{{computer/folder/}} % for the inclusion of logos

\begin{document} % - - - - - - - - - - - - - - - - - - - - - - - - - - 

% The title page
\makeatletter
\begin{titlepage}
\centering \titlebox{\huge\bfseries \@title \par}   
\vspace{2cm}
{\Large \@author \par}
\begin{tcolorbox}
[colframe=white, colback=white, halign=flush center]
%\includegraphics[width=0.3\textwidth]{myawsomelogo1}%
\end{tcolorbox}

% color front cover and no other page
\pagecolor{pink}\afterpage{\nopagecolor}

\end{titlepage}
\makeatother

The rest of the document

\end{document}

Possible front-covers:

enter image description here enter image description here

  • I would do it standalone using geometry and include the titlepage (rather cover) with the rest of your document as described in titlepages. – Johannes_B Oct 19 '15 at 16:18
1

If you want to shuffle multiple boxes around the page, use tikz.

\documentclass[12pt,a4paper]{article}
%\usepackage[utf8]{inputenc}% not with my editor
\usepackage{graphicx} % to be able to embed graphical content
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{color}

\definecolor{pink}{HTML}{FDDBC7}
\definecolor{red}{HTML}{B2182B}
\definecolor{blue}{HTML}{4393C3}

\newlength{\tempwidth}

\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[overlay,remember picture,font=\huge]
\node[below,minimum width={\paperwidth},minimum height={0.5\textwidth},
  fill=red,text=white] at (current page.north) {An awesome report};
\node[minimum width={\paperwidth},minimum height={0.5\textwidth},
  fill=red,text=white] at (current page.center) {An awesome person};
\node[above right,minimum width={0.5\paperwidth},minimum height={0.25\paperwidth},
  draw=blue,line width=5mm,fill=red,text=white] at (current page.south west) {\today};
\node[above left,minimum width={0.5\paperwidth},minimum height={0.25\paperwidth},
  draw=blue,line width=5mm,fill=red,text=white] at (current page.south east)
  {\includegraphics[height=4cm]{example-image}};
\end{tikzpicture}
\newpage
The rest of the document

\end{document}

enter image description here

  • Unfortunately I cannot tick both answers as the right ones, thank you very much @John Kormylo! – QQQs Oct 20 '15 at 11:27
1

The package geometry allows to change the margins for an individual page. In your case, the margins can be set to 0pt for the title page.

For example, you can do the following to place boxes:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{xcolor} % to colour the front cover
\usepackage{afterpage} % needed to colour only front cover and no other page
\usepackage{graphicx} % to be able to embed graphical content
\usepackage{tcolorbox} % needed for the text boxes
\usepackage{color} % needed to recognise hex colour
\usepackage{geometry}

\definecolor{pink}{HTML}{FDDBC7}
\definecolor{red}{HTML}{B2182B}
\definecolor{blue}{HTML}{4393C3}

\title{An awsome report}
\author{An awsome person}
\makeindex

\title{An awsome report}
\author{An awsome person}
\makeindex

\begin{document} % - - - - - - - - - - - - - - - - - - - - - - - - - -

% The title page
\newgeometry{margin=0pt}
\makeatletter
\begin{titlepage}
\centering
\begin{tcolorbox}[colframe=red,colback=red,sharp corners,halign=flush center,
  valign=center,height=0.5\textwidth,fontupper=\Huge\bfseries,
  after skip=2cm]
\@title
\end{tcolorbox}

{\Large \@author \par}

\begin{tcolorbox}[colframe=white,colback=white,halign=flush center,width=0.8\linewidth,
  before skip=2cm]
My Logo
\end{tcolorbox}

\pagecolor{pink}\afterpage{\nopagecolor}

\end{titlepage}
\makeatother

\restoregeometry
The rest of the document

\end{document}

enter image description here

  • Thank you very much @Thomas F Sturm, I combined the responses to make my front cover – QQQs Oct 20 '15 at 11:28

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.