Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Recognising $ as begin/end delimiter for in-line latex

  1. Oct 24, 2015 #1

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    A minor, but recurring, obstacle with LaTeX on physicsforums is that it does not recognise either of the usual delimiters for in-line math, which are the single dollar symbol and the \( ... \) combination. The latex engines I use on my computers, which are MiKTeX on Windows, MacTex on Mac and (something else, I forget which) on Linux, use those symbols. Conversely, the physicsforums delimiters of double-# and itex or tex inside square brackets are not recognised by my Tex engines and, as far as I can tell, are not part of standard LaTeX.

    If I am writing anything complicated, it's much easier to draft it up on my own computer's TeX editor and then copy it to a post. Currently however, I need to do a last step of changing every single-$ symbol to a double-#, which is complicated by the existence of double dollars for display math.

    I was wondering whether it would be difficult to get the physicsforums engine to recognise a delimiter for in-line math that is also recognised by most LaTeX engines, such as $ or \(.

    Alternatively, has anybody written a plugin or script that converts standard latex to physicforums latex? It would need to first convert all double-$ to something else like %%, then convert all single-$ symbols to double-#, then convert all %% back to double-$. Ideally there would be a reverse converter too, so that if one wants to do major surgery on a maths piece on physicsforums, they could convert it to standard latex, do the surgery offline then convert it back.

    thanks

    Andrew
     
  2. jcsd
  3. Oct 25, 2015 #2

    jtbell

    User Avatar

    Staff: Mentor

    I think the main problem with the single $ is that it's also used as a currency symbol, especially in the US. However, it seems to me that \( and \) would be a reasonable alternative. In fact the MathJax documentation uses them as an example in the section on configuring the tex2jax processor:

    https://docs.mathjax.org/en/v2.5-latest/options/tex2jax.html

    @Greg Bernhardt is the one who's responsible for this stuff, so let's see what he says.
     
  4. Oct 25, 2015 #3

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Replace ([^$])$([^$]) by $1##$2 using regex, and you don't have to mask double dollar signs. Every proper text editor can do that.
     
  5. Oct 25, 2015 #4

    anorlunda

    User Avatar
    Science Advisor
    Gold Member

    I'm having difficulty finding what the PF delimiters are for latex. Every time I try, I get the latex source instead of the rendering.
     
  6. Oct 25, 2015 #5

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Double # for inline tex, double $ for individual formulas. This ##\sqrt{a^2+b^2}## is inline, and this is not: $$\sqrt{a^2+b^2}$$
    Quote my post to see the source code.

    Alternatively, use [itex]formula[/itex] and [tex]formula[/tex]

    It will show the source code if there is a parsing error, usually from unrecognized control sequences or mismatched brackets.
     
  7. Oct 26, 2015 #6

    jtbell

    User Avatar

    Staff: Mentor

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Recognising $ as begin/end delimiter for in-line latex
  1. School season to begin (Replies: 15)

  2. Latex, PF Insights (Replies: 1)

Loading...