我输入以下程序。
\usepackage{pifont}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand{\cmark}{{\Large\bfseries\color{green!50!black}\ding{51}}}
\newcommand{\xmark}{{\Large\bfseries\color{red!50!black}\ding{55}}}
\begin{tabularx}{\textwidth}{cCCCC}
& {\scriptsize EAP-MD5} & {\scriptsize PEAP} & {\scriptsize EAP-TTLS} & {\scriptsize EAP-TLS} \\
\hline
ServerEC\footnotemark[1] & \xmark & \cmark & \cmark & \cmark \\
\hline
ClientEC\footnotemark[1] & \xmark & \xmark & \xmark & \xmark \\
ClientAuth & ID / PW & ID / PW & ID / PW & EC \\
ServerAuth & NONE & EC & EC & EC \\
\hline
\end{tabularx}
请帮助我!谢谢。
答案1
像这样?
您应该更改\cmark
和 的定义。您应该\xmark
使用 而不是使用。请参阅下面的 MWE:color{...}
\textcolor{<desired color}{<symvol>}
\documentclass[a4paper,12pt]{article}
\usepackage{pifont}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand{\cmark}{{\Large\bfseries\textcolor{green!50!black}{\ding{51}}}} % <---
\newcommand{\xmark}{{\Large\bfseries\textcolor{red!50!black}{\ding{55}}}} % <---
\begin{document}
\setlength\extrarowheight{4pt} % <---
\begin{tabularx}{\textwidth}{lCCCC}
& {\scriptsize EAP-MD5} & {\scriptsize PEAP} & {\scriptsize EAP-TTLS} & {\scriptsize EAP-TLS} \\
\hline
ServerEC\footnotemark[1] & \xmark & \cmark & \cmark & \cmark \\
\hline
ClientEC\footnotemark[1] & \xmark & \xmark & \xmark & \xmark \\
ClientAuth & ID / PW & ID / PW & ID / PW & EC \\
ServerAuth & NONE & EC & EC & EC \\
\hline
\end{tabularx}
\end{document}
附录:talltblt
通过使用包 ,您可以获得更简单的代码tabularray
。使用它和booktabs
规则(也可以在tabularx
表中使用)获得的表在我看来更漂亮,更正确:
\documentclass[a4paper,12pt]{article}
\usepackage{pifont}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\newcommand{\cmark}{{\Large\bfseries\textcolor{green!50!black}{\ding{51}}}} % <---
\newcommand{\xmark}{{\Large\bfseries\textcolor{red!50!black}{\ding{55}}}} % <---
\begin{document}
\begin{talltblr}[
caption = {table caption},
label = {tab:?},
note{a} = {explanation ...},
note{b} = {explanation ...},
]{colspec = {l *{3}{X[c]}},
row{1} = {font=\footnotesize}
}
& EAP-MD5 & PEAP & EAP-TTLS & EAP-TLS \\
\midrule
ServerEC\TblrNote{a} & \xmark & \cmark & \cmark & \cmark \\
\midrule
ClientEC\TblrNote{b} & \xmark & \xmark & \xmark & \xmark \\
ClientAuth & ID / PW & ID / PW & ID / PW & EC \\
ServerAuth & NONE & EC & EC & EC \\
\bottomrule
\end{talltblr}
\end{document}