4

I am creating a table in LaTeX. Everything happens to go by the script. However, there is a minor glitch. If you closely watch the table structure, you will find that the column boundary between "utterances" and "words" is slightly displaced when compared to the column boundary that is below it.

What is the reason for it. I am uploading the LaTeX code as well as the table it generates

image of table

The corresponding LaTeX code is: -

\begin{table}[h!]
\centering
\setlength{\arrayrulewidth}{.2mm}
\setlength{\tabcolsep}{7pt}
\renewcommand{\arraystretch}{1.5}
\begin{tabulary}{0.8\textwidth}{ |p{1.3cm}|p{1.2cm}|p{.6cm}|p{1.2cm}|p{.6cm}|}
\hline
\multirow{2}{*}{\textbf{Data Set}} & \multicolumn{2}{c}{\textbf{Utterances}} & \multicolumn{2}{|c|}
{\textbf{Words}} \\  \cline{2-5}
& \textbf{No.of utterances} & \textbf{Hours of Data} & \textbf{Word Count} & \textbf{Distinct Words} \\
\hline
\textbf{Training Set} & -  & - & - &- \\
\hline
\textbf{Development Set} & - & -  & - & - \\
\hline
\textbf{Test Set} & - & - & - & - \\
\hline
\end{tabulary}
\newline
\begin{center}
\caption{dataset available for experiment}
\end{center}
\end{table}
4

The reason is in the line commented here. I could only guess packages used by you, so the result is not identical, in particular there in not enough place for the entries. Please make full MWE's (see general help) in the future.

The reason is that in your case both vertical lines belong to the next column, while in the previous verse are in different ones, hence the discontinuity of line.

\documentclass{article}
\usepackage{tabulary}
\usepackage{multirow}

\begin{document}

\begin{table}[h!]
\centering
\setlength{\arrayrulewidth}{.2mm}
\setlength{\tabcolsep}{7pt}
\renewcommand{\arraystretch}{1.5}
\begin{tabulary}{0.8\textwidth}{ |p{1.3cm}|p{1.2cm}|p{.6cm}|p{1.2cm}|p{.6cm}|}
\hline
%\multirow{2}{*}{\textbf{Data Set}} & \multicolumn{2}{c}{\textbf{Utterances}} & \multicolumn{2}{|c|}
\multirow{2}{*}{\textbf{Data Set}} & \multicolumn{2}{c|}{\textbf{Utterances}} & \multicolumn{2}{c|} % here - PS
{\textbf{Words}} \\  \cline{2-5}
& \textbf{No.of utterances} & \textbf{Hours of Data} & \textbf{Word Count} & \textbf{Distinct Words} \\
\hline
\textbf{Training Set} & -  & - & - &- \\
\hline
\textbf{Development Set} & - & -  & - & - \\
\hline
\textbf{Test Set} & - & - & - & - \\
\hline
\end{tabulary}
\newline
\begin{center}
\caption{dataset available for experiment}
\end{center}
\end{table}

\end{document}

enter image description here

2

The source of your problem is explained in Przemysław Scherwentke answer. So I more focus on off-topics regarding your question, a table design as such:

  • you use tabulary table environment, why you not use its column types? In the first image you can see result, with use of L and C column type of tabulary.
  • problem of miss align of vertical rules in table can be simple eliminatew with no use them at all. For example, with employing horizontal rules from booktabs package and use tabularx table environment you can obtain table (2), which to my taste has looks better. Here you can reduce \arraystretch to 1.2.
  • I don't know, why you prescribed table width to 0.8\textwidth. If you change its width to text width, the table become (to my taste) even nicer (table 3)

enter image description here

A MWE:

\documentclass{article}
\usepackage{booktabs, makecell, tabularx, tabulary}
\renewcommand\tabularxcolumn[1]{b{#1}}

\usepackage{showframe}
\renewcommand*\ShowFrameColor{\color{green}}

\begin{document}
    \begin{table}[h!]
    \centering
\setlength{\arrayrulewidth}{.2mm}
    \setlength{\tabcolsep}{4pt}
    \renewcommand{\arraystretch}{1.5}
\begin{tabulary}{0.8\textwidth}{|L|*{4}{C|}}
    \hline
    &   \multicolumn{2}{c|}{\textbf{Utterances}} 
        &   \multicolumn{2}{c|}{\textbf{Words}}     \\  \cline{2-5}
\textbf{Data Set}
    &   \textbf{No. of utterances} 
        &   \textbf{Hours of Data} 
            &   \textbf{Word Count} 
                &   \textbf{Distinct Words}         \\  \hline
\textbf{Training Set}       & - & - & - & -         \\  \hline
\textbf{Development Set}    & - & - & - & -         \\  \hline
\textbf{Test Set}           & - & - & - & -         \\  \hline
\end{tabulary}
\caption{Dataset available for experiment (1)}
    \end{table}

    \begin{table}[h!]
\newcolumntype{C}{>{\centering\arraybackslash}X}
    \centering
    \setlength{\tabcolsep}{4pt}
    \renewcommand{\arraystretch}{1.2}
\begin{tabularx}{0.8\textwidth}{p{0.2\linewidth}*{4}{C}}
    \toprule
    &   \multicolumn{2}{c}{\textbf{Utterances}}
        &   \multicolumn{2}{c}{\textbf{Words}}     \\  
    \cmidrule(lr){2-3}\cmidrule(lr){4-5}
\textbf{Data Set}
    &   \textbf{No. of utterances}
        &   \textbf{Hours of Data}
            &   \textbf{Word Count}
                &   \textbf{Distinct Words}         \\  
    \midrule
\textbf{Training Set} & - & - & - & -               \\
\textbf{Develop. Set} & - & - & - & -               \\
\textbf{Test Set}     & - & - & - & -               \\  
    \bottomrule
\end{tabularx}
\caption{Dataset available for experiment (2)}
    \end{table}

    \begin{table}[h!]
\newcolumntype{C}{>{\centering\arraybackslash}X}
    \centering
    \setlength{\tabcolsep}{4pt}
    \renewcommand{\arraystretch}{1.2}
\begin{tabularx}{\textwidth}{l*{4}{C}}
    \toprule
    &   \multicolumn{2}{c}{\textbf{Utterances}}
        &   \multicolumn{2}{c}{\textbf{Words}}     \\
    \cmidrule(lr){2-3}\cmidrule(lr){4-5}
\textbf{Data Set}
    &   \textbf{No. of utterances}
        &   \textbf{Hours of Data}
            &   \textbf{Word Count}
                &   \textbf{Distinct Words}         \\
    \midrule
\textbf{Training Set}       & - & - & - & -         \\
\textbf{Development Set}    & - & - & - & -         \\
\textbf{Test Set}           & - & - & - & -         \\
    \bottomrule
\end{tabularx}
\caption{Dataset available for experiment (3)}
    \end{table}
\end{document}

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.