diff options
author | Karl Berry <karl@freefriends.org> | 2013-03-05 00:31:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-03-05 00:31:32 +0000 |
commit | 128badd949a46eab7b3cdd4be67a3cd4e69e7769 (patch) | |
tree | 15e2c62adc3721f8b04d13a15d149f8f9752c4c8 /Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex | |
parent | cecaa6eb0816bb7e9ca11b0aa34254ddf60e41ba (diff) |
FAQ-en (4mar13)
git-svn-id: svn://tug.org/texlive/trunk@29288 c570f23f-e606-0410-a88d-b1316a301751
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 | 127 |
1 files changed, 96 insertions, 31 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 f4a9c08f3e2..ac786c10aab 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.17 2012/02/18 19:28:56 rf10 Exp rf10 $ +% $Id: faq-wdidt.tex,v 1.23 2012/11/24 10:56:03 rf10 Exp $ \section{Why does it \emph{do} that?} @@ -72,12 +72,12 @@ This answer concerns two sorts of problems: errors of the form \begin{verbatim} ! Missing number, treated as zero. <to be read again> - g -<*> [grump] + p +<*> [perhaps] \end{verbatim} \end{quote} -and those where a single asterisk at the start of a line mysteriously -fails to appear in the output. +and errors where a single asterisk at the start of a line mysteriously +fails to appear in the typeset output. Both problems arise because \texttt{\bsbs } takes optional arguments. The command \texttt{\bsbs *} means ``break the line here, and inhibit page break @@ -85,24 +85,24 @@ 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 \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. +The problem arises because \texttt{\bsbs } looks for the next +non-blank thing; the test it uses ignores the end of the line in +your input text, so that \texttt{\bsbs } comes to imagine that you +were giving it a `modifier'. -The solution is to enclose the stuff at the start of the new line in -braces: +An obvious solution is to enclose the stuff at the start of the new +line in braces, typing: \begin{quote} \begin{verbatim} {\ttfamily /* C-language comment\\ - {[grump]} I don't like this format\\ + {[perhaps]} this could be done better\\ {*}/ } \end{verbatim} \end{quote} -(The above text derives from an actual post to -\Newsgroup{comp.text.tex}; this particular bit of typesetting could -plainly also be done using the \environment{verbatim} environment.) +This particular example could be coded (without any problems) in +verbatim, but the behaviour does confuse people. The problem also appears in maths mode, in arrays and so on. In this case, large-scale bracketing of things is \emph{not} a good idea; the @@ -121,8 +121,10 @@ which is a usage this \acro{FAQ} would not recommend, anyway: refer to the \Qref*{reason not to use \environment{eqnarray}}{Q-eqnarray}. Note that the \Package{amsmath} package modifies the behaviour of -\texttt{\bsbs } in maths. With \Package{amsmath}, the \environment{eqnarray} -example doesn't need any special measures. +\texttt{\bsbs } in maths. With \Package{amsmath}, the +\environment{eqnarray} example doesn't need any special action +(\csx{relax} or braces). +\LastEdit{2012-09-02} \Question[Q-verbwithin]{Why doesn't verbatim work within\,\dots{}?} @@ -245,8 +247,8 @@ 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. +the experimental \latex{}3 programming environment +(\Package{l3kernel}) which is pretty big. Other than the \Package{cprotect} package, there are three partial solutions to the problem: @@ -297,17 +299,16 @@ 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[l3kernel \nothtml{\rmfamily}bundle]\CTANref{l3kernel} \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} +\LastEdit{2013-02-15} -\Question[Q-noline]{No line here to end} +\Question[Q-noline]{``No line here to end''} The error \begin{quote} @@ -403,6 +404,64 @@ be had by saying: % other instances: \[no]linebreak in vertical mode +\Question[Q-vertspacefloat]{Extra vertical space in floats} + +A common complaint is that extra vertical space has crept into +\environment{figure} or \environment{table} floating environments. +More common still are users who post code that introduces this extra +space, and \emph{haven't noticed the problem}! + +The trouble arises from the fact that the \environment{center} +environment (and its siblings \environment{flushleft} and +\environment{flushright}) are actually based on \LaTeX{}'s +list-handling code; and lists always separate themselves from the +material around them. Meanwhile, there are parameters provided to +adjust the spacing between floating environments and their +surroundings; so if we have: +\begin{quote} +\begin{verbatim} +\begin{figure} + \begin{center} + \includegraphics{...} + \caption{...} + \end{center} +\end{figure} +\end{verbatim} +\end{quote} +\nothtml{\noindent}or worse still: +\begin{quote} +\begin{verbatim} +\begin{figure} + \begin{center} + \includegraphics{...} + \end{center} + \caption{...} +\end{figure} +\end{verbatim} +\end{quote} +unwarranted vertical space is going to appear. + +The solution is to let the float and the objects in it position +themselves, and to use ``generic'' layout commands rather than their +list-based encapsulations. +\begin{quote} +\begin{verbatim} +\begin{figure} + \centering + \includegraphics{...} + \caption{...} +\end{figure} +\end{verbatim} +\end{quote} +(which even involves less typing). + +This alternative code will work with any \LaTeX{} package. It will +not work with obsolete (pre-\LaTeXe{}) packages such as +\Package{psfig} or \Package{epsf}~--- see % beware line break +\Qref[question]{graphics inclusion}{Q-impgraph} for discussion of the +genesis of \csx{includegraphics}. +\LastEdit{2012-11-16} + \Question[Q-2colfltorder]{Two-column float numbers out of order} When \LaTeX{} can't place a float immediately, it places it on one of @@ -1683,19 +1742,22 @@ the problem. \Question[Q-dolldoll]{Why use \csx{[}\,\dots{}\csx{]} in place of \texttt{\$\$}\,\dots{}\texttt{\$\$}?} \LaTeX{} defines inline- and display-maths commands, apparently -s those that derive from the \TeX{} primitive maths -sequences bracketing maths commands with single (or pairs of) dollar signs. +duplicating those that derive from the \TeX{} primitive maths +sequences, that maths commands with single (or pairs of) dollar signs. As it turns out, \LaTeX{}'s inline maths grouping, % !line break \csx{(}\texttt{ ... }\csx{)}, has precisely the same effect as the \TeX{} primitive version \texttt{\$ ... \$}. (Except that the \LaTeX{} version checks to ensure you don't put \csx{(} and -\csx{)} the wrong way round.) +\csx{)} the wrong way round; this does occasionally detect errors\dots{}.) -In this circumstance, one often finds \LaTeX{} users, who have some +Since this is the case, one often finds \LaTeX{} users, who have some experience of using \plaintex{}, merely assuming that \LaTeX{}'s display maths grouping \csx{[}\texttt{ ... }\csx{]} may be replaced by -the \TeX{} primitive display maths \texttt{\$\$ ... \$\$}. +the \TeX{} primitive display maths \texttt{\$\$ ... \$\$}. Some +people ``go the whole hog'' and use \cmdinvoke{begin}{displaymath} +\dots{} \cmdinvoke{end}{displaymath} (which ``looks nicer'', in some +sense, and actually \emph{describes} what's being done. Unfortunately, they are wrong: if \LaTeX{} code is going to patch display maths, it can only do so by patching \csx{[} and \csx{]}. The most @@ -1704,14 +1766,17 @@ simply does not work for equations coded using % ! line break \texttt{\$\$ ... \$\$}, whether you're using the standard classes alone, or using package \Package{amsmath}. Also, the \csx{[} and \csx{]} construct has code for rationalising vertical spacing in some extreme -cases; that code is not available in \texttt{\$\$ ... \$\$}, so if you +cases; that code is not provided \texttt{\$\$ ... \$\$}, so if you use the non-standard version, you may occasionally observe -inconsistent vertical spacing . +inconsistent vertical spacing. Similar behaviour can bite if you are +writing a \emph{proof}; placing the ``\acro{QED} symbol'' doesn't work +if it is in \texttt{\$\$}-displayed maths. There are more subtle effects (especially with package \Package{amsmath}), and the simple rule is ``use % ! line break -\csx{[}\texttt{ ... }\csx{]} whenever displayed maths is needed in -\LaTeX{}''. +\csx{[}\texttt{ ... }\csx{]} (at least) whenever displayed maths is +needed in \LaTeX{}''. +\LastEdit{2013-02-20} \Question[Q-2letterfontcmd]{What's wrong with \csx{bf}, \csx{it}, etc.?} |