# How to use the geometry package with newlfm documents?

I am using the newlfm letter documentclass, and try loading the geometry package. This returns the following error:

! LaTeX Error: Command \geometry already defined.


What I want to do is put more space (margin) between the text and the top of the page. A MWE is provided below:

\documentclass{newlfm}
\usepackage[margin=0mm, top=2mm]{geometry}

\begin{document}

Here goes the letter content

\end{letter}
\end{document}


What am I doing wrong?

-
 You could use the class' "geometry" commands. They are detailed in the documentation. – jon Aug 2 '12 at 0:35

The command \geometry, it seems, is already defined by the class newflm. If you do not want that default page setting put

\let\geometry\relax


just below \documentclass{newlfm}

\documentclass{newlfm}
\let\geometry\relax
\usepackage[margin=0mm, top=2mm]{geometry}

\begin{document}

Here goes the letter content

\end{letter}
\end{document}


Update Ignoring the commands defined by the document class will certainly cause trouble at some point of time (Agreeing with @Mico). Hence it is always better to use these commands. This MWE shows how to play with different margins using the built-in commands of the newlfm class itself.

\documentclass[a4paper]{newlfm}
%% to change margins-----------------------
\leftmarginsize{0in}
\rightmarginsize{0in}
\topmarginsize{2mm}
\topmarginskip{0in}
%%-----------------------------------------
\usepackage{lipsum} %% to add dummy text
%%-----------------------------------------
\nameto{George Bush} \addrto{\parbox{2in}{The White House \\ Washington, DC}}
\namefrom{Paul Thompson} \addrfrom{\parbox{2in}{The Pink House \\ Belleville, IL}}
%%-----------------------------------------
\begin{document}
\closeline{Sincerely yours,} \greetto{Dear Mr. Bush,}
\begin{newlfm}
How are the azaleas?

\lipsum[5]
\end{newlfm}
\end{document}


For more details one may run texdoc newlfm from from the command prompt and the details of these lengths can be found in page 8 of the manual. I am attaching a screen shot of the same.

-

(Too long for a comment)

From the user guide of the newlfm document class:

geometry is no longer used for dimension setting. Rather, all dimensions are set internally. This is done using a combination of default values, header and footer sizes and values input from the user. These include primarily the page size commands leftmarginsize, textwidthsize and rightmarginsize.

I guess the implication of this passage is that if you're going to use this document class for letters, faxes, and memos, you should try not to use the geometry package and its methods; instead, try using the parameters provided by the newlfm document class directly. Conversely, even though you may be able load the geometry package after all -- see @HarishKumar's answer -- by first undefining the \geometry command, you may find that the page-related parameters won't work the way you might expect them to work in, say, the article document class.

Addendum: Here's a quick example of how you could proceed if you wanted the left and right margins to be 1.5" wide each:

\leftmarginsize{1.5in}
\rightmarginsize{1.5in}


The text block's width would then be calculated as <paperwidth>-2*1.5"; if the paper happens to be "US Letter"-size (8.5"x11"), the text block would end up being 5.5" wide. Other page-related parameters will, in general, be determined by the options you provide as arguments to the \documentclass[...]{newlfm} command.

-
 Yes, I totally agree with your answer; perhaps you could include a little example of the ways to change the topmargin: \topmarginskip{1in} or \newlfmP{topmarginskip=1in}. – Gonzalo Medina Aug 2 '12 at 2:04