# Automatic vertical spacing after minipage when used in tabulator environment

I encountered some issues with the minipage package combined with the tabulator options.

For clarity, I provide a MWE:

\documentclass[10pt, a4paper]{article}
\usepackage{multicol}
\newcommand{\ntab}[2]{
\rlap{}\hspace{.18\textwidth}
\llap{#1}\hspace{.02\textwidth}
\rlap{\begin{minipage}[t]{0.27\textwidth}#2\end{minipage}}
}

\begin{document}
\begin{multicols}{2}
Safety\\
\ntab{R38:}{Irritating to skin.}\\
\ntab{R48/20/22:}{Harmful: danger of serious damage to health by prolonged exposure through inhalation and if swallowed.}\\
\ntab{S36/37:}{Wear suitable protective clothing and gloves.}\\
\ntab{R65:}{Harmful: May cause lung damage if swallowed.} \\
\ntab{R67:}{Vapors may cause drowsiness and dizziness.} \\
\ntab{R62:}{Possible risk of impaired fertility.} \\
\ntab{S16:}{Keep away from sources of ignition - No smoking.} \\
\ntab{S29:}{Do not empty into drains.} \\
\ntab{S33:}{Take precautionary measures against static discharges.} \\
\end{multicols}
\end{document}


It seems that the lines inside the minipage environment are displayed correctly, however the spacing between minipages are not correct and leads to confusion.

I decided to use minipage to be able to write on multilines, since rlap and llap are not breaking the line if the sentence is too long.

Maybe there is a simpler way to achieve this.

I am open for every suggestion.

• Your distance between columns is as should be: small, however left margin of your text is accommodated to the width of R48/20/22: Try to change to the last item S33: to S33/22/11 and you will see, what is the problem. Possible solution: allow to longest "label" to intrude into text (meaning, you need to select another approach to make this list, for example with use simple description environment ... – Zarko Oct 23 '15 at 11:20
• @Zarko: the width is not accommodated to the longest width but is defined by myself with the hspace command. The issue is NOT the distance between the columns, but the "Automatic VERTICAL spacing after minipage..." as the title states. Thanks for your comment. – Fabio Oct 23 '15 at 11:45

I still not understand which vertical spacing you have in mind ... so, based on my guessing I suggest to use a list, which take a care about spacing between items. For example:

\documentclass[10pt,a4paper]{article}
\usepackage{multicol}
%\newcommand{\ntab}[2]{
%    \rlap{}\hspace{.18\textwidth}
%    \llap{#1}\hspace{.02\textwidth}
%    \rlap{\begin{minipage}[t]{0.27\textwidth}#2\end{minipage}}
%}
%    \setlength{\columnsep}{1em}

\usepackage{calc}
\usepackage{ragged2e}
\newcommand{\entrylabel}[1]{%
\makebox[\labelwidth][l]{\parbox[t]{\labelwidth}{%
\raggedleft\textsf{#1}}
}% end of makebox
}% end of definition
\newenvironment{entry}[1]%
{\begin{list}{}{%
\renewcommand{\makelabel}{\entrylabel}%
\settowidth{\labelwidth}{\textsf{#1:~}}%
\setlength{\leftmargin}{\labelwidth + \labelsep}
\setlength{\listparindent}{2ex}%
\setlength{\parsep}{0.2\baselineskip}
\setlength{\itemsep}{0.2\baselineskip}
}}%
{\end{list}}

\begin{document}
\subsection*{Safety}
\begin{multicols}{2}
\begin{entry}{R48/20/22}\RaggedRight
\item[R38]    Irritating to skin.
\item[R48/20/22]    Harmful: danger of serious damage to health by prolonged exposure through inhalation and if swallowed.
\item[S36/37]       Wear suitable protective clothing and gloves.
\item[R65]    Harmful: May cause lung damage if swallowed.
\item[R67]    Vapors may cause drowsiness and dizziness.
\item[R62]    Possible risk of impaired fertility.
\item[S16]    Keep away from sources of ignition - No smoking.
\item[S29]    Do not empty into drains.
\item[S33]    Take precautionary measures against static discharges.
\end{entry}
\end{multicols}
\end{document}


which gives:

If you like to have "safety" as ordinary text in two column text, than just remove \subsection{...} and move it inside two columns before list.

Don't use \rlap and \llap if you don't know how they work (and you don't, judging from the code): you'll incur in very unexpected behaviors.

\documentclass[10pt, a4paper]{article}
\usepackage{multicol}
\newcommand{\ntab}[2]{%
\par\noindent
\makebox[.2\textwidth][r]{#1\hspace{.02\textwidth}}%
\begin{minipage}[t]{0.27\textwidth}
\raggedright
#2\par\xdef\tpd{\the\prevdepth}\end{minipage}\par
\prevdepth\tpd\relax
}

\begin{document}
\begin{multicols}{2}
Safety
\ntab{R38:}{Irritating to skin.}
\ntab{R48/20/22:}{Harmful: danger of serious damage to health by prolonged exposure through inhalation and if swallowed.}
\ntab{S36/37:}{Wear suitable protective clothing and gloves.}
\ntab{R65:}{Harmful: May cause lung damage if swallowed.}
\ntab{R67:}{Vapors may cause drowsiness and dizziness.}
\ntab{R62:}{Possible risk of impaired fertility.}
\ntab{S16:}{Keep away from sources of ignition - No smoking.}
\ntab{S29:}{Do not empty into drains.}
\ntab{S33:}{Take precautionary measures against static discharges.}
\end{multicols}
\end{document}


I added \raggedright in the minipages, or the typesetting will be awful.

You could try the p option for a tabular:

\usepackage{array}
\newcommand{\ntab}[2]{
\begin{tabular}{>{\raggedleft}m{0.18\textwidth}p{0.27\textwidth}}
#1 & #2
\end{tabular}
}

• @Fabio this command creates a separate tabular for each row, therefore multicols can handle this without problem I think - unless you have a single table cell that you would like to span across columns/pages, which is problematic anyway for any tabular (longtable, supertabular, xtabular) or minipage. – Marijn Oct 23 '15 at 10:12