How to Modify Tensor Order in LaTeX

  • Context: LaTeX 
  • Thread starter Thread starter InbredDummy
  • Start date Start date
  • Tags Tags
    Latex Tensor
Click For Summary

Discussion Overview

The discussion revolves around formatting tensors in LaTeX, specifically focusing on how to properly space and order tensor indices. Participants share various methods and commands to achieve the desired formatting in their LaTeX documents.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses difficulty in getting the correct order of tensor indices in LaTeX, prompting requests for assistance.
  • Another participant questions how the order can change and suggests using the "\ " command to create spaces.
  • Examples of tensor formatting are provided, including the use of the \phantom command to manage spacing.
  • Some participants argue that using \phantom is preferable to using \ for spacing, as it avoids issues with hboxes.
  • One participant introduces the concept of hboxes, explaining their role in LaTeX typesetting and how they relate to hyphenation and layout.
  • Another participant proposes an alternative method for formatting tensors without using phantom characters, suggesting a different syntax for indices.

Areas of Agreement / Disagreement

There is no consensus on the best method for formatting tensors in LaTeX, as participants present multiple approaches and express differing opinions on the use of \phantom versus \ for spacing.

Contextual Notes

Participants discuss the implications of using different commands on the layout and appearance of tensors, highlighting potential issues with hboxes and spacing in LaTeX.

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 ·
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 11 ·
Replies
11
Views
3K