typora-issues icon indicating copy to clipboard operation
typora-issues copied to clipboard

Option to choose Math (LaTeX / MathJax) delimiters

Open elizhenning opened this issue 9 years ago • 19 comments
trafficstars

Sometimes it's more convenient to use the ( ) math environment delimiters than dollar signs. Being able to choose would also make import/export easier with other MathJax-enabled apps.

elizhenning avatar Feb 16 '16 03:02 elizhenning

Just wanted to second this - using $ $ and $$\n \n$$ for equations does not play nice with standard tools like marked 2. While you can modify marked 2 to use the dollar sign delimiters it would prefer to see $$MATH HERE$$ rather than

$$ MATH HERE $$

as typora produces. Since marked is my main tool for turning markdown into production PDFs I was also hoping typora could be modified to allow for ( ) and [ ] delimiters.

Thanks!

badralbanna avatar Nov 08 '16 20:11 badralbanna

Would it be possible to modify the Typora app so that additional text can be included after the closing inline delimiter? i.e. I think the current closing inline delimiter must be $$\n.

After editing in Typora, I would like to process markdown files through pandoc-crossref (https://github.com/lierdakil/pandoc-crossref). For example:

pandoc input.md --filter=pandoc-crossref -o input.tex

At the moment, the following renders okay in the Typora preview:

Test here.

$$a+b=c$$ {#eq:name}

More text here.

inline

But the following breaks the Typora preview:

Test here.

$$
a+b=c
$$ {#eq:name}

More text here.

display

masonlr avatar Feb 24 '17 02:02 masonlr

Would love to see an option to choose LaTeX syntax \(...\) for inline math, and \[...\] for display math as well, instead of TeX syntax $...$ and $$...$$.

gandalfsaxe avatar Jun 23 '18 13:06 gandalfsaxe

It's made into LaTeX syntax anyway when exported to LaTeX / converted via pandoc.

gandalfsaxe avatar Jun 23 '18 13:06 gandalfsaxe

@masonlr I had the same problem, luckily there is a solution now.

gandalfsaxe avatar Jun 25 '18 07:06 gandalfsaxe

Writing this here just for reference, since this issue seems to relate to being able to choose any MathJax delimiters.

Currently, typora supports align by doing:

$$
\begin{align}
...
\end{align}
$$

However this will not render when not exporting using File -> Export, but instead converting to .tex or .pdf using pandoc.

Therefore I suggest that having:

\begin{align}
...
\end{align}

by itself should also trigger a live preview, just like $$ does.

gandalfsaxe avatar Jun 25 '18 07:06 gandalfsaxe

Here is further motivation to get working align environment implemented:

There is a school of thought that adheres to the rule that all equations should be numbered. Why this is was best expressed by physicist David Mermin in his column What's Wrong with These Equations (Physics Today, 1989):

[...]Fisher's rule is for the benefit not of the author, but the reader.

For although you, dear author, may have no need to refer in your text to the equations you therefore left unnumbered, it is presumptuous to assume the same disposition in your readers. And though you may well have acquired the solipsistic habit of writing under the assumption that you will have no readers at all, you are wrong. There is always the referee. The referee may desire to make reference to equations that you did not. Beyond that, should fortune smile upon you and others actually have occasion to mention your analysis in papers of their own, they will not think the better of you for forcing them into such locutions as "the second equation after (3.21)" or "the third unnumbered equation from the top in the left-hand column on p.2485." Even should you solipsistically choose to publish in a journal both unrefereed and unread, you might subsequently desire (just for the record) to publish an erratum, the graceful flow of which could only be ensured if you had adhered to Fisher's rule in your original manuscript. Full text here.

But this cannot be done in an equation environment, that is meant for one displayed/numbered equation, which is all Typora supports for live preview!

Originally found in this SE discussion. While there is not unanimous agreement on Ficher's rule (number all equations, see SE discussion), it sure would be nice to at least have the option to adhere to it.

gandalfsaxe avatar Jun 26 '18 08:06 gandalfsaxe

I'll cite my vision from 2685 here. It was named as

feature request: Add more supported LaTeX equation formats

and contained the following:

Many scientific texts contain equations. Currently texts are sometimes written in RMarkdown.

Some texts are books and articles written in bookdown, some of texts are presentations written with xaringan.

Below is the feature request to support more LaTeX equation notations such as:

Environment `\begin{equation}...\end{equation}`
with auto-numbering:

\begin{equation}
h(z) = \sinh(z)
\end{equation}

---

Environment `\begin{equation}...(\#eq:label)\end{equation}`
with auto-numbering and label (for bookdown):

\begin{equation}
  f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
  (\#eq:binom)
\end{equation}

---

Environment `\begin{equation}...\label{label}\end{equation}`
with auto-numbering label for xaringan

\begin{equation}
  g\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
\label{binom2}
\end{equation}

This functionality is currently exists in other editors

retext

But it is missed in Typora editor.

In this feature request I ask only for rendering of equations. Auto-numbering is not needed for me. I'll do it in RStudio after knitting of the document.

N0rbert avatar Aug 03 '19 10:08 N0rbert

I too would love to be able to do this:

\\[
\begin{blah}
\ldots
\end{blah}
\\]

The main reason I would love this is for compatibility with other editors/previewers. Though, if there was a Typora iOS app, it wouldn't mean so much to me 😜

cssaus avatar Sep 05 '19 06:09 cssaus

relates #2448

abnerlee avatar Jan 20 '20 14:01 abnerlee

I second this feature request! Especially the \begin{equation} \end{equation} tags will make Typora a full-feature alternative to Rstudio for Rmd files and bookdown. These are becoming the new open source standard in scientific publishing.

peverati avatar Aug 25 '20 02:08 peverati

Just wanted to second this. iA Writer, for example, does not recognize

$$
\math
$$

but do recognize

\\[
\math
\\]

Would be nice to be able to change the math delimiters so that my notes created on my computer could be read on iA Writer, on my phone too. Obviously, an iOS Typora app would also help...

raphaelhuleux avatar Oct 21 '20 09:10 raphaelhuleux

Still needed. The below code is not rendered

Environment `\begin{equation}...\end{equation}`
with auto-numbering:

\begin{equation}
h(z) = \sinh(z)
\end{equation}

---

Environment `\begin{equation}...(\#eq:label)\end{equation}`
with auto-numbering and label (for bookdown):

\begin{equation}
  f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
  (\#eq:binom)
\end{equation}

---

Environment `\begin{equation}...\label{label}\end{equation}`
with auto-numbering label for xaringan

\begin{equation}
  g\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
\label{binom2}
\end{equation}

in Typora 0.9.98.

N0rbert avatar Apr 11 '21 17:04 N0rbert

Still a problem with 0.11.6.

N0rbert avatar Nov 19 '21 21:11 N0rbert

Still a problem with 1.0. I will not buy your great software until this bug get fixed. Downgraded to free 0.11.18-1.

N0rbert avatar Nov 29 '21 12:11 N0rbert

Still a problem with 1.0.4.

N0rbert avatar Feb 08 '22 07:02 N0rbert

Any progress?

zdaiot avatar Oct 29 '24 08:10 zdaiot

There are several reasons to support (...) delimiters. Mainly because they are reversible (if I change ( and ) to $, I cannot go back easily). Moreover, ChatGPT uses Markdown with MathJax delimiters for LaTeX, which cannot be rendered directly by Typora. I asked ChatGPT for Markdown readers supporting MathJax syntax. Amazingly, I got that Typora supports it (I transcribe the conversation for fun!)

Markdown readers that can interpret the \( and \) LaTeX math delimiters typically rely on MathJax or KaTeX for rendering, as opposed to the $ syntax commonly used in inline LaTeX math. Here are a few options for Linux Markdown readers that support this syntax:

1. Typora

  • Overview: Typora is a popular Markdown editor with built-in support for LaTeX equations using the \( and \) syntax.
  • Installation:
    • Download the .deb or .rpm package from the Typora website.
    • Install via your package manager:
      sudo dpkg -i typora*.deb   # For Debian-based systems
      sudo rpm -i typora*.rpm    # For Red Hat-based systems
      
  • Usage:
    • Typora renders \( and \) inline math syntax automatically as you type.
    • For display math, use \[ ... \].

2. Zettlr

  • Overview: Zettlr is a Markdown editor that supports LaTeX syntax rendered via MathJax, including the \( and \) delimiters.
  • Installation:
    • Download the .AppImage or other packages from the Zettlr website.
    • Make the AppImage executable:
      chmod +x Zettlr*.AppImage
      ./Zettlr*.AppImage
      
  • Usage:
    • Enable MathJax rendering in the preferences.
    • Supports both inline (\( and \)) and block (\[ ... \]) math.

3. Obsidian

  • Overview: Obsidian is a powerful Markdown editor that supports LaTeX via MathJax with \( and \) delimiters.
  • Installation:
    • Download the Linux package from the Obsidian website.
    • Install the .AppImage or extract and run the binary.
  • Usage:
    • Open Obsidian settings and enable LaTeX rendering.
    • Math will render automatically using \( and \) syntax.

4. MarkText

  • Overview: MarkText is an open-source Markdown editor that supports LaTeX rendering with \( and \) delimiters.
  • Installation:
    • Install using AppImage, Snap, or AUR (for Arch Linux users):
      snap install marktext
      
  • Usage:
    • Use \( for inline math and \[ ... \] for block math.
    • MathJax rendering is built-in.

5. VS Code with Markdown Extensions

  • Overview: Visual Studio Code with the right extensions can render LaTeX math using \( and \) syntax.
  • Installation:
    • Install VS Code:
      sudo apt install code  # On Debian/Ubuntu systems
      
    • Install the "Markdown+Math" extension or similar.
  • Usage:
    • Open a .md file and ensure MathJax is enabled in the extension settings.

Recommendation

If you're looking for simplicity and a user-friendly interface, Typora is the best choice. If you're already using VS Code, the Markdown+Math extension will integrate seamlessly into your workflow.

By default, Typora uses $...$ for inline math and $$...$$ for block math. If you want to use \(...\) and \[...\] delimiters, you’ll need to adjust its Math Rendering settings.


Steps to Enable \(...\) in Typora

  1. Open Preferences:

    • In Typora, go to File > Preferences (or Ctrl + ,).
  2. Enable MathJax Rendering:

    • In the Preferences window, navigate to Markdown > Math Rendering.
    • Ensure MathJax is selected as the rendering engine.
  3. Modify Math Delimiters:

    • Click on the Edit Config button next to MathJax.
    • This will open the MathJax configuration file, which allows you to customize the delimiters.
  4. Update MathJax Delimiters:

    • Look for the tex section in the MathJax configuration. Add support for \(...\) and \[...\] by modifying the inlineMath and displayMath arrays. Update them as follows:
      tex: {
          inlineMath: [["$", "$"], ["\\(", "\\)"]],
          displayMath: [["$$", "$$"], ["\\[", "\\]"]]
      }
      
    • This ensures that both $...$ and \(...\) are recognized for inline math, and both $$...$$ and \[...\] are recognized for block math.
  5. Save and Restart Typora:

    • Save the configuration file.
    • Restart Typora for the changes to take effect.

Test the Configuration

Create a Markdown file with the following content to test:

Inline math: \( a^2 + b^2 = c^2 \) or $a^2 + b^2 = c^2$.

Block math:
\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]

or

$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$

If Typora is configured correctly, both types of delimiters (\(...\) and $...$) should render properly.

If you don’t see the Math Rendering option in Typora, it might be due to one of the following reasons:

  1. Older Version of Typora:

    • The MathJax configuration might not be exposed directly in the UI for older versions of Typora.
  2. Typora Stable Release:

    • In some distributions, the Math Rendering configuration might not be available in the stable release. Recent versions may have improved configurability.

Solution: Manually Edit the Typora Configuration

You can manually edit Typora's configuration files to add support for \(...\) delimiters. Here’s how:

Locate Typora's Configuration File

The configuration file typically resides in one of these locations depending on your operating system:

  • Linux:

    ~/.config/Typora/conf/conf.user.json
    
  • Windows:

    %APPDATA%\Typora\conf\conf.user.json
    
  • MacOS:

    ~/Library/Application Support/abnerworks.Typora/conf/conf.user.json
    

Modify the Math Rendering Delimiters

  1. Open the conf.user.json file with a text editor:

    nano ~/.config/Typora/conf/conf.user.json
    
  2. Look for the math section. If it doesn’t exist, add it like this:

    "math": {
        "inlineMath": [["$", "$"], ["\\(", "\\)"]],
        "displayMath": [["$$", "$$"], ["\\[", "\\]"]]
    }
    
  3. Save the file and restart Typora.


I could not manage to make it work!

comcamot avatar Jan 13 '25 11:01 comcamot

There are several reasons to support (...) delimiters. Mainly because they are reversible (if I change ( and ) to $, I cannot go back easily). Moreover, ChatGPT uses Markdown with MathJax delimiters for LaTeX, which cannot be rendered directly by Typora. I asked ChatGPT for Markdown readers supporting MathJax syntax. Amazingly, I got that Typora supports it (I transcribe the conversation for fun!)

Markdown readers that can interpret the \( and \) LaTeX math delimiters typically rely on MathJax or KaTeX for rendering, as opposed to the $ syntax commonly used in inline LaTeX math. Here are a few options for Linux Markdown readers that support this syntax:

1. Typora

  • Overview: Typora is a popular Markdown editor with built-in support for LaTeX equations using the \( and \) syntax.

  • Installation:

    • Download the .deb or .rpm package from the Typora website.
    • Install via your package manager: sudo dpkg -i typora*.deb # For Debian-based systems sudo rpm -i typora*.rpm # For Red Hat-based systems
  • Usage:

    • Typora renders \( and \) inline math syntax automatically as you type.
    • For display math, use \[ ... \].

2. Zettlr

  • Overview: Zettlr is a Markdown editor that supports LaTeX syntax rendered via MathJax, including the \( and \) delimiters.

  • Installation:

    • Download the .AppImage or other packages from the Zettlr website.
    • Make the AppImage executable: chmod +x Zettlr*.AppImage ./Zettlr*.AppImage
  • Usage:

    • Enable MathJax rendering in the preferences.
    • Supports both inline (\( and \)) and block (\[ ... \]) math.

3. Obsidian

  • Overview: Obsidian is a powerful Markdown editor that supports LaTeX via MathJax with \( and \) delimiters.

  • Installation:

    • Download the Linux package from the Obsidian website.
    • Install the .AppImage or extract and run the binary.
  • Usage:

    • Open Obsidian settings and enable LaTeX rendering.
    • Math will render automatically using \( and \) syntax.

4. MarkText

  • Overview: MarkText is an open-source Markdown editor that supports LaTeX rendering with \( and \) delimiters.

  • Installation:

    • Install using AppImage, Snap, or AUR (for Arch Linux users): snap install marktext
  • Usage:

    • Use \( for inline math and \[ ... \] for block math.
    • MathJax rendering is built-in.

5. VS Code with Markdown Extensions

  • Overview: Visual Studio Code with the right extensions can render LaTeX math using \( and \) syntax.

  • Installation:

    • Install VS Code: sudo apt install code # On Debian/Ubuntu systems
    • Install the "Markdown+Math" extension or similar.
  • Usage:

    • Open a .md file and ensure MathJax is enabled in the extension settings.

Recommendation

If you're looking for simplicity and a user-friendly interface, Typora is the best choice. If you're already using VS Code, the Markdown+Math extension will integrate seamlessly into your workflow.

By default, Typora uses $...$ for inline math and $$...$$ for block math. If you want to use \(...\) and \[...\] delimiters, you’ll need to adjust its Math Rendering settings.

Steps to Enable \(...\) in Typora

  1. Open Preferences:

    • In Typora, go to File > Preferences (or Ctrl + ,).
  2. Enable MathJax Rendering:

    • In the Preferences window, navigate to Markdown > Math Rendering.
    • Ensure MathJax is selected as the rendering engine.
  3. Modify Math Delimiters:

    • Click on the Edit Config button next to MathJax.
    • This will open the MathJax configuration file, which allows you to customize the delimiters.
  4. Update MathJax Delimiters:

    • Look for the tex section in the MathJax configuration. Add support for \(...\) and \[...\] by modifying the inlineMath and displayMath arrays. Update them as follows: tex: { inlineMath: [["$", "$"], ["\(", "\)"]], displayMath: [["$$", "$$"], ["\[", "\]"]] }
    • This ensures that both $...$ and \(...\) are recognized for inline math, and both $$...$$ and \[...\] are recognized for block math.
  5. Save and Restart Typora:

    • Save the configuration file.
    • Restart Typora for the changes to take effect.

Test the Configuration

Create a Markdown file with the following content to test:

Inline math: ( a^2 + b^2 = c^2 ) or $a^2 + b^2 = c^2$.

Block math: [ \int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2} ]

or

$$ \int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2} $$ If Typora is configured correctly, both types of delimiters (\(...\) and $...$) should render properly.

If you don’t see the Math Rendering option in Typora, it might be due to one of the following reasons:

  1. Older Version of Typora:

    • The MathJax configuration might not be exposed directly in the UI for older versions of Typora.
  2. Typora Stable Release:

    • In some distributions, the Math Rendering configuration might not be available in the stable release. Recent versions may have improved configurability.

Solution: Manually Edit the Typora Configuration

You can manually edit Typora's configuration files to add support for \(...\) delimiters. Here’s how:

Locate Typora's Configuration File

The configuration file typically resides in one of these locations depending on your operating system:

  • Linux:
    ~/.config/Typora/conf/conf.user.json
    
  • Windows:
    %APPDATA%\Typora\conf\conf.user.json
    
  • MacOS:
    ~/Library/Application Support/abnerworks.Typora/conf/conf.user.json
    

Modify the Math Rendering Delimiters

  1. Open the conf.user.json file with a text editor: nano ~/.config/Typora/conf/conf.user.json
  2. Look for the math section. If it doesn’t exist, add it like this: "math": { "inlineMath": [["$", "$"], ["\(", "\)"]], "displayMath": [["$$", "$$"], ["\[", "\]"]] }
  3. Save the file and restart Typora.

I could not manage to make it work!

This is not true. Obsidian doesn't use "(" and neither does Typora, or Marktext. Where did you get all this info from? OHH, it's GPT's hallucination!!!

kundeng avatar Apr 09 '25 14:04 kundeng

supported in v1.11

abnerlee avatar Aug 26 '25 13:08 abnerlee