GeneralSuperscript and subscript before a symbol

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
sklarg
Posts: 1
Joined: Mon Jul 30, 2007 1:56 am

Superscript and subscript before a symbol

Post by sklarg »

How do you place a subscripted or superscripted symbol before a symbol?
The code (X_j^i) places i and j after X, but I'm unable to find any help on placing them before.
Last edited by cgnieder on Sat Nov 24, 2012 12:31 am, edited 1 time in total.

Recommended reading 2024:

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

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

angelixd
Posts: 15
Joined: Thu Jul 26, 2007 4:53 pm

Superscript and subscript before a symbol

Post by angelixd »

Don't think of the symbols ^ and _ as modifiers of the previous argument, but functions on the character that succeeds it. The code $_jX$ will produce a subscripted j before an X, and $^jX$ will do the same with a superscript.
Last edited by cgnieder on Sat Nov 24, 2012 12:31 am, edited 1 time in total.
jwiegley
Posts: 2
Joined: Fri Sep 03, 2010 3:17 am

Superscript and subscript before a symbol

Post by jwiegley »

WRONG! just plain WRONG! please try to think a little about what the author might be trying to do other than just $^i_jX$.

$^AP = ^BP^A_BT$ (a common linear algebra problem in
robotic kinematics for instance) comes out COMPLETELY wrong. TeX WILL associate the second ^A with the P just before it and not the T following it as it should. the ^B will be disassociated from anything and a space will be inserted after it and before the following P.

The carat and underscore are VERY much associated with the previous item unless no previous item exists (and even then it has been associated with the preceeding space and not the following symbol. And I can think of many mathematical notations of an item that benefit from four super-positions (pre-superfix, post-superfix, pre-subscript and pre-superscript). If you still don't believe that carat and underscore are associated with the previous item you should consider \sum. Carat doesn't *just* raise an item... it integrates with the Sigma symbol for sum that precedes it.

The best REAL answer I can find in a short amount of time is AMS math package. You will need to \usepackage{amsmath} which will provide you with \sideset{}{} that modifies the item FOLLOWING it.
The first set of brackets encloses what you want on the left of the symbol and the right set of brackets specifies the normal superscript and subscript. For instance the poster's desired solution is $\sideset{^i_j}{}X. My desired solution is $\sideset{^A}{}P = \sideset{^B}{}P\sideset{^B_A}{}T$.
Last edited by cgnieder on Sat Nov 24, 2012 12:34 am, edited 1 time in total.
jwiegley
Posts: 2
Joined: Fri Sep 03, 2010 3:17 am

Superscript and subscript before a symbol

Post by jwiegley »

Nope. Even this doesn't work. \sideset is ONLY designed to be used with large operators such as \sum and not on normal symbols.

Basically... LaTeX has a HUGE glaring absence of a commonly needed math typesetting operation. Nice job. All you Chemistry ppl can go take a leap too; why would you ever need this functionality in describing your field?

Instead you need \usepackage{tensor} and then $\tensor*[^A]{P}{} = \tensor*[^B]{P}{}\tensor*[^A_B]{T}{}$ will do the job.
Last edited by cgnieder on Sat Nov 24, 2012 12:30 am, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Superscript and subscript before a symbol

Post by localghost »

jwiegley wrote:[…] Basically... LaTeX has a HUGE glaring absence of a commonly needed math typesetting operation. Nice job. All you Chemistry ppl can go take a leap too; why would you ever need this functionality in describing your field? […]
A lot of fuss about nothing. Do me a favour and don't bluster here.
gurcani
Posts: 1
Joined: Thu Nov 18, 2010 2:34 am

Superscript and subscript before a symbol

Post by gurcani »

most people would just use:

Code: Select all

\,_2F_1
for instance this is how the hypergeometric function is typed in the wikipedia page.

http://en.wikipedia.org/wiki/Hypergeometric_function
ignasi
Posts: 20
Joined: Tue Jul 28, 2009 5:10 pm

Superscript and subscript before a symbol

Post by ignasi »

Hi,

I've used \mathstrut to write the hypergeometrical function:

Code: Select all

$\mathstrut_1 F_1$
Ignasi
Last edited by cgnieder on Sat Nov 24, 2012 12:34 am, edited 1 time in total.
Bbl
Posts: 1
Joined: Thu Jan 13, 2011 12:45 am

Superscript and subscript before a symbol

Post by Bbl »

Actually {^{pre-superscript}_{pre-subscript}} is the "correct" way to apply a pre-super or sub script to a non-operator symbol. (\sideset is only for operators.)

So ${_2}F_1$ or ${^i_j}X$ or ${^A}P = {^B}P{^B_A}T$, or alternatively ${}^i_jX$.

Using $\,^i_jX$ creates an unwanted space and $\mathstrut^i_j$ creates an unwanted empty box which sets the height to that of a parentheses.

Nesting the (pre-)super/sub-scripts in {} (or applying after) disassociates them from the previous symbol so they float. They are not technically associated to the symbol that comes after either though, so the formatting will often still look non-preferable.

Fortunately there is a package which has been written specifically to solve to the problem which jwiegley identified. This the fourIdx package:
http://tug.ctan.org/cgi-bin/ctanPackage ... id=fouridx

The main command is \fourIdx{pre-up}{pre-down}{post-up}{post-down} and this allows for several preferable options for pre & post super/sub scripts. So you'd use $\fourIdx{i}{j}{}{}X$.
Last edited by cgnieder on Sat Nov 24, 2012 12:36 am, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Superscript and subscript before a symbol

Post by localghost »

Bbl wrote:[…] Fortunately there is a package which has been written specifically to solve to the problem which jwiegley identified. This the fourIdx package: […]
tensor does exactly the same.
unfinishedsweet
Posts: 1
Joined: Sun Mar 04, 2012 7:51 pm

Superscript and subscript before a symbol

Post by unfinishedsweet »

localghost wrote:tensor does exactly the same.
tensor works extremely well for a wide variety of subscript/superscript applications. For this one in particular, you would just use

Code: Select all

\tensor[^{pre-superscript}_{pre-subscript}]{object after scripts}{}
Post Reply