Text Formatting ⇒ ^ in text mode.
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
^ in text mode.
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
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: ^ in text mode.
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
^ in text mode.
As Johannes said, your editor may have an auto-completion feature which can be used. Which editor are you using?
There's also the free and open source program autohotkey, which can be used for such a purpose and for many more.
Stefan
^ in text mode.
Code: Select all
\documentclass{article}
\begin{document}
\catcode`\^=13
\newcommand*^[1]{\ensuremath{\sp{#1}}}
A^3 $A^3$
\end{document}

Regards
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: ^ in text mode.
Another challenge would be supporting A^33, so putting in braces until the next space, punctuation, or delimiter character.

Stefan
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: ^ in text mode.
^ in text mode.
Probably doable if the specs (What should serve as delimiter, what shouldn't? Should category codes be taken into account?) are clear. But there are a lot of questions: should the following space be put back into the input stream? Or shouldn't it? What, if I want to typesetStefan_K wrote:Another challenge would be supporting A^33, so putting in braces until the next space, punctuation, or delimiter character.
A^3B
(and not A^{3B}
or A^3 B
…?)But actually I don't think the usage would be easier then: right now the behaviour is clear the next token or brace delimited group serves as argument just like with every other LaTeX command.
Actually I can't remember when I ever wanted to use
A$^{3}$
(text+math superscript) at all. Does anyone have an example where such usage makes sense?Regards