2

I'm writing my full job application with moderncv.

I don't want to use other classes for the letter, because I can't use the fancy heading of the moderncv title there.

For the letter I need to know how to align a plain-text in centi- or milimeters from the top of the page. With "top of the page" I mean the actual beginnig of the paper, not the geomerty borders or similar.

See picture for detail:

enter image description here

Thanks for help

EDIT EDIT EDIT

because of boobyandbobs problem understanding me, I specify it a litte:

At first you need to know, I'm german.

Germany has a standard for postal mails

This standard demands specifications like, as an example this:

  • The creators contact details have to be displayed aligned left and 1.5 centimeters from top of the page
  • The date and place from the creation of the letter have to be displayed aligned right and 2.2 centimeters from top

and so on.

See this picture for clearence:

enter image description here

EDIT EDIT EDIT number 2

Sorry, but this drives me nuts

See MWE:

\documentclass[12pt, a4paper]{moderncv}
\usepackage[ngerman]{babel}   
\usepackage[utf8]{inputenc}  
\usepackage[left=2.5cm, right=2.0cm, top=1.0cm, bottom=1.0cm]{geometry}  
\usepackage{fontawesome}  
\moderncvtheme[blue]{classic}
\name{{\scshape\Huge My}}{{\scshape Name}}
\address{My street}{12345 There}
\phone[handy]{\faMobile\hspace{2pt}0173\,1111111}
\usepackage{lipsum}
\begin{document}
\makecvtitle
\vspace{1cm}
\color{red}{!This has to be 2.2 centimeter from actual beginning of paper!\color{black}\\

\color{blue}{!This block\\has to be 3.4 centimeter\\from actual beginning of paper!\color{black}\\

\flushright \color{red}{This must be 4.3 centimeter from the top of the paper\color{black}\\
\flushleft
\lipsum[1-3]
\end{document}

MWE looks like:

enter image description here

1

Here is my first try. As been noted in the commentary its not a optimal solution but maybe it could help a little bit. The lines and margins are just generated optional with \usepackage{showframe} and \showgrid(Ref. @esdd )to see the dimensions, and could bet removed.

1. Position things absolutely on the page: Using the helper macros \AtTextUpperLeft or \AtPageUpperLeft (see eso-pic) for easier positioning on the page. Then moved away from \AtTextUpperLeft with some horizontal (\hspace*{<cm>}) and veritical (\raisebox{<cm>}{}) space. To get negative spacing i used \hspace{0pt-\widthof{<text>} to get right aligned text.

2. Length of given text: The calc package is used to get width of a given text as length.

I used code parts of:

enter image description here

MWE:

\documentclass[12pt, a4paper]{moderncv}
\usepackage[ngerman]{babel}   
\usepackage[utf8]{inputenc}  
\usepackage[left=2.5cm, right=2.0cm, top=1.0cm, bottom=1.0cm]{geometry}  
\usepackage{fontawesome}  
\moderncvtheme[blue]{classic}
\name{{\scshape\Huge My}}{{\scshape Name}}
\address{My street}{12345 There}
\phone[handy]{\faMobile\hspace{2pt}0173\,1111111}
\usepackage{lipsum,xcolor}
\usepackage{showframe}
\usepackage{eso-pic}

\usepackage{calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% code of @https://tex.stackexchange.com/a/99242/124842
\makeatletter
\def\@hspace#1{\begingroup\setlength\dimen@{#1}\hskip\dimen@\endgroup}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \showgrid with help of  @https://tex.stackexchange.com/a/229850/124842
\newcommand{\showgrid}{%
  \AddToShipoutPictureFG*{%
    \begin{tikzpicture}[overlay,remember picture,
        thin,nodes={font=\fontsize{1}{2}\selectfont},
        yshift=\paperheight% origin is in the upper left corner
        ]
      \draw[gray!25,step=1cm](current page.south west)grid(current page.north east);
      \draw[blue!30!gray,step=10cm](current page.south west) grid(current page.north east);
      \pgfmathtruncatemacro\xmaxstep{\paperwidth/1cm}% calculate needed steps in x direction
      \pgfmathtruncatemacro\ymaxstep{\paperheight/1cm}% calculate needed steps in y direction
      \foreach \step in {0,1,...,\xmaxstep}
        \node [anchor=north] at ([xshift=\step cm]current page.north west) {\step};
      \foreach \step in {0,1,...,\ymaxstep}
        \node [anchor=west] at ([yshift=-\step cm]current page.north west) {\step};
    \end{tikzpicture}%
  }%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\AddToShipoutPictureBG*{%

%\AtPageUpperLeft{%
%\hspace*{2.5cm}\raisebox{-2.2cm}{%
  \AtTextUpperLeft{%
  \hspace*{0cm}\hspace*{\textwidth}\hspace{0pt-\widthof{Is this okay? ...4.3 centimeter from the top of the paper}}\hspace{2cm-0.81cm}\raisebox{-4.3cm}{%
  \color{red}Is this okay? ...4.3 centimeter from the top of the paper
  }}

\AtTextUpperLeft{%
\hspace*{0cm}\raisebox{-2.2cm}{%
\color{blue}Is this okay? ...2.2 centimeter from the top of the paper
}
}

\AtTextUpperLeft{%
\hspace*{0cm}\raisebox{-3.4cm}{%
\color{blue}
Is this okay? ...3.4 centimeter from the top of the paper ... (single line)
}
}%

\AtTextUpperLeft{%
\hspace*{0cm}\raisebox{-3.87cm}{%
\color{green}
\begin{minipage}{30em}
 Is this okay? ...3.4 centimeter from the top of the paper \\
next line \\
... and ...
\end{minipage}
}}
}%

\showgrid
\makecvtitle
\vspace{1cm}
\flushleft
\lipsum[1-3]
\end{document}
| improve this answer | |
1

Thanks to Bobbyanbob, but the now deleted comment fits it better. The mentioned, german, document (http://archiv.dante.de/DTK/PDF/komoedie_2011_1.pdf) gave me a nice solution on page 30-40.

| improve this answer | |

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.