I want to write tensorial equations in latex indicating the equivalent indices as shown below:
Here I have used MS Powerpoint to make these images. Although it works, using this means I cannot use equation numbering in latex and relevant tags. And editing these becomes a pain.
Things I need –
- Lines to indicate the number of indices
\underbracket
type functionality joining the individual index lines and should allow for overlapping
Is there a more elegant solution, preferably using only latex?
Best Answer
Welcome to TeX.SE!! I think this is a possible solution, but I'm not very sure about you point 2. I don't know how the lines must 'indicate the number of indices'.
However I hope this helps. I made two
pics
. I call the firstvlines
which draw those vertical lines that must 'indicate the number of indices'. Thispic
takes a parameter: the number of lines to draw. If it's not present draws exactly 2 lines. The secondpic
,underbracket
draw a line connecting two nodes (created in the equations with\tikzmarknode
). Thispic
needs four parameters: end point, x shift in the initial point, x shift in the final point and y shift.Something like this:
Edit: I changed the second
pic
for astyle
inspired in Andrew Stacey's answer in this post. It does the same but I think that the syntax is a little bit clearer.And the new code: