4

I have a letterhead macro created with tikz that I'm using with dinbrief but it pushes the entire content of the letter down by 15mm. This would not be a big deal but when I print it out it no longer positions the address properly for DIN standard envelopes with an address window. The fold lines on the left side should be 105 and 210mm from the top, respectively.

Here is a minimal example:

% !TEX encoding = UTF-8 Unicode
\documentclass[10pt]{dinbrief}
\usepackage[a4paper]{geometry}
\usepackage{german}
\usepackage{fontspec}
\usepackage{tikz}

\def\briefkopf{
%header
\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-8cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        %\draw[help lines] (0, 0) grid (10cm, 8cm);
        \draw[line width=0.1cm, color=red] (0, 7cm) --(15cm, 7cm);
        \node[above right] at (15cm, 5.5cm) {\Huge{\textbf{Prof. Dr. Dr.}}};
       \end{tikzpicture}
      };
\end{tikzpicture}
}

\signature{Prof. Dr. Dr. Billiam Bohegas}
\place{Popeldorf}
\address{\briefkopf}
\date{\today\hspace*{31 mm}}

\begin{document}
\begin{letter}{Bob Derp \\ Herp GmbH \\ Alexanderstrasse 3 \\ 10178 Berlin \\ Germany }
  \opening{Dear Bob}

  Lorem ipsum ominus dominus etc.

  \closing{Mit freundlichen Grüßen,}
\end{letter}

\end{document}

enter image description here

I am not dead-set on using dinbrief. It's a bit old but I do like that it prints the fold lines and positions the address for standard envelopes. I am open to using any other classes as long as they can do those two things.

  • 1
    If I don't pass your \briefkopf macro to \address, the output doesn't seem any lower than when I leave it. What exactly do you mean by "shoves my whole letter down the page a bit"? Could you perhaps post a screenshot or two to show us the difference you observe? – jubobs Jan 4 '14 at 0:51
  • I added an image. Indeed, if I take out the letterhead tikz part completely, it still is vertically indented 15mm too far. Could this be a side effect of using XeLaTeX? – Brendan Howell Jan 4 '14 at 1:26
  • @BrendanHowell I observed this issue also with LuaLaTeX. But also, when I leave out the \fontspec line and compile with PDFLaTeX, nothing changes. – Speravir Jan 4 '14 at 2:51
2

Load a4paper as a class option instead of loading geometry

Loading geometry with option a4paper inside a dinbrief document seems to cause the undesirable behaviour you report. However, according to subsection 4.8 of the the dinbrief class documentation, there are class options for specifying the paper size. The problem goes away (at least with XeLaTeX) if you don't load geometry but pass a4paper as a class option instead.

Side note

I've modified your briefkopf macro a bit. Nesting a tikzpicture in another's node in order to achieve a particular shift is sort of awkward. Instead, you can use the tikz library called calc, which allows you to perform arithmetic calculations on nodes and achieve the placement you want.

enter image description here

\documentclass[10pt,a4paper]{dinbrief}
\usepackage{atbegshi}
\usepackage{german}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{calc}

\def\briefkopf{%
%header
    \begin{tikzpicture}[remember picture,overlay]
        \draw[line width=0.1cm, color=red]
            ($(current page.north west)+(0cm,0cm)$) -- ++(15cm, 0cm);
        \node[above right] at ($(current page.north west)+(15cm,-1.5cm)$)
            {\Huge{\textbf{Prof. Dr. Dr.}}};
    \end{tikzpicture}
}

\signature{Prof. Dr. Dr. Billiam Bohegas}
\place{Popeldorf}
\address{\briefkopf}
\date{\today\hspace*{31 mm}}

\begin{document}
\begin{letter}{Bob Derp \\ Herp GmbH \\ Alexanderstrasse 3 \\ 10178 Berlin \\ Germany }
  \opening{Dear Bob}

  Lorem ipsum ominus dominus etc.

  \closing{Mit freundlichen Grüßen,}
\end{letter}

\end{document}
  • The fold lines are still wrong but this answer solves my issue with pushing the recipient address down the page. I think I will add a bit of tikz to fake it. – Brendan Howell Apr 16 '14 at 22:19

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.