Math & ScienceDollar sign code

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
tkojar
Posts: 1
Joined: Wed Sep 26, 2012 5:21 am

Dollar sign code

Post by tkojar »

Hello
As most you can relate I find it very annoying that I have to type the dollar sign in my math text after I am done writing.So I am wondering if anyone has come up with a code that automatically puts the dollar sign when math lines are present in tex files.
Thank you,Tomas

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Dollar sign code

Post by Stefan Kottwitz »

Hi Tomas,

welcome to the board!

I'm not aware of any general solution. I know, that (if configured) TeX tries to switch the mode, even if displaying an error, when it encounters math mode control sequences. However, when should it switch back to text mode, in a reliable way? Letters can be variables, or products of variables, when would you decide that normal text starts?

I think delimiters for math mode are still required to distinguish modes. For example, a - in math mode (a minus) is not the same as a - in text mode (a dash), which has a different width.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Dollar sign code

Post by cgnieder »

Not that it would be less typing but I always type in both $ when writing inline math and then go back with left arrow key (or whatever it is correctly called...). This way I don't forget it.

Regards
site moderator & package author
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Dollar sign code

Post by localghost »

cgnieder wrote:Not that it would be less typing but I always type in both $ when writing inline math and then go back with left arrow key (or whatever it is correctly called...). This way I don't forget it. […]
I am used to proceed this way with ever kind of delimiter. So I rarely have problems with forgotten braces or similar stuff. But common editors support to keep track of delimiters by highlighting the content between them as soon as the cursor is placed correspondingly.


Thorsten
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Dollar sign code

Post by cgnieder »

Me too, actually. I don't switch between editors often but I believe there should be enough which also highlight maths differently than text (like kile or kate). I find that also very helpful.

Regards
site moderator & package author
Post Reply