It's more comfortable writing my questions in LyX then copying the text as MathJax code and post it in MathExchange. the problem is that every time I need to do this copy and paste I need to delete certain things like brackets and so on.

I have seen a similar question on Tex but there was no real solution for the problem: Lyx: exporting document in a "MathJax compatible" way

is there any new way to solve this problem?

  • 1
    Welcome to tex.sx. Ordinarily I would suggest checking the LyX website for information, but I've looked there and a search for "MathJax" in their documentation area doesn't turn up a single occurrence. Not promising. Commented May 8, 2020 at 16:14
  • Hi @barbarabeeton, Actually I'm using now the suggestion that is in the similar question. turns out it's not that bad. Thanks!. Commented May 8, 2020 at 16:20

1 Answer 1


Again not the best solution but export to LaTeX (plain) and paste in a txt, and replace the [ and ] with $$. Here's a Python code that does it for you:

with open('C:/Users/ubald/Google Drive/CMU/LYX.txt', 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('\\[\n', '$$')
filedata = filedata.replace('\n\\]', '$$')

# Write the file out again
with open('C:/Users/ubald/Google Drive/CMU/LYX.txt', 'w') as file:
  • Welcome to TeX.SE!
    – Mensch
    Commented Sep 22, 2021 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .