
我畫了這篇文章中顯示的表格,但我不太喜歡這種風格。您有更好的設計想法嗎?
謝謝大家!
表輸出:
代碼:
\documentclass{article}
\usepackage{tabu,booktabs,rotating,multirow}
\begin{document}
\begin{table}[H]
\centering
\caption{Divalent and trivalent metallic cations associations in anionic clays ($^{\star}$monovalent, $^{\star\star}$tetravalent)}
\label{tab:association}
\begin{tabu}{ccccccccccc}
\cmidrule[1pt]{3-11}
\multicolumn{1}{l}{} &
\multicolumn{1}{l}{} &
\multicolumn{9}{c}{\textbf{Divalent cations}} \\ \cline{3-11}
\multicolumn{1}{l}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{Mg} &
\multicolumn{1}{c|}{Mn} &
\multicolumn{1}{c|}{Fe} &
\multicolumn{1}{c|}{Co} &
\multicolumn{1}{c|}{Ni} &
\multicolumn{1}{c|}{Cu} &
\multicolumn{1}{c|}{Zn} &
\multicolumn{1}{c|}{Ca} &
\multicolumn{1}{c|}{Li$^{\star}$} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{\multirow{8}{*}{\begin{sideways}\textbf{Trivalent cations}\end{sideways}}} &
\multicolumn{1}{c|}{Al} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{Cr} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{Mn} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{Fe} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{Co} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{Ni} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{La} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\multicolumn{1}{|[1pt]c|}{} &
\multicolumn{1}{c|}{Ti$^{\star\star}$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{$\times$} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} \\ \cline{2-11}
\end{tabu}
\end{table}
\end{document}
答案1
IMNSHO,如果(a)資料列都具有相同的寬度並且(b)間隔更近一些,那麼表格看起來會更好。這可以透過例如從 切換到c
列w
類型並透過減少 的值來實現tabcolsep
,該值是控制在每列的任一側插入的空白填充量的參數。
也就是說,我一定也會丟掉幾乎所有的\multicolumn{1}{...}{...}
包裝紙。包裝器使程式碼閱讀起來相當乏味,而且也使應用任何更改或調整變得更加困難。
\documentclass{article}
\usepackage{array} % for 'w' column type
\usepackage{rotating,multirow}
\newcommand\ts{$\times$} % handy shortcut macro
\begin{document}
\begin{table}
\setlength\tabcolsep{4pt} % default: 6pt
\setlength\extrarowheight{1.5pt} % for a more open "look"
\centering
\caption{Divalent and trivalent metallic cations associations in
anionic clays ($^{\star}$monovalent, $^{\star\star}$tetravalent)}
\label{tab:association}
\begin{tabular}{ *{2}{l|} *{9}{w{c}{4mm}|} }
\multicolumn{2}{l}{} & \multicolumn{9}{c}{\textbf{Divalent cations}} \\
\cline{3-11}
\multicolumn{2}{l|}{} & Mg & Mn & Fe & Co & Ni & Cu & Zn & Ca & Li$^{\star}$ \\
\cline{2-11}
\multirow{8.5}{*}{\begin{sideways}\textbf{Trivalent cations}\end{sideways}}
& Al & \ts & & \ts & \ts & \ts & \ts & \ts & \ts & \ts \\
\cline{2-11}
& Cr & & & & & \ts & \ts & \ts & & \\
\cline{2-11}
& Mn & & \ts & & & & & & & \\
\cline{2-11}
& Fe & \ts & & \ts & \ts & & & & & \\
\cline{2-11}
& Co & & & & \ts & \ts & & & & \\
\cline{2-11}
& Ni & & & & & \ts & & & & \\
\cline{2-11}
& La & & & & & \ts & & & & \\
\cline{2-11}
& Ti$^{\star\star}$ & & & & \ts & & & & & \\
\cline{2-11}
\end{tabular}
\end{table}
\end{document}
附錄:為了進一步「美化」表格及其相關標題的外觀,可以載入該threeparttable
套件並將\caption
語句和tabular
環境包含在一個threeparttable
環境中。這樣,標題的寬度將設定為環境的寬度tabular
。此新增以及刪除加粗行標題和列標題的變化以及 的值進一步減小\tabcolsep
(從 4pt 到 3pt),將導致以下結果:
\documentclass{article}
\usepackage{array} % for 'w' column type
\usepackage{rotating,multirow}
\usepackage{threeparttable} % for 'threeparttable' env.
\newcommand\ts{$\times$} % handy shortcut macro
\begin{document}
\begin{table}
\centering
\begin{threeparttable}
\setlength\tabcolsep{3pt} % default: 6pt
\setlength\extrarowheight{2pt} % for a more open "look"
\caption{Divalent and trivalent metallic cation associations in
anionic clays ($^{\star}$mono\-valent, $^{\star\star}$tetravalent)}
\label{tab:association}
\begin{tabular}{ *{2}{l|} *{9}{w{c}{4mm}|} }
\multicolumn{2}{l}{} & \multicolumn{9}{c}{Divalent cations} \\
\cline{3-11}
\multicolumn{2}{l|}{} & Mg & Mn & Fe & Co & Ni & Cu & Zn & Ca & Li$^{\star}$ \\
\cline{2-11}
\multirow{8.5}{*}{\begin{sideways} Trivalent cations \end{sideways}\,}
& Al & \ts & & \ts & \ts & \ts & \ts & \ts & \ts & \ts \\
\cline{2-11}
& Cr & & & & & \ts & \ts & \ts & & \\
\cline{2-11}
& Mn & & \ts & & & & & & & \\
\cline{2-11}
& Fe & \ts & & \ts & \ts & & & & & \\
\cline{2-11}
& Co & & & & \ts & \ts & & & & \\
\cline{2-11}
& Ni & & & & & \ts & & & & \\
\cline{2-11}
& La & & & & & \ts & & & & \\
\cline{2-11}
& Ti$^{\star\star}$ & & & & \ts & & & & & \\
\cline{2-11}
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
答案2
所以,我採取了回答由 @leandriis 作為基礎。
使用書籤,刪除了大部分行。我將這兩行保留在第一行和第一列,以強調第一列與第一行類似。您可以嘗試刪除它們。此外,還有不同的符號,因此amssymb
包括在內。
\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{chemmacros}
\usepackage{caption}
\usepackage{amssymb}
\usepackage[column=0]{cellspace}
\begin{document}
\begin{table}
\centering
\caption{Mono- to tetravalent metallic cations associations in anionic clays }
\label{tab:association}
\begin{tabular}{c|*{10}{0c}}
\toprule
\multicolumn{1}{c|}{}
& \ch{Mg^{2+}} & \ch{Mn^{2+}}& \ch{Fe^{2+}} & \ch{Co^{2+}} & \ch{Ni^{2+}} & \ch{Cu^{2+}} & \ch{Zn^{2+}} & \ch{Ca^{2+}} & \ch{Li^{+}} \\
\midrule
\ch{Al^{3+}} & \checkmark & & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark \\
\ch{Cr^{3+}} & & & & & \checkmark & \checkmark & \checkmark & & \\
\ch{Mn^{3+}} & & \checkmark & & & & & & & \\
\ch{Fe^{3+}} & \checkmark & & \checkmark & \checkmark & & & & & \\
\ch{Co^{3+}} & & & & \checkmark & \checkmark & & & & \\
\ch{Ni^{3+}} & & & & & \checkmark & & & & \\
\ch{La^{3+}} & & & & & \checkmark & & & & \\
\ch{Ti^{4+}} & & & & \checkmark & & & & & \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案3
這是另一個建議:
\documentclass{article}
\usepackage{array,rotating,multirow, booktabs}
\usepackage[table, svgnames]{xcolor}
\usepackage{bbding}
\newcommand\xs{\cellcolor{Gainsboro!50!Lavender}\XSolid}
\newcommand{\mc}[1]{\multicolumn{1}{c}{\bfseries#1}}
\begin{document}
\begin{table}
\setlength\tabcolsep{4pt}
\setlength\extrarowheight{6pt}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\centering
\caption{Divalent and trivalent metallic cations associations
in anionic clays ($^{\star}$monovalent, $^{\star\star}$tetravalent)}
\label{tab:association}
\begin{tabular}{ *{2}{ >{\bfseries}l}!{\vrule width 1.2pt}w{c}{5mm} *{8}{|w{c}{5mm}}!{\vrule width 1.2pt}}
\multicolumn{1}{l}{} & \multicolumn{1}{l}{} &
\multicolumn{9}{c}{\textbf{Divalent cations}} \\
\multicolumn{2}{c}{} & \mc{Mg} & \mc{Mn} & \mc{Fe} & \mc{Co} & \mc{Ni} & \mc{Cu} & \mc{Zn} & \mc{Ca} & \mc{Li$^{\star}$} \\[1ex]
\cmidrule[1.2pt](l{-1.2pt}){3-11}
\multirow{8.5}{*}{\begin{sideways}\textbf{Trivalent cations}\end{sideways}\enspace}
& Al & \xs & & \xs & \xs & \xs & \xs & \xs & \xs & \xs \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& Cr & & & & & \xs & \xs & \xs & & \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& Mn & & \xs & & & & & & & \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& Fe & \xs & & \xs & \xs & & & & & \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& Co & & & & \xs & \xs & & & & \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& Ni & & & & & \xs & & & & \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& La & & & & & \xs & & & & \\
\cmidrule[0.4pt](l{-1.2pt}){3-11}
& Ti$^{\star\star}$ & & & & \xs & & & & & \\[-1.2pt]
\cmidrule[1.2pt](l{-1.2pt}){3-11}
\end{tabular}
\end{table}
\end{document}
答案4
在研究工作或論文中添加微小的細節會分散注意力,甚至可能令人反感:該領域的專家知道關於二價或三價或兩者兼而有之的陽離子(論文的審查員會看看是否你了解他們)。因此我會省略長標籤;如果您願意,可以重新插入它們。
為了完整性,可以在標題本身中添加一些細節;的可選參數\caption
就是為了這個目的:您可以在實際標題中包含信息,而無需將其包含在表格列表中。
在條目周圍添加籠子同樣會分散注意力。行與行之間有一些額外的空間,可以輕鬆追蹤它們。我將所有單元格設置為固定寬度 1.5em 並\Y
在輸入中使用,以避免程式碼混亂,因此您可以非常輕鬆地直觀地檢查輸入。
那些\multicolumn{1}{c|}{...}
都是邪惡的!這些單元格已經聲明為c|
,那麼為什麼要覆蓋它們只是為了使用相同的對齊方式?
\documentclass{article}
\usepackage{array,booktabs,caption}
\begin{document}
\begin{table}[htp]
\centering
\caption
[Divalent and trivalent metallic cations associations in anionic clays]
{Divalent and trivalent metallic cations associations in anionic clays;
* is monovalent, ** is tetravalent, rows list trivalent
cations, columns list divalent cations}
\label{tab:association}
% local command for simplifying input and reading
\newcommand{\Y}{$\times$}
\begin{tabular}{@{} w{l}{1.5em} *{9}{w{c}{1.5em}} @{}}
\toprule
& Mg & Mn & Fe & Co & Ni & Cu & Zn & Ca & Li* \\
\midrule
Al & \Y & & \Y & \Y & \Y & \Y & \Y & \Y & \Y \\
\addlinespace
Cr & & & & & \Y & \Y & \Y & & \\
\addlinespace
Mn & & \Y & & & & & & & \\
\addlinespace
Fe & \Y & & \Y & \Y & & & & & \\
\addlinespace
Co & & & & \Y & \Y & & & & \\
\addlinespace
Ni & & & & & \Y & & & & \\
\addlinespace
La & & & & & \Y & & & & \\
\addlinespace
Ti** & & & & \Y & & & & & \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
帶標籤的版本。由於 也需要進行一定量的猜測\multirow
,因此我選擇將旋轉標籤設置在表格之外,將其固定在底部以便更容易猜測。
\documentclass{article}
\usepackage{array,booktabs,caption,rotating}
\begin{document}
\begin{table}[htp]
\centering
\caption
[Divalent and trivalent metallic cations associations in anionic clays]
{Divalent and trivalent metallic cations associations in anionic clays;
* is monovalent, ** is tetravalent, rows list trivalent
cations, columns list divalent cations}
\label{tab:association}
% local command for simplifying input and reading
\newcommand{\Y}{$\times$}
\rotatebox{90}{\makebox[11.5\normalbaselineskip]{Trivalent cations}}\quad
\begin{tabular}[b]{@{} w{l}{1.5em} *{9}{w{c}{1.5em}} @{}}
\toprule
& \multicolumn{9}{c}{Divalent cations} \\
& Mg & Mn & Fe & Co & Ni & Cu & Zn & Ca & Li* \\
\midrule
Al & \Y & & \Y & \Y & \Y & \Y & \Y & \Y & \Y \\
\addlinespace
Cr & & & & & \Y & \Y & \Y & & \\
\addlinespace
Mn & & \Y & & & & & & & \\
\addlinespace
Fe & \Y & & \Y & \Y & & & & & \\
\addlinespace
Co & & & & \Y & \Y & & & & \\
\addlinespace
Ni & & & & & \Y & & & & \\
\addlinespace
La & & & & & \Y & & & & \\
\addlinespace
Ti** & & & & \Y & & & & & \\
\bottomrule
\end{tabular}
\end{table}
\end{document}