What is exponentiation in the slice category? I'm looking for an explicit construction, however involved, of the exponential objects in the slice categories of a topos. If we have a (elementary) topos $\mathbf{C}$ (cartesian closed+subobject classifier) and an object $a\in\mathbf{C}$, what is the exponential $g^f$ of the $\mathbf{C}/a$-objects $(f:x\to a)$ and $(g:y\to a)$ ?
The exponential object is a $\mathbf{C}$-arrow $g^f:E\to a$ but what is the object $E$ ? Maybe $y^x$ in $\mathbf{C}$ ? I'm trying to change diagrams of $\mathbf{C}/a$ into diagrams of $\mathbf{C}$ (for example from a product diagram you get a pullback diagram and vice versa in some cases) but it hasn't worked out yet.
What should I be looking for to construct the object $E$, the arrow $g^f:E\to a$ and the evaluation map $ev:g^f\times f\to g$ (arrow and product in $\mathbf{C}/a$) ?
I know could get the result easier with adjoint functors but I want the explicit step by step construction
Thanks!
 A: I believe I've successfully decoded the proof from Johnstone I mention in the comments. While I'm writing this much more explicitly than he did, I do recommend drawing out the details in a notebook to fill in the details I gloss over in the first couple of steps. They're the easier steps, though.
To start, we need the notion of partial map classifiers, which always exist in a topos. Given $f:A\to X$, we define the map $\theta:A\times X\to\tilde X$ as the map that classifies the partial morphism $A\times X\overset{\langle 1_A,f\rangle}{\leftarrowtail}A\overset{f}{\to}X$. Then for any $g:B\to X$, the exponential $g^f$ is given by the pullback of $\tilde{g}^A:\tilde{B}^A\to\tilde{X}^A$ along $\bar{\theta}:X\to\tilde{X}^A$, which I'll denote $g^f:E\to X$.
Why should this be the exponential? If you were to look at what $\bar{\theta}$ does in the category $\mathbf{Set}$, it takes every element of $x$ to the partial map $\gamma_x$ such that $\gamma_x(a)=x$ if $x=f(a)$, and is undefined otherwise---that is, $\gamma_x$ is the restriction of $f$ to $f^{-1}(\{x\})$. The object part of the pullback is then the set of $\langle x,m\rangle$ where $m$ is a partial map from $A\to B$ such that $g\circ m=\gamma_x$; this says all at once that the domain of $m$ is exactly $f^{-1}(\{x\})$ and that its range is within $g^{-1}(\{x\})$. As it turns out, this is one of the surprisingly common cases where the set theoretic analogy pays off in an arbitrary topos.
So suppose we have
$$\require{AMScd}\begin{CD} T @>z>> E \\ @VhVV @VVg^fV \\ X @= X \end{CD}$$
Some diagram shuffling and composition with evaluation maps gives us a morphism over $\tilde X$
$$\require{AMScd}\begin{CD}A\times T @>ev\circ 1_A\times(p_1 z)>> \tilde{B} \\ @V{\theta\circ 1_A\times h}VV @VV\tilde g V \\ \tilde X @= \tilde X \end{CD}.\qquad (1)$$
At this point we need to note that the left hand side of the previous square corresponds to the partial morphism given by the top and left edges of
$$\require{AMScd}\begin{CD} A\times_X T @>p_1>> A @>f>> X \\ @VVV @VV{\langle 1_A,f\rangle}V \\ A\times T @>>{1_A\times h}> A\times X \end{CD}\qquad (2)$$
where the square is a pullback and $A\times_X T$ the object part of that pullback because 
$$\require{AMScd}\begin{CD} A\times T @>1_A\times h>> A\times X \\ @V\pi_2VV @VV\pi_2V \\ T @>>h> X \end{CD}$$ is a pullback so we can apply the pullback lemma by pasting this onto the square in (2).
Because (1) commutes, this means the diagram
$$\require{AMScd}\begin{CD} A\times T @<<< A\times_X T \\ @Vev\circ 1_A\times(p_1 z)VV @| \\ \tilde{B} @. A\times_X T \\ @V\tilde{g}VV @VVf p_1V \\ \tilde X @<<< X \end{CD}$$ is a pullback. Since
$$\require{AMScd}\begin{CD} \tilde{B} @<<< B \\ @V\tilde{g}VV @VVgV \\ \tilde{X} @<<< X \end{CD}$$ is a pullback, its universal property gets us a unique 
$$\require{AMScd}\begin{CD} A\times _X T @>>> B \\ @Vfp_1VV @VVgV \\ X @= X \end{CD}$$
as desired. Each of these steps is also reversible, so this establishes the desired universal property.
