Cover letter with style - part five

This is the fifth part of the tutorial Cover letter with style. You can find the fourth part here.

In this part I will show you how to add your logo as a watermark to your cover letter1

Ok, ready to go. Well...almost: you need a logo. For this time, I will provide one (Save link as...) so you can proceed with the tutorial. It is a simple vectorial image, edited with Inkscape. If you don't have Inkscape installed, you already know what to do:

sudo apt-get install inkscape

Actually, if you are able to, I suggest to compile and install Inkscape from the svn sources, but it is not mandatory.

Another thing you need is to install a couple of fonts in a way the logo will look like as I designed. The fonts are: Diavlo and Fontin. Designed by Jos Buivenga, they are free to use. I already explained how to install new fonts in linux, so I won't bother you further.

Once the fonts and Inkscape are installed, grab the svg sample logo I made for you. Launch Inkscape, open the file and customize a little bit. For example, you could select the name

edit

replace it and then adjust the its displacement with ALT+(arrows up/down/left/right) which are the keys to adjust the font tracking and kerning in Inkscape. There's a plenty of Inkscape tutorials out there, so I am confident you will come up with a decent logo for yourself.

For the moment, I suggest you to do just little changes and save the file as Encapsulated Postscript (.eps). Before saving, Inkscape shows you this dialog:

dialog

There's only one option you should change: enable the "Convert texts to paths". What it does is converting... well, text into vectorial outlines (so font informations are then discarded) If you don't check that option, acrobat reader will consider text as text in your final pdf document. In brief, it will make the text selectable, like this

selectable

And, in general, you don't want that happening for a background image, don't you?

Anyway, now you should have your beautiful logo, says sample_logo_transparent.eps. A little digression: for the name of my logo I used the word transparent, but the eps's don't really support transparency. If you go back to Inkscape and look carefully at the fill properties:

fill

you will notice that the opacity is 100% and the color of the outlines is just a light gray, giving the impression, in the final document, of transparency. At first one could think to use indeed opacity parameter and save the logo as pdf (which supports transparency) but the final result is awful.

bad

The above picture is not a screenshot gone bad, it is the actual result if you try to import the image as pdf (supporting transparency) instead of an encapsulated postscript (which doesn't support transparency, so you are forced to fake using light colors). If someone obtains better results in importing images as pdf's, let me know, please. End of digression.

Ok, time is come to add our picture as the page background. For the purpose I will use a tiny package called eso-pic.

  1. \ProvidesFile{standard.lco}[%
  2.   2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
  3.  
  4. \usepackage{fontspec}
  5. \usepackage{marvosym}
  6. \usepackage{eso-pic}
  7.  
  8. % ==============================================
  9. %  PERSONAL DATA
  10. % ==============================================
  11. \setkomavar{fromname}{Iulius Caesar}
  12. \setkomavar{fromaddress}{Van Eeghenlaan 69\\1691QT Amsterdam\\Nederland}
  13. \setkomavar{fromphone}{+31 (0)22 7394203}
  14. \setkomavar{fromemail}{iulius@gmail.com}
  15. \setkomavar{fromfax}{+31 (0)71 5144543}
  16. \setkomavar{fromurl}{http://stefano.italians.nl}
  17. \setkomavar{frombank}{Postbank 9307157}
  18. \setkomavar{place}{Amsterdam}
  19. \setkomavar{signature}{Iulius Caesar}
  20.  
  21. % ==============================================
  22. %  FORMATTING STUFF
  23. % ==============================================
  24.  
  25. % === font settings
  26. \defaultfontfeatures{Mapping=tex-text}
  27. \setmainfont {Adobe Garamond Pro}
  28. \setsansfont {Gill Sans Std}
  29.  
  30. %set the font size and leading
  31. \renewcommand{\normalsize}{\fontsize{12.5}{17}\selectfont}
  32.  
  33. % === header settings
  34. \firsthead{
  35.    \centering
  36.          {\addfontfeature{LetterSpace=20.0}\fontsize{36}{36}\selectfont\scshape \usekomavar{fromname}}\\[5mm]
  37.          \fontsize{21}{21}\selectfont\scshape Programmer and Architect at Initech
  38. }
  39.  
  40. % === footer settings
  41. \firstfoot{
  42.   \centering
  43.   \addfontfeature{LetterSpace=20.0}\scshape
  44.   {
  45.       \renewcommand{\\}{\ {\large\textperiodcentered}\ }
  46.       \usekomavar{fromaddress}
  47.   }\\
  48.   {\Large\Letter} \usekomavar{fromemail} \ {\Large\Telefon} \usekomavar{fromphone}
  49.  
  50. % === watermark settings
  51. \newcommand\BackgroundPicture{
  52.    \put(0,0){
  53.      \parbox[b][\paperheight]{\paperwidth}{
  54.        \vfill
  55.        \centering
  56.        \includegraphics[width=0.8\paperwidth,height=0.8\paperheight,%
  57.                         keepaspectratio]{sample_logo_transparent.eps}%
  58.        \vfill
  59.      }}}
  60.  
  61. % the picture is centered on the page background
  62. \AddToShipoutPicture{\BackgroundPicture}
  63.  
  64.  
  65. \endinput

At line 6 I imported the package and at line 62 I added the background picture, which is defined in lines 51-59. The command \BackgroundPicture will put a box big as the entire page. Inside the box, the image, centered orizontally (with \centering) and vertically (with a pair of enclosing \vfill)

Finally! Let's run xelatex and see the result:

step 6

Our mighty page came to life. Hope you like it. Happy experimenting.

Click here for the last part of the tutorial.

  1. Note that in this part of the tutorial there is nothing specific to XeLaTex, so ideally you can use these instructions to add a watermark also to plain Latex documents. []

4 Comments so far

  1. ADude on September 27th, 2009

    I had to add \usepackage{graphicx} in order for \includegraphics command to work.

    Thanks for the great guide!

  2. R1 on February 2nd, 2010

    Ok with ADude’s comment. By the way, you’ve explained already how to install fonts on Linux, but how does it work on windows XP. There are several folders in which font files are. The default folder for windows, and several folders for MikTeX… Besides, does the name of the .otf files change anything? I had issues to install fonts, and use them to be honest….

    Thanks a lot, and sorry to use linux only occasionally….

  3. arun on March 7th, 2010

    Hi Stefano,
    I tried to get the background logo in the letter. But, it is showing error when I add the statement ‘\AddToShipoutPicture{\BackgroundPicture}’
    The error that I am getting is :
    Undefined control sequence.
    \ESO@HookI ->\BackgroundPicture

    l.195 \opening{Dr. Hamilton:} \body
    \closing{Respectfully,}
    ?

    I tried to correct it for hours, but still the same problem.

    I am using windows 7 OS. So, I typed the contents of the .lco file in the preamble itself. I hope u can provide some ideas as to how I can fix it.
    Arun

  4. kindoblue on March 8th, 2010

    Hi,

    Arun, R1, I don’t use Windows, sorry.

Leave a reply