How to Modify Tensor Order in LaTeX

  • LaTeX
  • Thread starter InbredDummy
  • Start date
  • Tags
    Latex Tensor
In summary, the conversation was about a problem with LaTeX and tensor spacing and ordering. The solution was to use the \phantom{} command to control index placement, as it automatically takes care of bounding boxes and prevents hyphenation breaks.
  • #1
InbredDummy
85
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
  • #2
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:
 
  • #3
Click on the following for an example of what it is I think you want:

[tex]T^{i_1i_2\ldots i_r}_{\phantom{i_1i_2\ldots i_r}j_1j_2\ldots j_k[/itex]

[tex]T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b[/tex]

[tex]R^a_{\phantom{a}b} = d\theta^a_{\phantom{a}b} + \theta^a_{\phantom{a}c}\wedge\theta^c_{\phantom{c}b}[/tex]
 
  • #4
shoehorn said:
Click on the following for an example of what it is I think you want:

[tex]T^{i_1i_2\ldots i_r}_{\phantom{i_1i_2\ldots i_r}j_1j_2\ldots j_k[/itex]

[tex]T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b[/tex]

[tex]R^a_{\phantom{a}b} = d\theta^a_{\phantom{a}b} + \theta^a_{\phantom{a}c}\wedge\theta^c_{\phantom{c}b}[/tex]

ooh … \phantom … that's spooooky! :eek:

Or [tex]T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b[/tex] :wink:
 
  • #5
tiny-tim said:
ooh … \phantom … that's spooooky! :eek:

Or [tex]T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b[/tex] :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.
 
  • #6
You don't need to use phantom characters:

[tex]{T^a}_b[/tex]
 
  • #7
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:
 
  • #8
Thank you so much! I love the \phantom{} command!
 
  • #9
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
[tex]
T^a = d\omega^a + \theta^a_{\phantom{a}b} \wedge \omega^b
[/tex]
or
Code:
T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b
[tex]
T^a = d\omega^a + \theta^a_{\ b} \wedge \omega^b
[/tex]

I use
Code:
T^a = d\omega^a + \theta^a{}_b \wedge \omega^b
[tex]
T^a = d\omega^a + \theta^a{}_b \wedge \omega^b
[/tex]

since I might do something like
Code:
T_{i}{}^{jk}{}_l{}^m{}_m
[tex]
T_{i}{}^{jk}{}_l{}^m{}_m
[/tex]
 

Related to How to Modify Tensor Order in LaTeX

1. What is tensor order in LaTeX?

In LaTeX, a tensor order refers to the number of indices associated with a tensor. For example, a tensor of order 2 has two indices and can be represented by a matrix, while a tensor of order 3 has three indices and can be represented by a cube.

2. How do I modify the tensor order in LaTeX?

To modify the tensor order in LaTeX, you can use the \tensor command from the tensor package. This allows you to specify the desired number of indices and input the elements of the tensor accordingly.

3. Can I change the appearance of the tensor indices in LaTeX?

Yes, you can change the appearance of the tensor indices in LaTeX by using the \tensor command with additional options. For example, you can change the size, style, and placement of the indices.

4. Is it possible to modify the tensor order of an existing tensor in LaTeX?

Yes, you can modify the tensor order of an existing tensor in LaTeX by using the \renewcommand or \declarecommand commands. These allow you to redefine the tensor command with the desired number of indices.

5. Are there any other packages or commands for modifying tensor order in LaTeX?

Yes, in addition to the \tensor command, there are other packages and commands such as \tensor*, \overaccent, and \tensoradd that can be used to modify tensor order in LaTeX. These provide additional options for customization and formatting of tensors.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
924
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
993
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
1K
  • Feedback and Announcements
Replies
11
Views
353
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
Back
Top