| 1 |
%% |
| 2 |
%% This is file `nagdemo.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% nag.dtx (with options: `nagdemo') |
| 8 |
%% This is a generated file. |
| 9 |
%% |
| 10 |
%% This file is part of the `nag' package. |
| 11 |
%% The `nag' package has the LPPL maintenance status: maintained. |
| 12 |
%% Current Maintainer is Ulrich M. Schwarz, [email protected] |
| 13 |
%% |
| 14 |
%% Copyright (C) 2005-8 by Ulrich M. Schwarz. |
| 15 |
%% |
| 16 |
%% This file may be distributed and/or modified under the |
| 17 |
%% conditions of the LaTeX Project Public License, either |
| 18 |
%% version 1.3a of this license or (at your option) any later |
| 19 |
%% version. The latest version of this license is in: |
| 20 |
%% http://www.latex-project.org/lppl.txt |
| 21 |
%% |
| 22 |
%% Test document: finding and complaining about obsolete macros. |
| 23 |
%% |
| 24 |
\RequirePackage[l2tabu, orthodox, experimental]{nag}[2007/12/21] |
| 25 |
\documentclass{article} |
| 26 |
%% some usual culprits |
| 27 |
\usepackage{times, a4wide, epsfig, palatino} |
| 28 |
%% some fancy packages |
| 29 |
\usepackage{subfig, topcapt, caption, hyperref} |
| 30 |
\begin{document} |
| 31 |
\typeout{Next: no complaint because frontmatter is not defined} |
| 32 |
\ifx\frontmatter\undefined |
| 33 |
\else |
| 34 |
\typeout{FAILURE! I shouldn't know frontmatter!} |
| 35 |
\fi |
| 36 |
\typeout{Next: no complaing about label outside float not preceded by caption} |
| 37 |
\section{Tests}\label{sec:tests} |
| 38 |
\typeout{Next: it and bf complaints} |
| 39 |
{\it italics {\bf not bold italics}} |
| 40 |
|
| 41 |
\typeout{Next: not-an-env complaints} |
| 42 |
\begin{Large} |
| 43 |
\begin{sffamily} |
| 44 |
Large and sans. |
| 45 |
\end{sffamily} |
| 46 |
\end{Large} |
| 47 |
|
| 48 |
\typeout{Next: center in float complaint} |
| 49 |
\begin{figure} |
| 50 |
\begin{center} |
| 51 |
Center in float. |
| 52 |
\end{center} |
| 53 |
\caption{\label{fig}Figs and dates.} |
| 54 |
\end{figure} |
| 55 |
|
| 56 |
\typeout{Next: no complaints: manually fake caption} |
| 57 |
\begin{figure} |
| 58 |
I have a caption, you just can't see it. |
| 59 |
\makeatletter\nag@hascaptiontrue\makeatother |
| 60 |
\label{date} |
| 61 |
\end{figure} |
| 62 |
|
| 63 |
\typeout{Next: no complaing about label outside float not preceded by caption} |
| 64 |
\section{More Tests}\label{sec:tests2} |
| 65 |
|
| 66 |
\typeout{Next: put-label-after-caption complaint} |
| 67 |
\begin{figure} |
| 68 |
\label{coconut}\caption{Preceded, not followed, by label.} |
| 69 |
\end{figure} |
| 70 |
|
| 71 |
\typeout{Next: no-caption complaint} |
| 72 |
\begin{figure} |
| 73 |
No caption, even a fake one. |
| 74 |
But too big, this should get bottom-of-page warning. |
| 75 |
\rule{1pt}{0.4\textheight} |
| 76 |
\end{figure} |
| 77 |
|
| 78 |
\typeout{Next: no complaint about subfloat and topcapt} |
| 79 |
\typeout{also: complaint about it in caption.} |
| 80 |
\begin{figure} |
| 81 |
\subfloat{\label{sf:1}Subfig number~\ref{sf:1} with label.} |
| 82 |
\subfloat[\label{sf:17}Strange subfig]{Subfig~\ref{sf:17} with label elsewhere.} |
| 83 |
\caption{Figure: \it's a sin!} |
| 84 |
\end{figure} |
| 85 |
|
| 86 |
\begin{figure} |
| 87 |
\topcaption{A topcaption.} |
| 88 |
\subfloat{\label{sf:2}Subfig~\ref{sf:2} with label, but no caption.} |
| 89 |
\end{figure} |
| 90 |
|
| 91 |
\typeout{Next: no robustness issues} |
| 92 |
\begin{minipage}{5cm} |
| 93 |
foo\footnote{bar} |
| 94 |
\end{minipage} |
| 95 |
|
| 96 |
\typeout{Shouldn't cause trouble to have dollars in headings.} |
| 97 |
\section{Maths tests, like if $1+1=2$} |
| 98 |
|
| 99 |
\typeout{Next: three complaints in total concerning $$ and eqnarray} |
| 100 |
|
| 101 |
A \TeX-style displayed equation: |
| 102 |
$$ 1+1=2 $$ |
| 103 |
|
| 104 |
Not an equation at all: |
| 105 |
$ $ 1+1=2 $ $ |
| 106 |
|
| 107 |
An in line equation: |
| 108 |
$1+1=2$ |
| 109 |
|
| 110 |
Two inline equations, double dollar is dollar dollar in resticted |
| 111 |
horizontal mode (onlyamsmath gets this wrong): |
| 112 |
$a+b=c$$1+1=2$ |
| 113 |
|
| 114 |
An eqnarray: |
| 115 |
\begin{eqnarray} |
| 116 |
1+1 &=& 2 |
| 117 |
\end{eqnarray} |
| 118 |
|
| 119 |
A bracket-style equation: |
| 120 |
\[1+1=2\] |
| 121 |
|
| 122 |
A starred eqnarray: |
| 123 |
\begin{eqnarray*} |
| 124 |
1+1 &=& 2 |
| 125 |
\end{eqnarray*} |
| 126 |
|
| 127 |
A double-dollar in a hbox: |
| 128 |
\hbox{$$} |
| 129 |
|
| 130 |
\typeout{Next: appendix complaints} |
| 131 |
\begin{appendix} |
| 132 |
\begin{center} |
| 133 |
It's a center environment. |
| 134 |
\end{center} |
| 135 |
\typeout{Next: no over complaint, centerline complaint, no frac complaint} |
| 136 |
Over etc. warning removed for compatibility with \LaTeX\ without amsmath. |
| 137 |
|
| 138 |
\centerline{Furthermore, $4\over 2=2$.} |
| 139 |
$\frac 42$ |
| 140 |
\end{appendix} |
| 141 |
\typeout{Next: unmatched endflushright} |
| 142 |
This is not flushright, in spite of a endflushright coming up. |
| 143 |
\endflushright |
| 144 |
\typeout{Next: unclosed center} |
| 145 |
{\center Smack in the middle, but center used as a switch\par} |
| 146 |
\typeout{Next: mismatched endflushright} |
| 147 |
|
| 148 |
Another endflushright, this is brace-mismatched and otherwise totally |
| 149 |
unsuited for closing the center command above. |
| 150 |
\endflushright |
| 151 |
|
| 152 |
\typeout{Next: a warning that is not uppercased.} |
| 153 |
\MakeUppercase{\it's a sin!} |
| 154 |
|
| 155 |
\typeout{Next: another warning about it in a caption, in the LoF this time.} |
| 156 |
\listoffigures |
| 157 |
\AtEndDocument{\typeout{You should get 25 warnings and one info in the log.}} |
| 158 |
\end{document} |
| 159 |
%%X Local Variables: |
| 160 |
%%X mode: latex |
| 161 |
%%X End: |
| 162 |
\endinput |
| 163 |
%% |
| 164 |
%% End of file `nagdemo.tex'. |