summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex')
-rw-r--r--Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex129
1 files changed, 58 insertions, 71 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex b/Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex
index 69e5e655dda..d421044660e 100644
--- a/Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex
+++ b/Master/texmf-dist/doc/generic/FAQ-en/faq-mac-prog.tex
@@ -1,4 +1,4 @@
-% $Id: faq-mac-prog.tex,v 1.6 2009/11/01 23:23:26 rf10 Exp rf10 $
+% $Id: faq-mac-prog.tex,v 1.10 2010/04/06 18:35:09 rf10 Exp rf10 $
\section{Macro programming}
@@ -782,7 +782,7 @@ doesn't have to remember that argument twelve is |soiltype|, and so
on: the commands may be copied from field notes quickly and
accurately.
\begin{ctanrefs}
-\item[keyval.sty]Distributed as part of \CTANref{graphics}
+\item[keyval.sty]Distributed as part of \CTANref{graphics}[keyval]
\end{ctanrefs}
\Question[Q-keyval]{Key-value input for macros and package options}
@@ -958,11 +958,11 @@ for \textsl{TUGboat} by Joseph Wright, and the partial translation of the
documentation of package \Package{scrbase} prepared by Philipp
Stephani.
\begin{ctanrefs}
-\item[keyval.sty]Distributed as part of \CTANref{graphics}
-\item[kvoptions.sty]Distributed as part of \CTANref{oberdiek}
-\item[kvsetkeys.sty]Distributed as part of \CTANref{oberdiek}
+\item[keyval.sty]Distributed as part of \CTANref{graphics}[keyval
+\item[kvoptions.sty]Distributed as part of \CTANref{oberdiek}[kvoptions]
+\item[kvsetkeys.sty]Distributed as part of \CTANref{oberdiek}[kvsetkeys]
\item[l3keys.sty]Distributed as part of \CTANref{expl3}
-\item[l3keys2e.sty]Distributed as part of \CTANref{expl3}
+\item[l3keys2e.sty]Distributed as part of \CTANref{xpackages}
\item[pgfkeys.sty]Distributed as part of \CTANref{pgf}
\item[scrbase.sty]Distributed as part of \CTANref{koma-script}
\item[xkeyval.sty]\CTANref{xkeyval}
@@ -975,19 +975,27 @@ Single characters can act as macros (defined commands), and both
``\texttt{\textasciitilde}'' as a ``non-breakable space''. A
character is made definable, or ``active'', by setting its
\emph{category code} (catcode) to be \csx{active} (13):
-|\catcode`_=\active|.
-
+\begin{quote}
+\begin{verbatim}
+\catcode`\_=\active
+\end{verbatim}
+\end{quote}
Any character could, in principle, be activated this way and defined
-as a macro (\csx{def}\texttt{\_\{}\csx{\_}\texttt{\}}~--- the simple answer to
-% beware line break
-\Qref[question]{using underscores}{Q-underscore}), but you must be
+as a macro:
+\begin{quote}
+\begin{verbatim}
+\def_{\_}
+\end{verbatim}
+\end{quote}
+which could be characterised as an over-simple answer to % ! line break
+\Qref[question]{using underscores}{Q-underscore}. However, you must be
wary: whereas people expect an active tilde, other active characters
may be unexpected and interact badly with other macros. Furthermore,
by defining an active character, you preclude the character's use for
other purposes, and there are few characters ``free'' to be subverted
in this way.
-To define the character ``|z|'' as a command, one would say something
+To define the character ``\texttt{z}'' as a command, one would say something
like:
\begin{quote}
\begin{verbatim}
@@ -1086,8 +1094,8 @@ made active~--- the definition of the command persists even if the
character's catcode reverts to its original value; the definition
becomes accessible again if the character once again becomes active.
\begin{ctanrefs}
-\item[doc.sty]Distributed as part of the source of \LaTeX{}, \CTANref{latex}
-\item[shortvrb.sty]Distributed as part of \CTANref{2etools}
+\item[doc.sty]Part of the \LaTeX{} distribution \CTANref{latex}[doc]
+\item[shortvrb.sty]Part of the \LaTeX{} distribution \CTANref{latex}[shortvrb]
\end{ctanrefs}
@@ -1450,9 +1458,10 @@ the ``\TeX{} project'' answers covering % ! line break
\Qref[\xetex{}~--- question]{\xetex{}}{Q-xetex}, and
\Qref[\LuaTeX{}~--- question]{\LuaTeX{}}{Q-luatex}).
\begin{ctanrefs}
-\item[ifpdf.sty]Distributed with Heiko Oberdiek's packages \CTANref{oberdiek}
-\item[ifluatex.sty]Distributed with Heiko Oberdiek's packages
- \CTANref{oberdiek}
+\item[ifpdf.sty]Distributed as part Heiko Oberdiek's bundle
+ \CTANref{oberdiek}[ifpdf]
+\item[ifluatex.sty]Distributed as part of Heiko Oberdiek's bundle
+ \CTANref{oberdiek}[ifluatex]
\item[ifxetex.sty]\CTANref{ifxetex}
\end{ctanrefs}
@@ -1808,8 +1817,8 @@ protection of some things, but the techniques available in
current \LaTeX{} mean that this is an expensive exercise. It remains
a long-term aim of the team to remove all need for \csx{protect}ion.
\begin{ctanrefs}
-\item[makerobust.sty]Distributed with Heiko Oberdiek's packages
- \CTANref{oberdiek}
+\item[makerobust.sty]Distributed as part of Heiko Oberdiek's bundle
+ \CTANref{oberdiek}[makerobust]
\end{ctanrefs}
\Question[Q-edef]{\csx{edef} does not work with \csx{protect}}
@@ -2074,8 +2083,8 @@ the command to be defined. The command requires that a
\ProgName{Python} interpreter (etc.\@) be installed on your computer.
\begin{ctanrefs}
\item[newcommand.py]\CTANref{newcommand}
-\item[optparams.sty]Distributed as part of \CTANref{sauerj}
-\item[twoopt.sty]Distributed as part of \CTANref{oberdiek}
+\item[optparams.sty]Distributed as part of \CTANref{sauerj}[optparams]
+\item[twoopt.sty]Distributed as part of \CTANref{oberdiek}[twoopt]
\item[xargs.sty]\CTANref{xargs}
\item[xkeyval.sty]\CTANref{xkeyval}
\end{ctanrefs}
@@ -2182,7 +2191,7 @@ definition like:
\end{quote}
\begin{ctanrefs}
\item[ifthen.sty]Part of the \LaTeX{} distribution
-\item[suffix.sty]Distributed as part of \CTANref{bigfoot}
+\item[suffix.sty]Distributed as part of \CTANref{bigfoot}[suffix]
\end{ctanrefs}
\nothtml{\hrule height 0pt \nobreak\vskip0pt plus2.5in\vskip 0pt\relax}
@@ -2493,7 +2502,7 @@ numbered per chapter, try:
\item[removefr.tex]\CTANref{removefr} (note, this is constructed as a
``fragment'' for use within other packages: load by
\cmdinvoke{input}{removefr})
-\item[remreset.sty]Distributed as part of \CTANref{carlisle}
+\item[remreset.sty]Distributed as part of \CTANref{carlisle}[remreset]
\end{ctanrefs}
\Question[Q-labelctr]{Making labels from a counter}
@@ -2657,79 +2666,57 @@ number appears in the heading, and some such people don't mind writing
out a few macros. This answer is for \emph{them}.
The section number is typeset using the
-\begin{narrowversion}
+\begin{dviversion}
\LaTeX{} internal
-\end{narrowversion}
-\begin{wideversion}
+\end{dviversion}
+\begin{hyperversion}
\Qref{\LaTeX{} internal}{Q-atsigns}
-\end{wideversion}
+\end{hyperversion}
\csx{@seccntformat} command, which is given the ``name'' (section,
subsection, \dots{}) of the heading, as argument. Ordinarily,
\csx{@seccntformat}
-merely outputs the section number, and then a \csx{quad} of space.
-Suppose you want to put a stop after every section (subsection,
-subsubsection, \dots{}) number, a trivial change may be implemented by
-simple modification of the command:
+merely outputs the section number, and then a \csx{quad} of space:
\begin{quote}
\begin{verbatim}
\renewcommand*{\@seccntformat}[1]{%
- \csname the#1\endcsname.\quad
+ \csname the#1\endcsname\quad
}
\end{verbatim}
\end{quote}
-
-Many people (for some reason) want a stop after a section number, but
-not after a subsection number, or any of the others.
-To do this, one must make \csx{@seccntformat} switch according to its
-argument. The following technique for doing the job is slightly
-wasteful, but is efficient enough for a relatively rare operation:
-\begin{wideversion}
+Suppose you want to put a stop after every section (subsection,
+subsubsection, \dots{}) number, a trivial change may be implemented by
+simple modification of the command:
\begin{quote}
\begin{verbatim}
-\let\@@seccntformat\@seccntformat
\renewcommand*{\@seccntformat}[1]{%
- \expandafter\ifx\csname @seccntformat@#1\endcsname\relax
- \expandafter\@@seccntformat
- \else
- \expandafter
- \csname @seccntformat@#1\expandafter\endcsname
- \fi
- {#1}%
+ \csname the#1\endcsname.\quad
}
\end{verbatim}
\end{quote}
-\end{wideversion}
-\begin{narrowversion}
+However, many people want to modify section numbers, but not
+subsection numbers, or any of the others. To do this, one must make
+\csx{@seccntformat} switch according to its argument. The following
+technique for doing the job is slightly wasteful, but is efficient
+enough for a relatively rare operation:
\begin{quote}
\begin{verbatim}
-\let\@@seccntformat\@seccntformat
\renewcommand*{\@seccntformat}[1]{%
- \expandafter\ifx
- \csname @seccntformat@#1\endcsname
- \relax
- \expandafter\@@seccntformat
- \else
- \expandafter
- \csname @seccntformat@#1\expandafter
- \endcsname
- \fi
- {#1}%
+ \csname the#1\endcsname
+ \csname adddot@#1\endcsname\quad
}
\end{verbatim}
\end{quote}
-\end{narrowversion}
-which looks to see if a second-level command has been defined, and
-uses it if so; otherwise it uses the original. The second-level
-command to define stops after section numbers (only) has the same
-definition as the original ``all levels alike'' version:
+which uses a second-level command to provide the dot, if it has been
+defined; otherwise it merely appends \csx{relax} (which does nothing
+in this context). The definition of the second-level command (the
+version for the \texttt{section}, here) specifies what to put after a
+section number, but it could be used to put anything after it:
\begin{quote}
\begin{verbatim}
-\newcommand*{\@seccntformat@section}[1]{%
- \csname the#1\endcsname.\quad
-}
+\newcommand*{\adddot@section}{.}
\end{verbatim}
\end{quote}
-Note that all the command definitions of this answer are dealing in
+Note that all the command definitions above are dealing in
\Qref*{\LaTeX{} internal commands}{Q-atsigns}, so the above
code should be in a package file, for preference.
@@ -2871,7 +2858,7 @@ to stabilise counter values~--- \LaTeX{} will generate the usual
warnings about labels changing.
\begin{ctanrefs}
\item[chngcntr.sty]\CTANref{chngcntr}
-\item[perpage.sty]Distributed as part \CTANref{bigfoot}
+\item[perpage.sty]Distributed as part \CTANref{bigfoot}[perpage]
\end{ctanrefs}
\Question[Q-fontsize]{Fonts at arbitrary sizes}
@@ -2917,7 +2904,7 @@ December 2003 edition of \LaTeX{}; if you have an older distribution,
the packages \Package{type1cm} (for \acro{CM} fonts) and
\Package{type1ec} (for \acro{EC} fonts) are available.
\begin{ctanrefs}
-\item[fix-cm.sty]Distributed as part of \CTANref{latex} (an unpacked
+\item[fix-cm.sty]Distributed as part of \CTANref{latex}[fix-cm] (an unpacked
version is available at \CTANref{fix-cm})
\item[type1cm.sty]\CTANref{type1cm}
\item[type1ec.sty]\CTANref{type1ec} (the package is actually part of