2016-09-23 9 views
0

다음의 LaTeX 표가 주어지면 모든 셀을 굵게 표시하려면 어떻게해야합니까?LaTeX 테이블에서 모든 셀을 굵게 만드는 방법은 무엇입니까?

MWE : 당신은 >{...}와 표 인수의 각 열의 서식을 설정할 수 있습니다

\documentclass{article} 
\begin{document} 
    \begin{table}[ht]% 
     \centering 
     \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} 
    \end{table} 
\end{document} 

답변

1

Tabular, make a column or a row emphasized 참조 :

\begin{tabular}{|>{\bfseries}l|>{\bfseries}l|>{\bfseries}c|>{\bfseries}c|>{\bfseries}c|>{\bfseries}c|} 

사용 *{num}{str} 구문이 더 짧고 만들기 위해 읽을 수있는 언어 :

\begin{tabular}{*{2}{|>{\bfseries}l} *{4}{|>{\bfseries}c} |}\hline 

즉, '두 번 플러시 왼쪽과 굵게'다음 '4 번 중심과 과감한'. (\bf is deprecated 있음을 유의하십시오.)

귀하의 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} 

또한 (이 경우에는 덜 흥미)를 전체 행의 서식을 설정할 수는 - 예를 How to change a whole row of a table를 참조하십시오.


참고 : 수 make a single cell normal again\normalfont{}를 사용하여.

0
\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}