summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/proof-at-the-end/proof-at-the-end_demo.tex
blob: f7e9f33ad94bd5cbc2c84e0f9bb03bf87cc95cbe (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
\documentclass{article}

\usepackage{amssymb, amsthm, amsmath}
\usepackage{hyperref}
% Load the package (put the proof-at-the-end.sty file in the working directory)
\usepackage{proof-at-the-end} % with default options...
% Or by putting in the 'conf' option the default configuration you want:
%\usepackage[conf={normal, one big link}]{proof-at-the-end}
%\usepackage[conf={normal, one big link=Goto proof}]{proof-at-the-end}
%\usepackage[conf={one big link translated=Aller à la preuve page}]{proof-at-the-end}
%\usepackage[conf={text link section}]{proof-at-the-end}

%%% If you want to use options with macros, you cannot
% use directly the package options, so just modify
% the global custom defaults like that:
% \pgfkeys{/prAtEnd/global custom defaults/.style={
%     text link={\hyperref[proof:prAtEnd\pratendcountercurrent]{See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent}}}
%   }
% }
%%% You can also easily modify the gloabl/locals defaults in other parts of the code using:
% \pgfkeys{/prAtEnd/local custom defaults/.style={
%     category=greattheorem
%   }
% }
%%% Or create new styles to apply:
% \pgfkeys{/prAtEnd/great category/.style={
%     category=greattheorem
%   }
% }

%% Define your theorem/lemma/... environments the way you want:
% Theorems
\newtheorem{thm}{Theorem}[section]
\newtheorem*{thm*}{Theorem}
\providecommand*\thmautorefname{Theorem}
% Lemmata
\newtheorem{lemma}[thm]{Lemma}
\newtheorem*{lemma*}{Lemma}
\providecommand*\lemmaautorefname{Lemma}

%% If you want you can define shortcuts:
\usepackage{xparse}
% And to define new shortcuts:
\NewDocumentEnvironment{mynormalthm}{O{}O{}+b}{%
  \begin{theoremEnd}[normal,#2]{thm}[#1]%
    #3%
  \end{theoremEnd}%
}{}

\begin{document}

\section{Demo of proof-at-the-end}

NB: This file is just a demo of proof-at-the-end.  You can find the documentation, sources, and example of proof-at-the-end at \url{https://github.com/leo-colisson/proof-at-the-end}. Note that this file is getting a bit big but it should contain more or less everything that is possible in this lib as it's also used to ``test'' the library.

% And use \theoremProofEnd[<package options>]{theorem environment name}[Title]{Theorem}{Optional proof}
\begin{theoremEnd}{thm}[Yes I can have a title]
  \label{thm:ilikelabels}
  Simplicity is luxury, I am a default theorem.
\end{theoremEnd}
\begin{proofEnd}
  Let's be simple.  
\end{proofEnd}

And I can refer to my theorems using classic labels, like in \autoref{thm:ilikelabels}.

\begin{theoremEnd}[text link section]{thm}[Changing link]
  It is possible to change the link.
\end{theoremEnd}
\begin{proofEnd}
  Here I'm using ``text link section''.
\end{proofEnd}

\begin{theoremEnd}[category=greattheorem, end]{thm}[Different categories]
  You can also create several categories, and put the proofs in different sections.
  \[2\Delta = \Delta + \Delta\]
\end{theoremEnd}
\begin{proofEnd}
  See, I am in another section! And I refer to \autoref{thm:ilikelabels} even in the proof.
\end{proofEnd}

\begin{theoremEnd}[restate]{thm}[I am restatable]
  I am a restatable theorem, go in Appendix you will see ;-)
\end{theoremEnd}
\begin{proofEnd}
  I am a proof of a restatable theorem.  
\end{proofEnd}


\begin{theoremEnd}[normal]{thm}
  You can easily turn it back into a normal theorem!
\end{theoremEnd}
\begin{proofEnd}
  And keep the proof with you!  
\end{proofEnd}

You can also put comments that appear only in the appendix.

\textEnd{See, I am a simple comments with math $\delta = b^2-ac$ and references \autoref{thm:mytheoremattheend}.}

\begin{textAtEnd}
  You can also use the environment syntax.
\end{textAtEnd}

\textEnd[both]{Or that appears in both and with references \autoref{thm:mytheoremattheend}!}

\begin{theoremEnd}[proof here]{thm}
  And you can duplicate the proof, here AND in appendix ;)  
\end{theoremEnd}
\begin{proofEnd}
  I am a proof that is everywhere, practical if you want to use synctex while you write the proof ;)
\end{proofEnd}

\begin{theoremEnd}{lemma}
  You can mix it with lemmas... Or any other theorem-like environment easily!  
\end{theoremEnd}
\begin{proofEnd}
  See, I'm the proof of a lemma!  
\end{proofEnd}

And also you can put both the theorem and the proof at the end, like for \autoref{thm:mytheoremattheend}!

\begin{theoremEnd}[all end]{thm}
  \label{thm:mytheoremattheend}
  $\delta = b^2-4ac$
  You can also put theorems only at the end.  
\end{theoremEnd}
\begin{proofEnd}
  See, I'm the proof of a lemma that is only at the end!
\end{proofEnd}


You can also remove the link to the theorem:
\begin{theoremEnd}[no link to theorem, restate]{thm}
  I don't like links in proofs.  
\end{theoremEnd}
\begin{proofEnd}
  Yes, I like being lost, but not too lost, so I prefer to restate as well!
\end{proofEnd}

Or keep the link, but remove the reference (practical for stared versions):
\begin{theoremEnd}[stared]{thm*}
  I don't like numbers.
\end{theoremEnd}
\begin{proofEnd}
  Yes, I hate numbers, but I like links.
\end{proofEnd}


\pgfkeys{/prAtEnd/french/.style={
    one big link translated={Voir preuve page},
    text proof translated={Preuve du}
  }
}
\begin{theoremEnd}[french]{thm}%% See how "french" is defined just above
  Change the text/languages of the link: Il est même possible de changer la langue du texte du lien!  
\end{theoremEnd}
\begin{proofEnd}
  Si c'est pas beau ;)
\end{proofEnd}

And of course it is easy to define custom shortcuts, using in prelude:
\begin{verbatim}
\NewDocumentEnvironment{frenchthm}{O{}+b}{%
  \begin{theoremEnd}[french]{thm}[#1]%
    #2%
  \end{theoremEnd}%
}{}
\end{verbatim}

\begin{mynormalthm}[My own environment]
  You can then create your own environment from other styles using
\end{mynormalthm}
\begin{proofEnd}
  That's quicker :D
\end{proofEnd}

\begin{mynormalthm}[My own environment][end]
  You can use options also with your custom environments.
\end{mynormalthm}
\begin{proofEnd}
  That's quicker with the proof at the end :D
\end{proofEnd}

\begin{mynormalthm}[][end]
  And you can remove the title and have options.
\end{mynormalthm}
\begin{proofEnd}
  Just leave empty title.
\end{proofEnd}

\begin{mynormalthm}[My second own environment][all end]
  My normal theorem is moved at the end!
\end{mynormalthm}
\begin{proofEnd}
  Custom environments are practical no ;)
\end{proofEnd}

\begin{theoremEnd}[]{thm}[Yes I can have no proof]
  Proof is useless. You can do do it. And see, I can include other environments inside me ;)\\
  \begin{tabular}{ c c } 
    A & B \\ 
    C & D \\ 
  \end{tabular}
\end{theoremEnd}


\begin{theoremEnd}[restate command=mymanualrestate]{thm}[Manual restate]
  A theorem can be manually restated  
\end{theoremEnd}
\begin{proofEnd}
  Use restate command for that! (see \autoref{sec:manualrestate} for an example)
\end{proofEnd}

\begin{theoremEnd}[see full proof]{thm}
  I can also write a sketch of proof, and put the full proof in appendix.
\end{theoremEnd}
\begin{proof}
  Hint: look at the alias options.
\end{proof}
\begin{proofEnd}
  You just use ``see full proof'' as an option
\end{proofEnd}

It should also deal with protected commands: $\mathtt{mathtt}$:
\begin{theoremEnd}[end]{thm}[Title $\Delta$ et $\mathtt{Gad}$]
  You can use commands that should be protected $\mathtt{See}$!
\end{theoremEnd}

\begin{theoremEnd}[end]{thm}[Deal with paragraphs]
  You can have a theorem

  with several paragraphs.
\end{theoremEnd}
\begin{proofEnd}
  And I also like to have big proofs.
  
  With several paragraphs.
\end{proofEnd}

\section{Section with restate before theorem}\label{sec:restatebefore}

\begin{theoremEndRestateBefore}{thm}[Title]{laterrestatable}
  \label{thm:laterrestatable}
  This theorem has been introduced in \autoref{sec:restatebefore} before the real definition, but the real definition is in \autoref{sec:restateafter}, more precisely here: \autoref{thm:laterrestatable}.
\end{theoremEndRestateBefore}


\begin{theoremEnd}{thm}
  And this is a normal theorem  
\end{theoremEnd}
\begin{proofEnd}
  With a normal proof  
\end{proofEnd}


\section{Section with late theorems}\label{sec:restateafter}
\begin{theoremEnd}[restated before]{thm}
  laterrestatable
\end{theoremEnd}
\begin{proofEnd}
  To state a theorem before the initial definition, use theoremEndRestateBefore environment where you first want to state the theorem, with a unique name in the second mandatory argument, and when you want to insert the theorem for the second time, use the usual theoremProofEnd command with the same unique name as before in place of the theorem definition and the ``restated before'' option.  
\end{proofEnd}

\section{Section with standard proofs}
% \verbatiminput{defaultcategory}
\printProofs

\section{Section with important proofs only}
\printProofs[greattheorem]

\section{Section with manual restate}\label{sec:manualrestate}

I like to manually restate theorems:
\mymanualrestate*


\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End: