# Swapping of surname and its initials

Below is my code:

\documentclass{article}
\newcommand\JRNL[1]{#1}
\newcommand\AUGRP[1]{{#1}}
\newcommand\AUTHOR[1]{#1}
\newcommand\SNM[1]{#1}
\newcommand\INITS[1]{#1}
\newcommand\SEP[1]{#1\ignorespaces}
\newcommand\ATITLE[1]{#1}
\newcommand\JTITLE[1]{{\em #1}}
\newcommand\VOLUME[1]{#1}
\newcommand\YEAR[1]{#1}
\newcommand\FPAGE[1]{#1}
\newcommand\LPAGE[1]{#1}

\begin{document}

\begin{thebibliography}{99}

\JRNL{
\bibitem{00}
\AUGRP{\AUTHOR{\INITS{L.}\SEP{ }\SNM{Anselin}}\SEP{, }
\AUTHOR{\INITS{A.K.}\SEP{ }\SNM{Bera}}\SEP{, }
\AUTHOR{\INITS{R.}\SEP{ }\SNM{Florax}}\SEP{ and }
\AUTHOR{\INITS{M.J.}\SEP{ }\SNM{Yoon.}}}\SEP{. }
\YEAR{1996}\SEP{. }
\ATITLE{Simple Diagnostic Tests for Spatial Dependence.}\SEP{ }
\JTITLE{Regional Science and Urban Economics}\SEP{ }
\VOLUME{26}\SEP{: }
\FPAGE{77}\SEP{--}
\LPAGE{104}\SEP{.}
}

\end{thebibliography}

\end{document}


My problem is I need to display the first author initial after surname, and the rest should stay as is. Please look into the below screenshot for your reference.

Without changing the Tex code can I get the required below output? Kindly confirm.

-
Is there a reason for not using the well-established bibtex/biblatex routes towards creating the bibliography? –  Mico May 24 at 11:01

If all of your authors are input in the form

\INITS{<initials>}\SEP{ }\SNM{<surname>}


then the following will do

\documentclass{article}

\newcommand\JRNL[1]{#1}
\newcommand\AUTHOR[1]{#1}
\newcommand\SNM[1]{#1}
\newcommand\SEP[1]{#1\ignorespaces}
\newcommand\ATITLE[1]{#1}
\newcommand\JTITLE[1]{{\em #1}}
\newcommand\VOLUME[1]{#1}
\newcommand\YEAR[1]{#1}
\newcommand\FPAGE[1]{#1}
\newcommand\LPAGE[1]{#1}

%%% change definition of \INITS
\newcommand\AUGRP[1]{{\let\INITS\FIRSTINITS#1}}
\def\FIRSTINITS#1#2\SNM#3{#3 #1\let\INITS\NORMALINITS}
\newcommand\NORMALINITS[1]{#1}

\begin{document}

\begin{thebibliography}{99}

\JRNL{
\bibitem{00}
\AUGRP{\AUTHOR{\INITS{L.}\SEP{ }\SNM{Anselin}}\SEP{, }
\AUTHOR{\INITS{A.K.}\SEP{ }\SNM{Bera}}\SEP{, }
\AUTHOR{\INITS{R.}\SEP{ }\SNM{Florax}}\SEP{ and }
\AUTHOR{\INITS{M.J.}\SEP{ }\SNM{Yoon.}}}\SEP{. }
\YEAR{1996}\SEP{. }
\ATITLE{Simple Diagnostic Tests for Spatial Dependence.}\SEP{ }
\JTITLE{Regional Science and Urban Economics}\SEP{ }
\VOLUME{26}\SEP{: }
\FPAGE{77}\SEP{--}
\LPAGE{104}\SEP{.}
}

\end{thebibliography}

\end{document}


You're using the wrong tool for adding a bibliography, I should add.

-
+1 for the comment about the OP's method for creating a bibliography being of questionable value. –  Mico May 24 at 11:00

I think the solution for your quest, with minimum change in the original structure, is to switch the order of the entries \INITS{L.} and \SNM{Anselin} inside the first \AUTHOR{ } key, which refers to the main author.

Below is the working code with that change:

\documentclass{article}
\newcommand\JRNL[1]{#1}
\newcommand\AUGRP[1]{{#1}}
\newcommand\AUTHOR[1]{#1}
\newcommand\SNM[1]{#1}
\newcommand\INITS[1]{#1}
\newcommand\SEP[1]{#1\ignorespaces}
\newcommand\ATITLE[1]{#1}
\newcommand\JTITLE[1]{{\em #1}}
\newcommand\VOLUME[1]{#1}
\newcommand\YEAR[1]{#1}
\newcommand\FPAGE[1]{#1}
\newcommand\LPAGE[1]{#1}

\begin{document}

\begin{thebibliography}{99}
\JRNL{%
\bibitem{00}
\AUGRP{\AUTHOR{\SNM{Anselin}\SEP{ }\INITS{L.}}\SEP{, }
\AUTHOR{\INITS{A.K.}\SEP{ }\SNM{Bera}}\SEP{, }
\AUTHOR{\INITS{R.}\SEP{ }\SNM{Florax}}\SEP{ and }
\AUTHOR{\INITS{M.J.}\SEP{ }\SNM{Yoon.}}}\SEP{. }
\YEAR{1996}\SEP{. }
\ATITLE{Simple Diagnostic Tests for Spatial Dependence.}\SEP{ }
\JTITLE{Regional Science and Urban Economics}\SEP{ }
\VOLUME{26}\SEP{: }
\FPAGE{77}\SEP{--}
\LPAGE{104}\SEP{.}
}%
\end{thebibliography}
\end{document}


But it is not clear for me why you can't make any change in the original. There are many other ways to produce that same result or even better if you consider using powerful tools like BibTeX.

Below is one example of the same reference using nothing but pdfTeX:

\documentclass{article}
\begin{document}

Citation in text looks like this \cite{anselin1996}

\begin{thebibliography}{99}
\bibitem{anselin1996}
Anselin L., A.K. Bera, R. Florax and M.J. Yoon. 1996. Simple Diagnostic Tests for Spatial Dependence. \emph{Regional Science and Urban Economics} 26: 77-104.
\end{thebibliography}
\end{document}


Using BibTeX package you you will have much more possibilities for your bibliography (see for instance, Some Reference Styles and BibTeX). And the best of all is that you don't have to type most of the references because they are available on internet, in the right format already (is just copy|paste&check). One of these sites I use often to search references is SAO/NASA ADS, and is very rare not finding publication on my field of research, at least for publications made after 1990.

-