mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-13 15:08:39 +00:00
Tilde \textasciitilde and fix ~ in \verb (#1286)
* \textasciitilde and fix ~ in \verb * Add support for `\textasciitilde` which reproduces tilde character in text mode. * Make `~` render as tilde instead of space within `\verb`, by manually mapping that character to `\textasciitilde`. This seems to be the only character that needs such manual mapping to reproduce LaTeX's `\verb` behavior. * Add `, -, ', ~ to Verb screenshot test
This commit is contained in:
@@ -25,7 +25,11 @@ defineFunction({
|
||||
// \verb enters text mode and therefore is sized like \textstyle
|
||||
const newOptions = options.havingStyle(options.style.text());
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
body.push(buildCommon.makeSymbol(text[i], "Typewriter-Regular",
|
||||
let c = text[i];
|
||||
if (c === '~') {
|
||||
c = '\\textasciitilde';
|
||||
}
|
||||
body.push(buildCommon.makeSymbol(c, "Typewriter-Regular",
|
||||
group.mode, newOptions, ["mord", "texttt"]));
|
||||
}
|
||||
buildCommon.tryCombineChars(body);
|
||||
|
@@ -632,6 +632,7 @@ defineSymbol(text, main, textord, "|", "\\textbar"); // in T1 fontenc
|
||||
defineSymbol(math, main, textord, "\u2225", "\\|");
|
||||
defineSymbol(math, main, textord, "\u2225", "\\Vert");
|
||||
defineSymbol(text, main, textord, "\u2225", "\\textbardbl");
|
||||
defineSymbol(text, main, textord, "~", "\\textasciitilde");
|
||||
defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
|
||||
defineSymbol(math, main, rel, "\u21d1", "\\Uparrow", true);
|
||||
defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
|
||||
|
Reference in New Issue
Block a user