0

I have written a table in beamer. The code is as under:

\documentclass{beamer}
\usepackage{adjustbox}
\begin{document}
    \begin{frame}
        \centering
        \adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
            max width=.9\textwidth}{
                    \begin{tabular}{|c|c|c|c|c|}
                    \hline 
                    \begin{tabular}{c}
                        XYZ\\ABC    
                    \end{tabular}
                    & \multicolumn{2}{c|}{Number of Vehicles } & \begin{tabular}{c}
                    Monthly\\Saving     
                    \end{tabular} &
                    \begin{tabular}{c}
                        Improvement in\\  ABC (\%) 
                    \end{tabular} \\ 
                    \hline 
                    & PQR & ZXC &  &  \\ 
                    \hline 
                    140 & 61 & 41 & 4 & 12 \\ 
                    \hline 
                    150 & 83 & 61 & 4 & 12 \\ 
                    \hline 
                    170 & 124 & 12 & 4 & 12 \\ 
                    \hline 
                \end{tabular} 
            }
            \end{frame}

        \end{document}

I want to merge last three rows of 4th column so that the entry 4 shows up only once. How can this be done?

1

Rather then \hline you can use \cline{1-3}\cline{5-5}

\documentclass{beamer}
\usepackage{adjustbox}
\begin{document}
    \begin{frame}
        \centering
        \adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
            max width=.9\textwidth}{
 \begin{tabular}{|c|c|c|c|c|}
  \hline 
  \begin{tabular}{c}
    XYZ\\ABC    
  \end{tabular} &
 \multicolumn{2}{c|}{Number of Vehicles } &       
  \begin{tabular}{c}
    Monthly\\Saving     
  \end{tabular} &
  \begin{tabular}{c}
    Improvement in\\  ABC (\%) 
  \end{tabular} \\ 
  \hline 
  & PQR & ZXC &  &  \\ 
  \hline 
  140 & 61  & 41 &   & 12 \\ 
  \cline{1-3}\cline{5-5} 
  150 & 83  & 61 & 4 & 12 \\ 
  \cline{1-3}\cline{5-5}
  170 & 124 & 12 &   & 12 \\ 
  \hline 
\end{tabular} 
}
  \end{frame}
\end{document}
  • Worked fine for 4th column but does not work for 5th column. – Ehsa Apr 28 '17 at 11:33
  • Just remove \cline{5-5} – Salim Bou Apr 28 '17 at 12:54

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.