mathpix-markdown-it 1.0.79 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.idea/workspace.xml +528 -609
  2. package/README.md +38 -0
  3. package/assets/mmd-image-properties.webp +0 -0
  4. package/doc/images/theorem_01.png +0 -0
  5. package/doc/images/theorem_02.png +0 -0
  6. package/doc/images/theorem_03.png +0 -0
  7. package/doc/images/theorem_04.png +0 -0
  8. package/doc/images/theorem_05.png +0 -0
  9. package/doc/images/theorem_06.png +0 -0
  10. package/doc/images/theorem_07.png +0 -0
  11. package/doc/images/theorems_and_proofs.png +0 -0
  12. package/doc/theorems.md +265 -0
  13. package/es5/bundle.js +1 -1
  14. package/es5/index.js +1 -1
  15. package/lib/components/mathpix-markdown/index.js +4 -2
  16. package/lib/components/mathpix-markdown/index.js.map +1 -1
  17. package/lib/markdown/common/consts.d.ts +20 -0
  18. package/lib/markdown/common/consts.js +60 -1
  19. package/lib/markdown/common/consts.js.map +1 -1
  20. package/lib/markdown/index.js +4 -2
  21. package/lib/markdown/index.js.map +1 -1
  22. package/lib/markdown/mathpix-markdown-plugins.js +7 -4
  23. package/lib/markdown/mathpix-markdown-plugins.js.map +1 -1
  24. package/lib/markdown/md-block-rule/begin-table.js +5 -6
  25. package/lib/markdown/md-block-rule/begin-table.js.map +1 -1
  26. package/lib/markdown/md-block-rule/helper.d.ts +1 -0
  27. package/lib/markdown/md-block-rule/helper.js +35 -0
  28. package/lib/markdown/md-block-rule/helper.js.map +1 -0
  29. package/lib/markdown/md-block-rule/lists/index.js +4 -18
  30. package/lib/markdown/md-block-rule/lists/index.js.map +1 -1
  31. package/lib/markdown/md-theorem/block-rule.d.ts +4 -0
  32. package/lib/markdown/md-theorem/block-rule.js +405 -0
  33. package/lib/markdown/md-theorem/block-rule.js.map +1 -0
  34. package/lib/markdown/md-theorem/helper.d.ts +34 -0
  35. package/lib/markdown/md-theorem/helper.js +251 -0
  36. package/lib/markdown/md-theorem/helper.js.map +1 -0
  37. package/lib/markdown/md-theorem/index.d.ts +18 -0
  38. package/lib/markdown/md-theorem/index.js +180 -0
  39. package/lib/markdown/md-theorem/index.js.map +1 -0
  40. package/lib/markdown/md-theorem/inline-rule.d.ts +23 -0
  41. package/lib/markdown/md-theorem/inline-rule.js +242 -0
  42. package/lib/markdown/md-theorem/inline-rule.js.map +1 -0
  43. package/lib/markdown/mdPluginRaw.js +18 -3
  44. package/lib/markdown/mdPluginRaw.js.map +1 -1
  45. package/lib/markdown/mdPluginTableTabular.js +3 -0
  46. package/lib/markdown/mdPluginTableTabular.js.map +1 -1
  47. package/lib/markdown/mdPluginText.js +7 -0
  48. package/lib/markdown/mdPluginText.js.map +1 -1
  49. package/lib/mathpix-markdown-model/index.d.ts +4 -0
  50. package/lib/mathpix-markdown-model/index.js +4 -2
  51. package/lib/mathpix-markdown-model/index.js.map +1 -1
  52. package/lib/styles/index.js +1 -1
  53. package/lib/styles/index.js.map +1 -1
  54. package/package.json +1 -1
package/README.md CHANGED
@@ -48,6 +48,40 @@ Mathpix Markdown addresses these limitations by adding support for the following
48
48
  OC(=O)c1cc(Cl)cs1
49
49
  ```
50
50
  ~~~
51
+ - images (Markdown). Parse and render additional parameters such as width, height, alignment:
52
+ ~~~
53
+ ![foo](foo.png){ width=50% }
54
+ ![foo](foo.png){ width="36px" }
55
+ ![image](<src> "title"){width="20px",height="20px"}
56
+ ![image](<src> "title"){width="20px",height="20px",right}
57
+ ![image](<src> "title"){width="20px",height="20px", align="left"}
58
+ ~~~
59
+ ![Image properties](assets/mmd-image-properties.webp)
60
+
61
+ - [theorems and proofs](doc/theorems.md)
62
+
63
+ ```text
64
+ \newtheorem{theorem}{Theorem}
65
+ \newtheorem{lemma}[theorem]{Lemma}
66
+
67
+ \begin{theorem}
68
+ Let \(f\) be a function whose derivative exists in every point, then \(f\)
69
+ is a continuous function.
70
+ \end{theorem}
71
+
72
+ \begin{lemma}
73
+ Given two line segments whose lengths are \(a\) and \(b\) respectively there
74
+ is a real number \(r\) such that \(b=ra\).
75
+ \end{lemma}
76
+
77
+ \begin{proof}
78
+ To prove it by contradiction try and assume that the statement is false,
79
+ proceed from there and at some point you will arrive to a contradiction.
80
+ \end{proof}
81
+ ```
82
+
83
+ ![](doc/images/theorems_and_proofs.png)
84
+
51
85
 
52
86
  # What is mathpix-markdown-it?
53
87
 
@@ -678,6 +712,8 @@ The `MathpixMarkdown` React element accepts the following props:
678
712
  | `showPageBreaks` | boolean;*`false`* | Hidden tags will be shown in html like page break |
679
713
  | `centerImages` | boolean;*`true`* | Center align images by default |
680
714
  | `centerTables` | boolean;*`true`* | Center align tables by default |
715
+ | `validateLink` | function;*`null`* | The function `(url: string) => void` to override md link validator |
716
+ | `enableCodeBlockRuleForLatexCommands`| boolean;*`false`* | By default, if latex commands are indented (4 spaces / 1 tab) they do not become `Code Blocks`. |
681
717
 
682
718
  ### optionsMathpixMarkdown
683
719
 
@@ -704,6 +740,8 @@ The `MathpixMarkdown` React element accepts the following props:
704
740
  | `showPageBreaks` | boolean;*`false`* | Hidden tags will be shown in html like page break |
705
741
  | `centerImages` | boolean;*`true`* | Center align images by default |
706
742
  | `centerTables` | boolean;*`true`* | Center align tables by default |
743
+ | `validateLink` | function;*`null`* | The function `(url: string) => void` to override md link validator |
744
+ | `enableCodeBlockRuleForLatexCommands`| boolean;*`false`* | By default, if latex commands are indented (4 spaces / 1 tab) they do not become `Code Blocks`. |
707
745
 
708
746
  ### TOutputMath
709
747
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,265 @@
1
+ # Theorems and proofs
2
+
3
+ ## Introduction
4
+
5
+ Mathematical documents include elements that require special formatting and numbering such as theorems, definitions, propositions, remarks, corollaries, lemmas and so on. This article explains how to define these environments in LaTeX.
6
+
7
+ Numbered environments in LaTeX can be defined by means of the command `\newtheorem` which takes two arguments:
8
+
9
+ ```tex
10
+ \newtheorem{theorem}{Theorem}
11
+ ```
12
+
13
+ - the first one is the name of the environment that is defined
14
+ - the second one is the word that will be printed, in boldface font, at the beginning of the environment.
15
+
16
+ Once this new environment is defined it can be used normally within the document, delimited by `\begin{theorem}` and `\end{theorem}`. An example is presented below:
17
+
18
+ ```tex
19
+ \newtheorem{theorem}{Theorem}
20
+
21
+ \section{Introduction}
22
+ Theorems can easily be defined:
23
+
24
+ \begin{theorem}
25
+ Let \(f\) be a function whose derivative exists in every point, then \(f\)
26
+ is a continuous function.
27
+ \end{theorem}
28
+ ```
29
+
30
+ This example produces the following output:
31
+
32
+ ![](images/theorem_01.png)
33
+
34
+
35
+ ## Numbered theorems, definitions, corollaries and lemmas
36
+
37
+ The numbering of the environments can be controlled by means of two additional parameters in the `\newtheorem` command. Let's see:
38
+
39
+ ```tex
40
+ \newtheorem{theorem}{Theorem}[section]
41
+ \newtheorem{corollary}{Corollary}[theorem]
42
+ \newtheorem{lemma}[theorem]{Lemma}
43
+
44
+ \section{Introduction}
45
+ Theorems can easily be defined:
46
+
47
+ \begin{theorem}
48
+ Let \(f\) be a function whose derivative exists in every point, then \(f\) is
49
+ a continuous function.
50
+ \end{theorem}
51
+
52
+ \begin{theorem}[Pythagorean theorem]
53
+ \label{pythagorean}
54
+ This is a theorem about right triangles and can be summarised in the next
55
+ equation
56
+ \[ x^2 + y^2 = z^2 \]
57
+ \end{theorem}
58
+
59
+ And a consequence of theorem \ref{pythagorean} is the statement in the next
60
+ corollary.
61
+
62
+ \begin{corollary}
63
+ There's no right rectangle whose sides measure 3cm, 4cm, and 6cm.
64
+ \end{corollary}
65
+
66
+ You can reference theorems such as \ref{pythagorean} when a label is assigned.
67
+
68
+ \begin{lemma}
69
+ Given two line segments whose lengths are \(a\) and \(b\) respectively there is a
70
+ real number \(r\) such that \(b=ra\).
71
+ \end{lemma}
72
+ ```
73
+
74
+ This example produces the following output:
75
+
76
+ ![](images/theorem_02.png)
77
+
78
+ There are three new environments defined in the preamble.
79
+
80
+ `\newtheorem{theorem}{Theorem}[section]`
81
+ This is the example presented in the introduction, but it has the additional parameter `[section]` that restarts the theorem counter at every new section.
82
+
83
+ `\newtheorem{corollary}{Corollary}[theorem]`
84
+ An environment called corollary is created, the counter of this new environment will be reset every time a new theorem environment is used.
85
+
86
+ `\newtheorem{lemma}[theorem]{Lemma}`
87
+ In this case, the even though a new environment called lemma is created, it will use the same counter as the theorem environment.
88
+
89
+ Some famous theorems have their own names, for these cases you can add said name inside brackets in the environment opening command. In the example, the line `\begin{theorem}[Pythagorean theorem]` prints "Pythagorean theorem" at the beginning of the paragraph.
90
+
91
+ As with many other numbered elements in LaTeX, the command `\label` can be used to reference theorem-like environments within the document.
92
+
93
+
94
+ ## Unnumbered theorem-like environments
95
+
96
+ It can be useful to have an unnumbered theorem-like environment to add remarks, comments or examples to a mathematical document.
97
+
98
+ ```tex
99
+ \newtheorem*{remark}{Remark}
100
+
101
+ Unnumbered theorem-like environments are also possible.
102
+
103
+ \begin{remark}
104
+ This statement is true, I guess.
105
+ \end{remark}
106
+ ```
107
+
108
+ This example produces the following output:
109
+
110
+ ![](images/theorem_03.png)
111
+
112
+
113
+ The syntax of the command `\newtheorem*` is the same as the non-starred version, except for the counter parameters. In this example, a new unnumbered environment called remark is created.
114
+
115
+ ## Theorem styles
116
+
117
+ A feature that is important when working in a mathematical document is to easily tell apart, say, definitions from theorems by its formatting.
118
+
119
+ ```tex
120
+ \theoremstyle{definition}
121
+ \newtheorem{definition}{Definition}[section]
122
+
123
+ \theoremstyle{remark}
124
+ \newtheorem*{remark}{Remark}
125
+
126
+ \section{Introduction}
127
+ Unnumbered theorem-like environments are also possible.
128
+
129
+ \begin{remark}
130
+ This statement is true, I guess.
131
+ \end{remark}
132
+
133
+ And the next is a somewhat informal definition
134
+
135
+ \begin{definition}[Fibration]
136
+ A fibration is a mapping between two topological spaces that has the homotopy lifting property for every space \(X\).
137
+ \end{definition}
138
+ ```
139
+
140
+ This example produces the following output:
141
+
142
+ ![](images/theorem_04.png)
143
+
144
+ The command `\theoremstyle{ }` sets the styling for the numbered environment defined right below it. In the example above, the styles *remark* and *definition* are used. Notice that the remark is now in italics and the text in the environment uses normal (Roman) typeface, the definition on the other hand also uses Roman typeface for the text within but the word "Definition" is printed in boldface font.
145
+
146
+ ## Proofs
147
+
148
+ Proofs are the core of mathematical papers and books, and it is customary to keep them visually apart from the normal text in the document.
149
+
150
+ ```text
151
+ \newtheorem{theorem}{Theorem}[section]
152
+ \newtheorem{lemma}[theorem]{Lemma}
153
+
154
+ \section{Introduction}
155
+ \begin{lemma}
156
+ Given two line segments whose lengths are \(a\) and \(b\) respectively there
157
+ is a real number \(r\) such that \(b=ra\).
158
+ \end{lemma}
159
+
160
+ \begin{proof}
161
+ To prove it by contradiction try and assume that the statement is false,
162
+ proceed from there and at some point you will arrive to a contradiction.
163
+ \end{proof}
164
+ ```
165
+
166
+ This example produces the following output:
167
+
168
+ ![](images/theorem_05.png)
169
+
170
+ ## Changing the QED symbol
171
+
172
+ The symbol printed at the end of a proof is called the “QED symbol”. To quote the meaning of QED from Wikipedia:
173
+
174
+ > QED is an initialism of the Latin phrase quod erat demonstrandum, meaning “thus it has been demonstrated”
175
+
176
+ It is straightforward to use a symbol, or wording, of your choice to represent the QED symbol. The command
177
+
178
+ ```tex
179
+ \renewcommand\qedsymbol{$\blacksquare$}
180
+ ```
181
+
182
+ You can be used to replace the default white square for a black square printed by `$\blacksquare$`, the parameter inside the braces. Or, you can write the word QED explicitly:
183
+
184
+ ```tex
185
+ \renewcommand\qedsymbol{QED}
186
+ ```
187
+
188
+ Here is an example to demonstrate both options:
189
+
190
+ ```tex
191
+ \newtheorem{theorem}{Theorem}[section]
192
+ \newtheorem{lemma}[theorem]{Lemma}
193
+
194
+ \section{Introduction}
195
+
196
+ \begin{lemma}
197
+ Given two line segments whose lengths are \(a\) and \(b\) respectively there
198
+ is a real number \(r\) such that \(b=ra\).
199
+ \end{lemma}
200
+
201
+ \renewcommand\qedsymbol{$\blacksquare$}
202
+
203
+ \begin{proof}
204
+ To prove it by contradiction try and assume that the statement is false,
205
+ proceed from there and at some point you will arrive to a contradiction.
206
+ \end{proof}
207
+
208
+ \renewcommand\qedsymbol{QED}
209
+
210
+ \begin{proof}
211
+ To prove it by contradiction try and assume that the statement is false,
212
+ proceed from there and at some point you will arrive to a contradiction.
213
+ \end{proof}
214
+ ```
215
+
216
+ This example produces the following output:
217
+
218
+ ![](images/theorem_06.png)
219
+
220
+
221
+ ## Start theorem counter from specific number
222
+
223
+ `\setcounter{theoremenv}{number}`
224
+ Sets count for `theoremenv` to contain the value number.
225
+
226
+ - *Note:* number can be positive or negative.
227
+
228
+ ```tex
229
+ \newtheorem{theorem}{Theorem}
230
+
231
+ \section{Introduction}
232
+ Theorems can easily be defined:
233
+
234
+ \begin{theorem}
235
+ Let \(f\) be a function whose derivative exists in every point, then \(f\)
236
+ is a continuous function.
237
+ \end{theorem}
238
+
239
+ \setcounter{theorem}{0}
240
+
241
+ \begin{theorem}
242
+ Let \(f\) be a function whose derivative exists in every point, then \(f\)
243
+ is a continuous function.
244
+ \end{theorem}
245
+
246
+ \setcounter{theorem}{-3}
247
+
248
+ \begin{theorem}
249
+ Let \(f\) be a function whose derivative exists in every point, then \(f\)
250
+ is a continuous function.
251
+ \end{theorem}
252
+ ```
253
+
254
+ This example produces the following output:
255
+
256
+ ![](images/theorem_07.png)
257
+
258
+
259
+ ## Reference guide
260
+
261
+ ### *Theorem styles*
262
+
263
+ - `definition` boldface title, Roman body. Commonly used in definitions, conditions, problems and examples.
264
+ - `plain` boldface title, italicized body. Commonly used in theorems, lemmas, corollaries, propositions and conjectures.
265
+ - `remark` italicized title, Roman body. Commonly used in remarks, notes, annotations, claims, cases, acknowledgments and conclusions.