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

  • LaTeX
  • Thread starter andrewkirk
  • Start date
  • Tags
    Latex
In summary, the delimiter for in-line math that is recognised by most LaTeX engines is $ or \, but the delimiter recognised by the physicsforums engine is double-# and itex or tex inside square brackets.
  • #1
andrewkirk
Science Advisor
Homework Helper
Insights Author
Gold Member
4,119
1,717
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
 
Physics news on Phys.org
  • #2
andrewkirk said:
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 \(.

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.
 
  • #3
andrewkirk said:
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.
Replace ([^$])$([^$]) by $1##$2 using regex, and you don't have to mask double dollar signs. Every proper text editor can do that.
 
  • Like
Likes andrewkirk
  • #4
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.
 
  • #5
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.
 
  • Like
Likes anorlunda
  • #6

1. What is the purpose of using $ as begin/end delimiter for in-line LaTeX?

The $ symbol is used to indicate the beginning and end of a math equation or formula in in-line LaTeX. This allows for the easy incorporation of mathematical expressions into text without having to use a separate environment.

2. Can I use other symbols as delimiters for in-line LaTeX?

Yes, there are other symbols that can be used as delimiters for in-line LaTeX such as \( and \). However, $ is the most commonly used and recognized delimiter.

3. How do I know when to use single or double $ delimiters?

Single $ delimiters should be used for in-line equations or formulas that are part of a sentence or paragraph. Double $ delimiters should be used for standalone equations or formulas that are separated from the rest of the text.

4. Is there a limit to the number of $ delimiters I can use in a single equation or formula?

No, there is no limit to the number of $ delimiters that can be used in a single equation or formula. However, it is important to use an equal number of delimiters at the beginning and end to avoid errors in the code.

5. Can I use $ delimiters for non-mathematical text in in-line LaTeX?

No, $ delimiters should only be used for mathematical expressions in in-line LaTeX. For regular text, you should use the appropriate text formatting commands such as \textit{} for italics or \textbf{} for bold.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
279
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Replies
13
Views
2K
Replies
13
Views
2K
Replies
4
Views
3K
  • STEM Career Guidance
Replies
4
Views
1K
  • STEM Academic Advising
Replies
10
Views
4K
Back
Top