Math & ScienceQuick way to nest within dollar signs?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
apexaviour
Posts: 3
Joined: Mon Apr 18, 2011 2:14 am

Quick way to nest within dollar signs?

Post by apexaviour »

Hi,

So I just downloaded Texniccenter today (lyx was giving me a headache with the lack of fine control I had).

I'm starting to type my thesis where I have to put in a LOT of superscripts and subscripts just among my normal text. So I've assigned keyboard shortcuts to both of those and they're handy enough. But then what really slows progress is having to then click on either side of them and put in a $ sign every single time. I've searched and searched and gone through the documentation but can't find a keyboard shortcut (or make one) that will simply nest dollar signs around my super or subscripts...
I'd love to be able to just type something like "ctrl+m ctrl+= 2" and have $_{2}$ pop up... it would save me a whole lot of time.

Cheers

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Quick way to nest within dollar signs?

Post by Stefan Kottwitz »

Hi apexaviour,

welcome to the board!

It seems a bit strange to me to put just superscripts and subscripts in math mode, instead of complete expressions. What comes before? Text or math? Do you use normal upright letters for names of variables? If that's the case, variables are hard to distinguish from normal text. Just imagine products. What's meant by abs? A product a*b*s, an operator abs or a "word" abs?

It's very common to use an italic font for variables. Just have a look at math or other science books.

I guess it would be good for your thesis to put complete math expressions in math mode.

It doesn't answer the shortcut question but I hope it helps. At least, you might need ness dollor signs.

Btw. you could use \( ... \) instead of $...$. If you use a shortcut, it's typed the same but is better readable. And, there are keyboard shortcut tools which also can be used with LaTeX editors.

Stefan
LaTeX.org admin
apexaviour
Posts: 3
Joined: Mon Apr 18, 2011 2:14 am

Quick way to nest within dollar signs?

Post by apexaviour »

Hi Stefan, thank you for your response.

To give you an example of what a fairly typical sentence in my thesis looks like:

Code: Select all

Oxygen 2$p_{y}$ orbitals have $\pi$-type interaction 
with the metal cations in Mn$O_{2}$ and IrO$_{2}$ 
($d^{5}$ valence) and are aligned perpendicular 
to the M$_3$O trigonal planes.
There's a convention to which ones are upright and which aren't (eg element symbols). As you probably can tell my hand is getting cramped typing shift-4 all the time, it's not the most accessible for my stubby fingers ;)

If there's no way to make a shortcut for \("script"\) or $"script"$ I guess I'll probably just end up mapping "$" to another key somehow.

What do you think?

Cheers
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Quick way to nest within dollar signs?

Post by josephwright »

Use the mhchem package:

Code: Select all

\documentclass{article}
\usepackage[version=3]{mhchem}
\begin{document}
\ce{MnO2} and \ce{IrO2}
\end{document}
Joseph Wright
apexaviour
Posts: 3
Joined: Mon Apr 18, 2011 2:14 am

Quick way to nest within dollar signs?

Post by apexaviour »

josephwright wrote:Use the mhchem package
Thanks that's useful. I can see how it would be extremely desirable for someone who had to type in a lot of long chemical formalae, but it unfortunately only solves part of my problem and very frequently typing \ce{} is about as time-consuming as $$.

If anyone is interested (googling in years to come?), I came by a solution in TeXnicCenter (1.0 stable version, I believe 2.0 will be more easily custimised) that suits my needs perfectly:

Going to insert -> own text modules -> manage text modules
Deleted all other modules.
Made new one putting in $ before cursor and same after.

Then went to tools -> customise -> keyboard (tab)
found insert own text module and mapped it to ctrl-'l'.

Now if I want to type $^{2}$ it's far more efficient: ctrl-'l' ctrl-'=' '2'. This can be done surprisingly fast, has increased my productivity and sated my frustration.

The own text modules is useful too for longer specialised things you use less frequently. Make more and you can map them to alt-'i' 'm' then whatever number it is. I periodically need to highlight and colour parts of my text red for editing purposes for example, and this makes it easier.

Thanks for your input guys, I learned quite a bit in this process. :)
Post Reply