# Preview math formula from Ulysses quick export

#### Liang Xu

31 Oct, 2018 05:52 AM

I configured to preview Ulysses sheet with Marked (cmd+6, then return). However, there are seems to be some issues in the Marked 2 preview for math formula. Please see the attached screenshot.

1. Posted by qiangqibing on 31 Oct, 2018 05:59 AM

attached are the screenshot

2. Support Staff Posted by Brett on 31 Oct, 2018 01:01 PM

First, you don't need to load MathJax, it's built into Marked and can be enabled via Preferences->Style. You can also customize the configuration options there, but the config you have in your script is already default.

If only the last item is not rendering, could you paste the complete text of the Ulysses sheet here so I can test?

-Brett

3. Posted by #XU LIANG# on 01 Nov, 2018 06:23 AM

Hi Brett,

Below is the text of the Ulysses sheet. some math formulas can display correctly but some are not.

Problems in Prove the Convergence

We have the following system
~$$y_k=\gamma_{k-1}+\theta_{k-1}$$~
where ~$\gamma_{k-1}\sim \mathcal{N}(0,U_{k-1})$~ and ~$\theta_{k-1} \sim \mathcal{N}(0, W_{k-1})$~. Moreover ~$\gamma_k$~ is independent with ~$\theta_{k}$~ and ~$W_k$~ converges to ~$W$~.

We construct the following sample mean to estimate ~$W_t$~ and want to prove its convergence to ~$W$~

~$$\frac{1}{k+1}\sum_{i=0}^k (y_iy_i'-U_{i-1})$$~

The problem is that the measurement ~$y_k$~ is correlated and therefore we have to utilize the Strong Law of Large Numbers for correlated random variables, which has constraints on bound of the second moment of ~$y_iy_i'$~, and it is difficult to show the boundedness.

4. Support Staff Posted by Brett on 01 Nov, 2018 12:12 PM

I assume you're using the Discount (GFM) processor? The equation as written (with one minor change, removing the space before the closing \$ in the third equation) renders completely in MultiMarkdown. It appears to be an issue with the Discount processor handling underscores and inserting markup (em tags) that break the MathJax processor.

There is a way to escape these properly for GFM, though I'm not well-versed enough in these formulae to detail it, unfortunately. You'd need to add backslashes before underscores, but that on its own doesn't completely fix it in my testing. It might take some research on both of our parts to get it working with GFM.

5. Support Staff Posted by Brett on 01 Nov, 2018 12:14 PM

Here's the preview in Marked using Ulysses quick export and the MultiMarkdown processor:

6. Support Staff Posted by Brett on 01 Nov, 2018 12:43 PM

I think I've found the issue. Working to fix it now, I don't think it will require any changes on your end, I'll keep you posted.

7. Support Staff Posted by Brett on 01 Nov, 2018 01:22 PM

Ok, I think I narrowed down the issue. I've fixed it in this test build, if you'd like to try it out and let me know if it solves the issue:

http://asssets.markedapp.com.s3.amazonaws.com/Marked2.5.27-pre.zip

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

### »

#### Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 19 Mar, 2019 07:13 PM Unable to use Marked with Bear 19 Mar, 2019 03:33 AM Marked keeps crashing after updating to 2.5.27 18 Mar, 2019 11:20 AM Missing paragraph 16 Mar, 2019 06:21 PM Import image to marked 2? 14 Mar, 2019 02:05 PM TOC on different frame?

## Recent Articles

 License code has already been utilized Highlight sentences longer than a certain number of words In-app purchase issues (Error Domain=Paddle Code=0 "(null)") How do I retrieve a lost license (direct version) Custom CSS: Writing custom CSS for Marked