TransWikia.com

Letter formatting in Latex main and input files

TeX - LaTeX Asked on September 25, 2021

I have created a single file ('main.tex') for letter where I will add other tex files ('letter_1.tex') using input in Latex. The document format is letter (for cover letters). I am struggling with using the begin{letter} and opening commands in the ('letter_1.tex') file as the compiler gives error. If I ignore these commands the compiler runs fine however the formatting is not that good. Please guide on how can I add these two commands and also flush the date to the right side as is normally written in letters.

The codes for the main.tex file is as following;

documentclass[12pt]{letter} 

usepackage[colorlinks,citecolor=black,urlcolor=black,bookmarks=false,hypertexnames=true]{hyperref} 
usepackage{graphicx}

usepackage{amssymb,amsmath}
usepackage{graphicx}
usepackage{hyperref}


% Entering the following five lines of the codes in ```main.tex``` and in ```letter_1.tex''' results in different margins output (I checked by entering in one file at a time before compiling)
oddsidemargin=.2in
evensidemargin=.2in
textwidth=5.9in
topmargin=-.5in
textheight=9in

begin{document}

input{letter_1}

end{document}

The code for the letter_1.tex file is as following;

today
% begin{document}
% begin{letter} {

Person ABC,
DEF Faculty,
GHI University,
Street 1, USA

% }

% opening{
Dear ABC,
% }

My letter text goes here.

closing{Yours Truly,

XYZ
}

One Answer

I am not an expert on the letter class, but a begin{***} needs and end{***}, so your letter_1.tex should read:

begin{letter} {%
Person ABC,
DEF Faculty,
GHI University,
Street 1, USA%
}

opening{Dear ABC,}

My letter text goes here.

closing{Yours Truly,
    
XYZ}

end{letter}

This produces:

enter image description here

Correct answer by TobiBS on September 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP