我已生成下表:
\documentclass{article}
%\usepackage[utf8]{inputenc}
%\usepackage{array}
%\usepackage{wrapfig}
%\usepackage{multirow}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{0.8\textwidth} { | >{\raggedright\arraybackslash}X | >{\centering\arraybackslash}X | >{\raggedleft\arraybackslash}X | }
\hline
T & F & T \\
\hline
T & F & T \\
\hline
F & T & F \\
\hline
\end{tabularx}
\end{document}
我想补充一下我,j,k, 和乙如下图所示,我想减少列之间的空间(以便表格看起来像图中一样)但不知道该怎么做:
我必须做什么才能对齐表格上方和旁边的文本,并减少列之间的空间?
答案1
答案2
一个非常简单的方法是
\documentclass{article}
%\usepackage[utf8]{inputenc}
\usepackage{array}
%\usepackage{wrapfig}
%\usepackage{multirow}
%\usepackage{tabularx}
%\usepackage[table]{xcolor}
%\usepackage{bigstrut}
\renewcommand{\arraystretch}{1.5}
\begin{document}
B \hspace{30pt}
\begin{tabular}[t]{c|c|c|c|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{i} & \multicolumn{1}{c}{j} & \multicolumn{1}{c}{k} \\
\cline{2-4}i & T & F & T \\
\cline{2-4}j & T & F & T \\
\cline{2-4}k & F & T & F \\
\cline{2-4}
\end{tabular}
或进行更精细的控制
\documentclass{article}
%\usepackage[utf8]{inputenc}
%\usepackage{array}
%\usepackage{wrapfig}
%\usepackage{multirow}
\usepackage{tabularx}
\usepackage{makecell}
\setcellgapes{7pt}
\begin{document}
B
\vspace{-1.2\baselineskip} % vertical offset
{ \hspace{40pt} % horizontal offset
\makegapedcells
\begin{tabular}{c|c|c|c|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{i} & \multicolumn{1}{c}{j} & \multicolumn{1}{c}{k} \\[-3pt] % control the space between i j k and table
\cline{2-4}i & T & F & T \\
\cline{2-4}j & T & F & T \\
\cline{2-4}k & F & T & F \\
\cline{2-4}
\end{tabular}}
\end{document}