I'm reading "Competition in the Promised Land – Black Migrants in Northern Cities and Labor Markets", by Leah Boustan, and I'm trying to understand her computation of black and white elasticity of substitution in labor market
She uses a Cobb-Douglas function:
$$Y=AL^{\alpha}K^{1-\alpha}$$
and then defines aggregate labor as:
$$L=\left(\sum_{e=1}^{n} \left(L_{e} \theta_{e}\right)^{\frac{\delta - 1}{\delta}}\right)^{\frac{\delta}{\delta - 1}}$$
aggregate labor by educational group as:
$$L_{e}=\left(\sum_{\substack{1 \leq e \leq n\\1 \leq x \leq m}} \left(L_{ex} \theta_{ex}\right)^{\frac{\eta - 1}{\eta}}\right)^{\frac{\eta}{\eta - 1}}$$
and aggregate labor by experience and educational group by:
$$\left(\left(L_{exb} \theta_{exb}\right)^{\frac{\sigma - 1}{\sigma}} + \left(L_{exw} \theta_{exw}\right)^{\frac{\sigma - 1}{\sigma}}\right)^{\frac{\sigma}{\sigma - 1}} $$
Then she derivates the production function relative to $L_{exr}$ (where $r=w,b$) and obtains:
$$ln w_{exr}=ln(A^{\frac{1}{\alpha}}k^{\frac{(1-\alpha)}{\alpha}})+\frac{1}{\delta}\cdot ln(L)+ln\theta_{e}-(\frac{1}{\delta}-\frac{1}{\eta})\cdot ln(L_{e})+ln\theta_{ex}-(\frac{1}{\eta}-\frac{1}{\delta})\cdot ln(L_{ex})+ln\theta_{e_{exr}}-\frac{1}{\delta}\cdot ln(L_{exr})$$
I cannot figure out how to reach this expression. I thought what I need is just 1) to substitute the L terms backwardly, 2) take the derivative, and 3) apply log. The substitution gives:
$$A K^{1 - \alpha} \left(\left(\sum_{e=1}^{n} \left(\theta_{e} \left(\sum_{\substack{1 \leq e \leq n\\1 \leq x \leq m}} \left(\theta_{ex} \left(\left(L_{exb} \theta_{exb}\right)^{\frac{\sigma - 1}{\sigma}} + \left(L_{exw} \theta_{exw}\right)^{\frac{\sigma - 1}{\sigma}}\right)^{\frac{\sigma}{\sigma - 1}}\right)^{\frac{\eta - 1}{\eta}}\right)^{\frac{\eta}{\eta - 1}}\right)^{\frac{\delta - 1}{\delta}}\right)^{\frac{\delta}{\delta - 1}}\right)^{\alpha} $$
But the derivative of this expression relative, for example, to $L_{exb}$ is a equation very different from the expression showed by the author (even after the log).
I must be making a very silly mistake here, but how can I get the desired expression from the equations of L? Is there a textbook where I can find a discusson about elasticity of substitution between demographic groups?
EDIT: paper version of this part of the book can be found here. In my research I noted that Boustan's work is based on Ottaviano (2006), and Card and Lemieux (2001).
Here is a jupyter notebook with the equations