-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could I get rid of the special meaning of backslash in markdown? #61
Comments
You can set the \markdownSetup{underscores = false} |
Amazing!! Thank you |
@Witiko Can I do the same thing with |
Sorry, there is currently no such option. However, in most cases, you should be able to use a single backslash. Can you show an example where you need several backslashes to achieve what you need? |
Most cases I need to escape the backslash is when I need to use the backslash to escape other characters in latex formula. For example, I have to use |
Such option is not yet implemented in the Lua parser. I will leave this issue open if anyone has the time and inclination to implement it. |
another example:
in latex:
I don't know why but I have to use six backslashes instead of four to make it work. I have another question:
|
Not at the moment, but you can go the other way around. For example, imagine having two files, main.tex and my-document.tex: main.tex
my-document.tex
|
Another example of this is when using the '#' character, which always has to be escaped in LaTeX. I use the LaTeX markdown environment with option What works now: \begin{markdown}
RRT$^\\#$ is a motion planner.
\end{markdown} What I would prefer: \begin{markdown}
RRT$^\#$ is a motion planner.
\end{markdown} In this case, the option to turn off escaping of backslashes only within TeX math mode would be sufficient. Excellent package, by the way! |
@rconnorlawson The # A heading
\# Not a heading However, markdown is not smart enough to only allow escaping in places where a heading may meaningfully start: This backslash: \# will *also* not get printed.
Try at <https://spec.commonmark.org/dingus/>. This is a more general issue and impacts most implementations of Markdown. |
Any idea if this is happening soon? I'm also having trouble with math environments and line breaks ( |
I try to keep the sections of my documents in markdown so I can build static sites with them and use MD text editors. To compile the math and have automatic tags in equations I use MathJax. The only way it works is to enclose the math environment in When I finish the document I compile a PDF using LaTeX and the markdown package. Before that, I have to change the line breaks in all the equations and delete the double dollar signs so I don't get an error. In that moment the I guess what I would like to have is way to use |
I am not tackling this at the moment, since it would require that we try to parse LaTeX and separate text from math, which can never be done precisely, since LaTeX is Turing-complete. If we were to implement this, we would at least need a heuristic (e.g. anything between |
Nice package I think! Recently I have made some attempts about
\documentclass{ctexart}
\usepackage{markdown}
\begin{document}
\begin{markdown}
undefined_object
\end{markdown}
\end{document} It works! ✅ But after I enable "hybrid" option... \documentclass{ctexart}
\usepackage{markdown}
\markdownSetup{hybrid = true}
\begin{document}
\begin{markdown}
undefined_object
\end{markdown}
\end{document} ummmm🤔......It gives a bunch of errors: Obviously it treats I think it should be treated as markdown character but not math note if not in math environment, even
By the way, fantastic and awesome package I think! Thank you nice developer🎉. |
@yfzhao20 Thank you for your thoughts. Here is why I am not in favor of making the
Instead of making
Similarly, we could introduce a |
@yfzhao20 Consider the following markdown text: In LaTeX, you can specify the size of the gap after a line break as follows: |
Options with specific functions (LaTeX comment, math environment and so on) are indeed what I want! That's great🎉
By the way, what I means about Cheers! |
@yfzhao20 I am sorry to say that there have always been tasks of higher priority for me to work on. 🙁 Recently, the upstream lunamark library has received support for raw attributes (see jgm#36), which I plan to port to the Markdown package in October (see #173). Perhaps you could use raw attributes for typing mathematical formulae: Here is a mathematical formula:
``` {=tex}
\[distance[i] =
\begin{dcases}
a & b \\
c & d
\end{dcases}
\]
``` Alternatively, you can contribute code or sponsor this issue. 🙂 |
@Witiko Thanks for your effort !!! 🌹 I will try this feature later, and keep updating debug report. 😃 |
In Markdown 2.18.0 (to be released on Monday), the \documentclass{article}
\usepackage[fenced_code, raw_attribute]{markdown}
\usepackage{mathtools}
\begin{document}
\begin{markdown}
Here is a `\TeX`{=tex} formula:
``` {=tex}
\[distance[i] =
\begin{dcases}
a & b \\
c & d
\end{dcases}
\]
```
\end{markdown}
\end{document} |
In Markdown 2.21.0 (released in February 2023), the \documentclass{article}
\usepackage[tex_math_dollars]{markdown}
\usepackage{mathtools}
\begin{document}
\begin{markdown}
Here is a $\text{\TeX}$ formula:
$$distance[i] =
\begin{dcases}
a & b \\
c & d
\end{dcases}
$$
\end{markdown}
\end{document} |
In Markdown 2.22.0 (to be released in March 2023), the \documentclass{article}
\usepackage[tex_math_single_backslash]{markdown}
\usepackage{mathtools}
\begin{document}
\begin{markdown}
Here is a \(\text{\TeX}\) formula:
\[distance[i] =
\begin{dcases}
a & b \\
c & d
\end{dcases}
\]
\end{markdown}
\end{document} |
The issue seems solved with multiple approaches to writing math described in #61 (comment), #61 (comment), and #61 (comment). Therefore, I am closing the issue. |
I am using markdown in latex to note faster and I also have the notes in two formats (latex -> pdf and markdown). But it is annoying when I have to use
x\_i
to writex_i
in latex. I also have to remove all of those slashes when copying to latex format. Could I rerender the underscore_
in markdown where I want it to have no special meaning?I see the option when we can rerender heading like this:
\markdownSetup{
renderers = {
headingOne = {\section{#1}},
headingTwo = {\subsection{#1}},
. },
}
But I don't know how to do in my case, Could you help me?
The text was updated successfully, but these errors were encountered: