# Where do I find the documentation for writing \newcommand's ?


My objective is that I will be able to take an existing package or document class and customize it to my needs.

As much as possible, kindly point me to a free online resource. Bookstores here in the Philippines do not have LaTeX in their vocabulary.

-
Does texdoc usrguide answer your questions? Section 3.4 discusses the latex way to define commands (newcommand etc). \def on the other hand is a tex primitive and is not recommended for latex users, but you can read about it in the TeXBook. –  Lev Bishop Oct 18 '10 at 0:58
@Lev: should have put your comment as an answer ;) –  Will Robertson Oct 18 '10 at 4:30
Kit, as someone who spends a huge amount of time traipsing around rubber plantations in southern and central Viet Nam (wife's family business) and PNG (where I come from), your remark that "bookstores here in the Philippines do not have LaTeX in their vocabulary" made me laugh so hard that I spilled my coffee everywhere. Well played, sir! :) –  Geoffrey Jones Oct 18 '10 at 7:03
@Geoffrey, I actually meant that as something sad; but don't worry, no offense taken. I was even amused at why it came across as funny :P Now that I thought about it, if bookstores and vocabulary went well together, I think the pun punched through :D –  Kit Oct 18 '10 at 15:29

Try also the not-so-short introduction to latex. Section 6.1 talks about \newcommand et al.

-

To tell you the truth from the beginning, getting to the point where you're able to read the code in existing class or style files (which do make extensive use of TeX and not only LaTeX) takes some good deal of time and effort.

Usually the easiest thing to do in order to “customize” an existing package is to first load the package in question (without modifying it), and then redefine just a few commands in order to fit your needs. The best way to learn is by doing it, so try to do something very specific (i.e. try to change the specific way something is formatted) and ask a question here if/when you get stuck.

It might also be useful to browse through other questions here, particularly those tagged macros, in order to get an idea of what other people is doing and what does their code looks like.

Finally, in order to get some type of documentation for reading TeX code in existing packages, have a look at TeX by Topic, or one of the other suggested books in this other question.

-
Actually that is what I had in mind -- to customize existing classes/packages bit by bit. –  Kit Oct 19 '10 at 14:12

Does texdoc usrguide answer your questions? Section 3.4 discusses the latex way to define commands (newcommand etc). \def on the other hand is a tex primitive and is not recommended for latex users, but you can read about it in the TeXBook (I know you asked for online resources, not books, but the texbook is indispensable for learning tex).

-