LaTeX How to Modify Tensor Order in LaTeX

  • Thread starter Thread starter InbredDummy
  • Start date Start date
  • Tags Tags
    Latex Tensor
AI Thread Summary
The discussion focuses on resolving issues with formatting tensors in LaTeX, particularly regarding spacing and ordering. Users express confusion about how LaTeX can alter the order of tensor indices. Suggestions include using the "\phantom" command to maintain spacing without disrupting the layout, as it automatically manages bounding boxes, which is crucial for proper typesetting. The importance of understanding hboxes, which are containers for typeset symbols, is highlighted, as they influence hyphenation and layout. The conversation emphasizes that while the "\\" command can be used for spacing, it may lead to undesirable formatting issues, making "\phantom" a preferred choice for consistent output in tensor expressions.
InbredDummy
Messages
82
Reaction score
0
Hey I was hoping someone could help me on this LaTeX problem. So usually when we have tensors, we have to be careful in how they are spaced and ordered. However in LaTeX it just lines it up and does not give me the order that I want. Can anyone help me with this?
 
Physics news on Phys.org
Hi InbredDummy! :smile:
InbredDummy said:
Hey I was hoping someone could help me on this LaTeX problem. So usually when we have tensors, we have to be careful in how they are spaced and ordered. However in LaTeX it just lines it up and does not give me the order that I want. Can anyone help me with this?

I'm not following you … how can it change the order? :confused:

Anyway, this link may help,

and also you can force it to leave spaces by typing "\ " :smile:
 
Click on the following for an example of what it is I think you want:

T^{i_1i_2\ldots i_r}_{\phantom{i_1i_2\ldots i_r}j_1j_2\ldots j_k[/itex]<br /> <br /> T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b<br /> <br /> R^a_{\phantom{a}b} = d\theta^a_{\phantom{a}b} + \theta^a_{\phantom{a}c}\wedge\theta^c_{\phantom{c}b}
 
shoehorn said:
Click on the following for an example of what it is I think you want:

T^{i_1i_2\ldots i_r}_{\phantom{i_1i_2\ldots i_r}j_1j_2\ldots j_k[/itex]<br /> <br /> T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b<br /> <br /> R^a_{\phantom{a}b} = d\theta^a_{\phantom{a}b} + \theta^a_{\phantom{a}c}\wedge\theta^c_{\phantom{c}b}
<br /> <br /> ooh … <i>\phantom</i> … that&#039;s <i>spooooky!</i> <img src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f631.png" class="smilie smilie--emoji" loading="lazy" width="64" height="64" alt=":eek:" title="Eek! :eek:" data-smilie="9"data-shortname=":eek:" /><br /> <br /> Or T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b <img src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f609.png" class="smilie smilie--emoji" loading="lazy" width="64" height="64" alt=":wink:" title="Wink :wink:" data-smilie="2"data-shortname=":wink:" />
 
tiny-tim said:
ooh … \phantom … that's spooooky! :eek:

Or T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b :wink:

Using \ in preference to \phantom will often get you into trouble with hboxes. It's better to use \phantom since that takes care of bounding boxes automatically.
 
You don't need to use phantom characters:

{T^a}_b
 
shoehorn said:
Using \ in preference to \phantom will often get you into trouble with hboxes. It's better to use \phantom since that takes care of bounding boxes automatically.

Hi shoehorn! :smile:

wot's an hbox? :confused: :confused:
 
Thank you so much! I love the \phantom{} command!
 
tiny-tim said:
Hi shoehorn! :smile:

wot's an hbox? :confused: :confused:

A hbox is a container in which LaTeX puts typeset symbols. Essentially, when LaTeX processes a source file it places characters in hboxes and then its internal magic decides on the layout of the text on the page based on the size and content of the hboxes.

One of the things for which hboxes are important is hyphenation and ligature breaks. If you use, say, the \phantom command to handle index placement, this results in some low-level constraints being placed on the hbox containing those elements. In particular, it passes special flags to the LaTeX processor that prevent nasty hyphenation breaks from mangling your output. On the other hand, if you use \ to handle spacing, LaTeX will typically put each \ character in its own (sub-)hbox, which can result in weird-looking output, particularly in the case of inline equations.
 
  • #10
Rather than
Code:
T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b
<br /> T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b<br />
or
Code:
T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b
<br /> T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b<br />

I use
Code:
T^a = d\omega^a + \theta^a{}_b \wedge \omega^b
<br /> T^a = d\omega^a + \theta^a{}_b \wedge \omega^b<br />

since I might do something like
Code:
T_{i}{}^{jk}{}_l{}^m{}_m
<br /> T_{i}{}^{jk}{}_l{}^m{}_m<br />
 

Similar threads

Replies
12
Views
3K
Replies
3
Views
2K
Replies
16
Views
2K
Replies
9
Views
2K
Replies
2
Views
2K
Replies
16
Views
3K
Replies
8
Views
2K
Replies
11
Views
5K
Replies
11
Views
2K
Back
Top