3
\documentclass[a4paper,11pt,twoside,openright]{book}

% \usepackage{geometry}
%  \geometry{
%  a4paper,
%  total={210mm,297mm},
%  left=20mm,
%  right=20mm,
%  top=20mm,
%  bottom=20mm,
%  }
\usepackage[margin=1in]{geometry}


\usepackage[utf8x]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{showkeys}
% \usepackage[dvips]{graphicx}
% per le figure:
\usepackage{graphicx}
% per il testo attorno alle figure
\usepackage{floatflt,epsfig}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{array}
% usare colori in tabella:
\usepackage{xcolor,colortbl}
\usepackage{titlesec}
%tabelle lunghe (gestione oltre il margine)
\usepackage{longtable} 
\usepackage{ltablex}
% \usepackage{lmode rn}
% \usepackage{listings}
% \usepackage[usenames]{color}
% \usepackage{color}
% \usepackage{xcolor}
% \usepackage{xspace}
% \lstset{language=TeX,
%       backgroundcolor=\color{lightgray},
%       basicstyle=\small\ttfamily,
%       xleftmargin=3em}

\pagestyle{fancy}\addtolength{\headwidth}{20pt}
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\#1}{}}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
\cfoot{}
\rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}
{\bfseries\thepage}}
\lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}
{\bfseries\rightmark}}

\begin{document}
\begin {flushright}
Dedica
\end {flushright}

\tableofcontents

\begin{table}[!ht]
\centering\scriptsize
\begin{tabular}{|c|m{4 cm}|m{4.5 cm}|m{3 cm}|}
\rowcolor{orange}
\rule[1ex]{0ex}{3ex}
Entità&Significato&Attributi&Identificatori \\
\midrule
Utente&
Utente finale registrato al servizio&
\begin{description}
 \item{} Username - Stringa  
 \item{} Password - Stringa 
 \item{} Nome - Stringa  
 \item{} Cognome - Stringa 
 \item{} DataNascita - Data 
 \item{}  PayPal - Stringa 
 \item{} IndirizzoDomicilio - Stringa 
\end{description}
&
Username \\

\bottomrule
\end{tabular}
\caption{Tabella Entità}
\end{table}


\end{document}
  • Which rules? The vertical ones? Yes, there usually is space of width \tabcolsep (6pt usually by default). Or do you mean the horizontal rules -- that's a feature of booktabs package. If really needed, the spacings can be changed by setting \belowrulesep and \aboverulesep – user31729 Sep 24 '15 at 16:21
  • Simply don't use vertical rules along with commands of booktabs such as \toprule, \bottomrule and \midrule. Better, never use vertical rules in tables. – egreg Sep 24 '15 at 16:41
4

Yes, there are separations above and below the horizontal rules if the booktabs package is included -- this is a nice design feature of that package!

If it is really necessary: (However, this makes the use of booktabs basically useless!)

The spacings above and below a horizontal rule made by \toprule, \bottomrule, midrule and \cmidrule (all provided by booktabs package) can be controlled with the lengths

\aboverulesep and \belowrulesep. Setting them both to 0pt will cause the separation to vanish:

\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}

I've done this within the table environment to restrict the change to the current table, not globally.

\documentclass[a4paper,11pt,twoside,openright]{book}


\usepackage[margin=1in]{geometry}


\usepackage[utf8x]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{showkeys}
\usepackage{graphicx}
% per il testo attorno alle figure
\usepackage{floatflt,epsfig}
\usepackage{wrapfig}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{array}
% usare colori in tabella:
\usepackage{xcolor,colortbl}
\usepackage{titlesec}
%tabelle lunghe (gestione oltre il margine)
\usepackage{longtable} 
\usepackage{ltablex}

\pagestyle{fancy}\addtolength{\headwidth}{20pt}
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\#1}{}}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
\cfoot{}
\rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}
{\bfseries\thepage}}
\lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}
{\bfseries\rightmark}}

\begin{document}
\begin {flushright}
Dedica
\end {flushright}

\tableofcontents

\begin{table}[!ht]
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\centering\scriptsize
\begin{tabular}{|c|m{4 cm}|m{4.5 cm}|m{3 cm}|}
\rowcolor{orange}
\rule[1ex]{0ex}{3ex} %%%% Why???? Why not \toprule with other thickness?
Entità&Significato&Attributi&Identificatori \\
\midrule
Utente&
Utente finale registrato al servizio&
\begin{description}
 \item{} Username - Stringa  
 \item{} Password - Stringa 
 \item{} Nome - Stringa  
 \item{} Cognome - Stringa 
 \item{} DataNascita - Data 
 \item{}  PayPal - Stringa 
 \item{} IndirizzoDomicilio - Stringa 
\end{description}
&
Username \\

\bottomrule
\end{tabular}
\caption{Tabella Entità}
\end{table}


\end{document}

enter image description here

  • There are other design issues not being addressed with my answer. I've deleted some commented code out of the 'MWE' ;-) – user31729 Sep 24 '15 at 16:31

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.