3

I am trying to match a corporate design with the following code. The design affects the first page of a letter only and I am currently using minipages to position elements properly. In addition I want the main text to flow in the left "column" and later to the next page while I want to keep the right column fixed on the first page. The solution I came up with is to place a minipage within a wrapfigure environment, which is exactly as long as the remaining vertical space on the page:

\documentclass[12pt,a4paper,dvipsnames]{article}

\usepackage[a4paper,left=24mm,right=14mm,top=15mm,bottom=18mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\usepackage{lipsum}

\newlength\savecolumnsep
\newlength\saveintextsep

\renewcommand{\familydefault}{\sfdefault}
\pagestyle{plain}

\begin{document}
\thispagestyle{empty}
\noindent\includegraphics[width=142mm]{./dummy.pdf}
\vspace{1mm}

\setlength{\savecolumnsep}{\columnsep}\setlength{\columnsep}{0pt}
\setlength{\saveintextsep}{\intextsep}\setlength{\intextsep}{0pt}
\begin{wrapfigure}{r}{55mm}
  \begin{minipage}[t]{5mm}\ \end{minipage}%
  \begin{minipage}[t][217mm]{50mm}
    \textbf{Date:}\\[-3pt] \today\\[4mm]
    \textbf{Address:}\\
    Street\\Zip\\[4pt]
    Phone: +123 456 789 1234\\
    Telefax: +123 456 789 1234\\[4pt]
    \vfill
    \textbf{Bank details:}\\
    BIC/SWIFT:\\
    IBAN:
  \end{minipage}
\end{wrapfigure}
%
\setlength{\columnsep}{\savecolumnsep}%
\setlength{\intextsep}{\saveintextsep}%
\noindent\textbf{Subject:} ....,
\vspace{48pt}\\
\noindent Dear ....\\[12pt]
\lipsum
\end{document}

If I, however, use spacing commands in order to separate the subject line from the main text, the space gets added twice: once where I want it and once to the bottom of the wrapfigure environment, which appears on the second page. How can I avoid this behaviour? That is, how can I add vertical space within the flowing text without extra vertical space appearing on the next page?

What I want is illustrated in the following picture (the only thing missing is some space between the subject line and the main text):

enter image description here

What I get, however, if I add the space between subject line and main text is some extra white space on the second page.

enter image description here

The parameter which interpolates between the wanted and the unwanted behaviour ist the last \vspace command in my MWE.

  • At the moment your question is a little bit unclear. Where should the IBAN content appear? At the bottom of the first page? – user31729 Jan 15 '17 at 13:19
  • Yes, this is exactly the expected behaviour. It is ensured by setting the height of the minipage to exactly the right value (217mm) and using a vfill in order to fill the space between the date/address and bank details. – jbroedel Jan 15 '17 at 13:24
  • Do you have some image where this layout is visualized? – user31729 Jan 15 '17 at 13:25
  • Added two pictures in order to illustrate the behaviour. – jbroedel Jan 15 '17 at 13:50
  • Part of the problem is the \vspace{40pt}\\ is treated by wrapfig as one \baselineskip. If you replace it with \newline\newline\newline\newline you will get much better results. Not sure what you are trying to accomplish with the first minipage (\hspace ?). – John Kormylo Jan 15 '17 at 20:39
2

Personally, I would have used two minipages and manually inserted a pagebreak (see \nopar from How to arrange a large picture on the side on the current page?).

\documentclass[12pt,a4paper,dvipsnames]{article}

\usepackage[a4paper,left=24mm,right=14mm,top=15mm,bottom=18mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\usepackage{lipsum}

\newlength\savecolumnsep
\newlength\saveintextsep

\renewcommand{\familydefault}{\sfdefault}
\pagestyle{plain}

\begin{document}
\thispagestyle{empty}
\noindent\includegraphics[width=142mm]{./dummy.pdf}
\vspace{1mm}

\setlength{\savecolumnsep}{\columnsep}\setlength{\columnsep}{0pt}
\setlength{\saveintextsep}{\intextsep}\setlength{\intextsep}{0pt}
\begin{wrapfigure}{r}{55mm}
  \vspace{-\baselineskip}%
  \begin{minipage}[t][221mm][s]{50mm}
    \textbf{Date:}\\[-3pt] \today\\[4mm]
    \textbf{Address:}\\
    Street\\Zip\\[4pt]
    Phone: +123 456 789 1234\\
    Telefax: +123 456 789 1234\\[4pt]
    \vfill
    \textbf{Bank details:}\\
    BIC/SWIFT:\\
    IBAN:
  \end{minipage}
\end{wrapfigure}
%
\setlength{\columnsep}{\savecolumnsep}%
\setlength{\intextsep}{\saveintextsep}%
\noindent\textbf{Subject:} ....,
\newline\newline\newline\newline
\noindent Dear ....\\[12pt]
\lipsum
\end{document}

This behaves more like you were expecting. Since \columnsep is unavoidable, you might as well use it. Note that even with \intextsep=0pt there will be an extra \newline at the end of the wrapfig environment, which you want to avoid.

\documentclass[12pt,a4paper,dvipsnames]{article}

\usepackage[a4paper,left=24mm,right=14mm,top=15mm,bottom=18mm,showframe]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\usepackage{lipsum}

\renewcommand{\familydefault}{\sfdefault}
\pagestyle{plain}

\setlength{\intextsep}{0pt}% used only by wrapfig

\begin{document}
\thispagestyle{empty}
\noindent\includegraphics[width=142mm]{./dummy.pdf}
\vspace{1mm}
\begin{wrapfigure}{r}{50mm}%
  \begin{minipage}[t][221mm][s]{50mm}
    \textbf{Date:}\\[-3pt] \today\\[4mm]
    \textbf{Address:}\\
    Street\\Zip\\[4pt]
    Phone: +123 456 789 1234\\
    Telefax: +123 456 789 1234\\[4pt]
    \vfill
    \textbf{Bank details:}\\
    BIC/SWIFT:\\
    IBAN:
  \end{minipage}\vspace{-\baselineskip}% automatic \newline at end
\end{wrapfigure}
%
\noindent\textbf{Subject:} ....,
\newline\newline\newline\newline
\noindent Dear ....\\[12pt]
\lipsum
\end{document}
  • thanks! That solves my problem, I just accepted your answer. The solution with two minipages is not applicable here, as this is going to be a template to be used by people who just want to fill in text and do not want to bother about pagebreaks. And yes, the first minipage was for spacing and should have been replaced by \hspace{}. What I don't understand: why is there a gap between the main text column and the minipage in the wrapfigure environment despite the 0pt columnsep? – jbroedel Jan 15 '17 at 23:02
  • Part of the gap comes from specifying a width of 55mm but only using 50mm. Part comes from when you reset \columnsep, \everypar will reduce \linewidth by \columnsep. Note, you cannot use equations or lists (like itemize) on the first page. You may need to use \WFclear on the first line of the second page. – John Kormylo Jan 16 '17 at 16:47

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.