# The Anchor Command anch

The didactic GELLMU production system provides a command “\anch” for anchors that is parallel to the HTML anchor tag “<a>”.

An example of basic usage is given by the following markup for an anchor to the World Wide Web Consortium (W3C):

\anch[href="http://www.w3.org/"]{this anchor}

The markup is used here for this anchor.

The urlanch command provides a succinct way to insert an anchor whose visible content is the referenced URI.1 Either of these commands may be used in a display, as here:

 http://www.w3.org/.

One may ask whether there is a difference between the use of a macro Urlanch defined by

 \newcommand{\Urlanch}[1]{\anch[href="#1"]{\path{#1}}}

and urlanch. The latter is used here:

 http://www.w3.org/.

There is a difference. The command urlanch corresponds to an SGML element, while anything defined with newcommand is fully expanded by the GELLMU syntactic translator before SGML generation. This means that the treatment of urlanch by a formatter is completely independent of the treatment of anch and path by a formatter, while the treatment of Urlanch, if so defined, is entirely dependent on the formatter's treatment of the other two names.

Whether it is sensible to undertake the effort of coding formatters to handle the SGML element urlanch in addition to the SGML elements anch and path depends upon whether or not one imagines that there is at least one hypothetical output format for one's document type that might benefit from independent treatment.2

If one thinks about these issues solely in terms of formatting from GELLMU markup to LaTeX, one will come to realize that there are several approaches to the needs traditionally met in the LaTeX world with packages:

(a) Using macros such as newcommand for SGML generation.
(b) Carefully crafting formatters from one's document type to LaTeX.
(c) Writing LaTeX packages to “receive” various SGML (or XML, of course) document types.3

### Footnotes

1. * The name urianch would be more “correct” since its content is a URI.
2. * With the default GELLMU formatter for LaTeX, for example, a footnote is created with Urlanch but not with urlanch. (A footnote might also be avoided by using a different attribute name Href instead of href, but that still does not make the issue vanish.)
3. * In fact, it is generally easier to write formatters for document types that are formally XML. On the other hand, writing SGML is easier for authors. Since an SGML parser can, for most document types, convert SGML to XML, it is sensible for document types used with GELLMU to have both SGML and XML definitions.