3

I am using LyX to type answers and questions for Math.SE and many times I need to use use inline math (by writing two dollars signs instead of just the one, i.e $$).

After finishing typing I copy the text from "body" view (so I can copy all of it at once) and paste it to the forum.

The only problem is that for the opening instead of the double dollar signs I have [ and for the closing double dollar signs I have ]

Then I go over all instances and changes them by hand.

Can I make LyX use $$ ?

Belgi
  • 449
  • 1
  • 8
  • 21
  • 2
    Your use of TeX terminology is a bit confusing. The control sequences \[ and \] initiate and terminate display math, not inline math. To switch back and forth between text mode and inline math, you should the control sequences \( and \) or the singe-dollar, $, switch. For a discussion of why LaTeX users should not use the double-dollar, $$, switch see, e.g., What are the differences between $$, \[, align, equation and displaymath?. – Mico Oct 19 '13 at 08:13
  • 1
    You mean display math not inline (inline uses a single $) but even if you can change lyx here it would not help completely as the markup is different, for example for align in lyx or latex there is no outer $$ or \[ at all, but mathjax needs the $$ to enable processing – David Carlisle Oct 19 '13 at 09:30
  • I doubt that you can (and it really would be a pointless thing to add to LyX, IMHO), so you probably have to stick to find and replace/manual editing. – Torbjørn T. Nov 06 '13 at 22:18
  • Actually, MathJax (at least on Math SE) does not require dollars around align*s. See for example this question, which I edited myself, whose code shows no $$ around the many align*s in it. And I just tried align, gather and gather*, and it rendered. Even with the &s, which surprised me. – MickG Feb 27 '16 at 10:32

1 Answers1

3

I don't think you can, and I also think that adding that as an option in LyX is a bad idea, as $$ .. $$ should not be used in LaTeX at all.

However, you don't have to edit each instance by hand. Copy the text to your favourite text editor first, then use find and replace to change all \[ and \] to $$. If you're using environments such as align and gather you could use a similar technique to add the necessary $$ before and after. (If this is something you do a lot, it might be easier to write a script that does this automatically.)

Torbjørn T.
  • 206,688