mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +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);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
@@ -358,6 +358,7 @@ Verb: |
|
||||
\verb* \verb* , & \verb*|\verb* |, \\
|
||||
\verb!<x> & </y>! & \scriptstyle\verb|ss verb| \\
|
||||
\verb*!<x> & </y>! & \small\verb|sm verb| \\
|
||||
\verb|``---''~|
|
||||
\end{array}
|
||||
VerticalSpacing:
|
||||
pre: potato<br>blah
|
||||
|
Reference in New Issue
Block a user