0

I am trying to make small header to use for a report. To reduce the space the header uses, I want the image to use space of the top margin. For this I use the geometry package.
Next to this image I want 3 lines of text. After some trail and error and some searching in the web, I thought using the wrapfigure package for this would be the easiest way.
Under the header I want a horizontal line.
Directly under this line I want my report.

I encounter the following problems:
1) I can't find a way to add more vertical space before the text so it doesn't stick to the top. I want the text vertically centered relative to the image.
2) The horizontal line begins at the text, not the beginning of the page.
3) The text begins on the next page. It should begin right under the line.
Code:

\documentclass[titlepage, a4paper]{scrartcl}
\usepackage[dutch]{babel}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{float}
\usepackage[]{wrapfig}
\usepackage[a4paper]{geometry}

\newcommand{\smalltitle}[1]{\noindent \underline{\textbf{\large{#1}}} \vspace{2mm} \\}
\setlength\parindent{0pt}
\begin{document}

\newgeometry{top=0cm}
\begin{wrapfigure}{l}{0.2\linewidth}
\includegraphics[scale=1.5]{images/logo}
\end{wrapfigure}    

\Large{
    \textbf{Student:} My name and surname 
    \textbf{Course:} Latex lessons for beginners
    \textbf{Subject:} making headers in a beautiful way
} 

\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
\restoregeometry


This is a course on Latex

\end{document}

This is a picture of how the header currently looks: https://puu.sh/sKJaI/ce099c3692.png

This is a drawing of how I want it to look: https://puu.sh/sKJgi/a01eb507d2.png

1
  • Not clear what you exactly want: a header ( reproduced on every page of the document) or header for just the first page or a title?
    – Bernard
    Dec 10, 2016 at 18:48

1 Answer 1

1

I don't think wrapfig is the best solution. You are not really wrapping. Just put the picture and the text each in a minipage, then the text will automatically be centered with respect to the picture.

Furthermore, both \newgeometry and \restoregeometry start a new page, therefore your text begins at the next page. Don't use \newgeometry, but position the header with \vspace. And position the rule with \hspace. If you want to change the vertical spacing, just adapt the \vspace.

\vspace*{-1in}\vspace*{-\headheight}\vspace*{-\headsep}
\begin{minipage}{0.2\linewidth}
\includegraphics[width=\linewidth]{images/logo}
\end{minipage}\hspace{0.05\linewidth}%
\begin{minipage}{0.75\linewidth}
  \Large
    \textbf{Student:} My name and surname \\
    \textbf{Course:} Latex lessons for beginners \\
    \textbf{Subject:} making headers in a beautiful way
\end{minipage}
\\[1ex]
\hspace*{-1in}\hspace{-\oddsidemargin}\rule{\paperwidth}{0.4pt}

This is a course on Latex.  More text...  More text...  More text...  More text...  More text...  More text...  More text... 

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .