Add eqref, math accents, and named undefined-command errors
This commit is contained in:
1 parent
f4d477695f
commit
e77181e997
3 files changed
+68
-2
No files matched your search
@@ -43,6 +43,15 @@ const PRELUDE: &str = r#"
|
||||
\def\texttt#1{\texrrastylestart{monospace}#1\texrrastyleend{monospace}}
|
||||
\def\underline#1{\texrramathaccentstart{underline}#1\texrramathaccentend}
|
||||
\def\hat#1{\texrramathaccentstart{hat}#1\texrramathaccentend}
|
||||
\def\bar#1{\texrramathaccentstart{bar}#1\texrramathaccentend}
|
||||
\def\tilde#1{\texrramathaccentstart{tilde}#1\texrramathaccentend}
|
||||
\def\vec#1{\texrramathaccentstart{vec}#1\texrramathaccentend}
|
||||
\def\dot#1{\texrramathaccentstart{dot}#1\texrramathaccentend}
|
||||
\def\ddot#1{\texrramathaccentstart{ddot}#1\texrramathaccentend}
|
||||
\def\check#1{\texrramathaccentstart{check}#1\texrramathaccentend}
|
||||
\def\breve#1{\texrramathaccentstart{breve}#1\texrramathaccentend}
|
||||
\def\acute#1{\texrramathaccentstart{acute}#1\texrramathaccentend}
|
||||
\def\grave#1{\texrramathaccentstart{grave}#1\texrramathaccentend}
|
||||
\def\widehat#1{\texrramathaccentstart{widehat}#1\texrramathaccentend}
|
||||
\def\tilde#1{\texrramathaccentstart{tilde}#1\texrramathaccentend}
|
||||
\def\widetilde#1{\texrramathaccentstart{widetilde}#1\texrramathaccentend}
|
||||
@@ -64,6 +73,7 @@ const PRELUDE: &str = r#"
|
||||
\def\clearpage{\texrrapagebreak}
|
||||
\def\pagebreak{\texrrapagebreak}
|
||||
\def\label#1{\texrralabel{#1}}
|
||||
\def\eqref#1{(\ref{#1})}
|
||||
\def\ref#1{\texrraref{#1}}
|
||||
\def\nonumber{\texrranonumber}
|
||||
\def\notag{\texrranonumber}
|
||||
|
||||
@@ -5509,6 +5509,56 @@ fn math_accent_start_primitive(
|
||||
"overline" => MathAccent::Overline,
|
||||
"underline" => MathAccent::Underline,
|
||||
"hat" => MathAccent::Hat,
|
||||
"bar" => MathAccent::Overline,
|
||||
"vec" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{20D7}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"dot" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{0307}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"ddot" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{0308}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"check" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{030C}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"breve" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{0306}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"acute" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{0301}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"grave" => MathAccent::Unicode {
|
||||
class: MathClass::Ordinary,
|
||||
family: 0,
|
||||
character: '\u{0300}',
|
||||
stretch: false,
|
||||
bottom: false,
|
||||
},
|
||||
"tilde" => MathAccent::Tilde,
|
||||
"widehat" => MathAccent::WideHat,
|
||||
"widetilde" => MathAccent::WideTilde,
|
||||
|
||||
Vendored
+8
-2
@@ -356,6 +356,8 @@ impl TexError for SimpleFailedPreconditionError {
|
||||
pub struct UndefinedCommandError {
|
||||
/// The token that was referred to an undefined command.
|
||||
pub token: token::Token,
|
||||
/// The name of the undefined command.
|
||||
pub name: String,
|
||||
/// Control sequences that are spelled similarly to the token.
|
||||
pub close_names: Vec<WordDiff>,
|
||||
}
|
||||
@@ -373,7 +375,11 @@ impl UndefinedCommandError {
|
||||
}
|
||||
let close_names = spellcheck::find_close_words(&all_names, &name);
|
||||
|
||||
UndefinedCommandError { token, close_names }
|
||||
UndefinedCommandError {
|
||||
token,
|
||||
name,
|
||||
close_names,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +389,7 @@ impl TexError for UndefinedCommandError {
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
"undefined control sequence".into()
|
||||
format!("undefined control sequence `\\{}`", self.name)
|
||||
}
|
||||
|
||||
fn notes(&self) -> Vec<display::Note> {
|
||||
|
||||
Reference in new issue
Block a user