


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Outdated and superseded latex commands, classes, and packages, along with their alternatives. It also includes a warning system that alerts users when these obsolete elements are used in their latex documents.
Typology: Papers
1 / 26
This page cannot be seen from the preview
Don't miss anything!
Abstract Old habits die hard. All the same, there are commands, classes and packages
the use of those. As an example, we provide an extension that detects many of the
4.1 The caption package............................... 18 4.2 The subfig package................................ 18 4.3 The float package................................. 22 4.4 The topcapt package and the subfig package................. 22 4.5 The rotating package............................... 23
∗This document corresponds to nag 0.61, dated 2008/02/10. Other versions can be found at
http://absatzen.de/ †ulmi@absatzen.de
1 User-side considerations.
1.1 Installation.
tion docs. (This is recommended if you plan to extend nag to handle your own pack-
that nag can generate.
1.2 Usage.
\RequirePackage[l2tabu, orthodox]{nag}
1.3 Known bugs
1.4 nag-l2tabu.cfg
35 \nag@singledollar}% 36 }% 37 }{% 38 %% in pdf context, just be a math shift. This creates the "math 39 %% shift not allowed" warnings we all love. 40 \nag@singledollar 41 }% 42 }
If the user doesn’t load hyperref, we have to fake its \texorpdfstring command. Note that this will break any package that is foolish enough to detect hyperref by testing for
43 \AtBeginDocument{\providecommand\texorpdfstring{@firstoftwo}} 44 \AtBeginDocument{\catcode‘$\active}%$
45 \bgroup 46 \catcode‘$\active%$ 47 \gdef\nag@maybe@dispmath{% 48 \bgroup 49 \let@sptoken\nag@quark% prevent skipping of spaces 50 @ifnextchar${%$% 51 \ifmmode 52 % we already warned upon entering. 53 \else 54 \nag@warn{% 55 \nag@doubledollar...\nag@doubledollar\space is obsolete.\MessageBreak 56 Use \string[...\string] et al. instead}% 57 \fi 58 \egroup\expandafter\nag@doubledollar@gobble 59 }{% 60 \egroup\nag@singledollar 61 }% 62 } 63 % we do the assignment here, which means any package that redefines 64 % $ as well will silently disable us. This is a feature. 65 \global\let$\nag@maybedispmath%$ 66 \egroup
67 \AtBeginDocument{% 68 @ifpackageloaded{rcs}{% 69 % this redefinition is functionally equivalent, 70 % but does not share actual code. 71 \renewcommand\RCS{\bgroup%
72 \catcode‘_ =\active 73 \catcode‘$=3 % this line added for compatibility. 74 \csname RCS_get_argument\endcsname 75 } 76 \PackageInfo{nag}{rcs.sty hack applied}% 77 }{}% 78 @ifpackageloaded{svninfo}{% 79 \g@addto@macro@svnBeginRead{\catcode‘$ 3 }% 80 \PackageInfo{nag}{svninfo.sty hack applied}% 81 }{}% 82 @ifpackageloaded{svn}{% 83 \PackageInfo{nag}{svn.sty is broken: disabling dollar check}% 84 \catcode‘$ 3 85 }{}% 86 @ifpackageloaded{rcsinfo}{% 87 \PackageInfo{nag}{rcsinfo.sty is broken: disabling dollar check}% 88 \catcode‘$ 3 89 }{}% 90 @ifpackageloaded{pgf}{% 91 \PackageInfo{nag}{pgf.sty is broken: disabling dollar check}% 92 \catcode‘$ 3 93 }{}% 94 } 95 96 97 %% \S 1.7 cannot reasonably be checked programmatically 98 %% \S 1.8 \sloppy is called by parbox, among others, and would 99 %% give many spurious warnings. 100 %% \S 2.1. 101 \ObsoleteCS[an old LaTeX 2.09 command]{bf} 102 {\protect\bfseries\space or \protect\textbf} 103 \ObsoleteCS[an old LaTeX 2.09 command]{it} 104 {\protect\itshape\space or \protect\textit} 105 \ObsoleteCS[an old LaTeX 2.09 command]{rm} 106 {\protect\rmfamily\space or \protect\textrm} 107 \ObsoleteCS[an old LaTeX 2.09 command]{sc} 108 {\protect\scshape\space or \protect\textsc} 109 \ObsoleteCS[an old LaTeX 2.09 command]{sf} 110 {\protect\sffamily\space or \protect\textsf} 111 \ObsoleteCS[an old LaTeX 2.09 command]{sl} 112 {\protect\slshape\space or \protect\textsl} 113 \ObsoleteCS[an old LaTeX 2.09 command]{tt} 114 {\protect\ttfamily\space or \protect\texttt} 115 \ObsoleteCS[an old LaTeX 2.09 command]{cal} 116 {\protect\mathcal}% Hmm, this is not in l2tabu? 117 %% \S 2.1. 118 %% Gone with 1.8 because this never worked for the kernel \frac anyway. 119 %% \ObsoleteCS[TeX]{over}{\protect\frac} 120 %% \ObsoleteCS[TeX]{choose}{\protect\frac\space or amsmath’s \protect\binom} 121 %% \S 2.1.
172 % \changes{0.53}{2007/03/21}{topcapt support.} 173 \g@addto@macro\nag@captions{,caption,captionabove,captionbelow,hc@caption,topcaption}% 174 175 %% \S 3. 176 \NotAnEnvironment{appendix}% 177 %% In the same vein: 178 @for\sectioning:=frontmatter,mainmatter,backmatter\do{% 179 \expandafter\NotAnEnvironment\expandafter{\sectioning}% 180 } 181 %% \S 3. 182 %% It’s more trouble than it’s worth to have another warning for 183 %% align*, since it passes through align. 184 \ObsoleteEnv{eqnarray}{amsmath’s align} 185 %% \S 3.4 -- nothing to be done --
1.5 nag-orthodox.cfg
186 \ProvidesFile{nag-orthodox.cfg} 187 [2006/04/19 v1.8 strict rules for nag.sty (ulmi)] 188 @for\fontcmd:=tiny,small,footnotesize,normalsize,large,Large,% 189 LARGE,huge,Huge\do{% 190 \expandafter\NotAnEnvironment\expandafter{\fontcmd}% 191 }% 192 @for\fontcmd:=sffamily,rmfamily,ttfamily,% 193 bfseries,mdseries,scshape,% 194 itshape,upshape\do{% 195 \expandafter\NotAnEnvironment\expandafter{\fontcmd}% 196 }% 197 @for\justsw:=centering,raggedleft,raggedright,% 198 RaggedLeft,RaggedRight\do{% 199 \expandafter\NotAnEnvironment\expandafter{\justsw}% 200 } 201 @for\justenv:=center,flushleft,flushright\do{% 202 \expandafter\NotASwitch\expandafter{\justenv}% 203 }
1.6 nag-abort.cfg
204 \ProvidesFile{nag-abort.cfg} 205 [2007/11/10 v0.2 treat complaints as errors (ulmi)] 206 \DeclareRobustCommand\nag@warn[1]{%
207 \addtocounter{nag@sins}{1}% 208 \PackageError{nag}{#1}{#1}% 209 } 210 \DeclareRobustCommand\nag@warnNoLine[1]{% 211 \addtocounter{nag@sins}{1}% 212 \PackageError{nag}{#1}{#1}% 213 }
1.7 nag-experimental.cfg
214 \ProvidesFile{nag-experimental.cfg} 215 [2009/07/04 v0.62alpha2 experimental additions to nag (ulmi)]
216 \let@xa\expandafter 217 \newif\ifnag@dofloatsizecheck 218 \newif\ifnag@allfloatpositionsfailed 219 \newcommand\nag@allfloatsizechecks{}% 220 \newcommand\nag@onefloatsizecheck[2]{% 221 % #1 is size fraction of textheight, 222 % #2 is position to say in warning. 223 \ifdim \ht@currbox>#1\textheight 224 @tempdima -#1\textheight 225 \advance @tempdima \ht@currbox 226 \PackageInfo{nag}{Float too large for #2 by \the@tempdima}% 227 % note we do not truncate. 228 % also, it’s too late to add "p" now. 229 \else 230 \nag@allfloatpositionsfailedfalse 231 \fi 232 } 233 % @currbox is current float box, 234 % @fps is the current list of float specifiers. 235 \renewcommand@largefloatcheck{% 236 \ifdim \ht@currbox>\textheight 237 @tempdima -\textheight 238 \advance @tempdima \ht@currbox 239 @latex@warning {Float too large for page by \the@tempdima}% 240 \ht@currbox \textheight 241 \fi 242 %% the preceding is the original check. 243 \nag@dofloatsizechecktrue 244 \nag@allfloatpositionsfailedtrue 245 \def\nag@allfloatsizechecks{}% 246 @xa@xa@xa@tfor@xa@xa@xa\nag@fltsz@tmp@xa@xa@xa:@xa@xa@xa=\csname @fps\endcsnam 247 \ifx\nag@fltsz@tmp\relax 248 \nag@dofloatsizecheckfalse 249 \fi
2 Author-side considerations and implementation.
If you are a package or class author and want to extend the range of nag (or prevent nag from criticizing your macros), please see the description below, in sections 2.
2.1 Low-level tools.
300 \NeedsTeXFormat{LaTeX2e} 301 \ProvidesPackage{nag}[2009/07/30 0.62 warning about old commands (ulmi)] 302 \let@xa\expandafter 303 \let@nx\noexpand
304 \newcounter{nag@c} 305 \renewcommand\thenag@c{\roman{nag@c}}% 306 \setcounter{nag@c}{1}% 307 \begingroup 308 \let@addtoreset@gobbletwo 309 \newcounter{nag@sins}% 310 \endgroup
Niepraschk (savesym))
311 \newcommand\nag@ifundefined[1]{% 312 \begingroup 313 @ifundefined{#1}{\endgroup@firstoftwo}{\endgroup@secondoftwo}% 314 }
315 \newcommand\nag@prepend[2]{%
316 \nag@ifundefined{#1}{% 317 % if it doesn’t exist, don’t do anything. 318 \PackageInfo{nag}{% 319 Command @backslashchar#1\space not defined, skipping amendment% 320 }% 321 }{% 322 \nag@ifundefined{#1 }{% 323 \let\nag@maybespace@empty 324 }{% 325 \let\nag@maybespace\space 326 %\PackageInfo{nag}{% 327 % Command @backslashchar#1\space appears robust\MessageBreak 328 % Modifying ‘@backslashchar#1\space’ instead. 329 %}% 330 }% 331 @xa\let 332 \csname nag@@#1@\thenag@c@xa\endcsname 333 \csname #1\nag@maybespace\endcsname 334 @xa\DeclareRobustCommand\csname nag@@warning@\thenag@c@xa\endcsname{% 335 #2% 336 }% 337 @xa\nag@pr@p@nd\csname #1\nag@maybespace@xa\endcsname 338 \csname nag@@#1@\thenag@c@xa\endcsname 339 \csname nag@@warning@\thenag@c@xa\endcsname
340 \stepcounter{nag@c}% 341 }% 342 } 343 \newcommand\nag@pr@p@nd[3]{% 344 \def#1{#3#2}% 345 }
346 \DeclareRobustCommand\nag@warn{% 347 \addtocounter{nag@sins}{1}% 348 \PackageWarning{nag}% 349 } 350 \DeclareRobustCommand\nag@warnNoLine{% 351 \addtocounter{nag@sins}{1}% 352 \PackageWarningNoLine{nag}% 353 }
2.2 Obsoletifying commands.
384 % Sommer for finding this bug. 385 \expandafter\ifx\csname #1\endcsname\relax 386 \else 387 % it’s there after all 388 \let\tmp@a@firstoftwo 389 \fi 390 \fi 391 \tmp@a{#2}{#3}% 392 \endgroup 393 }%
394 \global\let\nag@ifcsname\nag@ifcsname 395 }{}
396 \newcommand\ObsoletePackage[3][obsolete]{% 397 \AtEndDocument{% 398 % |@clsextension| is onlypreamble, for some reason. 399 \nag@ifcsname{ver@#2.sty}{% 400 \nag@warnNoLine{% 401 Package #2 is #1.\MessageBreak 402 Use #3 instead}% 403 }{}% 404 }% 405 }
406 \newcommand\ObsoleteClass[3][obsolete]{% 407 \AtEndDocument{% 408 % |@clsextension| is onlypreamble, for some reason. 409 \nag@ifcsname{ver@#2.cls}{% 410 \nag@warnNoLine{% 411 Class #2 is #1.\MessageBreak 412 Use #3 instead}% 413 }{}% 414 }% 415 }
2.4 Common float errors and no-nos.
in the float already. Package writers may want to set these manually behind nag’s back.
416 \newif\ifnag@haslabel 417 \newif\ifnag@hascaption\nag@hascaptiontrue
418 \newcommand\nag@hackfloat[1]{% 419 \nag@prepend{#1}{% 420 \global\nag@haslabelfalse\global\nag@hascaptionfalse 421 }% 422 \nag@prepend{end#1}{% 423 \ifnag@hascaption\relax\else 424 \nag@warn% 425 {#1 with no \protect\caption}% 426 \fi 427 % labels outside floats shouldn’t complain: 428 \global\nag@hascaptiontrue 429 % (we do this always because it needs to be global) 430 }% 431 }
432 \AtBeginDocument{% 433 \g@addto@macro{@preamblecmds}{%
471 \else 472 \typeout{No complaints by nag.}% 473 \fi 474 }% 475 }
3 Switch vs. Environment
476 \DeclareRobustCommand\nag@ifCurrentEnvironment[3]{% 477 \bgroup 478 \def\tmp@a{#1}% 479 \ifx@currenvir\tmp@a 480 #2% 481 \else 482 #3% 483 \fi 484 \egroup 485 }
486 \newcommand\NotAnEnvironment[1]{% 487 \AtBeginDocument{% 488 \nag@prepend{#1}{% 489 \nag@ifCurrentEnvironment{#1}{% 490 \nag@warn{% 491 There is no environment ‘‘#1’’.\MessageBreak 492 Maybe you want a grouped @backslashchar# 493 }% 494 }{% OK case. 495 }% 496 }% 497 }% 498 }
499 % we need to maintain a stack of environments that are used in the 500 % \foo...\endfoo way. 501 \newcommand\nag@envstack{\relax} 502 503 \DeclareRobustCommand\nag@beginenv[1]{% 504 % push a begin-entry onto the stack. Form is 505 % |{\foo{lineno}}| for environment foo. 506 \bgroup 507 @xa\toks@@xa{\nag@envstack}% 508 \xdef\nag@envstack{% 509 @nx{% 510 @xa@nx\csname #1\endcsname 511 @nx{\the\inputlineno@nx}% 512 @nx}% 513 \the\toks@ 514 }% 515 \egroup 516 } 517 \DeclareRobustCommand\nag@endenv[1]{% 518 % extract the first entry. 519 @xa\nag@end@nv\nag@envstack@nil #1@nil 520 } 521 522 \def\nag@end@nv#1#2@nil #3@nil{% 523 \def\tmp@a{#1}% 524 \def\tmp@b{\relax}% 525 \ifx\tmp@a\tmp@b 526 % This was the end-of-stack flag. 527 \nag@warn{‘‘@backslashchar end#3’’ without matching 528 ‘‘@backslashchar #3’’} 529 \else 530 % We may assume this is a proper entry. See if the begin-token on 531 % the stack matches what |\nag@endenv| was passed. 532 @xa\ifx\csname #3@xa\endcsname@firstoftwo #1% 533 %OK case, just pop the entry. 534 \gdef\nag@envstack{#2}% 535 \else 536 % error case 537 \nag@warn{% 538 You cannot close ‘‘@xa\string@firstoftwo #1’’ on line 539 @secondoftwo #1 with ‘‘@backslashchar end#3’’% 540 }% 541 % leave it on the stack. Some case of misnesting will always cause 542 % horrible amounts of follow-up errors. Also, scare them! 543 \fi 544 \fi 545 }
574 \def\nag@maybehacksubfig{% 575 % 576 % of course, i need to touch the single longest definition in 577 % subfig.sty, to amend one single command... 578 % 579 % The definition is taken from subfig.sty 1.3 dated 2005/07/05 by 580 % S.D. Chochran, where it is called sf@@@subfloat, and appears here 581 % under the conditions of section 6 of the LPPL 1.3. The subfig 582 % package is available on a CTAN mirror near you. 583 % 584 \long\def\nag@@original@@sf@@@subfloat##1[##2][##3]##4{% 585 @ifundefined{FBsc@max}{% 586 }{% 587 \FB@readaux{\let\FBsuboheight\relax}% 588 }% 589 @tempcnta=@ne 590 \if@minipage 591 @tempcnta=\z@ 592 \else\ifdim \lastskip=\z@ \else 593 @tempcnta=\tw@ 594 \fi\fi 595 \ifmaincaptiontop 596 \sf@top=\sf@nearskip 597 \sf@bottom=\sf@farskip 598 \else 599 \sf@top=\sf@farskip 600 \sf@bottom=\sf@nearskip 601 \fi 602 \leavevmode 603 \setbox@tempboxa \hbox{% 604 ##4}% 605 @tempdima=\wd@tempboxa 606 @ifundefined{FBsc@max}{% 607 }{% 608 \global\advance\Xhsize-\wd@tempboxa 609 \dimen@=\ht@tempboxa 610 \advance\dimen@\dp@tempboxa 611 \ifdim\dimen@>\FBso@max 612 \global\FBso@max\dimen@ 613 \fi 614 }% 615 \vtop\bgroup 616 \vbox\bgroup 617 \ifcase@tempcnta 618 @minipagefalse 619 \or 620 \vskip\sf@top
621 \or 622 \ifdim \lastskip=\z@ \else 623 @tempskipb\sf@top\relax@xaddvskip 624 \fi 625 \fi 626 \sf@ifpositiontop{% 627 \ifx @empty##3\relax \else 628 \sf@subcaption{##1}{##2}{##3}% 629 \vskip\sf@capskip 630 \vskip\sf@captopadj 631 \fi\egroup 632 \hrule width0pt height0pt depth0pt 633 \box@tempboxa 634 }{% 635 @ifundefined{FBsc@max}{% 636 \box@tempboxa 637 }{% 638 \ifx\FBsuboheight\relax 639 \box@tempboxa 640 \else 641 \vbox to \FBsuboheight{\FBafil\box@tempboxa\FBbfil}% 642 \fi}% 643 \egroup 644 \ifx @empty##3\relax \else 645 \vskip\sf@capskip 646 \hrule width0pt height0pt depth0pt 647 \sf@subcaption{##1}{##2}{##3}% 648 \fi 649 }% 650 \vskip\sf@bottom 651 \egroup 652 @ifundefined{FBsc@max}{% 653 }{% 654 \addtocounter{FRobj}{-1}% 655 \ifnum\c@FRobj=0\else 656 \subfloatrowsep 657 \fi 658 }% 659 \ifmaincaptiontop\else 660 \global\advance@nameuse{c@@captype}\m@ne 661 \fi 662 \endgroup\ignorespaces}% 663 % 664 \expandafter\ifx\csname sf@@@subfloat\endcsname\nag@@original@@sf@@@subfloat 665 % yup, that’s it. 666 \PackageInfo{nag}{OK, equivalent to subfig 1.3, redefining 667 @backslashchar sf@@@subfloat@gobble}% 668 \global\long\def\sf@@@subfloat##1[##2][##3]##4{% 669 @ifundefined{FBsc@max}{% 670 }{%