diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex | 100 |
1 files changed, 70 insertions, 30 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex b/Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex index 040767dec37..f4a9c08f3e2 100644 --- a/Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex +++ b/Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex @@ -1,4 +1,4 @@ -% $Id: faq-wdidt.tex,v 1.12 2011/06/01 19:57:21 rf10 Exp rf10 $ +% $Id: faq-wdidt.tex,v 1.17 2012/02/18 19:28:56 rf10 Exp rf10 $ \section{Why does it \emph{do} that?} @@ -40,7 +40,8 @@ whereas, in \end{figure} \end{verbatim} \end{quote} -the label will report the \emph{previous} figure's number, etc. +the label will report the number of the section (or whatever) in which +the surrounding text resides, or the like. You can, with the same malign effect, shield the \csx{caption} command from its associated \csx{label} command, by enclosing the caption in an @@ -55,13 +56,13 @@ environment of its own. This effect will be seen with: \end{verbatim} \end{quote} where the \csx{label} definitely \emph{is} after the \csx{caption}, -but because the \environment{figure} environment closed early, the -\csx{label} can't `see' the \csx{caption}. +but because the \environment{figure} environment closed before the +\csx{label} command, the \csx{caption} is no longer ``visible''. In summary, the \csx{label} must be \emph{after} the command that defines it (e.g., \csx{caption}), and if the \csx{caption} is inside an environment, the \csx{label} must be in there too. -\LastEdit{2011-03-09} +\LastEdit{2012-02-07} \Question[Q-newlineargs]{Start of line goes awry} \keywords{asterisk square bracket start line} @@ -78,13 +79,13 @@ This answer concerns two sorts of problems: errors of the form and those where a single asterisk at the start of a line mysteriously fails to appear in the output. -Both problems arise because |\|{}|\| takes optional arguments. The -command |\|{}|\*| means ``break the line here, and inhibit page break -following the line break''; the command |\|{}|\[|\meta{dimen}|]| +Both problems arise because \texttt{\bsbs } takes optional arguments. The +command \texttt{\bsbs *} means ``break the line here, and inhibit page break +following the line break''; the command \texttt{\bsbs [}\meta{dimen}\texttt{]} means ``break the line here and add \meta{dimen} extra vertical space afterwards''. -So why does |\|{}|\| get confused by these things at the start of a +So why does \texttt{\bsbs } get confused by these things at the start of a line? It's looking for the first non-blank thing, and in the test it uses ignores the end of the line in your input text. @@ -216,6 +217,37 @@ development (though it \emph{does} work in this simple case) and deserves consideration in most cases; the package documentation gives more details. +Another way out is to use one of ``argument types'' of the +\csx{NewDocumentCommand} command in the experimental \latex{}3 package +\Package{xparse}: +\begin{quote} +\begin{verbatim} +\NewDocumentCommand\cmd{ m v m }{#1 `#2' #3} +\cmd{Command }|\furble|{ isn't defined} +\end{verbatim} +\end{quote} +Which gives us: +\begin{quote} + Command \csx{furble} isn't defined +\end{quote} +The ``\texttt{m}'' tag argument specifies a normal mandatory argument, +and the ``\texttt{v}'' specifies one of these verbatim arguments. +As you see, it's implanting a \csx{verb}-style command argument in the +argument sequence of an otherwise ``normal'' sort of command; that +\begin{typesetversion} + `\texttt{\char`\|}' +\end{typesetversion} +\begin{htmlversion} + `\texttt{|}' +\end{htmlversion} +may be any old character that doesn't +conflict with the content of the argument. + +This is pretty neat (even if the verbatim is in an argument of its +own) but the downside is that \Package{xparse} pulls in +\Package{expl3} (the experimental \latex{}3 programming environment) +which is painfully large. + Other than the \Package{cprotect} package, there are three partial solutions to the problem: \begin{itemize} @@ -244,7 +276,7 @@ solutions to the problem: its absence you could simply use \csx{texttt}), consider using \csx{string}. \cmdinvoke{texttt}{my\csx{string}\_name} typesets the same as - |\verb+my_name+|, and will work in the argument of a command. It + \csx{verb+my\_name+}, and will work in the argument of a command. It won't, however, work in a moving argument, and no amount of \Qref*{\csx{protect}ion}{Q-protect} will make it work in such a case. @@ -265,10 +297,14 @@ solutions to the problem: \end{itemize} \begin{ctanrefs} \item[cprotect.sty]\CTANref{cprotect} +\item[expl3.sty]Distributed as part of \CTANref{l3kernel}[expl3] \item[fancyvrb.sty]\CTANref{fancyvrb} \item[memoir.cls]\CTANref{memoir} \item[url.sty]\CTANref{url} \item[verbdef.sty]\CTANref{verbdef} +\item[xparse.sty]Distributed as part of \CTANref{l3packages}[xparse] +\LastEdit{2012-02-13} + \end{ctanrefs} \Question[Q-noline]{No line here to end} @@ -291,7 +327,7 @@ See the LaTeX manual or LaTeX Companion \end{verbatim} \end{narrowversion} \end{quote} -comes in reaction to you giving \LaTeX{} a |\|{}|\| command at a time +comes in reaction to you giving \LaTeX{} a \texttt{\bsbs } command at a time when it's not expecting it. The commonest case is where you've decided you want the label of a list item to be on a line of its own, so you've written (for example): @@ -307,7 +343,7 @@ so you've written (for example): \bsbs {} is actually a rather bad command to use in this case (even if it worked), since it would force the `paragraph' that's made up of the text of the item to terminate a line which has nothing on it but the -label. This would lead to an ``|Underfull \hbox|'' warning message +label. This would lead to an ``\texttt{Underfull }\csx{hbox}'' warning message (usually with `infinite' badness of 10000); while this message doesn't do any actual harm other than slowing down your \LaTeX{} run, any message that doesn't convey any information distracts for no useful @@ -1019,7 +1055,7 @@ reason is that the font you selected just doesn't have a representation for the character in question. For example, if I type ``that will be \pounds{}44.00'' into an ordinary -\AllTeX{} document, or if I select the font |rsfs10| (which contains +\AllTeX{} document, or if I select the font \texttt{rsfs10} (which contains uppercase letters only) and type pretty much anything, the \pounds{} sign, or any lowercase letters or digits will not appear in the output. There's no actual error message, either: you have to read the @@ -1074,7 +1110,7 @@ from the previous run when it started; it does this comparison at Sometimes, the message won't go away: however often you reprocess your document, \LaTeX{} still tells you that ``Label(s) may have changed''. This can sometimes be caused by a broken package: both -\Package{footmisc} (with the |perpage| option) and \Package{hyperref} +\Package{footmisc} (with the \pkgoption{perpage} option) and \Package{hyperref} have been known to give trouble, in the past: if you are using either, check you have the latest version, and upgrade if possible. @@ -1114,7 +1150,7 @@ quickly, and would really rather not type them all. An alternative structure, that doesn't violate the design of \LaTeX{}, is to say \csx{fred}\csx{ }~--- the \csx{ } command is ``self -terminating'' (like |\|{}|\|) and you don't need braces after +terminating'' (like \texttt{\bsbs }) and you don't need braces after \emph{it}. Thus one can reduce to one the extra characters one needs to type. @@ -1217,7 +1253,7 @@ assignment~--- for example \end{verbatim} \end{quote} For both, an ``infinite'' tolerance is represented by the value -|10|\nothtml{\,}|000|, but infinite tolerance is rarely +\texttt{10}\nothtml{\,}\texttt{000}, but infinite tolerance is rarely appropriate, since it can lead to very bad line breaks indeed. \csx{emergencystretch} is a \TeX{}-internal `dimen' register, and can @@ -1238,12 +1274,12 @@ troublesome. In practice, \csx{pretolerance} is rarely used other than to manipulate the use of hyphenation; \plaintex{} and \LaTeX{} both set its value -to |100|. To suppress the first scan of paragraphs, set -\csx{pretolerance} to |-1|. +to \texttt{100}. To suppress the first scan of paragraphs, set +\csx{pretolerance} to \texttt{-1}. \csx{tolerance} is often a good method for adjusting spacing; -\plaintex{} and \LaTeX{} both set its value to |200|. \LaTeX{}'s -\csx{sloppy} command sets it to |9999|, as does the +\plaintex{} and \LaTeX{} both set its value to \texttt{200}. \LaTeX{}'s +\csx{sloppy} command sets it to \texttt{9999}, as does the \environment{sloppypar} environment. This value is the largest available, this side of infinity, and can allow pretty poor-looking breaks (this author rarely uses \csx{sloppy} ``bare'', though he does @@ -1566,9 +1602,9 @@ keyboards have been (or ever will be) manufactured. By contrast, the \Package{fontenc} package generates the \acro{T}1 code points from ordinary \LaTeX{} commands (e.g., it generates the -\texttt{\'e} character codepoint from the command |\'|{}|e|). So, unless you -have program-generated \acro{T}1 input, use -\cmdinvoke{usepackage}[T1]{fontenc} rather than +\texttt{\'e} character codepoint from the command \csx{'}\texttt{e}). +So, unless you have program-generated \acro{T}1 input (which is almost +inconceivable), use \cmdinvoke{usepackage}[T1]{fontenc} rather than \cmdinvoke{usepackage}{t1enc}. \Question[Q-why-inp-font]{Why bother with \Package{inputenc} and \Package{fontenc}?} @@ -1587,13 +1623,13 @@ One doesn't do this for a variety of small reasons: \begin{description} \item[Confusion] You've been happily working in this mode, and for some reason find you're to switch to writing in German: the effect - of using ``\texttt{\ss {}}'' is somewhat startling, since \acro{T}1 + of using ``\texttt{\ss }'' is somewhat startling, since \acro{T}1 and Latin-1 treat the codepoint differently. \item[Compatibility] You find yourself needing to work with a colleague in Eastern Europe: their keyboard is likely to be set to produce Latin-2, so that the simple mapping doesn't work. \item[Traditional \LaTeX{}] You lapse and write something like - |\'|{}|e| rather than typing \texttt{\'e}; only \Package{fontenc} + \cmdinvoke{'}{e} rather than typing \texttt{\'e}; only \Package{fontenc} has the means to convert this \LaTeX{} sequence into the \acro{T}1 character, so an \csx{accent} primitive slips through into the output, and hyphenation is in danger. @@ -1623,8 +1659,9 @@ associated with real arrays elsewhere in the document. The user is far better served by the \AMSLaTeX{} bundle, which provides an \environment{align} environment, which is designed with the needs of mathematicians in mind (as opposed to the convenience of -\LaTeX{} programmers). For this simple case (align is capable of far -greater things), code as: +\LaTeX{} programmers). For this simple case (\environment{align} and +other \AMSLaTeX{} alignment environments are capable of far greater +things), code as: \begin{quote} \begin{verbatim} \begin{align} @@ -1635,7 +1672,10 @@ greater things), code as: \end{quote} The matter is discussed in more detail in a % ! line break \href{http://tug.org/pracjourn/2006-4/madsen/madsen.pdf}{Prac\TeX{} journal paper} -by Lars Madsen. +by Lars Madsen; Stefan Kottwitz offers a % ! line break +\href{http://texblog.net/latex-archive/maths/eqnarray-align-environment/}{\tex{} blog entry} +which includes screen shots of the output, convincingly demonstrating +the problem. \begin{ctanrefs} \item[AMSLaTeX]\CTANref{amslatex} \end{ctanrefs} @@ -1691,7 +1731,7 @@ At the release of \LaTeXe{} in summer 1994, these simple commands were deprecated, but recognising that their use is deeply embedded in the brains of \LaTeX{} users, the commands themselves remain in \LaTeX{}, \emph{with their \LaTeXo{} semantics}. Those semantics were part of -the reason they were deprecated: each |\|\emph{\texttt{xx}} overrides +the reason they were deprecated: each \csx{\emph{xx}} overrides any other font settings, keeping only the size. So, for example, \begin{quote} \begin{verbatim} @@ -1705,7 +1745,7 @@ italic correction has a real effect), whereas {\it\bf happy as can be\/} \end{verbatim} \end{quote} -ignore \csx{it} and produces upright text at bold weight (and the +ignores \csx{it} and produces upright text at bold weight (and the italic correction has nothing to do). The same holds if you mix \LaTeXe{} font selections with the old style commands: \begin{quote} |