Saturday, November 21, 2020

Writing a Letter using Latex

Latex is a typesetting system which follows the WISWYM paradigm.It can be used to   typeset any kind of document such as books,reports and even letters.  

To write a letter in you have load the letter class. By default it uses the modified block layout.

Important Packages to Load:

These are the important packages to  load in my perspective, they are

  • Nag 
  • Inputenc
  • fontenc
  • microtype
  • setspace
  • datetime
  • block [if you need the full block layout]

 The package Nag is to prevent from running obsolete or depreciated commands.  

Inputenc  is for loading unicode encodings and fontenc is for the extended character set.

 The microtype package is for character protrusion and font expansion, furthermore the adjustment of interword spacing and additional kerning, as well as hyphenatable letter spacing (tracking) and the possibility to disable all or selected ligatures.

The set space package as the name indicates sets the line spacing. The datetime packages helps modifies the date to our liking. 

Some website may say use the newlfm and isodoc packages but compare to them this package doesn't have any other options and works within the letter class makes it an ideal package for the letter layout

 code for loading the packages:

\RequirePackage[orthodox]{nag}                         \documentclass[a4paper,12pt,oneside]{letter}        \usepackage[utf8]{inputenc}                             \usepackage[T1]{fontenc}              \usepackage{microtype}                  \usepackage{setspace}                           \usepackage[nodayofweek]{datetime}

Page styles:

The letter class supports the following styles

        1. Headings
        2. Empty
        3. First Page
        4. Plain      

We  will be using the page style empty. The code to load the style is 

\pagestyle{empty}  

  Writing the letter:

We are using the empty page style,by default the letter class leaves an 1 inch space for the header and another 1.5 in for the top margin. We will be removing the header in our document. This will make sure there will be 1.5 inch margin from top,left and right.

The commands supported inside the document are 

          1. \address
          2. \signature
          3. \name
          4. \location
          5. \telephone  
          6. \opening
          7. \closing
          8. \encl
          9. \cc 

We begin the document by \begin{document}  in the letter the address of the sender is first written.  The From address is typed within the \address command. using \\ for starting a new line. The \signature command  as the name implies will put your name in closing leaving a space for you to manually sign your letter.

     \begin{document}   

     \address{type your address}             

     \signature{your name}

We begin the letter with the \begin{letter} followed by the receipient address. Next we add the opening greeting of the letter with \opening  followed by the subject of the letter. There is no command for the  subject. The subject must be below 1pt from the  opening and should be left justified  so we use the \begin{spacing} environment were we write our  subject.

   \begin{letter}{receipient's address} 

Before the \opening run the following  commands so that there won't be  a huge space from the top. Use the following commands with caution.If you have an header file then you shouldn't use this command. 

     \makeatletter
  \def\@texttop{}
  \setlength\headheight{0\p@}
  \setlength\headsep{0\p@}
  \setlength\footskip{0\p@}
  \setlength\topmargin{20pt}
  \setlength\footnotesep{0\p@}
  \setlength{\skip\footins}{0\p@}
  \makeatother

               \opening{Dear sir/Madam}
               \begin{spacing}{1}
                 \begin{flushleft}
                    Re: Your subject
                 \end{flushleft}
               \end{spacing}

After this write your content of the letter. A business or formal letters should be a one  page document. Finish the letter with the \closing{Regards,} command. If you have  enclosures with the letter then run the \encl{\\1. xy \\2. xx} and if you have multiple receipients then you should add courtesy copy command          \cc{\\1. aa \\2.bb

End the document with \end{letter} and \end{document}. The signature and closing might not be adequately right justified so use the \hfill command within that command. Finally save the file and compile in pdflatex and if compiled successfully it will produce a pdf containing your letter which you can now print. 

No comments:

Post a Comment

Popular Posts