Now assume you have a signal x[n], that is even on the paper. Say it spans from n=-L to n=L (it has a total of N= 2L+1 samples). Now when you introduce this signal to matlab for its N-point DFT computation via FFT, matlab will assume this signal to begin from index n=0 to end at n= N-1 =2L. Therefore we can think of this new signal as x2[n] = x[n-L] a time shifted version of the original signal on the paper. (ok, it is actually a circular shift, but intuitively this is satisfying)
Now, from DFT time circuar shift property, you know that $X2[k] = e^{-j2\pi Lk/(2L+1)} X[k]$
This X2[k] is what you are seeing on Matlab, but what you compute on the paper is X[k] and it is readily related to X2[k] from above as $X[k] = e^{j2\pi Lk/(2L+1)} X2[k]$
Finaly it is this signal X[k] that I guess you were looking for,
In other words, DFT of a real and even signals being real.
See the sample matlab code below:
L = 127;
N= 2*L+1;
n=[-L:L];
x = cos(2*pi*12*n/1024); % this signal is even on the paper;)
X2 = fft(x,N); % but its DFT is actually DFT of x2[n]
X = exp(j*2*pi*[0:N-1]*L/(2*L+1)).*X; % lets recover X[k] from X2[k]
figure, stem(n,x);
figure,plot(real(X2)); %
figure,plot(real(X)); %
figure,plot(imag(X2)); % Here1, X2 has imaginary part?...
figure,plot(imag(X)); % now it is ok, X[k] is a real.
figure,stem(real(ifft(X2))) % reconstruct back signal from DFT X2[k]
figure,stem(real(ifft(exp(-j*2*pi*[0:N-1]*(L)/(2*L+1)).*X))) % do it from X[k]