# 2-col floats and citation order problem

I am writing a document using IEEEtran class. And I am dealing with typical problem with 2-col floats (in my case a table).

I am aware of issue that a table has to be declared one page before than I would like to show it. That is OK, however, if I would like to use numerical bibliography (standard for IEEE) and put citation inside the caption of the float the numbers will be according to the declaration in the code and not according to the order in the document. That is of course undesirable.

Is there any possible way how to fix it?

INFO and MWE:

using MiKTeX 2.9 (Version 0.4.3 r.857)

\documentclass[journal,a4paper]{IEEEtran}
\usepackage{cite}

\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
\graphicspath{{Pictures/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
\fi
\usepackage[cmex10]{amsmath}
\interdisplaylinepenalty=2500
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{fixltx2e}
\usepackage{url}
\usepackage{booktabs}
\usepackage{lipsum}

\hyphenation{op-tical net-works semi-conduc-tor}

\begin{document}
\title{TITLE}
\author{Author
\thanks{Author is with the Department
of Electrical Engineering and Computing, University of Zagreb, Croatia, e-mail:(author@mail.com).}}

\markboth{journa;, August~2012}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Journals}

\maketitle
\begin{abstract}
\lipsum[2]
\end{abstract}

\begin{IEEEkeywords}
Stars, space, time.
\end{IEEEkeywords}
\IEEEpeerreviewmaketitle

\section{Introduction}
\IEEEPARstart{E}{very} \lipsum[2-6]

\begin{table*}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{Properties of systems, data are obtain from \cite{TheU.S.government-TheDepartmentofDefense2008} and \cite{EuropeanUnion2010} and valid for 25th July
}
\label{tab:stat}
\centering
\begin{tabular}{@{}lrrrrr@{}}\toprule[1.5pt]
GNSS & satellites [\#] & altitude [km] & orbit period [$^{\circ}$] & inclination [$^{\circ}]$ & used frequencies [MHz] \\ \midrule
GPS & 32(+3) & 20 185  & 11h58m & 55 &  1575.42 \& 1227.6\\
GLONASS & 22(+4) & 19 100  & 11h16m & 65 & 1597-1606 \& 1238-1250\\
Galileo& 0(+1) & 23 222  & 14h & 56 & 1575.42 \& 1278.75 \& 1191.795\\
Beidou & 13 & 21 500 & 12h & 55 & 1610-1626.5 \& 2483.5-2500\\
\bottomrule[1.5pt]
\end{tabular}
\end{table*}

\section{Positioning principle of GNSS}
\IEEEPARstart{A}{propo} \cite{IEEEhowto:kopka} \lipsum[7-10]

\section{Conclusion}
\lipsum[8]
\ifCLASSOPTIONcaptionsoff
\newpage
\fi

\begin{thebibliography}{9}

\bibitem{TheU.S.government-TheDepartmentofDefense2008}
The U.S. government - The Department of Defense, \emph{GLOBAL POSITIONING SYSTEM
STANDARD POSITIONING SERVICE},'' \relax no.~September, 2008.

\bibitem{EuropeanUnion2010}
European Union, \emph{European GNSS ( Galileo ) Open Service - Signal In Space
Interface Control Document},'' \relax no.~September, 2008.

\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to \LaTeX}, 3rd~ed.\hskip 1em plus
0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.

\end{thebibliography}
\end{document}


As you can see, the table is placed well, but the citation has lower number than the citation on the first page.

(! NOTE !) the bibliography is created automatically! in other case I would manually write the order as I would like to of course!

Question is: Is there any solution or I have to avoid writing citations in floats captions?

THX for any feedback!

-
Why not simply put the table* after  \IEEEPARstart{E}{very} \lipsum[2-6]\cite{IEEEhowto:kopka} so that the citations appear as you wish. The document appears to format OK when I tried it. –  David Carlisle Jul 25 '12 at 15:57
@DavidCarlisle Ok, that would solve this exact problem, but what if a citation would be inside the second section \IEEEPARstart{A}{propo} \lipsum[7-10] and I would like to have the table after the section? But in the end, I am afraid that I will have to play with positioning anyway : ( –  MasterPJ Jul 25 '12 at 16:37
@DavidCarlisle I edited the code to make it more clear. The 2. section unfortunately has to start after the table to show the table after the section. –  MasterPJ Jul 25 '12 at 16:46
When I tried it the table came at the top of page 2 in the output whichever position it was in the source? –  David Carlisle Jul 25 '12 at 19:06

Maybe an automatic version is possible, but for a short paper it's probably easier do some management by hand:

\begin{filecontents*}{\jobname.bib}
@techreport{TheU.S.government-TheDepartmentofDefense2008,
institution={{The U.S. government - The Department of Defense}},
title={{GLOBAL POSITIONING SYSTEM
STANDARD POSITIONING SERVICE}},
year={2008},
}
@techreport{EuropeanUnion2010,
institution={{European Union}},
title={European {GNSS} ({Galileo}) Open Service - Signal In Space
Interface Control Document},
year={2008},
}
@book{IEEEhowto:kopka,
author={Kopka, H. and Daly, P. W.},
title={A Guide to {\LaTeX}},
edition={3rd},
year={1999},
}
\end{filecontents*}

\documentclass[journal,a4paper]{IEEEtran}
\usepackage{cite}
\usepackage{etoolbox}

\makeatletter
\newcommand{\disablewritingcites}{%
\patchcmd{\@nocite}{\if@filesw}{\iffalse}{}{}%
}
\makeatother

\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
\graphicspath{{Pictures/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
\fi
\usepackage[cmex10]{amsmath}
\interdisplaylinepenalty=2500
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{fixltx2e}
\usepackage{url}
\usepackage{booktabs}
\usepackage{lipsum}

\hyphenation{op-tical net-works semi-conduc-tor}

\begin{document}
\title{TITLE}
\author{Author
\thanks{Author is with the Department
of Electrical Engineering and Computing, University of Zagreb, Croatia, e-mail:(author@mail.com).}}

\markboth{journa;, August~2012}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Journals}

\maketitle
\begin{abstract}
\lipsum[2]
\end{abstract}

\begin{IEEEkeywords}
Stars, space, time.
\end{IEEEkeywords}
\IEEEpeerreviewmaketitle

\section{Introduction}
\IEEEPARstart{E}{very} \lipsum[2-6]

\begin{table*}[!t]
\renewcommand{\arraystretch}{1.3}
\disablewritingcites
\caption{Properties of systems, data are obtain from \cite{TheU.S.government-TheDepartmentofDefense2008} and
\cite{EuropeanUnion2010} and valid for 25th July}\label{tab:stat}
\centering
\begin{tabular}{@{}lrrrrr@{}}\toprule[1.5pt]
GNSS & satellites [\#] & altitude [km] & orbit period [$^{\circ}$] & inclination [$^{\circ}]$ &
used frequencies [MHz] \\ \midrule
GPS & 32(+3) & 20 185  & 11h58m & 55 &  1575.42 \& 1227.6\\
GLONASS & 22(+4) & 19 100  & 11h16m & 65 & 1597-1606 \& 1238-1250\\
Galileo& 0(+1) & 23 222  & 14h & 56 & 1575.42 \& 1278.75 \& 1191.795\\
Beidou & 13 & 21 500 & 12h & 55 & 1610-1626.5 \& 2483.5-2500\\
\bottomrule[1.5pt]
\end{tabular}
\end{table*}

\section{Positioning principle of GNSS}
\IEEEPARstart{A}{propo} \cite{IEEEhowto:kopka} \lipsum[7-9]

\nocite{TheU.S.government-TheDepartmentofDefense2008}
\nocite{EuropeanUnion2010}

\lipsum[10]

\section{Conclusion}
\lipsum[8]
\ifCLASSOPTIONcaptionsoff
\newpage
\fi

\bibliographystyle{unsrt}
\bibliography{\jobname}

\end{document}


As you see, the writing of citations in the .aux file is disabled in the table environment. Two \nocite commands for those entries have been added between paragraphs so that the numbers are determined correctly.

NOTE. The command to patch is \@nocite because the document loads the cite package. Without it the command to work on is \@citex.

-
Cool, I should take a look at etoolbox package closely : ) –  MasterPJ Jul 26 '12 at 8:04

I moved the table in the source so it is after the first cite, it floats in to the same position at the top of page 2 which seems to be what you want? Of course the entries don't renumber in this MWE as it is a fixed bibliography but if your real example is regenerated with bibtex it would presumably order in order of use in the file and so the one in teh section heading would be [1].

\documentclass[journal,a4paper]{IEEEtran}
\usepackage{cite}

\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
\graphicspath{{Pictures/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
\fi
\usepackage[cmex10]{amsmath}
\interdisplaylinepenalty=2500
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{fixltx2e}
\usepackage{url}
\usepackage{booktabs}
\usepackage{lipsum}

\hyphenation{op-tical net-works semi-conduc-tor}

\begin{document}
\title{TITLE}
\author{Author
\thanks{Author is with the Department
of Electrical Engineering and Computing, University of Zagreb, Croatia, e-mail:(author@mail.com).}}

\markboth{journa;, August~2012}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Journals}

\maketitle
\begin{abstract}
\lipsum[2]
\end{abstract}

\begin{IEEEkeywords}
Stars, space, time.
\end{IEEEkeywords}
\IEEEpeerreviewmaketitle

\section{Introduction}
\IEEEPARstart{E}{very} \lipsum[2-6]

\section{Positioning principle of GNSS}
\IEEEPARstart{A}{propo} \cite{IEEEhowto:kopka}

\begin{table*}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{Properties of systems, data are obtain from \cite{TheU.S.government-TheDepartmentofDefense2008} and \cite{EuropeanUnion2010} and valid for 25th July
}
\label{tab:stat}
\centering
\begin{tabular}{@{}lrrrrr@{}}\toprule[1.5pt]
GNSS & satellites [\#] & altitude [km] & orbit period [$^{\circ}$] & inclination [$^{\circ}]$ & used frequencies [MHz] \\ \midrule
GPS & 32(+3) & 20 185  & 11h58m & 55 &  1575.42 \& 1227.6\\
GLONASS & 22(+4) & 19 100  & 11h16m & 65 & 1597-1606 \& 1238-1250\\
Galileo& 0(+1) & 23 222  & 14h & 56 & 1575.42 \& 1278.75 \& 1191.795\\
Beidou & 13 & 21 500 & 12h & 55 & 1610-1626.5 \& 2483.5-2500\\
\bottomrule[1.5pt]
\end{tabular}
\end{table*}

\lipsum[7-10]

\section{Conclusion}
\lipsum[8]
\ifCLASSOPTIONcaptionsoff
\newpage
\fi

\begin{thebibliography}{9}

\bibitem{TheU.S.government-TheDepartmentofDefense2008}
The U.S. government - The Department of Defense, \emph{GLOBAL POSITIONING SYSTEM
STANDARD POSITIONING SERVICE},'' \relax no.~September, 2008.

\bibitem{EuropeanUnion2010}
European Union, \emph{European GNSS ( Galileo ) Open Service - Signal In Space
Interface Control Document},'' \relax no.~September, 2008.

\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to \LaTeX}, 3rd~ed.\hskip 1em plus
0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.

\end{thebibliography}
\end{document}

-
I understand your point, but, this would work just in this example. But what if the citation would not be in the beginning but in the middle or in the end of the section (where actually is in my paper)? Putting a float into a text creates paragraph break. So I would have to put the float between some paragraphs. You are probably, right and I would be able to manage the code to suit my citations order in any situation. And this solution is as good as any. However, I was looking for some solution in general term, to avoid fitting my code according to actual length of the text. –  MasterPJ Jul 26 '12 at 8:03
You are mistaken, in that a float does not start a new paragraph, you can put it mid-word if you like (although that will inhibit hyphenation, it won't introduce any white space into the main document flow) –  David Carlisle Jul 26 '12 at 9:19
You are right, in that case only what matters is: Do I want to move with floats or with \nocite commands? : ) –  MasterPJ Jul 26 '12 at 11:16