I want to try to communicate what I want to achieve with the following code example. I would like to have one left- and right-command for this functionality, which compiles in reasonable time. I am happy with the aesthetics achieved by the routines below. I apologize if that question could be solved using other answers from the site. Thank you for taking a look at it!









I write longer sentences which have inline math and wrap over several lines. It might happen that I speak about a derivative $\constantoverleftarrow{D_{x_1\cdots x_n}}$ and put it inside the text. It is important for me that the arrow of such a formula does not expand over the indices. I used the smashed version of my own arrow here because I do not want that the lines spread apart. 

Of course, it might as well happen that I speak about a derivative
which occurs in display math. Here, I use the unsmashed version of my own arrow because I want the spacing to be ordinary. This is important, in particular if I have display math with several lines or even boxes around the math from empheq package.\footnote{A derivative $\constantfootoverrightarrow{D_y}$ in a footnote needs to be smaller.} (It might also be important for deliminators. But there, I usually control the size myself and do not use the $\left(\right)$ version. This seems less important to me.)

The experts from \TeX Stackexchange might notice: Such a macro does not always work. Indeed, it will not adjust to subscripts for example, like $\int_{\constantoverrightarrow{D_z}}$. However, I do not need this. I don't have to worry about all the functionality but only about the one I really use.

I finally want to remark: My document may have around 200 to 300 arrows. And using the code above in the preamble takes a lot of time to compile.


Related, related, related.

  • I fixed a lot of typos in your code above. Now it compiles. – Sigur Aug 31 '19 at 15:19
  • You said that takes a lot of time to compile. Maybe because the errors I already fixed. Try again with the code above. – Sigur Aug 31 '19 at 15:21
  • Why don't use simply \int_{\overrightarrow{D}_z}? – Sigur Aug 31 '19 at 15:23
  • @Sigur The point is that the index $z$ gets shifted to the right. Concerning compiling, I thought it is maybe bad coding. – user66288 Aug 31 '19 at 15:42
  • Well, it is not clear what is the problem with z. It is subscript, so should be moved a little bit. Do you want to reduce the right spacing? – Sigur Aug 31 '19 at 15:44

I think this works for me by combining egreg's and Steven's solution. It compiles fast while the above in the question gets timeout. I smash it twice which I forgot in the question. It seems like things get not spread assymetrically at top and bottom now. It is probably not optimal but I can work with it.




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.