Comments (4)
You're welcome. mdBook-KaTeX is designed for the user to have simple normal experience, not to work in a pipeline. For that purpose, it would probably be easier to use mdBook-KaTeX as a library. This is the function you want:
mdbook-katex/src/preprocess.rs
Lines 78 to 84 in 5302e96
from mdbook-katex.
Hi @Demian101, actually, looking at this again, I don't think the output would ever have four backslashes.
The code above is what you see in the Gettext PO file: it backslash-escapes the \\
once more and so you end up with \\\\
. However, when we generate Markdown using this translation, we remove one layer of backslashes.
So we should ultimately be converting
$$
\begin{array}{|c|c|c|c|c|}
\hline
1 & x_1 & x_2 & x_3 & out \\
\hline
0 & 1 & 1 & 0 & 0 \\
\hline
\end{array}
$$
into
$$ \\begin{array}{|c|c|c|c|c|} \\hline 1 & x_1 & x_2 & x_3 & out \\ \\hline 0 & 1 & 1 & 0 & 0 \\ \\hline \\end{array} $$
with the single backslashes turned into escaped backslashes.
Note: \\
becomes \\
after the conversion since \\
is already an escaped backslash according to the normal CommonMark rules for Backslash escapes. I don't know how mdbook-katex works, but I think this could be an important point: how does it distinguish between the escaped backslash in \\begin
and in \\
where the latter is supposed to create a line break?
from mdbook-katex.
- What is the error?
- You should feed in mdBook-KaTeX normal math expressions, i.e., without escaping backslashes. Because, it runs before the markdown processor.
from mdbook-katex.
- You should feed in mdBook-KaTeX normal math expressions, i.e., without escaping backslashes. Because, it runs before the markdown processor.
Oh, thank you for that, this clears up my questions! I somehow expected it to work with the parsed Markdown, but doing this on the raw input is of course much simpler 🙂
It does make the task of mdbook-i18n-helpers a bit more complex since the tools there work on the Markdown AST. We now somehow have to emit Markdown as-if we were working on the raw input.
I think we can close the issue/question here — making this work is a matter between google/mdbook-i18n-helpers#105 and possibly Byron/pulldown-cmark-to-cmark#60.
Thanks for the help!
from mdbook-katex.
Related Issues (20)
- Support many custom delimiters HOT 8
- Devanagri package HOT 1
- cannot use macro `\newcommand` HOT 1
- Scrollable equations HOT 2
- Debugging the plugin HOT 2
- `\\` line separators invalid in matrix environments HOT 7
- Undefined references in new release v0.5.10 HOT 3
- About client-side katex.js features HOT 2
- When a delimiter starts with backtick (`), katex renders inside code blocks HOT 1
- Less than symbol not rendered correctly HOT 7
- Call for PR: use Pulldown-CMark to extract match expressions HOT 1
- Error: The "katex" preprocessor exited unsuccessfully with signal: 6 (SIGABRT) (core dumped) status HOT 7
- `\mathrm` after rendering generate unwanted '>' char HOT 8
- Process chapter names as well HOT 2
- Error: The katex preprocessor does not support the 'pdf' renderer HOT 2
- Help: matrix not display correctly HOT 3
- Unable to render matrix HOT 2
- square brackets cause problems HOT 6
- matrix rendering HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdbook-katex.