3

So I'm fairly new to latex and am mainly using the Overleaf site for writing my report. Now I have a particular page with info regarding my school etc. but I want the school logo sitting neatly in the right corner.

This is the code I'm using right now:

\begin{center}

{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{"Ricochetbeschadiging op beton"}}

\vspace{2cm}

\begin{figure}[h!]
 \centering
 \includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{figure}

\end{center}

\vspace{50mm}

\begin{flushleft}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}

\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}

\begin{wrapfigure}{r}{5.5cm}
 \includegraphics[width=5.5cm]{Saxion_logo.pdf}
\end{wrapfigure} 


\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}

\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}


\end{flushleft}

As you can see, I tried to use the wrapit function, without succes.

imnothere
  • 14,215

4 Answers4

4

The wrapfigure has problems with flushleft or flushright, more generally with lists environments. I suggest using \InsBoxR from the insbox plain TeX macro package. It takes two mandatory arguments: the number of lines which remain untouched before the insertion, and the inserted box, and an optional argument: the number of supplementary shorter lines, in case the compiler doen't make a correct calculation.

\documentclass[a4paper,12pt]{article}

\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\input{insbox}

\begin{document}

\begin{center}

{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{"Ricochetbeschadiging op beton"}}

\vspace{2cm}

\begin{figure}[h!]
 \centering
 \includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{figure}
\end{center}

\vspace{50mm}

\begin{flushleft}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}

\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}

\InsertBoxR{0}{\includegraphics[width=5.5cm]{Saxion_logo.pdf}}

\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}

\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}
\end{flushleft}

\end{document} 

enter image description here

Bernard
  • 271,350
2

In this situation I would suggest the use of tcolorbox environment from the package of the same name. In my opinion, this would be much more efficent as it very customizable.

\documentclass[a4paper,11pt,draft]{article}

  \usepackage{graphicx}
  \usepackage{tcolorbox}


  \begin{document}



% options for every upcomming tcolorbox environment
\tcbset{sidebyside,
  size=minimal,
  width=\textwidth,
  colback=white,
  lower separated=false, % no visible separation
  halign lower=flush right, % right side
  frame empty, % no borders
}


\begin{tcolorbox}[ halign upper=flush center] % upper = left side
  {\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{"Ricochetbeschadiging op beton"}}
\tcblower  %left right separation
  \includegraphics[scale=1.4]{Politie_Logo.pdf}
\end{tcolorbox}




\vspace{50mm}

\begin{tcolorbox}
  \textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}

\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}

\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}

\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}

\tcblower % left right separation

\includegraphics[width=5.5cm]{Saxion_logo.pdf}

\end{tcolorbox}




\end{document} 

enter image description here

1

There's no compelling reason that an image is included in a figure (or similar) environment.

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{showframe}

\begin{document}

\begin{center}

\begin{minipage}{\textwidth}
\LARGE\centering
Stagewerkplan over het onderzoek naar\\
\textit{"Ricochetbeschadiging op beton"}
\end{minipage}% <-- don't forget
\makebox[0pt][r]{\raisebox{-0.5\height}{\includegraphics[width=2cm,height=2cm]{example-image}}}

\end{center}

\vspace{50mm}

\begin{flushleft}
\makebox[\textwidth][r]{\raisebox{-\height}[0pt][0pt]{\includegraphics[width=5.5cm,height=6cm]{example-image}}}

\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}

\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}

\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}

\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}


\end{flushleft}

\end{document}

I used both height and width in order to get pictures which might be similar to the ones you have. The showframe package has only been loaded for showing the text block boundaries.

enter image description here

egreg
  • 1,121,712
0

This solution uses standard LaTeX/TeX commands.

How this works, whether using wrapfig or any other package, is that you are overlaying the image on the page, then preventing the text from overlapping this image. \rlap overlaps horizontally and \raisebox can be used to overlap vertically. \strut is used here mostly because it is easier to type than \leavevmode.

In this case, the text doesn't overlap the image without modification. However, by setting and resetting \rightskip you can protect the right size of the page from longer lines (at least inside flushleft). The limitation is that you can only do this between paragraphs.

\documentclass[a4paper,12pt]{article}

\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}

\begin{document}
\begin{center}

{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{``Ricochetbeschadiging op beton''}}

\vspace{2cm}

\includegraphics[scale=1.4]{Politie_Logo.pdf}

\end{center}

\vspace{50mm}

\begin{flushleft}
\textbf{Student:}\\ \textit{Emiel Janssen}\\
\textbf{Studentnummer:}\\ \textit{349226}

\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}

\rightskip=\dimexpr 5.5cm+\columnsep\relax% not needed in this case
\strut\rlap{\makebox[\textwidth][r]{\raisebox{\dimexpr \ht\strutbox-\height}[0pt][0pt]
  {\includegraphics[width=5.5cm]{Saxion_logo.pdf}}}}%
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}
\rightskip=0pt

\textbf{Stagebegeleider:}\\ \textit{Drs. Maria Berk}

\end{flushleft}
\end{document}

It occurred to me that you might be trying to bottom align the text and image.

\documentclass[a4paper,12pt]{article}

\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}

\setlength{\parindent}{0pt}%

\begin{document}
\begin{center}

{\LARGE Stagewerkplan over het onderzoek naar}\\[0.1cm]
\LARGE{\textit{``Ricochetbeschadiging op beton''}}

\vspace{2cm}

\includegraphics[scale=1.4]{Politie_Logo.pdf}

\end{center}
\vfill

\hangindent=\bibindent
\textbf{Student:}\\ \textit{Emiel Janssen}

\hangindent=\bibindent
\textbf{Studentnummer:}\\ \textit{349226}

\hangindent=\bibindent
\textbf{Stagecoördinator:}\\ \textit{Joost Hansté;\\
Senior Wetenschappelijk Forensisch Onderzoeker}

\setlength{\rightskip}{\dimexpr 5.5cm+\columnsep}% not needed in this case
\hangindent=\bibindent
\textbf{Organisatie}\\ \textit{Politie Oost-Nederland\\
Afdeling Forensische Opsporing\\
Hermandad 2\\
7511 JN Enschede}

\hangindent=\bibindent
\textbf{Stagebegeleider:}\\
\strut\rlap{\makebox[\dimexpr \textwidth-\bibindent][r]{\smash{\includegraphics[width=5.5cm]{Saxion_logo.pdf}}}}%
\textit{Drs. Maria Berk}
\setlength{\rightskip}{0pt}%
\end{document}

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120