Latex 如何使乳胶表中的所有单元格都加粗?
根据下表,如何使所有单元格具有粗体样式 MWE:Latex 如何使乳胶表中的所有单元格都加粗?,latex,miktex,Latex,Miktex,根据下表,如何使所有单元格具有粗体样式 MWE: 您可以使用>{…}在表格参数中设置每列的格式,请参见: 使用*{num}{str}语法使其更短、更可读: \begin{tabular}{*{2}{|>{\bfseries}l} *{4}{|>{\bfseries}c} |}\hline 即“两次向左齐平并加粗”,然后“四次居中并加粗”。(请注意。) 您的MWE: \documentclass{article} \usepackage{array} % otherwise you
您可以使用
>{…}
在表格参数中设置每列的格式,请参见:
使用*{num}{str}
语法使其更短、更可读:
\begin{tabular}{*{2}{|>{\bfseries}l} *{4}{|>{\bfseries}c} |}\hline
即“两次向左齐平并加粗”,然后“四次居中并加粗”。(请注意。)
您的MWE:
\documentclass{article}
\usepackage{array} % otherwise you get "Error: Illegal character in array arg."
\begin{document}
\begin{table}[ht]%
\centering
\caption[Data description]{Dataset description}
\begin{tabular}{*{2}{|>{\bfseries}l} *{4}{|>{\bfseries}c} |}\hline
&Dataset &Samples&Numerical&Categorical&Class\\ \hline
1&Horse & 300 & 7 & 16 & 2 \\ \hline
2&Ionosphere & 351 & 32 & 1 & 2 \\ \hline
3&Band & 540 & 13 & 6 & 2 \\ \hline
4&Australian+MV& 621 & 3 & 11 & 2 \\ \hline
5&Hepatitis & 155 & 2 & 17 & 2 \\ \hline
6&Credit & 690 & 3 & 12 & 2 \\ \hline
\end{tabular}
\label{tab:data}
\end{table}
\end{document}
您还可以设置整行的格式(本例中不太有趣)-例如,请参阅
注意:您可以使用
\normalfont{}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{table}[ht]%
% If you want all in bold face then enclose it between {\ bf }
\centering {\bf
\caption[Data description]{Dataset description}
\begin{tabular}{|l|l|c|c|c|c|}\hline
& Dataset & Samples & Numerical & Categorical & Class\\\hline
1 & Horse & 300 & 7 & 16 & 2 \\\hline
2 & Ionosphere & 351 & 32 & 1 & 2 \\\hline
3 & Band & 540 & 13 & 6 & 2 \\\hline
4 & Australian+MV& 621 & 3 & 11 & 2 \\\hline
5 & Hepatitis & 155 & 2 & 17 & 2 \\\hline
6 & Credit & 690 & 3 & 12 & 2 \\\hline
\end{tabular}
\label{tab:data}
\documentclass{article}
\usepackage{array} % otherwise you get "Error: Illegal character in array arg."
\begin{document}
\begin{table}[ht]%
\centering
\caption[Data description]{Dataset description}
\begin{tabular}{*{2}{|>{\bfseries}l} *{4}{|>{\bfseries}c} |}\hline
&Dataset &Samples&Numerical&Categorical&Class\\ \hline
1&Horse & 300 & 7 & 16 & 2 \\ \hline
2&Ionosphere & 351 & 32 & 1 & 2 \\ \hline
3&Band & 540 & 13 & 6 & 2 \\ \hline
4&Australian+MV& 621 & 3 & 11 & 2 \\ \hline
5&Hepatitis & 155 & 2 & 17 & 2 \\ \hline
6&Credit & 690 & 3 & 12 & 2 \\ \hline
\end{tabular}
\label{tab:data}
\end{table}
\end{document}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{table}[ht]%
% If you want all in bold face then enclose it between {\ bf }
\centering {\bf
\caption[Data description]{Dataset description}
\begin{tabular}{|l|l|c|c|c|c|}\hline
& Dataset & Samples & Numerical & Categorical & Class\\\hline
1 & Horse & 300 & 7 & 16 & 2 \\\hline
2 & Ionosphere & 351 & 32 & 1 & 2 \\\hline
3 & Band & 540 & 13 & 6 & 2 \\\hline
4 & Australian+MV& 621 & 3 & 11 & 2 \\\hline
5 & Hepatitis & 155 & 2 & 17 & 2 \\\hline
6 & Credit & 690 & 3 & 12 & 2 \\\hline
\end{tabular}
\label{tab:data}