我的论文出了点小问题。这是我第一次使用 latex,表格有点问题。我创建了下面的表格
\begin{table}[H]
%\centering
\caption{Mobile apps categories with some exemplary apps}
\label{table:1} %% \ref{table:1} pour la ref
\begin{tabular}{||c l l c l l||}
%%\hline
\hlineB{3.5}
\textbf{No.} & \textbf{Category} & \textbf{Examples of apps} & \textbf{No.} & \textbf{Category} &
\textbf{Examples of apps} \\ [0.5ex]
\hline
\hline
1 & Calendar & Calendar & 13 & Weather & Weather \\ \hline
2 & Communication & Messenger, WhatsApp, TrueCaller & 14 & Games & Texas Poker, Quick ball, Ludo King
\\ \hline
3 & Video Players and Editors & YouTube, HUAWEI Video & 15 & Music and Audio & Musique, Shazam,
spotify \\ \hline
4 & Clock & Clock, Horloge, Alarme & 16 & Entertainment & Netflix \\ \hline
5 & Sytem Tool & Setting, Calculatrice & 17 & Education & Google Translate \\ \hline
6 & Health and fitness & Health, SmokeCount & 18 & Personnalisation & Theme, Wallpapers \\ \hline
7 & Phone and SMS & Contacts, Dialler, Messages & 19 & Sports & beIN sport, Live Football Scores\\
\hline
8 & Social Media & Facebook, Instagram, LinkedIn & 20 & News and Magazines & Google Podcast, Opera
News\\ \hline
9 & Photography & Camera, Gallery & 21 & Shopping & IKEA\\ \hline
10 & Lifestyle & Tinder, Jumia & 22 & Finance & STB, CIC, Boursorama Banque\\ \hline
11 & Maps and Navigation & Google Maps, Bolt & 23 & Productivity & PDF reader, Notepad, Docs\\ \ \ v
\hline
12 & Travel and Local & Kayak, Booking.com & & & \\%%[1ex]
\hlineB{3.5}
\end{tabular}
\end{table}
答案1
最近我发现了这个tabularray
包...为了练习,让我展示两种使用这个多功能包进行表格设置的解决方案。第一个在横向页面上显示表格,第二个显示重新设计的表格,可以轻松适应纵向页面。两者都使用标准字体大小 10pt,但是如果需要,第二个也可以使用 11pt 或 12pt,并且在删除包时也可以适应页面geometry
:
由于您没有提供有关文档设计的任何信息,我使用\usepackage[vmargin=30mm]{geometry}
它来确定页面布局。
\documentclass{article}
\usepackage[vmargin=30mm]{geometry}
\usepackage{pdflscape} % landscape
\usepackage[skip=1ex,
font=small,
labelfont=bf]{caption}
\usepackage[table]{xcolor}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\begin{landscape}
\begin{table}
\caption{Mobile apps categories with some exemplary apps}
\label{table:1} %% \ref{table:1} pour la ref
\begin{tblr}{colsep=3pt,
colspec={c ll c ll},
row{odd}={gray!30}
}
\hline
\textbf{No.}
& \textbf{Category}
& \textbf{Examples of apps}
& \textbf{No.}
& \textbf{Category}
& \textbf{Examples of apps} \\
\hline
1 & Calendar & Calendar
& 13 & Weather & Weather \\
2 & Communication & Messenger, WhatsApp, TrueCaller
& 14 & Games & Texas Poker, Quick ball, Ludo King \\
3 & Video Players and Editors & YouTube, HUAWEI Video
& 15 & Music and Audio & Musique, Shazam, spotify \\
4 & Clock & Clock, Horloge, Alarme
& 16 & Entertainment & Netflix \\
5 & Sytem Tool & Setting, Calculatrice
& 17 & Education & Google Translate \\
6 & Health and fitness & Health, SmokeCount
& 18 & Personnalisation & Theme, Wallpapers \\
7 & Phone and SMS & Contacts, Dialler, Messages
& 19 & Sports & beIN sport, Live Football Scores \\
8 & Social Media & Facebook, Instagram, LinkedIn
& 20 & News and Magazines & Google Podcast, Opera News\\
9 & Photography & Camera, Gallery
& 21 & Shopping & IKEA \\
10 & Lifestyle & Tinder, Jumia
& 22 & Finance & STB, CIC, Boursorama Banque \\
11 & Maps and Navigation & Google Maps, Bolt
& 23 & Productivity & PDF reader, Notepad, Docs \\
12 & Travel and Local & Kayak, Booking.com
& & & \\
\hline
\end{tblr}
\end{table}
\end{landscape}
\begin{table}
\caption{Mobile apps categories with some exemplary apps}
\label{table:1} %% \ref{table:1} pour la ref
\begin{tblr}{colspec={c X[l]X[l]},
row{odd}={gray!30}
}
\hline
\textbf{No.}
& \textbf{Category} & \textbf{Examples of apps} \\
\hline
1 & Calendar & Calendar \\
2 & Communication & Messenger, WhatsApp, TrueCaller \\
3 & Video Players and Editors
& YouTube, HUAWEI Video \\
4 & Clock & Clock, Horloge, Alarme \\
5 & Sytem Tool & Setting, Calculatrice \\
6 & Health and fitness & Health, SmokeCount \\
7 & Phone and SMS & Contacts, Dialler, Messages \\
8 & Social Media & Facebook, Instagram, LinkedIn \\
9 & Photography & Camera, Gallery \\
10 & Lifestyle & Tinder, Jumia \\
11 & Maps and Navigation & Google Maps, Bolt \\
12 & Travel and Local & Kayak, Booking.com \\
13 & Weather & Weather \\
14 & Games & Texas Poker, Quick ball, Ludo King\\
15 & Music and Audio & Musique, Shazam, spotify \\
16 & Entertainment & Netflix \\
17 & Education & Google Translate \\
18 & Personnalisation & Theme, Wallpapers \\
19 & Sports & beIN sport, Live Football Scores \\
20 & News and Magazines & Google Podcast, Opera News \\
21 & Shopping & IKEA \\
22 & Finance & STB, CIC, Boursorama Banque \\
23 & Productivity & PDF reader, Notepad, Docs \\
\hline
\end{tblr}
\end{table}
\end{document}
在横向页面上:
在纵向页面上,重新设计(只有三列和两倍的行数,但仍然可以放在一页上):
答案2
通过将表格置于横向模式,它将适合页面并且易于阅读。
\documentclass[11pt,a4paper]{article}
\usepackage{pdflscape} % landscape
\usepackage{hhline} % double line
\usepackage{array} % strecth celld
\begin{document}
\begin{landscape}
\begin{table}
\centering
\small
\caption{Mobile apps categories with some exemplary apps}\label{table:1} %% \ref{table:1} pour la ref
\smallskip
\renewcommand{\arraystretch}{1.5} % exaonds the cells vertically
\setlength{\tabcolsep}{4pt}
\begin{tabular}{%
||c l l c l l||}
\hline
\textbf{No.} & \textbf{Category} & \textbf{Examples of apps} & \textbf{No.} & \textbf{Category} & \textbf{Examples of apps} \\ [0.5ex]
\hhline{======}
1 & Calendar & Calendar & 13 & Weather & Weather \\ \hline
2 & Communication & Messenger, WhatsApp, TrueCaller & 14 & Games & Texas Poker, Quick ball, Ludo King \\ \hline
3 & Video Players and Editors & YouTube, HUAWEI Video & 15 & Music and Audio & Musique, Shazam, spotify \\ \hline
4 & Clock & Clock, Horloge, Alarme & 16 & Entertainment & Netflix \\ \hline
5 & Sytem Tool & Setting, Calculatrice & 17 & Education & Google Translate \\ \hline
6 & Health and fitness & Health, SmokeCount & 18 & Personnalisation & Theme, Wallpapers \\ \hline
7 & Phone and SMS & Contacts, Dialler, Messages & 19 & Sports & beIN sport, Live Football Scores \\ \hline
8 & Social Media & Facebook, Instagram, LinkedIn & 20 & News and Magazines & Google Podcast, Opera News \\ \hline
9 & Photography & Camera, Gallery & 21 & Shopping & IKEA \\ \hline
10& Lifestyle & Tinder, Jumia & 22 & Finance & STB, CIC, Boursorama Banque \\ \hline
11& Maps and Navigation & Google Maps, Bolt & 23 & Productivity & PDF reader, Notepad, Docs \\ \hline
12& Travel and Local & Kayak, Booking.com & & & \\ \hline
\end{tabular}
\end{table}
\end{landscape}
\end{document}
第二个示例使用包nicematrix
,用交替颜色的行替换水平线。
\documentclass[11pt,a4paper]{article}
\usepackage{pdflscape} % landscape
\usepackage{nicematrix}
\begin{document}
\begin{landscape}
\begin{table}
\centering
\small
\caption{Mobile apps categories with some exemplary apps}\label{table:1} %% \ref{table:1} pour la ref
\smallskip
\setlength{\tabcolsep}{4pt}
\begin{NiceTabular}{%
|c l l c l l|}[cell-space-limits = 6pt, code-before=\rowcolor{gray!50}{1} \rowcolors{2}{gray!25}{white}] % alternate row colors and expand cells
\hline
\textbf{No.} & \textbf{Category} & \textbf{Examples of apps} & \textbf{No.} & \textbf{Category} & \textbf{Examples of apps} \\[0.5ex]
1 & Calendar & Calendar & 13 & Weather & Weather \\
2 & Communication & Messenger, WhatsApp, TrueCaller & 14 & Games & Texas Poker, Quick ball, Ludo King \\
3 & Video Players and Editors & YouTube, HUAWEI Video & 15 & Music and Audio & Musique, Shazam, spotify \\
4 & Clock & Clock, Horloge, Alarme & 16 & Entertainment & Netflix \\
5 & Sytem Tool & Setting, Calculatrice & 17 & Education & Google Translate \\
6 & Health and fitness & Health, SmokeCount & 18 & Personnalisation & Theme, Wallpapers \\
7 & Phone and SMS & Contacts, Dialler, Messages & 19 & Sports & beIN sport, Live Football Scores \\
8 & Social Media & Facebook, Instagram, LinkedIn & 20 & News and Magazines & Google Podcast, Opera News \\
9 & Photography & Camera, Gallery & 21 & Shopping & IKEA \\
10& Lifestyle & Tinder, Jumia & 22 & Finance & STB, CIC, Boursorama Banque \\
11& Maps and Navigation & Google Maps, Bolt & 23 & Productivity & PDF reader, Notepad, Docs \\
12& Travel and Local & Kayak, Booking.com & & & \\ \hline
\end{NiceTabular}
\end{table}
\end{landscape}
\end{document}