2

First of all, I need to apologize to transcript the almost the whole document here. But without it I could not present what I wanted to show. If you compile the document, there is one table that goes to the last page, and stays in the middle of it. I know that if I change margins, font size, etc., I can avoid that to happen, but I would like to keep those settings.

As such, I can I prevent the table to go to the middle of last page? I mean, can I place it at top of page as the other page?

Moreover, I could also make table fit \columnwidth, however it does not work very well because I am using verbatims on it.

% arara: pdflatex
% arara: pdflatex
% arara: clean: { files: [ rules.aux, rules.log, rules.out ] }

%\documentclass[a4paper,twocolumn,10pt]{article}
%\documentclass[a4paper,twocolumn,10pt,DIV=15]{scrartcl}
%\documentclass[a4paper,twocolumn,10pt]{scrartcl}
\documentclass[paper=a4,twocolumn,10pt,DIV=calc]{scrartcl}

\setlength{\columnsep}{7.5mm}
%\usepackage[hmargin=15mm,columnsep=7.5mm]{geometry}
\usepackage{microtype}
\usepackage{type1ec}
\usepackage{enumitem}
%\setlist{noitemsep}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{listings}
\lstset{%
    language=[LaTeX]TeX,
    basicstyle=\ttfamily,
    breaklines=true,
    columns=fullflexible,
}
\usepackage{caption}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\floatplacement{figure}{ht}
\floatplacement{table}{ht}
\usepackage[colorlinks]{hyperref}
\usepackage{bookmark}
\usepackage{cleveref}
%\usepackage[obeyall,per=slash]{siunitx}[03/05/2012]
\usepackage[detect-all,per-mode=symbol]{siunitx}[03/05/2012]
\usepackage{relsize}

\renewcommand*{\verb}{\lstinline}
\newcommand{\unit}[2]{\mbox{\ensuremath{#1\,\mathrm{#2}}}}
\newcommand*{\TikZ}{\mbox{Ti\emph{k}Z}}
\newcommand*{\pkg}[1]{\texttt{#1}}
\newcommand*{\mail}[1]{\textsmaller{\textless\href{mailto:#1}{\texttt{#1}}\textgreater}}


\begin{document}

\title{Practical and Harmonization Rules for GTEL Book}
\author{Carlos F.~M.~e Silva\\ \mail{cfms@gtel.ufc.br}}
\date{\today}
\maketitle


\section{Introduction}

Since we are in the last kilometers for the book, which are also the most important ones, it seemed to me reasonable to write some set of \emph{rules} to follow for the book (and for the upcoming books). This will be probably unfinished document, since some rules only come when new situations arrive.

\noindent \textbf{Disclaimer}: These \emph{rules} are not strict. Many aspects are left out of the scope of this document. The author knows that others may have better ways to achieve the same (or even better) result. These also follow the \emph{Contributor's Guide v.2.0}.


\section{Use of em-dash, en-dash, an minus}

In \textsc{Wikipedia} a definition may be found for all kind of uses. The one may want to check out its uses in \url{http://en.wikipedia.org/wiki/Dash}. To be brief, see~\cref{tab:dash_use} for usage examples.

\begin{table*}
\centering
\begin{tabular}{lccl}
\toprule
Sign name & Input      & Looks like & Example of use \\
\midrule
em-dash   & \verb|---| & ---        & The BS---known in LTE as eNB---has its coverage\dots \\
en-dash   & \verb|--|  & --         & The range 1--10 is better to\dots \\
minus     & \verb|-|   & -          & Inter-interference, or in math $1-2=-1$ \\
\bottomrule
\end{tabular}
\caption{Different dash usages}
\label{tab:dash_use}
\end{table*}


\section{Reference chapters, sections, figures, tables, and algorithms}

In preamble, it may be defined some commands as the following, and then use them all over the document.

\begin{lstlisting}
% in preamble
\newcommand*{\ie}{i.e.}
\newcommand*{\eg}{e.g.}
\newcommand*{\ChapRef}[1]{Chapter~\ref{#1}}
\newcommand*{\SecRef}[1]{Section~\ref{#1}}
\newcommand*{\FigRef}[1]{Fig.~\ref{#1}}
\newcommand*{\TabRef}[1]{Table~\ref{#1}}
\newcommand*{\EqRef}[1]{Eq.~\ref{#1}}
\end{lstlisting}


\section{Font for drawings}

The indication from the book's editor is to use Arial font at 10pt. However, if the author wants to use sophisticated tools like: PGF\slash \TikZ, or generate plots via Gnuplot, or even use Inkscape (separating drawing from text) and include then later in the document, there is no easy way to use it in \LaTeX. My suggestion is to use Helvetica and scale it down.

\begin{lstlisting}
% in preamble
\documentclass[10pt]{svmult}
\usepackage[scaled=.8]{helvet}
\end{lstlisting}


\section{Algorithms}

Algorithms are included as figures. It more visual attractive to include a frame around the algorithm and put numbers in the lines.

\begin{lstlisting}
% in preamble
\usepackage{varwidth}
\usepackage{algorithmic}
\usepackage{etoolbox}
%\AtBeginEnvironment{algorithmic}{\normalsize}
\newsavebox{\mybox}
\newenvironment{algbox}
{%
  \begin{lrbox}{\mybox}%
  \begin{varwidth}[b]{\textwidth}%
}{%
  \end{varwidth}%
  \end{lrbox}%
  \fbox{\usebox{\mybox}}%
}

% in document
\begin{figure}
\begin{algbox}
\begin{algorithm}[1]
...
\end{algorithm}
\end{algbox}
\caption{...}
\label{...}
\end{figure}

\end{lstlisting}

The font in algorithms is scaled down to \verb|\small|, however if required to use the text font, the \pkg{etoolbox} provides an easy way to do it: \verb|\AtBeginEnvironment{algorithmic}{\normalsize}|, where now font will be at \verb|\normalsize| for all algorithms.


\section{Use of acronyms}

In technical documents, we often use lots of acronyms. There are some packages in \LaTeX that deal with them. The one that is often used is \pkg{acronym}.

\begin{lstlisting}
% in preamble
\usepackage[printonlyused]{acronym}
\renewcommand{\bflabel}[1]{#1\hfill}
\end{lstlisting}

Lists of acronyms are defined as usual.

\begin{lstlisting}
\begin{acronym}[3GPP ] % write the widest acronym inside '[]'
  \acro{3GPP}{Third Generation Partnership Project}
  \acro{BS}{Base Station}
  \acro{D2D}{Device-to-Device}
\end{acronym}
\end{lstlisting}

Everyone is familiar with \verb|\ac|, \verb|\acs|, \verb|\acl|, and \verb|\acf| commands (there many are others, namely for plurals). However, some rules shall be considered.
%
\begin{itemize}
    \item At chapter, section headings, and captions (figures, tables, and algorithms) use \verb|\acs| for short version and \verb|\acl| for long version, but not \verb|\ac|;
    \item Keep the acronym list manually \textsc{sorted} (\pkg{acronym} cannot do it for us).
\end{itemize}


\section{Use of units}

The use of mathematical units in our documents is very frequent. The \emph{correct} way to display units is to guarantee that there is a thin space between the number and the unit, like \verb|\,|. The one may use \verb|\mbox{30\,m/s}|, or define a command for that \verb|\newcommand{\unit}[2]{\mbox{\ensuremath{#1\,\mathrm{#2}}}}|. However, the better way is to use the \pkg{siunitx} for that, see~\cref{tab:disp_units}.

\begin{lstlisting}
% in preamble
\usepackage[detect-all,per-mode=symbol]{siunitx}[03/05/2012] % TeXLive 2012, Ubuntu 12.04
\end{lstlisting}

\begin{table*}[b]
\centering
\begin{tabular}{llc}
\toprule
& Input & Looks like \\
\cmidrule{2-3}
Plain \LaTeX  & \verb|\mbox{30\,m/s}|              & \mbox{30\,m/s} \\
With command  & \verb|\unit{30}{m/s}|              & \unit{30}{m/s} \\ 
\pkg{siunitx} & \verb|\SI{30}{\meter\per\second}|  & \SI{30}{\meter\per\second} \\
\bottomrule
\end{tabular}
\caption{Display units}
\label{tab:disp_units}
\end{table*}


\section{Table widths}


\section{Miscellaneous}


\subsection{Labels for chapters, sections, figures, tables, and algorithms}

One of the real advantages of \LaTeX over other text processors is its capabilities to handle references. As suggestion, a label shall be defined for each 
chapter, section, figure, table, and algorithm. Also, label shall be defined only after the main command is given: \verb|\chapter|, \verb|\section|, or \verb|caption|.

\begin{lstlisting}
\label{chp:chpname} % chapters
\label{sec:secname} % sections 
\label{fig:figname} % figures
\label{tab:tabname} % tables
\label{alg:algname} % algorithms
...
\end{lstlisting}

An example of usage for a table could be as follows.

\begin{lstlisting}
\begin{table}
...
\caption{...}
\label{tab:table1}
\end{table}
\end{lstlisting}

\end{document}
  • I see that the code you write is only for one figure. In fact it could be a general solution if one could write a macro for more than a figure/table that could be executed before each \begin{figure} or \begin{table}. – cacamailg Apr 17 '13 at 0:10
  • It could fairly easily be made into a macro you just have to parametrise it a bit and think of an interface. (not tonight though:-) – David Carlisle Apr 17 '13 at 0:14
3

two column floats are first considered on the page after they appear in the source (as the first column has already been set and can't be shortened to make room.

So you need to allow [t] (it only allowed b) and move it forward in the source.

enter image description here

% arara: pdflatex
% arara: pdflatex
% arara: clean: { files: [ rules.aux, rules.log, rules.out ] }

%\documentclass[a4paper,twocolumn,10pt]{article}
%\documentclass[a4paper,twocolumn,10pt,DIV=15]{scrartcl}
%\documentclass[a4paper,twocolumn,10pt]{scrartcl}
\documentclass[paper=a4,twocolumn,10pt,DIV=calc]{scrartcl}

\setlength{\columnsep}{7.5mm}
%\usepackage[hmargin=15mm,columnsep=7.5mm]{geometry}
\usepackage{microtype}
\usepackage{type1ec}
\usepackage{enumitem}
%\setlist{noitemsep}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{listings}
\lstset{%
    language=[LaTeX]TeX,
    basicstyle=\ttfamily,
    breaklines=true,
    columns=fullflexible,
}
\usepackage{caption}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\floatplacement{figure}{hpt}
\floatplacement{table}{hpt}
\usepackage[colorlinks]{hyperref}
\usepackage{bookmark}
\usepackage{cleveref}
%\usepackage[obeyall,per=slash]{siunitx}[03/05/2012]
\usepackage[detect-all,per-mode=symbol]{siunitx}[03/05/2012]
\usepackage{relsize}

\renewcommand*{\verb}{\lstinline}
\newcommand{\unit}[2]{\mbox{\ensuremath{#1\,\mathrm{#2}}}}
\newcommand*{\TikZ}{\mbox{Ti\emph{k}Z}}
\newcommand*{\pkg}[1]{\texttt{#1}}
\newcommand*{\mail}[1]{\textsmaller{\textless\href{mailto:#1}{\texttt{#1}}\textgreater}}


\begin{document}

\title{Practical and Harmonization Rules for GTEL Book}
\author{Carlos F.~M.~e Silva\\ \mail{cfms@gtel.ufc.br}}
\date{\today}
\maketitle


\section{Introduction}

Since we are in the last kilometers for the book, which are also the most important ones, it seemed to me reasonable to write some set of \emph{rules} to follow for the book (and for the upcoming books). This will be probably unfinished document, since some rules only come when new situations arrive.

\noindent \textbf{Disclaimer}: These \emph{rules} are not strict. Many aspects are left out of the scope of this document. The author knows that others may have better ways to achieve the same (or even better) result. These also follow the \emph{Contributor's Guide v.2.0}.


\section{Use of em-dash, en-dash, an minus}

In \textsc{Wikipedia} a definition may be found for all kind of uses. The one may want to check out its uses in \url{http://en.wikipedia.org/wiki/Dash}. To be brief, see~\cref{tab:dash_use} for usage examples.

\begin{table*}
\centering
\begin{tabular}{lccl}
\toprule
Sign name & Input      & Looks like & Example of use \\
\midrule
em-dash   & \verb|---| & ---        & The BS---known in LTE as eNB---has its coverage\dots \\
en-dash   & \verb|--|  & --         & The range 1--10 is better to\dots \\
minus     & \verb|-|   & -          & Inter-interference, or in math $1-2=-1$ \\
\bottomrule
\end{tabular}
\caption{Different dash usages}
\label{tab:dash_use}
\end{table*}


\section{Reference chapters, sections, figures, tables, and algorithms}

In preamble, it may be defined some commands as the following, and then use them all over the document.

\begin{lstlisting}
% in preamble
\newcommand*{\ie}{i.e.}
\newcommand*{\eg}{e.g.}
\newcommand*{\ChapRef}[1]{Chapter~\ref{#1}}
\newcommand*{\SecRef}[1]{Section~\ref{#1}}
\newcommand*{\FigRef}[1]{Fig.~\ref{#1}}
\newcommand*{\TabRef}[1]{Table~\ref{#1}}
\newcommand*{\EqRef}[1]{Eq.~\ref{#1}}
\end{lstlisting}


\section{Font for drawings}

The indication from the book's editor is to use Arial font at 10pt. However, if the author wants to use sophisticated tools like: PGF\slash \TikZ, or generate plots via Gnuplot, or even use Inkscape (separating drawing from text) and include then later in the document, there is no easy way to use it in \LaTeX. My suggestion is to use Helvetica and scale it down.

\begin{lstlisting}
% in preamble
\documentclass[10pt]{svmult}
\usepackage[scaled=.8]{helvet}
\end{lstlisting}


\section{Algorithms}

Algorithms are included as figures. It more visual attractive to include a frame around the algorithm and put numbers in the lines.

\begin{lstlisting}
% in preamble
\usepackage{varwidth}
\usepackage{algorithmic}
\usepackage{etoolbox}
%\AtBeginEnvironment{algorithmic}{\normalsize}
\newsavebox{\mybox}
\newenvironment{algbox}
{%
  \begin{lrbox}{\mybox}%
  \begin{varwidth}[b]{\textwidth}%
}{%
  \end{varwidth}%
  \end{lrbox}%
  \fbox{\usebox{\mybox}}%
}

% in document
\begin{figure}
\begin{algbox}
\begin{algorithm}[1]
...
\end{algorithm}
\end{algbox}
\caption{...}
\label{...}
\end{figure}

\end{lstlisting}

The font in algorithms is scaled down to \verb|\small|, however if required to use the text font, the \pkg{etoolbox} provides an easy way to do it: \verb|\AtBeginEnvironment{algorithmic}{\normalsize}|, where now font will be at \verb|\normalsize| for all algorithms.


\section{Use of acronyms}

\begin{table*}[btp]
\centering
\begin{tabular}{llc}
\toprule
& Input & Looks like \\
\cmidrule{2-3}
Plain \LaTeX  & \verb|\mbox{30\,m/s}|              & \mbox{30\,m/s} \\
With command  & \verb|\unit{30}{m/s}|              & \unit{30}{m/s} \\ 
\pkg{siunitx} & \verb|\SI{30}{\meter\per\second}|  & \SI{30}{\meter\per\second} \\
\bottomrule
\end{tabular}
\caption{Display units}
\label{tab:disp_units}
\end{table*}


In technical documents, we often use lots of acronyms. There are some packages in \LaTeX that deal with them. The one that is often used is \pkg{acronym}.

\begin{lstlisting}
% in preamble
\usepackage[printonlyused]{acronym}
\renewcommand{\bflabel}[1]{#1\hfill}
\end{lstlisting}

Lists of acronyms are defined as usual.

\begin{lstlisting}
\begin{acronym}[3GPP ] % write the widest acronym inside '[]'
  \acro{3GPP}{Third Generation Partnership Project}
  \acro{BS}{Base Station}
  \acro{D2D}{Device-to-Device}
\end{acronym}
\end{lstlisting}

Everyone is familiar with \verb|\ac|, \verb|\acs|, \verb|\acl|, and \verb|\acf| commands (there many are others, namely for plurals). However, some rules shall be considered.
%
\begin{itemize}
    \item At chapter, section headings, and captions (figures, tables, and algorithms) use \verb|\acs| for short version and \verb|\acl| for long version, but not \verb|\ac|;
    \item Keep the acronym list manually \textsc{sorted} (\pkg{acronym} cannot do it for us).
\end{itemize}


\section{Use of units}

The use of mathematical units in our documents is very frequent. The \emph{correct} way to display units is to guarantee that there is a thin space between the number and the unit, like \verb|\,|. The one may use \verb|\mbox{30\,m/s}|, or define a command for that \verb|\newcommand{\unit}[2]{\mbox{\ensuremath{#1\,\mathrm{#2}}}}|. However, the better way is to use the \pkg{siunitx} for that, see~\cref{tab:disp_units}.

\begin{lstlisting}
% in preamble
\usepackage[detect-all,per-mode=symbol]{siunitx}[03/05/2012] % TeXLive 2012, Ubuntu 12.04
\end{lstlisting}



\section{Table widths}


\section{Miscellaneous}


\subsection{Labels for chapters, sections, figures, tables, and algorithms}

One of the real advantages of \LaTeX over other text processors is its capabilities to handle references. As suggestion, a label shall be defined for each 
chapter, section, figure, table, and algorithm. Also, label shall be defined only after the main command is given: \verb|\chapter|, \verb|\section|, or \verb|caption|.

\begin{lstlisting}
\label{chp:chpname} % chapters
\label{sec:secname} % sections 
\label{fig:figname} % figures
\label{tab:tabname} % tables
\label{alg:algname} % algorithms
...
\end{lstlisting}

An example of usage for a table could be as follows.

\begin{lstlisting}
\begin{table}
...
\caption{...}
\label{tab:table1}
\end{table}
\end{lstlisting}

\end{document}
  • I was thinking about an automatic way to prevent LaTeX from doing that. If none, I will try the manual method as you said :). – cacamailg Apr 16 '13 at 23:41
  • @cacamailg Manually moving it is probably the safest (and the documented way) but I did make an answer on site for a semi-automatic workaround, I'll see if I can find it... – David Carlisle Apr 16 '13 at 23:43
  • I found dblfloatfix and midfloat packages, but not sure if it does the trick. – cacamailg Apr 17 '13 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.