简体   繁体   中英

Why in overleaf I miss a vertical edges in the table?

在此处输入图像描述

I am new in Latex, I create a table

    \begin{table}[!ht]
  \centering
  \caption{Cities analyzed in this study}
  \begin{adjustbox}{max width=\textwidth}
  \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
    \hline
    City & Number of & Number of  & \multicolumn{2}{c}{Transportation type}  \\
    \cline{4-9}
    & stations & routes & Bus & Tram & Subway&Rail&Ferry& Cable-car \\
    \hline
    Adelaide & 7548 & 9234 & 8950 &54 & - & 230 & -&- \\
     \hline

But in the top right, the vertical line is not showing. How can I make it appear? My second question how can I put 'Transportation type' on the center of the cell?

You can add the missing edge by using \multicolumn{6}{c|}{...} , but before you actually use this, please have a look at http://betterposters.blogspot.com/2012/08/the-data-prison.html or https://www.inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf for some guides about nice table layouts. Using vertical lines is really bad style.

Please also don't scale elements that contain text. This will make result in a suboptimal usage of font shapes. If you must make your table smaller, manually choose an appropriate font size.

\documentclass{article}

\begin{document}

    \begin{table}[!ht]
  \centering
  \caption{Cities analyzed in this study}
  \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
    \hline
    City & Number of & Number of  & \multicolumn{6}{c|}{Transportation type}  \\
    \cline{4-9}
    & stations & routes & Bus & Tram & Subway&Rail&Ferry& Cable-car \\
    \hline
    Adelaide & 7548 & 9234 & 8950 &54 & - & 230 & -&- \\
     \hline
     \end{tabular}
     \end{table}

\end{document}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM