echo this is a commandThe try the following
The most popular browsers create 3D effect by using three color variations of the document's background color to draw a table border. These colors can be controlled, but the effectiveness of the 3D effect is dependent on the choice of colors and widths of the border components, so probably best not worry about colors. It is more common to adjust the width of the compound border and its components:
Usually you want a table to include some headers. There is a corresponding tag <th>, and this tag can take the attribute colspan to make a single header span several columns of the table. For example, we might want a table to tally results of a questionnaire for students in grades 10, 11 and 12, but we might want to keep the responses from male students and female students separate. Here is how to set up such a table.
<table border cellspacing=0 cellpadding=3> <tr> <td colspan=1 rowspan=2></td> <th colspan=3 align=center>Females</th> <th colspan=3 align=center>Males</th> </tr> <tr align=center> <th>Grade 10 </th> <th>Grade 11 </th> <th>Grade 12 </th> <th>Grade 10 </th> <th>Grade 11 </th> <th>Grade 12 </th> </tr> <tr> <td align=center >Question 1</td> <td>25%</td> <td>45%</td> <td>10%</td> <td>43%</td> <td>21%</td> <td>18%</td> </tr>
The table looks like this.
| Females | Males | |||||
|---|---|---|---|---|---|---|
| Grade 10 | Grade 11 | Grade 12 | Grade 10 | Grade 11 | Grade 12 | |
| Question #1 | 25% | 45% | 10% | 43% | 21% | 18% |
Let's start by reviewing the main ideas about custom commands in LaTeX. You can make the job of typing a LaTeX document easier if you add some of your own commands to the large number of pre-defined commands. These custom commands are sometimes called "macros", short for "macro commands". For example, you can introduce commands to abbreviate longer commands. To abbreviate the command \begin{equation} to just \be you type
\newcommand{\be}{\begin{equation}}
Then, to put LaTeX into the equation environment, you can just type
\be. Notice that the \newcommand takes two
required arguments: the name of the new command and the definition of
the new command.
Suppose that you have to type Greek letters often. Then it may pay to create commands for the ones that you need. Thus,
\newcommand{\ga}{\alpha}
makes it possible to type \ga instead of \alpha.
While the savings is small for that \ga macro, your savings could be greater if you have a more complicated symbol to typeset, say an uppercase gamma with one superscript and two subscripts. If you have defined a command \gijk as follows:
\newcommand{\gijk}{\Gamma_{jk}^{i}},
then you can type \gijk whenever you want to typeset
\Gamma_{jk}^{i}.
At least, if you want to redefine a command, you should check what the current definition is. To do this you go into interactive mode. Namely, comment out the \end{document} line and run LaTeX on the file to get the * prompt.
First, you'll get a ? prompt. If you enter a return, then you should
see the * prompt. When you are at the * prompt, then you can type
\show \commandname. You should try, for example,
\show \vec. You should see that \vec is a
math accent. You could redefine it without much danger. However,
some commands are "primitive" TeX commands. They should not be
redefined. An example is \hangafter. Try showing it!
Although I have seen it said that you can also type the \show \commandname command into your document itself, and get the information in the log file and on the monitor, it did not work for me when I tried it.
\newcommand{\name}[nargs]{command definition}
The arguments are referred to in the command definition as #1, #2, ..., #nargs.
There can be no more than 9 arguments.
Let's start with a simple example. Some people like to format the names of authors in small caps when they write an article. This can be done by using the small caps text-style command \textsc You could put a name, say Frobenius, in small caps by putting in your source code \textsc{Frobenius}, but it is better to have your source code indicate not only the formatting but also the reason for the formatting. You do this by defining a new command, say, \names as follows.
\newcommand{\names}[1]{\textsc{#1}}
The new command \names takes a single argument, a string of
text, which it converts to small caps. Thus, you could have a passage
in an article that looked like this:
We have made use here of an idea that goes back to \names{Frobenius}, who used it in his celebrated paper ...Then if you later decide to change the formatting of names in your document, you can simply redefine the command \names.
Here is another simple example. Suppose that in the symbol \Gamma_{jk}^{i}, the subscripts and the superscript change. You could set up a command that would allow you to replace the i, j, and k variables whenever you wished to. For example,
\newcommand{\vG}[3]{\Gamma_{#2#3}^{#1}}
Then you could type $\vG{a}{b}{c}$ to get an upper case
Gamma with superscript a and subscripts b, c. There is no reason
that the arguments have to be single characters. You could make
each argument a whole word or even a phrase.
Suppose that you will almost always use your new command with the first argument taking a particular value, say x. You can make x the default value of the first argument to your command and make first argument to your command optional. That way, you can invoke the command without specifying the first argument most of the time. When you want to override the default, you can do it by putting in the optional argument. To do this, you specify the default value by an optional argument (hence in square brackets, []) to \newcommand immediately after the nargs argument. Thus, it will be the third argument to \newcommand. It looks like:
\newcommand{\name}[nargs][default#1]{command definition}
Here is an example taken from Grätzer's book Math into LaTeX.
\newcommand{\Sum}[2][n]{#2_{1}+#2_{2}+\cdots+#2_{#1}}
The new command that is defined in this example, \Sum has
two arguments. The second argument is required. The first argument is optional
and has a default value n. In the example the arguments to \newcommand have the following meanings:
\ensuremath{math code}
This will ensure that its argument is always put in math mode. Namely,
it will put $ signs around the argument if there are none. In the
book The LaTeX Companion Goosens-Mittelbach-Samarin
give the following example:
\newcommand{\avec}[1]{% arg1: the name of a vector
\ensuremath{#1_1,\ldots,#1_n}}
The series \avec{x} or $\avec{y}$ \ldots
If you have done all the above activities, and there is still time left, here are some other activities you can do.
You should have time to start on these during class.
