diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-04 23:39:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-04 23:39:21 +0000 |
commit | 16bfcc69400c93c3d779a104107606ae122a7dbe (patch) | |
tree | e2456232be21108418db974f47ea118eec770469 /Master/texmf-dist/doc/generic/FAQ-en/faq-wdidt.tex | |
parent | 9a8f00b89c2c1cd283f5fd0fb54959ef0690646f (diff) |
FAQ-en 3.22 (4may11)
git-svn-id: svn://tug.org/texlive/trunk@22304 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 | 83 |
1 files changed, 48 insertions, 35 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 8b998fc5ce3..730207665e1 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.10 2011/02/10 23:01:29 rf10 Exp rf10 $ +% $Id: faq-wdidt.tex,v 1.11 2011/03/09 21:02:45 rf10 Exp $ \section{Why does it \emph{do} that?} @@ -7,48 +7,61 @@ \Question[Q-crossref]{\LaTeX{} gets cross-references wrong} Sometimes, however many times you run \LaTeX{}, the cross-references -are just wrong. Remember that -the \csx{label} command must come \emph{after} the \csx{caption} command, or -be part of it. For example, -\htmlignore -\par\noindent -\begin{tabular}{@{}lll} -| \begin{figure}| & & |\begin{figure}|\\ -| \caption{A Figure}| & or & |\caption{A Figure%| \\ -| \label{fig}| & & | \label{fig}}| \\ -| \end{figure}| & & |\end{figure}| \\ -\end{tabular} -\endhtmlignore -\begin{htmlversion} +are just wrong. A likely reason is that you have placed the label +before the data for the label was set; if the label is recording a +\csx{caption} command, the \csx{label} command must appear +\emph{after} the \csx{caption} command, or be part of it. For example: +\begin{quote} \begin{verbatim} - \begin{figure} \begin{figure} - \caption{A Figure} or \caption{A Figure% - \label{fig} \label{fig}} - \end{figure} \end{figure} +\begin{figure} + <the illustration itself> + \caption{My figure} + \label{myfig} +\end{figure} \end{verbatim} -\end{htmlversion} - -You can, just as effectively, shield the \csx{caption} command from its -associated \csx{label} command, by enclosing the caption in an -environment of its own. For example, people commonly seek help after: +\end{quote} +is correct, as is \begin{quote} \begin{verbatim} -\begin{center} - \caption{A Figure} -\end{center} -\label{fig} +\begin{figure} + <the illustration itself> + \caption{My figure% + \label{myfig}} +\end{figure} \end{verbatim} \end{quote} -has failed to label correctly. If you really need this centring (and -those in the know commonly reject it), code it as: +whereas, in \begin{quote} \begin{verbatim} -\begin{center} +\begin{figure} + <the illustration itself> + \label{myfig} + \caption{My figure} +\end{figure} +\end{verbatim} +\end{quote} +the label will report the \emph{previous} figure's number, etc. + +You can, with the same malign effect, shield the \csx{caption} command +from its associated \csx{label} command, by enclosing the caption in an +environment of its own. This effect will be seen with: +\begin{quote} +\begin{verbatim} +\begin{figure} + <the illustration itself> \caption{A Figure} - \label{fig} -\end{center} +\end{figure} +\label{myfig} \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}. + +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} \Question[Q-newlineargs]{Start of line goes awry} \keywords{asterisk square bracket start line} @@ -160,7 +173,7 @@ aren't just fragile, they're quite unusable in any ``normal'' command parameter, regardless of \Qref*{\csx{protect}ion}{Q-protect}. (The \csx{verb} command tries hard to detect if you're misusing it; unfortunately, it -can't always do so, and the error message is therefore not a reliable +can't always do so, and the error message is therefore not reliable as an indication of problems.) The first question to ask yourself is: ``is \csx{verb} actually @@ -237,13 +250,13 @@ solutions to the problem: such a case. A robust alternative is: - \begin{quote} +\begin{quote} \begin{verbatim} \chardef\us=`\_ ... \section{... \texttt{my\us name}} \end{verbatim} - \end{quote} +\end{quote} Such a definition is `naturally' robust; the construction ``\meta{back-tick}\csx{\meta{char}}'' may be used for any troublesome character (though it's plainly not necessary for things |