HumanReadableLogsRules.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /* eslint-disable no-useless-escape */
  2. import React from 'react'
  3. import PropTypes from 'prop-types'
  4. function WikiLink({ url, children }) {
  5. return window.wikiEnabled ? (
  6. <a href={url} target="_blank">
  7. {children}
  8. </a>
  9. ) : (
  10. <>{children}</>
  11. )
  12. }
  13. WikiLink.propTypes = {
  14. url: PropTypes.string,
  15. children: PropTypes.node.isRequired
  16. }
  17. const rules = [
  18. {
  19. regexToMatch: /Misplaced alignment tab character \&/,
  20. extraInfoURL:
  21. 'https://www.overleaf.com/learn/Errors/Misplaced_alignment_tab_character_%26',
  22. humanReadableHintComponent: (
  23. <>
  24. You have placed an alignment tab character '&' in the wrong place. If
  25. you want to align something, you must write it inside an align
  26. environment such as \begin
  27. {'{align}'} … \end
  28. {'{align}'}, \begin
  29. {'{tabular}'} … \end
  30. {'{tabular}'}, etc. If you want to write an ampersand '&' in text, you
  31. must write \& instead.
  32. </>
  33. ),
  34. humanReadableHint:
  35. 'You have placed an alignment tab character &#x27;&amp;&#x27; in the wrong place. If you want to align something, you must write it inside an align environment such as \\begin{align} … \\end{align}, \\begin{tabular} … \\end{tabular}, etc. If you want to write an ampersand &#x27;&amp;&#x27; in text, you must write \\&amp; instead.'
  36. },
  37. {
  38. regexToMatch: /Extra alignment tab has been changed to \\cr/,
  39. extraInfoURL:
  40. 'https://www.overleaf.com/learn/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr',
  41. humanReadableHintComponent: (
  42. <>
  43. You have written too many alignment tabs in a table, causing one of them
  44. to be turned into a line break. Make sure you have specified the correct
  45. number of columns in your{' '}
  46. <WikiLink url="https://www.overleaf.com/learn/Tables">table</WikiLink>.
  47. </>
  48. ),
  49. humanReadableHint:
  50. 'You have written too many alignment tabs in a table, causing one of them to be turned into a line break. Make sure you have specified the correct number of columns in your <a href="https://www.overleaf.com/learn/Tables" target="_blank">table</a>.'
  51. },
  52. {
  53. regexToMatch: /Display math should end with \$\$/,
  54. extraInfoURL:
  55. 'https://www.overleaf.com/learn/Errors/Display_math_should_end_with_$$',
  56. humanReadableHintComponent: (
  57. <>
  58. You have forgotten a $ sign at the end of 'display math' mode. When
  59. writing in display math mode, you must always math write inside $$ … $$.
  60. Check that the number of $s match around each math expression.
  61. </>
  62. ),
  63. humanReadableHint:
  64. 'You have forgotten a $ sign at the end of &#x27;display math&#x27; mode. When writing in display math mode, you must always math write inside $$ … $$. Check that the number of $s match around each math expression.'
  65. },
  66. {
  67. regexToMatch: /Missing [{$] inserted./,
  68. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Missing_$_inserted',
  69. humanReadableHintComponent: (
  70. <>
  71. Check that your $'s match around math expressions. If they do, then
  72. you've probably used a symbol in normal text that needs to be in math
  73. mode. Symbols such as subscripts ( _ ), integrals ( \int ), Greek
  74. letters ( \alpha, \beta, \delta ), and modifiers (\vec
  75. {'{x}'}, \tilde
  76. {'{x}'} ) must be written in math mode. See the full list{' '}
  77. <WikiLink url="https://www.overleaf.com/learn/Errors/Missing_$_inserted">
  78. here
  79. </WikiLink>
  80. . If you intended to use mathematics mode, then use $ … $ for 'inline
  81. math mode', $$ … $$ for 'display math mode' or alternatively \begin
  82. {'{math}'} … \end
  83. {'{math}'}.
  84. </>
  85. ),
  86. humanReadableHint:
  87. 'Check that your $&#x27;s match around math expressions. If they do, then you&#x27;ve probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list <a href="https://www.overleaf.com/learn/Errors/Missing_$_inserted" target="_blank">here</a>. If you intended to use mathematics mode, then use $ … $ for &#x27;inline math mode&#x27;, $$ … $$ for &#x27;display math mode&#x27; or alternatively \\begin{math} … \\end{math}.'
  88. },
  89. {
  90. regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/,
  91. extraInfoURL:
  92. 'https://www.overleaf.com/learn/Errors/There_were_undefined_references',
  93. humanReadableHintComponent: (
  94. <>
  95. You have referenced something which has not yet been labelled. If you
  96. have labelled it already, make sure that what is written inside \ref
  97. {'{...}'} is the same as what is written inside \label
  98. {'{...}'}.
  99. </>
  100. ),
  101. humanReadableHint:
  102. 'You have referenced something which has not yet been labelled. If you have labelled it already, make sure that what is written inside \\ref{...} is the same as what is written inside \\label{...}.'
  103. },
  104. {
  105. regexToMatch: /Citation .+ on page .+ undefined on input line .+/,
  106. extraInfoURL:
  107. 'https://www.overleaf.com/learn/Errors/Citation_XXX_on_page_XXX_undefined_on_input_line_XXX',
  108. humanReadableHintComponent: (
  109. <>
  110. You have cited something which is not included in your bibliography.
  111. Make sure that the citation (\cite
  112. {'{...}'}) has a corresponding key in your bibliography, and that both
  113. are spelled the same way.
  114. </>
  115. ),
  116. humanReadableHint:
  117. 'You have cited something which is not included in your bibliography. Make sure that the citation (\\cite{...}) has a corresponding key in your bibliography, and that both are spelled the same way.'
  118. },
  119. {
  120. regexToMatch: /(Label .+)? multiply[ -]defined( labels)?/,
  121. extraInfoURL:
  122. 'https://www.overleaf.com/learn/Errors/There_were_multiply-defined_labels',
  123. humanReadableHintComponent: (
  124. <>
  125. You have used the same label more than once. Check that each \label
  126. {'{...}'} labels only one item.
  127. </>
  128. ),
  129. humanReadableHint:
  130. 'You have used the same label more than once. Check that each \\label{...} labels only one item.'
  131. },
  132. {
  133. regexToMatch: /`!?h' float specifier changed to `!?ht'/,
  134. extraInfoURL:
  135. 'https://www.overleaf.com/learn/Errors/%60!h%27_float_specifier_changed_to_%60!ht%27',
  136. humanReadableHintComponent: (
  137. <>
  138. The float specifier 'h' is too strict of a demand for LaTeX to place
  139. your float in a nice way here. Try relaxing it by using 'ht', or even
  140. 'htbp' if necessary. If you want to try keep the float here anyway,
  141. check out the{' '}
  142. <WikiLink url="https://www.overleaf.com/learn/Positioning_of_Figures">
  143. float package
  144. </WikiLink>
  145. .
  146. </>
  147. ),
  148. humanReadableHint:
  149. 'The float specifier &#x27;h&#x27; is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using &#x27;ht&#x27;, or even &#x27;htbp&#x27; if necessary. If you want to try keep the float here anyway, check out the <a href="https://www.overleaf.com/learn/Positioning_of_Figures" target="_blank">float package</a>.'
  150. },
  151. {
  152. regexToMatch: /No positions in optional float specifier/,
  153. extraInfoURL:
  154. 'https://www.overleaf.com/learn/Errors/No_positions_in_optional_float_specifier',
  155. humanReadableHintComponent: (
  156. <>
  157. You have forgotten to include a float specifier, which tells LaTeX where
  158. to position your figure. To fix this, either insert a float specifier
  159. inside the square brackets (e.g. \begin
  160. {'{figure}'}
  161. [h]), or remove the square brackets (e.g. \begin
  162. {'{figure}'}
  163. ). Find out more about float specifiers{' '}
  164. <WikiLink url="https://www.overleaf.com/learn/Positioning_of_Figures">
  165. here
  166. </WikiLink>
  167. .
  168. </>
  169. ),
  170. humanReadableHint:
  171. 'You have forgotten to include a float specifier, which tells LaTeX where to position your figure. To fix this, either insert a float specifier inside the square brackets (e.g. \\begin{figure}[h]), or remove the square brackets (e.g. \\begin{figure}). Find out more about float specifiers <a href="https://www.overleaf.com/learn/Positioning_of_Figures" target="_blank">here</a>.'
  172. },
  173. {
  174. regexToMatch: /Undefined control sequence/,
  175. extraInfoURL:
  176. 'https://www.overleaf.com/learn/Errors/Undefined_control_sequence',
  177. humanReadableHintComponent: (
  178. <>
  179. The compiler is having trouble understanding a command you have used.
  180. Check that the command is spelled correctly. If the command is part of a
  181. package, make sure you have included the package in your preamble using
  182. \usepackage
  183. {'{...}'}.
  184. </>
  185. ),
  186. humanReadableHint:
  187. 'The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \\usepackage{...}.'
  188. },
  189. {
  190. regexToMatch: /File .+ not found/,
  191. extraInfoURL:
  192. 'https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX',
  193. humanReadableHintComponent: (
  194. <>
  195. The compiler cannot find the file you want to include. Make sure that
  196. you have{' '}
  197. <WikiLink url="https://www.overleaf.com/learn/Including_images_in_ShareLaTeX">
  198. uploaded the file
  199. </WikiLink>{' '}
  200. and{' '}
  201. <WikiLink url="https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX.">
  202. specified the file location correctly
  203. </WikiLink>
  204. .
  205. </>
  206. ),
  207. humanReadableHint:
  208. 'The compiler cannot find the file you want to include. Make sure that you have <a href="https://www.overleaf.com/learn/Including_images_in_ShareLaTeX" target="_blank">uploaded the file</a> and <a href="https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX." target="_blank">specified the file location correctly</a>.'
  209. },
  210. {
  211. regexToMatch: /LaTeX Error: Unknown graphics extension: \..+/,
  212. extraInfoURL:
  213. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.XXX',
  214. humanReadableHintComponent: (
  215. <>
  216. The compiler does not recognise the file type of one of your images.
  217. Make sure you are using a{' '}
  218. <WikiLink url="https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.gif.">
  219. supported image format
  220. </WikiLink>{' '}
  221. for your choice of compiler, and check that there are no periods (.) in
  222. the name of your image.
  223. </>
  224. ),
  225. humanReadableHint:
  226. 'The compiler does not recognise the file type of one of your images. Make sure you are using a <a href="https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.gif." target="_blank">supported image format</a> for your choice of compiler, and check that there are no periods (.) in the name of your image.'
  227. },
  228. {
  229. regexToMatch: /LaTeX Error: Unknown float option `H'/,
  230. extraInfoURL:
  231. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_float_option_%60H%27',
  232. humanReadableHintComponent: (
  233. <>
  234. The compiler isn't recognizing the float option 'H'. Include \usepackage
  235. {'{float}'} in your preamble to fix this.
  236. </>
  237. ),
  238. humanReadableHint:
  239. 'The compiler isn&#x27;t recognizing the float option &#x27;H&#x27;. Include \\usepackage{float} in your preamble to fix this.'
  240. },
  241. {
  242. regexToMatch: /LaTeX Error: Unknown float option `q'/,
  243. extraInfoURL:
  244. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_float_option_%60q%27',
  245. humanReadableHintComponent: (
  246. <>
  247. You have used a float specifier which the compiler does not understand.
  248. You can learn more about the different float options available for
  249. placing figures{' '}
  250. <WikiLink url="https://www.overleaf.com/learn/Positioning_of_Figures">
  251. here
  252. </WikiLink>{' '}
  253. .
  254. </>
  255. ),
  256. humanReadableHint:
  257. 'You have used a float specifier which the compiler does not understand. You can learn more about the different float options available for placing figures <a href="https://www.overleaf.com/learn/Positioning_of_Figures" target="_blank">here</a> .'
  258. },
  259. {
  260. regexToMatch: /LaTeX Error: \\math.+ allowed only in math mode/,
  261. extraInfoURL:
  262. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_%5Cmathrm_allowed_only_in_math_mode',
  263. humanReadableHintComponent: (
  264. <>
  265. You have used a font command which is only available in math mode. To
  266. use this command, you must be in maths mode (E.g. $ … $ or \begin
  267. {'{math}'} … \end
  268. {'{math}'}
  269. ). If you want to use it outside of math mode, use the text version
  270. instead: \textrm, \textit, etc.
  271. </>
  272. ),
  273. humanReadableHint:
  274. 'You have used a font command which is only available in math mode. To use this command, you must be in maths mode (E.g. $ … $ or \\begin{math} … \\end{math}). If you want to use it outside of math mode, use the text version instead: \\textrm, \\textit, etc.'
  275. },
  276. {
  277. ruleId: 'hint_mismatched_environment',
  278. types: ['environment'],
  279. regexToMatch: /Error: `([^']{2,})' expected, found `([^']{2,})'.*/,
  280. newMessage: 'Error: environment does not match \\begin{$1} ... \\end{$2}',
  281. humanReadableHintComponent: (
  282. <>
  283. You have used \begin
  284. {'{...}'} without a corresponding \end
  285. {'{...}'}.
  286. </>
  287. ),
  288. humanReadableHint:
  289. 'You have used \\begin{...} without a corresponding \\end{...}.'
  290. },
  291. {
  292. ruleId: 'hint_mismatched_brackets',
  293. types: ['environment'],
  294. regexToMatch: /Error: `([^a-zA-Z0-9])' expected, found `([^a-zA-Z0-9])'.*/,
  295. newMessage: "Error: brackets do not match, found '$2' instead of '$1'",
  296. humanReadableHintComponent: (
  297. <>You have used an open bracket without a corresponding close bracket.</>
  298. ),
  299. humanReadableHint:
  300. 'You have used an open bracket without a corresponding close bracket.'
  301. },
  302. {
  303. regexToMatch: /LaTeX Error: Can be used only in preamble/,
  304. extraInfoURL:
  305. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Can_be_used_only_in_preamble',
  306. humanReadableHintComponent: (
  307. <>
  308. You have used a command in the main body of your document which should
  309. be used in the preamble. Make sure that \documentclass[…]
  310. {'{…}'} and all \usepackage
  311. {'{…}'} commands are written before \begin
  312. {'{document}'}.
  313. </>
  314. ),
  315. humanReadableHint:
  316. 'You have used a command in the main body of your document which should be used in the preamble. Make sure that \\documentclass[…]{…} and all \\usepackage{…} commands are written before \\begin{document}.'
  317. },
  318. {
  319. regexToMatch: /Missing \\right inserted/,
  320. extraInfoURL:
  321. 'https://www.overleaf.com/learn/Errors/Missing_%5Cright_insertede',
  322. humanReadableHintComponent: (
  323. <>
  324. You have started an expression with a \left command, but have not
  325. included a corresponding \right command. Make sure that your \left and
  326. \right commands balance everywhere, or else try using \Biggl and \Biggr
  327. commands instead as shown{' '}
  328. <WikiLink url="https://www.overleaf.com/learn/Errors/Missing_%5Cright_inserted">
  329. here
  330. </WikiLink>
  331. .
  332. </>
  333. ),
  334. humanReadableHint:
  335. 'You have started an expression with a \\left command, but have not included a corresponding \\right command. Make sure that your \\left and \\right commands balance everywhere, or else try using \\Biggl and \\Biggr commands instead as shown <a href="https://www.overleaf.com/learn/Errors/Missing_%5Cright_inserted" target="_blank">here</a>.'
  336. },
  337. {
  338. regexToMatch: /Double superscript/,
  339. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Double_superscript',
  340. humanReadableHintComponent: (
  341. <>
  342. You have written a double superscript incorrectly as a^b^c, or else you
  343. have written a prime with a superscript. Remember to include {'{and}'}{' '}
  344. when using multiple superscripts. Try a^
  345. {'{b ^ c}'} instead.
  346. </>
  347. ),
  348. humanReadableHint:
  349. 'You have written a double superscript incorrectly as a^b^c, or else you have written a prime with a superscript. Remember to include {and} when using multiple superscripts. Try a^{b ^ c} instead.'
  350. },
  351. {
  352. regexToMatch: /Double subscript/,
  353. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Double_subscript',
  354. humanReadableHintComponent: (
  355. <>
  356. You have written a double subscript incorrectly as a_b_c. Remember to
  357. include {'{and}'} when using multiple subscripts. Try a_
  358. {'{b_c}'} instead.
  359. </>
  360. ),
  361. humanReadableHint:
  362. 'You have written a double subscript incorrectly as a_b_c. Remember to include {and} when using multiple subscripts. Try a_{b_c} instead.'
  363. },
  364. {
  365. regexToMatch: /No \\author given/,
  366. extraInfoURL: 'https://www.overleaf.com/learn/Errors/No_%5Cauthor_given',
  367. humanReadableHintComponent: (
  368. <>
  369. You have used the \maketitle command, but have not specified any
  370. \author. To fix this, include an author in your preamble using the
  371. \author
  372. {'{…}'} command.
  373. </>
  374. ),
  375. humanReadableHint:
  376. 'You have used the \\maketitle command, but have not specified any \\author. To fix this, include an author in your preamble using the \\author{…} command.'
  377. },
  378. {
  379. regexToMatch: /LaTeX Error: Environment .+ undefined/,
  380. extraInfoURL:
  381. 'https://www.overleaf.com/learn/Errors%2FLaTeX%20Error%3A%20Environment%20XXX%20undefined',
  382. humanReadableHintComponent: (
  383. <>
  384. You have created an environment (using \begin
  385. {'{…}'} and \end
  386. {'{…}'} commands) which is not recognized. Make sure you have included
  387. the required package for that environment in your preamble, and that the
  388. environment is spelled correctly.
  389. </>
  390. ),
  391. humanReadableHint:
  392. 'You have created an environment (using \\begin{…} and \\end{…} commands) which is not recognized. Make sure you have included the required package for that environment in your preamble, and that the environment is spelled correctly.'
  393. },
  394. {
  395. regexToMatch: /LaTeX Error: Something's wrong--perhaps a missing \\item/,
  396. extraInfoURL:
  397. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Something%27s_wrong--perhaps_a_missing_%5Citem',
  398. humanReadableHintComponent: (
  399. <>
  400. There are no entries found in a list you have created. Make sure you
  401. label list entries using the \item command, and that you have not used a
  402. list inside a table.
  403. </>
  404. ),
  405. humanReadableHint:
  406. 'There are no entries found in a list you have created. Make sure you label list entries using the \\item command, and that you have not used a list inside a table.'
  407. },
  408. {
  409. regexToMatch: /Misplaced \\noalign/,
  410. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Misplaced_%5Cnoalign',
  411. humanReadableHintComponent: (
  412. <>
  413. You have used a \hline command in the wrong place, probably outside a
  414. table. If the \hline command is written inside a table, try including \\
  415. before it.
  416. </>
  417. ),
  418. humanReadableHint:
  419. 'You have used a \\hline command in the wrong place, probably outside a table. If the \\hline command is written inside a table, try including \\\\ before it.'
  420. },
  421. {
  422. regexToMatch: /LaTeX Error: There's no line here to end/,
  423. extraInfoURL:
  424. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_There%27s_no_line_here_to_end',
  425. humanReadableHintComponent: (
  426. <>
  427. You have used a \\ or \newline command where LaTeX was not expecting
  428. one. Make sure that you only use line breaks after blocks of text, and
  429. be careful using linebreaks inside lists and other environments.\
  430. </>
  431. ),
  432. humanReadableHint:
  433. 'You have used a \\\\ or \\newline command where LaTeX was not expecting one. Make sure that you only use line breaks after blocks of text, and be careful using linebreaks inside lists and other environments.\\'
  434. },
  435. {
  436. regexToMatch: /LaTeX Error: \\verb ended by end of line/,
  437. extraInfoURL:
  438. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_%5Cverb_ended_by_end_of_line',
  439. humanReadableHintComponent: (
  440. <>
  441. You have used a \verb command incorrectly. Try replacling the \verb
  442. command with \begin
  443. {'{verbatim}'}
  444. …\end
  445. {'{verbatim}'}
  446. .\
  447. </>
  448. ),
  449. humanReadableHint:
  450. 'You have used a \\verb command incorrectly. Try replacling the \\verb command with \\begin{verbatim}…\\end{verbatim}.\\'
  451. },
  452. {
  453. regexToMatch: /Illegal unit of measure (pt inserted)/,
  454. extraInfoURL:
  455. 'https://www.overleaf.com/learn/Errors%2FIllegal%20unit%20of%20measure%20(pt%20inserted)',
  456. humanReadableHintComponent: (
  457. <>
  458. You have written a length, but have not specified the appropriate units
  459. (pt, mm, cm etc.). If you have not written a length, check that you have
  460. not witten a linebreak \\ followed by square brackets […] anywhere.
  461. </>
  462. ),
  463. humanReadableHint:
  464. 'You have written a length, but have not specified the appropriate units (pt, mm, cm etc.). If you have not written a length, check that you have not witten a linebreak \\\\ followed by square brackets […] anywhere.'
  465. },
  466. {
  467. regexToMatch: /Extra \\right/,
  468. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Extra_%5Cright',
  469. humanReadableHintComponent: (
  470. <>
  471. You have written a \right command without a corresponding \left command.
  472. Check that all \left and \right commands balance everywhere.
  473. </>
  474. ),
  475. humanReadableHint:
  476. 'You have written a \\right command without a corresponding \\left command. Check that all \\left and \\right commands balance everywhere.'
  477. },
  478. {
  479. regexToMatch: /Missing \\begin{document}/,
  480. extraInfoURL:
  481. 'https://www.overleaf.com/learn/Errors%2FLaTeX%20Error%3A%20Missing%20%5Cbegin%20document',
  482. humanReadableHintComponent: (
  483. <>
  484. No \begin
  485. {'{document}'} command was found. Make sure you have included \begin
  486. {'{document}'} in your preamble, and that your main document is set
  487. correctly.
  488. </>
  489. ),
  490. humanReadableHint:
  491. 'No \\begin{document} command was found. Make sure you have included \\begin{document} in your preamble, and that your main document is set correctly.'
  492. },
  493. {
  494. ruleId: 'hint_mismatched_environment2',
  495. types: ['environment'],
  496. cascadesFrom: ['environment'],
  497. regexToMatch: /Error: `\\end\{([^\}]+)\}' expected but found `\\end\{([^\}]+)\}'.*/,
  498. newMessage: 'Error: environments do not match: \\begin{$1} ... \\end{$2}',
  499. humanReadableHintComponent: (
  500. <>
  501. You have used \begin
  502. {'{}'} without a corresponding \end
  503. {'{}'}.
  504. </>
  505. ),
  506. humanReadableHint:
  507. 'You have used \\begin{} without a corresponding \\end{}.'
  508. },
  509. {
  510. ruleId: 'hint_mismatched_environment3',
  511. types: ['environment'],
  512. cascadesFrom: ['environment'],
  513. regexToMatch: /Warning: No matching \\end found for `\\begin\{([^\}]+)\}'.*/,
  514. newMessage: 'Warning: No matching \\end found for \\begin{$1}',
  515. humanReadableHintComponent: (
  516. <>
  517. You have used \begin
  518. {'{}'} without a corresponding \end
  519. {'{}'}.
  520. </>
  521. ),
  522. humanReadableHint:
  523. 'You have used \\begin{} without a corresponding \\end{}.'
  524. },
  525. {
  526. ruleId: 'hint_mismatched_environment4',
  527. types: ['environment'],
  528. cascadesFrom: ['environment'],
  529. regexToMatch: /Error: Found `\\end\{([^\}]+)\}' without corresponding \\begin.*/,
  530. newMessage: 'Error: found \\end{$1} without a corresponding \\begin{$1}',
  531. humanReadableHintComponent: (
  532. <>
  533. You have used \begin
  534. {'{}'} without a corresponding \end
  535. {'{}'}.
  536. </>
  537. ),
  538. humanReadableHint:
  539. 'You have used \\begin{} without a corresponding \\end{}.'
  540. }
  541. ]
  542. if (!window.wikiEnabled) {
  543. rules.forEach(rule => {
  544. rule.extraInfoURL = null
  545. rule.humanReadableHint = stripHTMLFromString(rule.humanReadableHint)
  546. })
  547. }
  548. function stripHTMLFromString(htmlStr) {
  549. const tmp = document.createElement('DIV')
  550. tmp.innerHTML = htmlStr
  551. return tmp.textContent || tmp.innerText || ''
  552. }
  553. export default rules