4

I'm using the org-mode to write some mathematical notes, so I'm using latex fragments like $\frac{a}{b}$ a lot. However, if I succeed the fragment with a dash, like $\frac{a}{b}$-fraction, it will not render (preview) the fragment.

Questions: (1) How can I override this behavior and make it show? (2) Is this the intended behavior or strictly a bug?

2 Answers 2

5

Use \(...\) instead of $...$ and it should work just fine.

2
  • does it work fine for you? for me it isn't recognized as math mode, so it gets typeset as regular text, not a formula
    – Tyler
    Dec 7, 2017 at 22:01
  • actually works for me
    – Zuza
    Dec 8, 2017 at 20:46
2

Org-mode recognizes Latex fragments by the $ symbol at the start and end of the fragment. If you add a trailing -, then the fragment doesn't end with a $ anymore, so Org won't recognize it as a fragment. You can work around this by placing a space between the closing $ and the -:

$\frac{a}{b}$ -fraction
3
  • But how can one then supress the space during export? Note that this is possible when dealing with emphasis: /wh/-pronoun.
    – Timm
    Nov 30, 2017 at 21:35
  • The code for font-locking, responsible for bold and emphasis, is different than the code for identifying code fragments, so they will not necessarily behave the same. Another work around: try $\frac{a}{b} - \text{fraction}$. Do you need to have the '-fraction' outside the fragment for some reason?
    – Tyler
    Nov 30, 2017 at 21:45
  • Does the following work? $\frac{a}{b}$ \hspace{-\em} (or -\thinspace)?
    – mankoff
    Dec 7, 2017 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.