1

Good morning

I have one table (longtable) and there is two columns. In 2nd column I use the tool itemize. When I do it I have gaps between rows but I don't want to have any gaps, picture below.

Thanks for help.

\documentclass[10pt,a6paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper, top=10mm, left=10mm, right=10mm, bottom=10mm,foot=5mm,marginparsep=0mm,showframe]{geometry}
%showframe
\usepackage{tipa}
\usepackage{tabularx,booktabs}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{array}
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{longtable}
\usepackage{lscape}

\usepackage{enumitem}
\usepackage{tabularx,booktabs}
\usepackage{enumitem}
\usepackage{mathtools}
\pagenumbering{alph}
\pagenumbering{Roman}

\usepackage{ textcomp }
\usepackage{ marvosym }
\usepackage{fontawesome}
\usepackage{tfrupee}
\usepackage{stackengine}
\def\yenrule{\rule{1.3ex}{.1ex}}
\def\textyen{\renewcommand\stacktype{L}\stackon[.4ex]{\stackon[.65ex]{Y}{\yenrule}}{\yenrule}}
\usepackage{textcomp}

\begin{document}
\catcode`\-=12
\sloppy

{\small\setlist[itemize]{nosep , label=--, wide = 0pt, labelsep=.25em, leftmargin=*}
\begin{longtable}{p{3cm}p{3cm}}
  \toprule
  sometext      & \setlist{nosep,topsep=0sp,label=--} \vspace{-\baselineskip}
                  \begin{itemize}
                    \item[-] some long text 
                  \end{itemize}\\   
  sometext      & \setlist{nosep,topsep=0sp,label=--} \vspace{-\baselineskip}
                  \begin{itemize}
                    \item[-] some long text
                  \end{itemize}\\
  sometext      & \setlist{nosep,topsep=0sp,label=--} \vspace{-\baselineskip}
                  \begin{itemize}
                    \item[-] some long text
                  \end{itemize}\\                 
  sometext      & \setlist{nosep,topsep=0sp,label=--} \vspace{-\baselineskip}
                  \begin{itemize}
                    \item[-] some long text
                  \end{itemize}\\                 
  \toprule
\end{longtable}}

\end{document}

enter image description here

  • 1
    Everytime you start and finish an environment, vertical space is inserted. The above space is killed by that very ugly \vspace*{-\baselineskip} hack. How long is you actual text in the columns? Maybe it would be better to avoid itemize at all and use a completely different construct. – Johannes_B Sep 4 '16 at 7:13
  • 1
    label=-- is supposed to set the labels to be an endash. You are setting a hyphen each and every time by hand. If you really want a hyphen instead of a dash, use label=-. But stop doing stuff manually. – Johannes_B Sep 4 '16 at 7:19
2

Like this?

enter image description here

Adopted from answer on question:

\documentclass[10pt,a6paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper, 
            margin=10mm,foot=5mm,marginparsep=0mm,
            showframe]{geometry}

    \usepackage{booktabs,longtable,makecell}
\renewcommand\theadfont{\bfseries\sffamily}
    \usepackage{ragged2e}

    \usepackage{enumitem}% for nice list
\newcommand{\tablistcommand}{% <-- for eliminating vertical space
                             %     before and after itemize
            \leavevmode\par\vspace{-\baselineskip}
                            }
\newlist{tableitems}{itemize}{1}% <-- defined new list
\setlist[tableitems]{nosep,     % <-- new list setup
                     topsep     = 0pt               ,
                     partopsep  = 0pt               ,
                     leftmargin = *                 ,
                     label      = -                 ,
                     before     = \tablistcommand   ,
                     after      = \tablistcommand
                     }

\begin{document}
%\catcode`\-=12
%\sloppy

\begin{longtable}{p{3cm}p{3cm}}
  \toprule
  sometext      & \begin{tableitems}
                    \item   some long text
                  \end{tableitems}         \\
  sometext      & \begin{tableitems}
                    \item   some long text
                  \end{tableitems}         \\
  sometext      & \begin{tableitems}
                    \item   first item in some long text
                    \item   second item in some long text
                    \item   thirs item in some long text
                  \end{tableitems}         \\
  sometext      & \begin{tableitems}
                    \item   some long text
                  \end{tableitems}\\
  \bottomrule
\end{longtable}

\end{document}

In above MWE I omit all unrelated packages in your MWE.

3

An alternative not using itemize at all, define a command to do the job for you.

lubomirLongtableItemize

\documentclass[10pt,
    dvipsnames,
%a6paper% still unused
]{book}
\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[a6paper, top=10mm, left=10mm, right=10mm, bottom=10mm,foot=5mm,marginparsep=0mm,showframe]{geometry}
%showframe
\usepackage{xcolor}% Load the package without any options.
\usepackage{booktabs}
\usepackage{longtable}
\pagenumbering{alph}
\pagenumbering{Roman}% does ist make sense to change the numbering of pages in the preamble, two times in a row? 



\newcommand{\blindtext}{This is a text that does not contain Ducks, nor Wombats}

\newcommand{\tabitem}[1]{--~\parbox[t]{.9\linewidth}{\small\raggedright#1\par}\vspace{2ex}}
\begin{document}
\catcode`\-=12
\sloppy

{\small
\begin{longtable}{p{3cm}p{3cm}}
    \toprule
    sometext      &  \tabitem{\blindtext} \\
    sometext      &  \tabitem{\blindtext} \\
    sometext      &  \tabitem{\blindtext} \\
    sometext      &  \tabitem{\blindtext} \\
    \bottomrule
\end{longtable}}

\end{document}

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