The standard is the DTX format where you put the documentation as comments around your code. Normally in the comment all code is wrapped in macrocode
environments and macros again in macro
environment. It is then compiled using the ltxdoc
class which uses the doc
package.
See more information about DTX at the TeX FAQ: https://texfaq.org/FAQ-dtx
Example:
% \begin{macro}{\mymacro}
% Some explanation
% \begin{macrocode}
\def\mymacro#1#2{%
\relax
\dosomething
% \end{macrocode}
% Explain the next part of the macro
% \begin{macrocode}
\domore
\expandafter\some\code
}
% \end{macrocode}
% \end{macro
Note that you can autogenerate a DTX file from any package or other code file using the sty2dtx
script.
A. I discovered there is a "url" command through a Google search, how can I get a "list of commands/packages"?
The list of packages is on CTAN. But by itself it’s not very helpful – there are too many packages. Similarly, there’s no list of commands, that’s not meaningful since there are simply too many. The easiest way of finding out about a package/command is to google for general typesetting help in its domain (e.g. googling for latex plot
) and taking it from there.
B. I update my "packages" using TeX Live Utility.app, is this the "right" way to do it?
Yes. This is by far the easiest and less painful way. If you need to install specific versions of packages which aren’t yet available via this interface (e.g. beta versions) you need to use the tlmgr
command line interface instead.
Could I have not got to this information in a simpler way?
I wish there was something like "JavaDoc" or a "built-in help system" akin to what I get using Eclipse and installing JavaDoc jars and attaching source documentations
On the command line,
texdoc url
Generally, every package’s documentation can be accessed via texdoc <packagename>
. Most packages come with a typeset documentation as a PDF. – Incidentally, I don’t know why most LaTeX beginners’ guides don’t mention this, or only mention it obliquely. This is by far the most useful thing I’ve ever learned about LaTeX. For instance, all core commands of LaTeX are documented in texdoc source2e
(which is highly technical, but complete).
In fact, LaTeX’ documentation system is far more complete than JavaDoc or similar systems. Package writers are strongly encouraged to practice literal programming, i.e. they don’t comment/document their code. Rather, they write a documentation which contains the code (not the other way round, as in the case of JavaDoc). This usually means that package documentation is very comprehensive. For an extreme example, try texdoc tikz
(an awesome package, by the way) – this is a beautifully typeset 700-page documentation with several tutorials and examples throughout.
Best Answer
There's not much to say. The package can be passed three options:
nomath
, which will not change the math fonts, keeping the default Computer Modern;variablett
, that sets up a variable width typewriter font;lighttt
, that uses a lighter version of the typewriter font, so the bold variant is more evident.The main action of the package is to set up text fonts so that the Latin Modern family is used.