The oveleft/rightarrow-command is not optimal because it shiftes indices to much to the right in formulas like:
$\overleftarrow{D}_v$
Therefore, I use the following macro which I have adapted from some answer on this site a while ago. (Sorry, I cannot give credit to the author of the code because I forgot where I read it.)
\usepackage{stackengine}
\newcommand\constantoverleftarrow[1]{\stackengine{0pt}{$\overleftarrow{\hphantom{D}\vphantom{#1}}$}{$#1$}{O}{l}{F}{F}{L}}
The command
$\constantoverleftarrow{D_v}$
then gives the desired result. So far so good. Now, I want to align the subscripts as in the follwing code:
$\constantoverleftarrow{D_{v'\vphantom{\scalebox{0.73}{$\int$}}}}x_{v,v'}^d$
If you use
$\constantoverleftarrow{D_{v'}}x_{v,v'}^d$
instead, you will see that the v's and the v''s in the subscripts are not properly aligned. With the naked eye, I chose the value 0.73 in the scalebox to more or less achieve what I want.
Can someone please tell me how I do this properly? I hardly want to choose for each formula a value in the scalebox, as you can imagine. Because this takes incredibly much time. Also, I want the alignement to be perfect and not only approximative. How can I achieve this?
I tried several things now and was not able to do it. There are many questions like this on the site. But I was not able to find a solution. Note, I want the arrow over the D not shifted upwards or anything like this.
Related.
MWE.
\documentclass[12pt]{amsart}
\usepackage{stackengine}
\newcommand\constantoverleftarrow[1]{\stackengine{0pt}{$\overleftarrow{\hphantom{D}\vphantom{#1}}$}{$#1$}{O}{l}{F}{F}{L}}
\begin{document}
\[
\constantoverleftarrow{D_{v'}}x_{v,v'}^d
\]
\end{document}
This MWE repdocues indeed the error. You see, the indices are not aligned. Only if you add the integral. The problem is caused by the d in the superscript as I noticed now while playing around. I am sorry that I forgot the d in my initial post.
Possible solution for the right result.
\documentclass[12pt]{amsart}
\usepackage{stackengine}
\newcommand\constantoverleftarrow[1]{\stackengine{0pt}{$\overleftarrow{\hphantom{D}\vphantom{D}}$}{$#1$}{O}{l}{F}{F}{L}}
\newcommand{\nhphantom}[1]{\setbox0=\hbox{#1}\hspace{-\the\wd0}}
\begin{document}
%This is not perfect because the space between $D$ and the subscript $v'$ is not exactly like in $D_{v'}$ but almost and slightly smaller. The indices are however aligned. The best I can do.
\[
\constantoverleftarrow{D\nhphantom{$\displaystyle x_{}^{}$}\phantom{x}_{\vphantom{,}v'}^{\vphantom{d}}}x_{v,v'}^d
\]
\end{document}



\documentclass, and end with\end{document}and should load the minimum number of packages that you need to illustrate the problem. (And it should compile.) – Circumscribe Jul 06 '18 at 13:55^d). I believe thesupdepthpackage "fixes" this. (See this answer.) – Circumscribe Jul 06 '18 at 14:36subdepthwith optionlow-supdoes the job. Strangely enough, it only work inbetween\[...\]but not inbetween$...$. – Christoph Mark Jul 06 '18 at 14:53low-supoption is buggy, I think it doesn't work in inline equations with superscript that stick out below the baseline. The only fix I know involves redefining^, and I'm not sure I should be recommending that since it is a rather drastic thing to do. I don't really know how the package works though, so there might very well be better ways to fix that problem. – Circumscribe Jul 06 '18 at 16:22subdepthpackage similar but not the same (the same does not work properly) as posted in my question under possible solution. Thank you very much, anyway! – Christoph Mark Jul 06 '18 at 16:40