HumanReadableLogsHints.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. import PropTypes from 'prop-types'
  2. function WikiLink({ url, children }) {
  3. if (window.wikiEnabled) {
  4. return (
  5. <a href={url} target="_blank" rel="noopener">
  6. {children}
  7. </a>
  8. )
  9. } else {
  10. return <>{children}</>
  11. }
  12. }
  13. WikiLink.propTypes = {
  14. url: PropTypes.string.isRequired,
  15. children: PropTypes.node.isRequired,
  16. }
  17. const hints = {
  18. hint_misplaced_alignment_tab_character: {
  19. extraInfoURL:
  20. 'https://www.overleaf.com/learn/Errors/Misplaced_alignment_tab_character_%26',
  21. formattedContent: (
  22. <>
  23. You have placed an alignment tab character '&' in the wrong place. If
  24. you want to align something, you must write it inside an align
  25. environment such as \begin
  26. {'{align}'} … \end
  27. {'{align}'}, \begin
  28. {'{tabular}'} … \end
  29. {'{tabular}'}, etc. If you want to write an ampersand '&' in text, you
  30. must write \& instead.
  31. </>
  32. ),
  33. },
  34. hint_extra_alignment_tab_has_been_changed: {
  35. extraInfoURL:
  36. 'https://www.overleaf.com/learn/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr',
  37. formattedContent: (
  38. <>
  39. You have written too many alignment tabs in a table, causing one of them
  40. to be turned into a line break. Make sure you have specified the correct
  41. number of columns in your{' '}
  42. <WikiLink url="https://www.overleaf.com/learn/Tables">table</WikiLink>.
  43. </>
  44. ),
  45. },
  46. hint_display_math_should_end_with: {
  47. extraInfoURL:
  48. 'https://www.overleaf.com/learn/Errors/Display_math_should_end_with_$$',
  49. formattedContent: (
  50. <>
  51. You have forgotten a $ sign at the end of 'display math' mode. When
  52. writing in display math mode, you must always math write inside $$ … $$.
  53. Check that the number of $s match around each math expression.
  54. </>
  55. ),
  56. },
  57. hint_missing_inserted: {
  58. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Missing_$_inserted',
  59. formattedContent: (
  60. <>
  61. <p>
  62. You need to enclose all mathematical expressions and symbols with
  63. special markers. These special markers create a ‘math mode’.
  64. </p>
  65. <p>
  66. Use <code>$...$</code> for inline math mode, and <code>\[...\]</code>
  67. or one of the mathematical environments (e.g. equation) for display
  68. math mode.
  69. </p>
  70. <p>
  71. This applies to symbols such as subscripts ( <code>_</code> ),
  72. integrals ( <code>\int</code> ), Greek letters ( <code>\alpha</code>,{' '}
  73. <code>\beta</code>, <code>\delta</code> ) and modifiers{' '}
  74. <code>{'(\\vec{x}'}</code>, <code>{'\\tilde{x}'})</code>.
  75. </p>
  76. </>
  77. ),
  78. },
  79. hint_reference_undefined: {
  80. extraInfoURL:
  81. 'https://www.overleaf.com/learn/Errors/There_were_undefined_references',
  82. formattedContent: (
  83. <>
  84. You have referenced something which has not yet been labelled. If you
  85. have labelled it already, make sure that what is written inside \ref
  86. {'{...}'} is the same as what is written inside \label
  87. {'{...}'}.
  88. </>
  89. ),
  90. },
  91. hint_there_were_undefined_references: {
  92. extraInfoURL:
  93. 'https://www.overleaf.com/learn/Errors/There_were_undefined_references',
  94. formattedContent: (
  95. <>
  96. You have referenced something which has not yet been labelled. If you
  97. have labelled it already, make sure that what is written inside \ref
  98. {'{...}'} is the same as what is written inside \label
  99. {'{...}'}.
  100. </>
  101. ),
  102. },
  103. hint_citation_on_page_undefined_on_input_line: {
  104. extraInfoURL:
  105. 'https://www.overleaf.com/learn/Errors/Citation_XXX_on_page_XXX_undefined_on_input_line_XXX',
  106. formattedContent: (
  107. <>
  108. You have cited something which is not included in your bibliography.
  109. Make sure that the citation (\cite
  110. {'{...}'}) has a corresponding key in your bibliography, and that both
  111. are spelled the same way.
  112. </>
  113. ),
  114. },
  115. hint_label_multiply_defined_labels: {
  116. extraInfoURL:
  117. 'https://www.overleaf.com/learn/Errors/There_were_multiply-defined_labels',
  118. formattedContent: (
  119. <>
  120. You have used the same label more than once. Check that each \label
  121. {'{...}'} labels only one item.
  122. </>
  123. ),
  124. },
  125. hint_float_specifier_changed: {
  126. extraInfoURL:
  127. 'https://www.overleaf.com/learn/Errors/%60!h%27_float_specifier_changed_to_%60!ht%27',
  128. formattedContent: (
  129. <>
  130. The float specifier 'h' is too strict of a demand for LaTeX to place
  131. your float in a nice way here. Try relaxing it by using 'ht', or even
  132. 'htbp' if necessary. If you want to try keep the float here anyway,
  133. check out the{' '}
  134. <WikiLink url="https://www.overleaf.com/learn/Positioning_of_Figures">
  135. float package
  136. </WikiLink>
  137. .
  138. </>
  139. ),
  140. },
  141. hint_no_positions_in_optional_float_specifier: {
  142. extraInfoURL:
  143. 'https://www.overleaf.com/learn/Errors/No_positions_in_optional_float_specifier',
  144. formattedContent: (
  145. <>
  146. You have forgotten to include a float specifier, which tells LaTeX where
  147. to position your figure. To fix this, either insert a float specifier
  148. inside the square brackets (e.g. \begin
  149. {'{figure}'}
  150. [h]), or remove the square brackets (e.g. \begin
  151. {'{figure}'}
  152. ). Find out more about float specifiers{' '}
  153. <WikiLink url="https://www.overleaf.com/learn/Positioning_of_Figures">
  154. here
  155. </WikiLink>
  156. .
  157. </>
  158. ),
  159. },
  160. hint_undefined_control_sequence: {
  161. extraInfoURL:
  162. 'https://www.overleaf.com/learn/Errors/Undefined_control_sequence',
  163. formattedContent: (
  164. <>
  165. The compiler is having trouble understanding a command you have used.
  166. Check that the command is spelled correctly. If the command is part of a
  167. package, make sure you have included the package in your preamble using
  168. \usepackage
  169. {'{...}'}.
  170. </>
  171. ),
  172. },
  173. hint_file_not_found: {
  174. extraInfoURL:
  175. 'https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX',
  176. formattedContent: (
  177. <>
  178. The compiler cannot find the file you want to include. Make sure that
  179. you have{' '}
  180. <WikiLink url="https://www.overleaf.com/learn/Including_images_in_ShareLaTeX">
  181. uploaded the file
  182. </WikiLink>{' '}
  183. and{' '}
  184. <WikiLink url="https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX.">
  185. specified the file location correctly
  186. </WikiLink>
  187. .
  188. </>
  189. ),
  190. },
  191. hint_unknown_graphics_extension: {
  192. extraInfoURL:
  193. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.XXX',
  194. formattedContent: (
  195. <>
  196. The compiler does not recognise the file type of one of your images.
  197. Make sure you are using a{' '}
  198. <WikiLink url="https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.gif.">
  199. supported image format
  200. </WikiLink>{' '}
  201. for your choice of compiler, and check that there are no periods (.) in
  202. the name of your image.
  203. </>
  204. ),
  205. },
  206. hint_unknown_float_option_h: {
  207. extraInfoURL:
  208. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_float_option_%60H%27',
  209. formattedContent: (
  210. <>
  211. The compiler isn't recognizing the float option 'H'. Include \usepackage
  212. {'{float}'} in your preamble to fix this.
  213. </>
  214. ),
  215. },
  216. hint_unknown_float_option_q: {
  217. extraInfoURL:
  218. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_float_option_%60q%27',
  219. formattedContent: (
  220. <>
  221. You have used a float specifier which the compiler does not understand.
  222. You can learn more about the different float options available for
  223. placing figures{' '}
  224. <WikiLink url="https://www.overleaf.com/learn/Positioning_of_Figures">
  225. here
  226. </WikiLink>{' '}
  227. .
  228. </>
  229. ),
  230. },
  231. hint_math_allowed_only_in_math_mode: {
  232. extraInfoURL:
  233. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_%5Cmathrm_allowed_only_in_math_mode',
  234. formattedContent: (
  235. <>
  236. You have used a font command which is only available in math mode. To
  237. use this command, you must be in maths mode (E.g. $ … $ or \begin
  238. {'{math}'} … \end
  239. {'{math}'}
  240. ). If you want to use it outside of math mode, use the text version
  241. instead: \textrm, \textit, etc.
  242. </>
  243. ),
  244. },
  245. hint_mismatched_environment: {
  246. formattedContent: (
  247. <>
  248. You have used \begin
  249. {'{...}'} without a corresponding \end
  250. {'{...}'}.
  251. </>
  252. ),
  253. },
  254. hint_mismatched_brackets: {
  255. formattedContent: (
  256. <>You have used an open bracket without a corresponding close bracket.</>
  257. ),
  258. },
  259. hint_can_be_used_only_in_preamble: {
  260. extraInfoURL:
  261. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Can_be_used_only_in_preamble',
  262. formattedContent: (
  263. <>
  264. You have used a command in the main body of your document which should
  265. be used in the preamble. Make sure that \documentclass[…]
  266. {'{…}'} and all \usepackage
  267. {'{…}'} commands are written before \begin
  268. {'{document}'}.
  269. </>
  270. ),
  271. },
  272. hint_missing_right_inserted: {
  273. extraInfoURL:
  274. 'https://www.overleaf.com/learn/Errors/Missing_%5Cright_insertede',
  275. formattedContent: (
  276. <>
  277. You have started an expression with a \left command, but have not
  278. included a corresponding \right command. Make sure that your \left and
  279. \right commands balance everywhere, or else try using \Biggl and \Biggr
  280. commands instead as shown{' '}
  281. <WikiLink url="https://www.overleaf.com/learn/Errors/Missing_%5Cright_inserted">
  282. here
  283. </WikiLink>
  284. .
  285. </>
  286. ),
  287. },
  288. hint_double_superscript: {
  289. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Double_superscript',
  290. formattedContent: (
  291. <>
  292. You have written a double superscript incorrectly as a^b^c, or else you
  293. have written a prime with a superscript. Remember to include {'{and}'}{' '}
  294. when using multiple superscripts. Try a^
  295. {'{b ^ c}'} instead.
  296. </>
  297. ),
  298. },
  299. hint_double_subscript: {
  300. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Double_subscript',
  301. formattedContent: (
  302. <>
  303. You have written a double subscript incorrectly as a_b_c. Remember to
  304. include {'{and}'} when using multiple subscripts. Try a_
  305. {'{b_c}'} instead.
  306. </>
  307. ),
  308. },
  309. hint_no_author_given: {
  310. extraInfoURL: 'https://www.overleaf.com/learn/Errors/No_%5Cauthor_given',
  311. formattedContent: (
  312. <>
  313. You have used the \maketitle command, but have not specified any
  314. \author. To fix this, include an author in your preamble using the
  315. \author
  316. {'{…}'} command.
  317. </>
  318. ),
  319. },
  320. hint_environment_undefined: {
  321. extraInfoURL:
  322. 'https://www.overleaf.com/learn/Errors%2FLaTeX%20Error%3A%20Environment%20XXX%20undefined',
  323. formattedContent: (
  324. <>
  325. You have created an environment (using \begin
  326. {'{…}'} and \end
  327. {'{…}'} commands) which is not recognized. Make sure you have included
  328. the required package for that environment in your preamble, and that the
  329. environment is spelled correctly.
  330. </>
  331. ),
  332. },
  333. hint_somethings_wrong_perhaps_a_missing_item: {
  334. extraInfoURL:
  335. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Something%27s_wrong--perhaps_a_missing_%5Citem',
  336. formattedContent: (
  337. <>
  338. There are no entries found in a list you have created. Make sure you
  339. label list entries using the \item command, and that you have not used a
  340. list inside a table.
  341. </>
  342. ),
  343. },
  344. hint_misplaced_noalign: {
  345. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Misplaced_%5Cnoalign',
  346. formattedContent: (
  347. <>
  348. You have used a \hline command in the wrong place, probably outside a
  349. table. If the \hline command is written inside a table, try including \\
  350. before it.
  351. </>
  352. ),
  353. },
  354. hint_no_line_here_to_end: {
  355. extraInfoURL:
  356. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_There%27s_no_line_here_to_end',
  357. formattedContent: (
  358. <>
  359. You have used a \\ or \newline command where LaTeX was not expecting
  360. one. Make sure that you only use line breaks after blocks of text, and
  361. be careful using linebreaks inside lists and other environments.\
  362. </>
  363. ),
  364. },
  365. hint_verb_ended_by_end_of_line: {
  366. extraInfoURL:
  367. 'https://www.overleaf.com/learn/Errors/LaTeX_Error:_%5Cverb_ended_by_end_of_line',
  368. formattedContent: (
  369. <>
  370. You have used a \verb command incorrectly. Try replacling the \verb
  371. command with \begin
  372. {'{verbatim}'}
  373. …\end
  374. {'{verbatim}'}
  375. .\
  376. </>
  377. ),
  378. },
  379. hint_illegal_unit_of_measure_pt_inserted: {
  380. extraInfoURL:
  381. 'https://www.overleaf.com/learn/Errors%2FIllegal%20unit%20of%20measure%20(pt%20inserted)',
  382. formattedContent: (
  383. <>
  384. You have written a length, but have not specified the appropriate units
  385. (pt, mm, cm etc.). If you have not written a length, check that you have
  386. not witten a linebreak \\ followed by square brackets […] anywhere.
  387. </>
  388. ),
  389. },
  390. hint_extra_right: {
  391. extraInfoURL: 'https://www.overleaf.com/learn/Errors/Extra_%5Cright',
  392. formattedContent: (
  393. <>
  394. You have written a \right command without a corresponding \left command.
  395. Check that all \left and \right commands balance everywhere.
  396. </>
  397. ),
  398. },
  399. hint_missing_begin_document_: {
  400. extraInfoURL:
  401. 'https://www.overleaf.com/learn/Errors%2FLaTeX%20Error%3A%20Missing%20%5Cbegin%20document',
  402. formattedContent: (
  403. <>
  404. No \begin
  405. {'{document}'} command was found. Make sure you have included \begin
  406. {'{document}'} in your preamble, and that your main document is set
  407. correctly.
  408. </>
  409. ),
  410. },
  411. hint_mismatched_environment2: {
  412. formattedContent: (
  413. <>
  414. You have used \begin
  415. {'{}'} without a corresponding \end
  416. {'{}'}.
  417. </>
  418. ),
  419. },
  420. hint_mismatched_environment3: {
  421. formattedContent: (
  422. <>
  423. You have used \begin
  424. {'{}'} without a corresponding \end
  425. {'{}'}.
  426. </>
  427. ),
  428. },
  429. hint_mismatched_environment4: {
  430. formattedContent: (
  431. <>
  432. You have used \begin
  433. {'{}'} without a corresponding \end
  434. {'{}'}.
  435. </>
  436. ),
  437. },
  438. }
  439. if (!window.wikiEnabled) {
  440. Object.keys(hints).forEach(ruleId => {
  441. hints[ruleId].extraInfoURL = null
  442. })
  443. }
  444. export default hints