2020-10-29 06:24:07 -04:00
/* eslint-disable no-useless-escape */
import PropTypes from 'prop-types'
2021-12-07 06:30:08 -05:00
function WikiLink ( { url , children } ) {
2021-08-03 06:01:54 -04:00
if ( window . wikiEnabled ) {
return (
2021-09-14 06:43:57 -04:00
< a href = { url } target = "_blank" rel = "noopener" >
2021-08-03 06:01:54 -04:00
{ children }
< / a >
)
} else {
return < > { children } < / >
}
2020-10-29 06:24:07 -04:00
}
WikiLink . propTypes = {
2021-08-03 06:01:54 -04:00
url : PropTypes . string . isRequired ,
2021-04-27 03:52:58 -04:00
children : PropTypes . node . isRequired ,
2020-10-29 06:24:07 -04:00
}
const rules = [
2018-11-05 05:06:39 -05:00
{
regexToMatch : /Misplaced alignment tab character \&/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/Misplaced_alignment_tab_character_%26' ,
humanReadableHintComponent : (
< >
You have placed an alignment tab character '&' 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 '&' in text , you
must write \ & instead .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have placed an alignment tab character '&' 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 '&' in text, you must write \\& instead.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Extra alignment tab has been changed to \\cr/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/Extra_alignment_tab_has_been_changed_to_%5Ccr' ,
humanReadableHintComponent : (
< >
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 { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Tables" > table < / W i k i L i n k > .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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>.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Display math should end with \$\$/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/Display_math_should_end_with_$$' ,
humanReadableHintComponent : (
< >
You have forgotten a $ sign at the end of 'display math' mode . When
writing in display math mode , you must always math write inside $$ … $$ .
Check that the number of $s match around each math expression .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have forgotten a $ sign at the end of 'display math' mode. When writing in display math mode, you must always math write inside $$ … $$. Check that the number of $s match around each math expression.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Missing [{$] inserted./ ,
2020-10-29 06:24:07 -04:00
extraInfoURL : 'https://www.overleaf.com/learn/Errors/Missing_$_inserted' ,
humanReadableHintComponent : (
< >
2021-08-03 06:01:54 -04:00
< p >
You need to enclose all mathematical expressions and symbols with
special markers . These special markers create a ‘ math mode ’ .
< / p >
< p >
Use < code > $ ... $ < / c o d e > f o r i n l i n e m a t h m o d e , a n d < c o d e > \ [ . . . \ ] < / c o d e >
or one of the mathematical environments ( e . g . equation ) for display
math mode .
< / p >
< p >
This applies to symbols such as subscripts ( < code > _ < / c o d e > ) ,
integrals ( < code > \ int < / c o d e > ) , G r e e k l e t t e r s ( < c o d e > \ a l p h a < / c o d e > , { ' ' }
< code > \ beta < / c o d e > , < c o d e > \ d e l t a < / c o d e > ) a n d m o d i f i e r s { ' ' }
< code > { '(\\vec{x}' } < / c o d e > , < c o d e > { ' \ \ t i l d e { x } ' } ) < / c o d e > .
< / p >
2020-10-29 06:24:07 -04:00
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-08-03 06:01:54 -04:00
'You need to enclose all mathematical expressions and symbols with special markers. These special markers create a ‘ math mode’ . Use $...$ for inline math mode, and \\[...\\] or one of the mathematical environments (e.g. equation) for display math mode. This applies to symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ) and modifiers (\\vec{x}, \\tilde{x} ).' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /(undefined )?[rR]eference(s)?.+(undefined)?/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/There_were_undefined_references' ,
humanReadableHintComponent : (
< >
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
{ '{...}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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{...}.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Citation .+ on page .+ undefined on input line .+/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/Citation_XXX_on_page_XXX_undefined_on_input_line_XXX' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /(Label .+)? multiply[ -]defined( labels)?/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/There_were_multiply-defined_labels' ,
humanReadableHintComponent : (
< >
You have used the same label more than once . Check that each \ label
{ '{...}' } labels only one item .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used the same label more than once. Check that each \\label{...} labels only one item.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /`!?h' float specifier changed to `!?ht'/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/%60!h%27_float_specifier_changed_to_%60!ht%27' ,
humanReadableHintComponent : (
< >
The float specifier 'h' is too strict of a demand for LaTeX to place
your float in a nice way here . Try relaxing it by using 'ht' , or even
'htbp' if necessary . If you want to try keep the float here anyway ,
check out the { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Positioning_of_Figures" >
float package
< / W i k i L i n k >
.
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' 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>.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /No positions in optional float specifier/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/No_positions_in_optional_float_specifier' ,
humanReadableHintComponent : (
< >
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 { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Positioning_of_Figures" >
here
< / W i k i L i n k >
.
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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>.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Undefined control sequence/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/Undefined_control_sequence' ,
humanReadableHintComponent : (
< >
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
{ '{...}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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{...}.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /File .+ not found/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX' ,
humanReadableHintComponent : (
< >
The compiler cannot find the file you want to include . Make sure that
you have { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Including_images_in_ShareLaTeX" >
uploaded the file
< / W i k i L i n k > { ' ' }
and { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Errors/File_XXX_not_found_on_input_line_XXX." >
specified the file location correctly
< / W i k i L i n k >
.
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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>.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: Unknown graphics extension: \..+/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.XXX' ,
humanReadableHintComponent : (
< >
The compiler does not recognise the file type of one of your images .
Make sure you are using a { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_graphics_extension:_.gif." >
supported image format
< / W i k i L i n k > { ' ' }
for your choice of compiler , and check that there are no periods ( . ) in
the name of your image .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: Unknown float option `H'/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_float_option_%60H%27' ,
humanReadableHintComponent : (
< >
The compiler isn 't recognizing the float option ' H ' . Include \ usepackage
{ '{float}' } in your preamble to fix this .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'The compiler isn't recognizing the float option 'H'. Include \\usepackage{float} in your preamble to fix this.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: Unknown float option `q'/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Unknown_float_option_%60q%27' ,
humanReadableHintComponent : (
< >
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 { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Positioning_of_Figures" >
here
< / W i k i L i n k > { ' ' }
.
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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> .' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: \\math.+ allowed only in math mode/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_%5Cmathrm_allowed_only_in_math_mode' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
ruleId : 'hint_mismatched_environment' ,
types : [ 'environment' ] ,
regexToMatch : /Error: `([^']{2,})' expected, found `([^']{2,})'.*/ ,
newMessage : 'Error: environment does not match \\begin{$1} ... \\end{$2}' ,
2020-10-29 06:24:07 -04:00
humanReadableHintComponent : (
< >
You have used \ begin
{ '{...}' } without a corresponding \ end
{ '{...}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used \\begin{...} without a corresponding \\end{...}.' ,
2018-11-05 05:06:39 -05:00
} ,
{
ruleId : 'hint_mismatched_brackets' ,
types : [ 'environment' ] ,
regexToMatch : /Error: `([^a-zA-Z0-9])' expected, found `([^a-zA-Z0-9])'.*/ ,
newMessage : "Error: brackets do not match, found '$2' instead of '$1'" ,
2020-10-29 06:24:07 -04:00
humanReadableHintComponent : (
< > You have used an open bracket without a corresponding close bracket . < / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used an open bracket without a corresponding close bracket.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: Can be used only in preamble/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Can_be_used_only_in_preamble' ,
humanReadableHintComponent : (
< >
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}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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}.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Missing \\right inserted/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/Missing_%5Cright_insertede' ,
humanReadableHintComponent : (
< >
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 { ' ' }
< WikiLink url = "https://www.overleaf.com/learn/Errors/Missing_%5Cright_inserted" >
here
< / W i k i L i n k >
.
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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>.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Double superscript/ ,
2020-10-29 06:24:07 -04:00
extraInfoURL : 'https://www.overleaf.com/learn/Errors/Double_superscript' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Double subscript/ ,
2020-10-29 06:24:07 -04:00
extraInfoURL : 'https://www.overleaf.com/learn/Errors/Double_subscript' ,
humanReadableHintComponent : (
< >
You have written a double subscript incorrectly as a _b _c . Remember to
include { '{and}' } when using multiple subscripts . Try a _
{ '{b_c}' } instead .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have written a double subscript incorrectly as a_b_c. Remember to include {and} when using multiple subscripts. Try a_{b_c} instead.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /No \\author given/ ,
2020-10-29 06:24:07 -04:00
extraInfoURL : 'https://www.overleaf.com/learn/Errors/No_%5Cauthor_given' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: Environment .+ undefined/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors%2FLaTeX%20Error%3A%20Environment%20XXX%20undefined' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: Something's wrong--perhaps a missing \\item/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_Something%27s_wrong--perhaps_a_missing_%5Citem' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Misplaced \\noalign/ ,
2020-10-29 06:24:07 -04:00
extraInfoURL : 'https://www.overleaf.com/learn/Errors/Misplaced_%5Cnoalign' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: There's no line here to end/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_There%27s_no_line_here_to_end' ,
humanReadableHintComponent : (
< >
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 . \
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.\\' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /LaTeX Error: \\verb ended by end of line/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors/LaTeX_Error:_%5Cverb_ended_by_end_of_line' ,
humanReadableHintComponent : (
< >
You have used a \ verb command incorrectly . Try replacling the \ verb
command with \ begin
{ '{verbatim}' }
… \ end
{ '{verbatim}' }
. \
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used a \\verb command incorrectly. Try replacling the \\verb command with \\begin{verbatim}…\\end{verbatim}.\\' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Illegal unit of measure (pt inserted)/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors%2FIllegal%20unit%20of%20measure%20(pt%20inserted)' ,
humanReadableHintComponent : (
< >
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 .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'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.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Extra \\right/ ,
2020-10-29 06:24:07 -04:00
extraInfoURL : 'https://www.overleaf.com/learn/Errors/Extra_%5Cright' ,
humanReadableHintComponent : (
< >
You have written a \ right command without a corresponding \ left command .
Check that all \ left and \ right commands balance everywhere .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have written a \\right command without a corresponding \\left command. Check that all \\left and \\right commands balance everywhere.' ,
2018-11-05 05:06:39 -05:00
} ,
{
regexToMatch : /Missing \\begin{document}/ ,
extraInfoURL :
2020-10-29 06:24:07 -04:00
'https://www.overleaf.com/learn/Errors%2FLaTeX%20Error%3A%20Missing%20%5Cbegin%20document' ,
humanReadableHintComponent : (
< >
No \ begin
{ '{document}' } command was found . Make sure you have included \ begin
{ '{document}' } in your preamble , and that your main document is set
correctly .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'No \\begin{document} command was found. Make sure you have included \\begin{document} in your preamble, and that your main document is set correctly.' ,
2018-11-05 05:06:39 -05:00
} ,
{
ruleId : 'hint_mismatched_environment2' ,
types : [ 'environment' ] ,
cascadesFrom : [ 'environment' ] ,
regexToMatch : /Error: `\\end\{([^\}]+)\}' expected but found `\\end\{([^\}]+)\}'.*/ ,
newMessage : 'Error: environments do not match: \\begin{$1} ... \\end{$2}' ,
2020-10-29 06:24:07 -04:00
humanReadableHintComponent : (
< >
You have used \ begin
{ '{}' } without a corresponding \ end
{ '{}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used \\begin{} without a corresponding \\end{}.' ,
2018-11-05 05:06:39 -05:00
} ,
{
ruleId : 'hint_mismatched_environment3' ,
types : [ 'environment' ] ,
cascadesFrom : [ 'environment' ] ,
regexToMatch : /Warning: No matching \\end found for `\\begin\{([^\}]+)\}'.*/ ,
newMessage : 'Warning: No matching \\end found for \\begin{$1}' ,
2020-10-29 06:24:07 -04:00
humanReadableHintComponent : (
< >
You have used \ begin
{ '{}' } without a corresponding \ end
{ '{}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used \\begin{} without a corresponding \\end{}.' ,
2018-11-05 05:06:39 -05:00
} ,
{
ruleId : 'hint_mismatched_environment4' ,
types : [ 'environment' ] ,
cascadesFrom : [ 'environment' ] ,
regexToMatch : /Error: Found `\\end\{([^\}]+)\}' without corresponding \\begin.*/ ,
newMessage : 'Error: found \\end{$1} without a corresponding \\begin{$1}' ,
2020-10-29 06:24:07 -04:00
humanReadableHintComponent : (
< >
You have used \ begin
{ '{}' } without a corresponding \ end
{ '{}' } .
< / >
2021-01-04 05:22:57 -05:00
) ,
humanReadableHint :
2021-04-27 03:52:58 -04:00
'You have used \\begin{} without a corresponding \\end{}.' ,
} ,
2020-05-19 05:02:56 -04:00
]
2020-10-29 06:24:07 -04:00
2021-01-04 05:22:57 -05:00
if ( ! window . wikiEnabled ) {
rules . forEach ( rule => {
rule . extraInfoURL = null
rule . humanReadableHint = stripHTMLFromString ( rule . humanReadableHint )
} )
}
function stripHTMLFromString ( htmlStr ) {
const tmp = document . createElement ( 'DIV' )
tmp . innerHTML = htmlStr
return tmp . textContent || tmp . innerText || ''
}
2020-10-29 06:24:07 -04:00
export default rules