I am trying to make a cover page using TikZ. I want to insert some text (title, author, date) and insert a picture of a logo into a rectangle as shown in the attached picture. I have tried using nodes but it doesn't work.
\documentclass{article}
\usepackage{lipsum}
\usepackage[paper=a4paper,margin=.5in]{geometry}
\usepackage{tikz}
\begin{document}
\begin{titlepage}
\begin{tikzpicture}
\draw [fill=gray,draw=gray] (2.65,2) rectangle (20.2,1.4);
\end{tikzpicture}
\begin{tikzpicture}
\draw [fill=white,draw=white] (2.75,6) rectangle (20.2,0.3);
\draw [ultra thick](0,5.8) -- (17.53,5.8);
\draw [thick](0,2) -- (17.53,2);
\end{tikzpicture}
\begin{tikzpicture}
\draw [fill=gray,draw=gray] (2.65,20.2) rectangle (20.2,0.2);
\draw [fill=white,draw=white] (8.5,15) rectangle (15,17); %{abstract}
\draw [fill=white,draw=white] (8.5,10) rectangle (15,12); %{insert logo}
\end{tikzpicture}
\end{titlepage}
\newgeometry{top=1in,bottom=1in,right=1in,left=1in}
\section{First section} \lipsum[1-4]
\section{Second section} \lipsum[5-8]
\end{document}
Best Answer
There are better ways of doing it, but following your initial code you could use something like:
Update:
Previous version of this answer was done using your code where you define several
tikzpictures
. You should understand that atikzpicture
is like a character, therefore LaTeX places them where it considers that this character should go. If you want to build a design where several pieces are placed relative to others it's better to use onetikzpicture
with all of them. And if you want to fix an specific position for this picture over the page you can use thecurrent page
node (seevi pa's
comment) andremember picture
andoverlay
options (in this case you should compile the code twice before getting the final result).This is what is done in following code where the gray background rectangle is placed relative to page bottom and all other elements have fixed positions relative to this gray rectangle. This way you can easily select distances between elements. As the result is similar to the previous one, I won't repeat the image.