summaryrefslogtreecommitdiff
path: root/support/chktex/Test.tex
blob: 12854473552dfd04a353d4b1954cace09b7014e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
Note: This file was written with only two purposes in mind:
    o To test the program upon it
    o To show off some of the features

Most of the file does thus consist of lots of pseudo-commands, which
are nonsense in a TeXnical manner.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Warning 1

\foo This is an error.
So is this \foo
\smallskip This is a not. $\foo Neither$ is this.

% Warning 2

This is a faulty reference to \ref{foo}
This is not a faulty reference to~\ref{foo}

% Warning 3

$[(ab)^{-1}]^{-2}$  is not beautiful
${{[{(ab)}^{-1}]}}^{-2}$ is beautiful

% Warning 4-6, 28

Testing {\it italic} in \/ this {\em sentence\/}, as {\em you \/ see\/}.
Testing {\it italic\/} in this {\em sentence,} as {\em you see}.

% LaTeX2e

Testing \textem{italic} in \/ this \textit{sentence\/}, as \textem{you \/ see\/}.
Testing \textem{italic\/} in this \textit{sentence}, as \textem{you see}.

% Warning 7

This \'is a test of $\hat{j}$ accents.
This \'{\i}s a test of $\hat{\jmath}$ accents.

% Warning 8

It wasn't anything - just a 2---3 star--shots.
It wasn't anything --- just a 2--3 star-shots.
It's just a start-shot.
is also used to send cross-calls (xc) and cross-traps (xt) to other
% From Knuths TeXbook Chapter 14
% "How TeX Breaks Paragraphs into Lines", fourth paragraph:
in plain TeX---are the key

% Using DashExcpt
The Birch--Swinnerton-Dyer conjecture is correct.
The Birch--Swinnerton--Dyer conjecture is not correct.
The Birch-Swinnerton-Dyer conjecture is not correct (is now caught).

% Warning 9-10

% Brackets:

)}{[])} }}}]]])))
{[]} ((([[[{{{}}}]]])))

% Envs:

\begin{quux} \begin{baz} \end{quux} \end{baz} \end{asoi} \begin{dobedo}

\begin{foo} \begin{bar} \end{bar}\end{foo}

% Warning 47 -- ConTeXt environment mismatch -- split from 9
\startsection[title={Testing ConTeXt}]
These should now be an error.
\stoptext
\starttext

% (Un)fortunately, this is not an error
\begin{foo}
\startbar
\end{foo}
\stopbar

% Warning 11

Foo...bar. $1,...,3$. $1+...+3$. $1,\cdots,3$. $1\cdot\ldots\cdot3$.
Foo\dots bar. $1,\ldots,3$. $1+\cdots+3$. $1,\ldots,3$. $1\cdot\cdots\cdot3$.

% Warning 12

1st. Foo Inc. Ab.cd. foo ab.cd. Foo. bar baz., billy.; bob.: joe.! frank.? james.. george
1st.\ foo Inc.\ ab.cd.\ foo ab.cd.\ Foo.\ bar baz., billy.; bob.:\ joe.!\ frank.?\ james..\ george

% Bug 54751

Mr. ``X'' and Mrs. \(Y\)

% ignore commands by default
\Mr. ``X'' and \Mrs. \(Y\)

% Warning 13

Look at THIS! It's an error.
Look at THIS\@! It's an error. D. E. Knuth.

% after frenchspacing it's not an error
\frenchspacing
Look at THIS! It's not an error.
Look at THIS\@! It's not an error. D. E. Knuth.

% warning again
\nonfrenchspacing
Look at THIS! It's an error.
Look at THIS\@! It's not an error. D. E. Knuth.

% ignore commands by default
Look at \THIS\@! It's not an error. D. E. Knuth.

% Warning 14

\hat
\hat{a}

% Warning 18,19

Is this an "example", or is it an ´example´.
Is this an `example', or is it an `example'.

% Warning 20

That bug is \unknown\ to me.
% That bug is \unknown\ to me.

% Warning 21

\LaTeX\ is an extension of \TeX\. Right?
\LaTeX\ is an extension of \TeX. Right?

% Warning 23

```Hello', I heard him said'', she remembered.
``\,`Hello', I heard him said'', she remembered.

% Warning 24

Indexing text \index{text} is fun!
Indexing text\index{text} is fun!
Indexing text%
     \index{text} is fun!
Indexing text
     \index{text} is fun!

% Warning 25

$5\cdot10^10$
$5\cdot10^{10}$

% Warning 26

Do you understand ?
Do you understand?

% Warning 27

\input input.tex
\input input
\input input/file

% Warning 29
The program opens a screen sized 640x200 pixels
The program opens a screen sized $640\times200$ pixels
Approximately $\frac{2x}{1+x}$ $x$s shouldn't be errors.

% Warning 30

White           is a beautiful colour.
White is a beautiful colour.

% Warning 31
\begin{verbatim}
\this is
\end{verbatim} foo bar

% Warning 32-34

This is either an 'example`, an ''example`` or an `"`example'`'.
This is either an `example', an ``example'' or an ``example''.

% Warning 35

$sin^2 + cos^2 = 1$
$\sin^2 + \cos^2 = 1$

% Warning 36-37

This( an example( Nuff said )), illustrates( ``my'' )point.
This (an example (Nuff said)), illustrates (``my'') point.

% Warning 38
``An example,'' he said, ``would be great.''
``An example'', he said, ``would be great''.

% Warning 39

For output codes, see table ~\ref{tab:fmtout}.
For output codes, see table~\ref{tab:fmtout}.

% Warning 40
$\this,$ and $$this$$.
$\this$, and $$this.$$

% Warning 41
foo \above qux
\frac{foo}{qux}

% Warning 42
This is a footnote \footnote{foo}.
This is a footnote\footnote{foo}.

% Warning 43
Here is a mistake $\left{x\right}$.
This one triggers warning 22 $\left\{x\right\}$.
Here \chktex\ doesn't complain $\left\lbrace x\right\rbrace$.

% Warning 44 -- user regex -- default message
You should always write a good intro.
You should always write a good introduction.

% Warning 44 -- user regex -- user message
For every $p\not|n$ you have an ugly prime which doesn't divide $n$.
For every $p\nmid n$ you have a cute prime which doesn't divide $n$.

% Warning about optional arguments inside optional arguments
\begin{something}[\cite2[1231]{adadsd}]\end{something}
[dasd{dasda[ ads[ dasd ]]}]
adssd[ {}[]]
\begin{something}[\cite{adadsd}[1231]]\end{something}
\begin{something}[ ][\cite{adadsd}[1231]]\end{something}

% Shouldn't warn
\begin{something}[{\cite{adadsd}[1231]}]\end{something}
\begin{something}[{\cite{{adadsd}}[1231]}]\end{something}
\begin{something}[{\cite{adadsd}[1231]}]\end{something}
\begin{something}[ ]{\cite{adadsd}[1231]}\end{something}
\begin{something}[ ][{\cite{adadsd}[1231]}]\end{something}
\begin{something}[{} ]{\cite{adadsd}[1231]}\end{something}


% Math mode check
\ensuremath{sin x\text{is not the same as sin x, but is the same as $sin x$}}
Also, $x(3)\text{ is not x(3) but it is $x(3)$}$

% breqn mode check
\begin{darray*}
sin x
\begin{dsuspend}
is not the same as sin x, but is the same as $sin x$
\end{dsuspend}
\end{darray*}

This is\\% a comment. Nothing here should be checked(right)?
a broken line.
But this is not a \% comment, so we should find this error(right)?

Here(on this line only)is a warning $sin(x)$ suppressed. % chktex 36 chktex 35
Here(on this line only)is a warning $sin(x)$ suppressed. % CHKTEX 35 36

In section~\ref{sec:3} we have a warning.
In section~\ref{sec:4} it is suppressed. % chktex -1
% In section~\ref{sec:5} we don't have a warning.

\begin{tabular*}{1.0\linewidth}[h]{|c|cc|}
  a & b \\
  \hline
  c & d
\end{tabular*}

% Verb check

\verb@\this is )() lots of errors, etc. Or what?@
\verb#

\begin{verbatim}
\this is
\end{verbatim} FOO

% WipeArg
\autocite[34-35]{text--1---1}

% Bug 60197 -- "double math mode" should be handled okay
\begin{align}
    \begin{array} {l}
        abc
    \end{array} \\
    3 - 2 = 1
    \pi
\end{align}


% Warning 49

\]

% Warning 16,15

$$(

% Local Variables:
% require-final-newline: nil
% End:
% There should be no newline at the end of this file to test bug #46539