From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/morehelp/morehelp.README | 133 ++++++++++++++ macros/latex/contrib/morehelp/morehelp.dyn | 78 ++++++++ macros/latex/contrib/morehelp/morehelp.eng | 249 ++++++++++++++++++++++++++ macros/latex/contrib/morehelp/morehelp.sty | 134 ++++++++++++++ 4 files changed, 594 insertions(+) create mode 100644 macros/latex/contrib/morehelp/morehelp.README create mode 100644 macros/latex/contrib/morehelp/morehelp.dyn create mode 100644 macros/latex/contrib/morehelp/morehelp.eng create mode 100644 macros/latex/contrib/morehelp/morehelp.sty (limited to 'macros/latex/contrib/morehelp') diff --git a/macros/latex/contrib/morehelp/morehelp.README b/macros/latex/contrib/morehelp/morehelp.README new file mode 100644 index 0000000000..e773e8add1 --- /dev/null +++ b/macros/latex/contrib/morehelp/morehelp.README @@ -0,0 +1,133 @@ +morehelp.sty version 0.1 1997 by Olaf Kummer + +NOTE: This is an early alpha version. + + +About this Package +================== + +This package enhances the error messages of LaTeX +by providing descriptions of the possible causes +including those that may not be obvious. + +This style is effectively an online substitute for +error lists found LaTeX books, although it cannot +completely replace them. Only true LaTeX errors are +included, TeX errors are beyond the reach of ordinary +macros. + + +How to Use +========== + +Install the files + morehelp.sty + morehelp.dyn + morehelp.eng +at a place where TeX can find them. Depending on +your installation you might have to run a special script +like texhash. Now you can say + \usepackage{morehelp} +in the preamble of your document. But if LaTeX complains + ! LaTeX Error: File `morehelp.sty' not found. +then you are in trouble. Are the three files placed +correctly? As a last resort you might even +consider to put them in one directory with your TeX +sources, they are almost always found there. + +Try and make some errors and look what morehelp.sty +has to say about them. Let's say + + \documentclass{article} + \usepackage{morehelp} + \begin{document} + For 4$ you can get an \item or an eqnarray! + + \begin{eqnarray} + a & = & b*a & for b=1 or a=1 + \end{eqnarray} + \end{document} + +Try it! It cannot do wonders, but it is much better +than nothing at all. + + +Caveats +======= + +This is an early alpha version. It is not yet robust +enough and may cause weird errors from time to time. +(They did not occur when I tested it, but I am pretty +sure they are out there. This style required quite a +lot of hacks.) + +Please test this style even if you are an experienced +TeXnician, so that we can make it foolproof. + +It is slightly more probable that TeX runs out of +memory while handling an error, so that an even more +obscure message might be output. So in the case of +garbled messages, it might be worthwhile to *exclude* +\usepackage{morehelp} from your preamble! + +If you cannot figure out the cause of an error with this +package, DO NOT SEND A MAIL asking me to fix your problem. +I won't answer. THIS PACKAGE is there to help you, I am not. +That may sound harsh, but you will find out everything with +the help of your local TeXnician. + + +Extensions +========== + +This package defines two more errors. + +"You must be in horizontal mode to use \@." + +Explanation: You issued the command \@, but you were in either +math or vertical mode. You are required to start a pragraph +before you may use \@. morehelp.sty issues this error instead +of the awful "... cannot use \spacefactor..." message, +but only if it cannot determine a more plausible reason. + +"You forgot to call \makeatletter." + +Explanation: You issued the command \@, but from the context +morehelp.sty could determine that you actually wanted to issue +a command sequence that starts with \@... which is not allowed +here. Enclose your code in \makeatletter\makeatother pairs and TeX +will be happy. + + +Closing Remarks +=============== + +This package originated from a discussion on the newsgroup +de.comp.text.tex. Thanks to David Kastrup, Markus Kohm, +and Florian Weimer for their participation. + +You may use, copy, and redistribute this software as you +like, but + - any distribution must contain all the files that + come with this package. + - you must inform the author of any commercial distribution. + - you must be aware that this package is distributed in the + hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. The author is not + liable for ANY DAMAGE of any kind that may be excluded + under the applicable law. (See legal.txt as distributed + with LaTeX2e for details.) + +You may change this software, as long as + - you put all the changes in the public domain, + - you send to the author any changes you make, + - you rename all files that you changes, + - you leave a notice of your responsibility for the changes. + +Additions and corrections are encouraged. They should be send +to kummer@informatik.uni-hamburg.de by email. Translations +to other languages are especially welcome. + + + diff --git a/macros/latex/contrib/morehelp/morehelp.dyn b/macros/latex/contrib/morehelp/morehelp.dyn new file mode 100644 index 0000000000..9b7a3ebac5 --- /dev/null +++ b/macros/latex/contrib/morehelp/morehelp.dyn @@ -0,0 +1,78 @@ +% morehelpdyn.tex version 0.1 1997 by Olaf Kummer +% +% see morehelp.README for explanations +% +% The dynamically loaded macros for special errors. +\begingroup + \makeatletter + \gdef\morehelp@atcommand{% + \ifnum\the\catcode`\@=11 + % At least it cannot be the ordinary error. + \morehelp@afterelse\morehelp@modefor@err + \else + % No, the user probably meant \@somecommand. + \expandafter\morehelp@caterr + \fi + }% + \gdef\morehelp@modefor@err{% + \PackageError{morehelp}{% + You must be in horizontal mode to use \protect\@.^^J^^J% + You issued the command \protect\@, but you were in + \ifmmode math \fi\ifvmode vertical \fi mode.^^J% + You are required to start a pragraph before you may^^J% + use \protect\@}{I am ignoring that command.} + }% + \gdef\morehelp@caterr{% + \def\morehelp@e{}% + % Does a character or a another at-sign follow? + \futurelet\morehelp@a\morehelp@caterr@ + }% + \gdef\morehelp@caterr@{% + \ifcat\noexpand\morehelp@a a% + \let\morehelp@a=\morehelp@caterr@@ + \else\if\noexpand\morehelp@a\morehelp@atsign + \let\morehelp@a=\morehelp@caterr@@ + \else + \let\morehelp@a=\morehelp@caterr@@@ + \fi\fi + \morehelp@a + }% + \gdef\morehelp@caterr@@#1{% + \edef\morehelp@e{\morehelp@e#1}% + \futurelet\morehelp@a\morehelp@caterr@ + }% + \gdef\morehelp@caterr@@@{% + \ifx\morehelp@e\@empty + % I am not really sure what went wrong. + \morehelp@afterelse\morehelp@modefor@err + \else + \morehelp@afterfi + \PackageError{morehelp}{You forgot to call \protect\makeatletter.^^J^^J% + TeX detected the command \protect\@. If you really wanted to^^J% + use that command, you should only use it in the middle of a^^J% + paragraph.^^J^^J% + But almost certainly you typed the command \protect\@\morehelp@e^^J% + (maybe hidden in a previous macro definition).^^J% + TeX did not recognize the remaining characters^^J% + as a part of the command name, because @ is not^^J% + a letter and usually cannot go in a control sequence.^^J% + \expandafter\ifx\csname @\morehelp@e\endcsname\relax + On the other hand \protect\@\morehelp@e\space is not even^^J% + a valid command name, so maybe I'm wrong here.^^J% + \fi + ^^J% + Enclose your code in \protect\makeatletter\protect\makeatother^^J% + pairs and TeX will be happy. But are you sure you should touch^^J% + LaTeX's internals? This is slippery ground% + }{% + I have reinserted the probable command sequence to be read again. + } + \csname @\morehelp@e\endcsname + \fi + }% +\endgroup +\endinput + + + + diff --git a/macros/latex/contrib/morehelp/morehelp.eng b/macros/latex/contrib/morehelp/morehelp.eng new file mode 100644 index 0000000000..ab0e588b08 --- /dev/null +++ b/macros/latex/contrib/morehelp/morehelp.eng @@ -0,0 +1,249 @@ +% morehelp.eng version 0.1 1997 by Olaf Kummer +% +% see morehelp.README for explanations +% +% It contains a list of the error messages for which we can provide +% a more elaborate description. \morehelp@try{prefix}{message} +% suggests that the message might be output, if the current +% error text starts with the prefix. It is sometimes +% impossible to match the complete error message as there +% might be variable parts. It might be useful to parse +% the variable parts to get a more detailed picture of the +% error. +% +% \morehelp@try@expand will expand its second argument +% for checking conditions like math mode etc. +% +% These error messages are sorted according to the +% alphabetic characters of the message, ignoring any +% backslashes or other special characters. +% +% Great care must be taken so that no spurious spaces +% are present in this text. +% +\morehelp@try{Bad \protect\line\space or \protect\vector\space argument}{% + You were using a picture environment and LaTeX did not like + your syntax of the line drawing commands. Check the source}% +% +\morehelp@try@expand{Bad math environment delimiter}{% + \ifmmode + You probably used \noexpand\protect\noexpand\( or + \noexpand\protect\noexpand\[ at a point where you were^^J% + already in math mode. Maybe you failed to close math mode^^J% + earlier on\if@additional@error, or TeX was confused by an error and^^J% + wrongly switched to math mode\fi.\MessageBreak + ^^J% + On the other hand, you might be in math mode, but you started^^J% + math mode with \noexpand\protect\noexpand\[ and stopped with + \noexpand\protect\noexpand\) or vice versa% + \else + You probably used \noexpand\protect\noexpand\) or + \noexpand\protect\noexpand\] at a point where you were^^J% + not in math mode. Either you failed to start math mode^^J% + earlier on, or TeX was confused by an error and^^J% + wrongly switched to math mode% + \fi}% +% +\morehelp@try{Can be used only in preamble}{% + You issued a command like \protect\documentclass,^^J% + \protect\includeonly, \protect\makeindex, \protect\makeglossary, or^^J% + \protect\nofiles\space after LaTeX started the body of the^^J% + document. Move it where it belongs}% +% +\morehelp@try{Command \@backslashchar\reserved@a\space already defined}{% + You have probably declared a command using \protect\newcommand.^^J% + The name you chose was already in use, so LaTeX complained.^^J% + Choose a different name for your macro, or use^^J% + \protect\renewcommand\space if you absolutely have to redefine^^J% + this command}% +% +% The next two cannot be distiguished by the current means. +\morehelp@try@expand{Command \protect}{% ... invalid in math mode + % ... unavailable in encoding ... + \ifmmode + You probably used a text command in math mode. If you^^J% + switched to math mode without wanting to, correct^^J% + that error first. If you wanted to use this command^^J% + in math mode, temporarily switch to text mode using a box^^J% + or find some suitable math mode macro as a replacement.^^J% + ^^J% + There is an off chance that you issued the offending^^J% + command from within the wrong font encoding% + \else + You used an enconding specific command from within the^^J% + wrong encoding% + \fi}% +% +\morehelp@try{Counter too large}{% + You tried to print the content of a counter as a letter and^^J% + the counter was greater than 26. This might happen if^^J% + you have too many appendices, extremely long enumerations, or too^^J% + many footnotes on a minipage. This is usually an indicator^^J% + that the document structure should be improved. If you^^J% + absolutely need it this way, use numbers instead of letters}% +% +%\morehelp@try{Environment}{% ... undefined +%}% +% can be caused by \renewenvironment and by \begin. +% This requires entirely different error messages. +% As the ordinary messages are pretty clear, I will not +% try to make any guesses. +% +\morehelp@try{Float(s) lost}{% + You used a floating object (a \protect\marginpar, a figure, or^^J% + a table) within a vertical box (a minipage, a parbox, or^^J% + even a footnote). The error is probably much earlier in the^^J% + document. Look at the output to determine which float was lost}% +% +\morehelp@try{\ifcase }% Illegal character\or + % Missing @-exp\or Missing p-arg\fi\space in array arg +{% + In the formating parameter of a tabular or a multicolumn^^J% + command you did not adhere to the right syntax.^^J% + Maybe you left out a mandatory argument or you specified^^J% + an illegal format character}% +% +\morehelp@try{\string\<\space in mid line}{% + You used the command \protect\<\space when you were not^^J% + at the beginning of a line in your tabbing environment.^^J% + Either you forgot a line break or you wanted to use a different^^J% + command (like \protect\>) or you missed another command somewhere}% +% +\morehelp@try{Lonely \string\item--perhaps a missing list environment}{% + If you did specify a list and if the offending \protect\item^^J% + command is indeed inside the list, maybe the list was^^J% + terminated too early by a different \protect\end\space command}% +% +\morehelp@try{Missing \protect\begin}{% ...{document} + Somehow LaTeX began the actual typesetting process^^J% + before it encountered the \protect\begin{document}^^J% + command. If there were other errors before, try to tackle^^J% + those first.^^J% + ^^J% + But maybe you forgot a comment sign somewhere? Or you^^J% + forgot a \protect\ so that LaTeX treated a command name^^J% + as text? Perhaps you really typed text in the preamble?^^J% + Did you invoke a command like \protect\tableofcontents\space in the^^J% + preamble? It belongs in the text body. However improbable,^^J% + it is possible that you left out the \protect\begin{document}}% +% +\morehelp@try{No counter}{% ... defined + LaTeX tried to access a counter that is unknown.^^J% + Either you misspelled the name, or you misspelled the name^^J% + during the definition. Or maybe you tried to reference^^J% + a counter like chapter that does not exist in all^^J% + document classes}% +% +\morehelp@try{\noexpand}{% ... undefined + You were applying \protect\renewcommand^^J% + to a command that has not been defined before. Check your^^J% + spelling. If that is right, use \protect\newcommand\space or^^J% + \protect\providecommand}% +% +\morehelp@try{\noexpand\verb ended by end of line}{% + The argument of a \protect\verb\space command must not span^^J% + multiple lines. And by the way, it is not delimited^^J% + by braces, but by two identical characters to the left^^J% + and to the right}% +% +\morehelp@try{\noexpand\verb illegal in command argument}{% + \protect\verb\space must not be used inside the arguments of other^^J% + commands. Move the \protect\verb\space outside the offending^^J% + command or try to replace it by an environment}% +% +\morehelp@try{Not in outer par mode}{% + You inserted a floating item like a \protect\marginpar\space command,^^J% + a figure, or a table, but you were inside another^^J% + box construction. Move the floating item to a place^^J% + where you are typesetting ordinary text. You will probably^^J% + get some more errors due to this one}% +% +\morehelp@try{\protect\begin}{% {...} ended by \end{...} + Your environments are not properly nested. Maybe you^^J% + forgot to terminate a previous environment? Or you^^J% + changed an environment (like enumerate and itemize)^^J% + and forgot to adapt the end?^^J% + ^^J% + You might want to look at the output to determine which^^J% + environment caused the trouble. If you cannot spot^^J% + the error, try to uncomment parts of your document}% +% +\morehelp@try{\protect\pushtabs\space and \protect\poptabs + \space don't match}% +{% + In a tabbing environment you did not match every^^J% + \protect\pushtab\space by a \protect\poptab, or there were too many^^J% + \protect\pushtab\space commands. Look at the source and count}% +% +\morehelp@try{Something's wrong--perhaps a missing \protect\item}{% + Usually you left out an \protect\item\space in a list environment.^^J% + Note that the problem is reported a bit too late, namely at^^J% + the end of the list or just after the first \protect\item\space that you^^J% + have actually inserted. It is even possible that a wrongly^^J% + placed \protect\item\space triggers this error.^^J% + ^^J% + It might also be that you used the command \protect\addvspace^^J% + in the middle of a paragraph. It must only be used between^^J% + two paragraphs}% +% +\morehelp@try{\string\include\space cannot be nested}{% + You tried to use \protect\include in a file that was^^J% + itself included by \protect\include. Perhaps you meant^^J% + to use \protect\input instead? If not, restructure^^J% + your document}% +% +\morehelp@try{Tab overflow}{% + Possibly the tabbing environment that is currently processed is^^J% + simply too complex. You might consider a different structure of^^J% + your table, but first look at the source to see if the syntax^^J% + was used correctly}% +% +\morehelp@try{There's no line here to end}{% + You used \protect\newline, \protect\linebreak, \protect\\ or^^J% + the like, but you did not start a paragraph yet. If^^J% + you want to insert text later, better leave out the^^J% + offending command until then. If you wanted to achieve^^J% + a vertical spacing effect, better use \protect\bigskip,^^J% + \protect\vspace, and the related commands}% +% +\morehelp@try{This may be a LaTeX bug}{% + Probably this isn't a LaTeX bug. Maybe LaTeX got screwed^^J% + up by earlier errors. Maybe you redefined an internal ^^J% + macro of LaTeX. If this isn't the case, look at the output^^J% + and call a wizard}% +% +\morehelp@try{Too deeply nested}{% + You used too many lists (list, enumerate, itemize)^^J% + nested within each other. Maybe you forgot to terminate^^J% + a previous list? If you did not, you might have to rethink^^J% + the document structure in order to reduce the depth of the^^J% + nesting}% +% +\morehelp@try{Too many columns in eqnarray environment}{% + Usually exactly three columns should be used in an^^J% + eqnarray environment. Maybe you forgot a line break?^^J% + If you need more than three columns, try the array^^J% + environment}% +% +\morehelp@try{Too many unprocessed floats}{% + LaTeX has accumulated a lot of floating items and can only^^J% + proceed by forgetting some of them. Floating items might be^^J% + \protect\marginpars, figures, or tables. ^^J% + ^^J% + If you do not use \protect\marginpars, see if you issue many figure ^^J% + environments in quick succession, possibly without any interleaving^^J% + text. In that case, you might first try to add a \protect\clearpage^^J% + now and then.^^J% + ^^J% + On the other hand, you might have enough ordinary text, but some of^^J% + your figures cannot be placed appropriately, such figures will be ^^J% + delayed by LaTeX until the very end of a chapter. Overly restrictive^^J% + placement arguments, e.g. [h], might also cause this problem}% +% +\morehelp@try{Undefined tab position}{% + You were using a tabbing environment and tried to access a tab mark^^J% + that was not specified. Maybe you even left out a line break}% +% +\endinput +% + diff --git a/macros/latex/contrib/morehelp/morehelp.sty b/macros/latex/contrib/morehelp/morehelp.sty new file mode 100644 index 0000000000..2ff373ecb5 --- /dev/null +++ b/macros/latex/contrib/morehelp/morehelp.sty @@ -0,0 +1,134 @@ +% morehelp.sty version 0.1 1997 by Olaf Kummer +% +% see morehelp.README for explanations +% +\NeedsTeXFormat{LaTeX2e}[1997/12/01] +\ProvidesPackage{morehelp}[1997/02/18 More Help Package V0.1] + +% Save the original definition. +\let\morehelp@latex@error=\@latex@error + +% Define some auxillary macros. +\def\morehelp@iftrue{\iftrue} +\def\morehelp@iffalse{\iffalse} + +% It is helpful to distinguish the first error. +\newif\if@additional@error +\@additional@errorfalse + +% Check if the second argument is a prefix of the +% first argument. Arguments are delimited by plus signs. +\def\morehelp@ifmatches#1#2+#3#4+{% + \def\morehelp@a{#1}% + \def\morehelp@b{#2}% + \def\morehelp@c{#3}% + \def\morehelp@d{#4}% + \ifx\morehelp@d\@empty + \ifx\morehelp@a\morehelp@c + \def\morehelp@return{\morehelp@iftrue}% + \else + \def\morehelp@return{\morehelp@iffalse}% + \fi + \else\ifx\morehelp@b\@empty + \def\morehelp@return{\morehelp@iffalse}% + \else\ifx\morehelp@a\morehelp@c + \def\morehelp@return{% + \expandafter\expandafter\expandafter\morehelp@ifmatches + \expandafter\morehelp@b\expandafter+\morehelp@d+}% + \else + \def\morehelp@return{\morehelp@iffalse}% + \fi\fi\fi + \morehelp@return +} + +% Check if the first argument is a prefix of the +% current error message. If yes, replace the current +% help message by the second argument. +\def\morehelp@try@#1#2#3{% + % Is this the error message we are looking for? + \expandafter\morehelp@ifmatches\morehelp@msg.+#2+% + % Yes, but is it helpful? + #1\morehelp@a{#3}% + \ifx\morehelp@a\@empty\else + % Replace the help message. + \let\morehelp@help=\morehelp@a% + \fi + \fi +} + +% The help text is given as is, without choices. +\def\morehelp@try{\morehelp@try@\def} + +% The help text is expandable and will try some tricks to be more precise. +\def\morehelp@try@expand{\morehelp@try@\edef} + +% Redefine the internal error handling routine of LateX. +\def\@latex@error#1#2{% + % Are we on safe ground? + \ifx\protect\relax + {% Yes, proceed with analysis. + % Inhibit looping. + \let\@latex@error=\morehelp@latex@error + % Keep track of the actual error. + \def\morehelp@msg{#1}% + \let\morehelp@help\@empty% + % See if we can find a better help message. + % + % We read the file with the messages now. Slower and somewhat + % more error prone than reading it ahead of time, but + % more memory efficient. + \makeatletter + \@@input morehelp.eng\relax + \makeatother + % Now we output the error. + \ifx\morehelp@help\@empty + \@latex@error{#1}{#2} + \else + \GenericError{% + \space\space\space\@spaces\@spaces\@spaces + }{% + LaTeX Error: #1% + }{% + \morehelp@help.^^J^^J% + See the LaTeX manual or LaTeX Companion for further explanation.% + }{#2}% + \fi + \@additional@errortrue + }% + \else + % No, we might run into trouble. Better be invisible. + \morehelp@afterfi\morehelp@latex@error{#1}{#2}% + \fi +} + +\let\@latexerr\@latex@error + +% Try to catch the most obvious catcode error. + +\def\morehelp@a{\spacefactor\@m} +\def\morehelp@afterelse#1\else#2\fi{\fi#1} +\def\morehelp@afterfi#1\fi{\fi#1} + +\ifx\morehelp@a\@% + % Nobody clobbered \@, so we try to redefine it. + \def\@{% + % Are we ok? + \ifhmode + % Yes, probably the user knows what to do. + \morehelp@afterelse\spacefactor\@m + \else + \expandafter\morehelp@atcommand + \fi + } + \begingroup + \makeatother + \expandafter\global\expandafter\let\csname morehelp@atsign\endcsname=@ + \endgroup + + \def\morehelp@atcommand{% + \ifx\morehelp@modefor@err\undefined + \@@input morehelp.dyn\relax + \fi + \morehelp@atcommand + } +\fi -- cgit v1.2.3