\begin{center}
\begin{bytefield}{64}
\bitbox{12}{\textbf{Made Classification}} & \bitbox{8}{Water} & \bitbox{8}{Air} & \bitbox{16}{Chromium} \\
\bitbox{12}{\textbf{Classification Control}} & \bitbox{4}{NNG} & \bitbox{4}{On/off}& \bitbox{4}{NNG}& \bitbox{4}{On/off}& \bitbox{8}{NNG} & \bitbox{8}{On/off}\\
\bitbox{12}{\textbf{Compressing Interval}} & \bitbox{2}{R} & \bitbox{2}{S}& \bitbox{2}{R}&\bitbox{2}{S}& \bitbox{2}{R} & \bitbox{2}{S}& \bitbox{2}{R} & \bitbox{2} {S}& \bitbox{4}{R} & \bitbox{4}{S}& \bitbox{4}{R} & \bitbox{4}{S}\\
\bitbox{12}{\textbf{Compatibility Fan}} & \bitbox{1}{V} & \bitbox{1}{F}& \bitbox{1}{V}& \bitbox{1}{F}& \bitbox{1}{V} & \bitbox{1}{F}& \bitbox{1}{V}& \bitbox{1}{F}& \bitbox{1}{V} & \bitbox{1}{F}& \bitbox{1}{V}& \bitbox{1}{F}& \bitbox{1}{V} & \bitbox{1}{F}& \bitbox{1}{V}& \bitbox{1}{F}& \bitbox{2}{V} & \bitbox{2}{F}& \bitbox{2}{V}& \bitbox{2}{F}& \bitbox{2}{V} & \bitbox{2}{F}& \bitbox{2}{V}& \bitbox {2}{F}\\
\bitbox{12}{\textbf{Vertical Alignment}}& \bitbox{1}{1} & \bitbox{1}{2}& \bitbox{1}{3}& \bitbox{1}{4}& \bitbox{1}{} & \bitbox{1}{5}& \bitbox{1}{}& \bitbox{1}{}& \bitbox{1}{6} & \bitbox{1}{7}& \bitbox{1}{8}& \bitbox{1}{9}& \bitbox{1}{} & \bitbox{1}{10}& \bitbox{1}{}& \bitbox{1}{}& \bitbox{2}{11} & \bitbox{2}{}& \bitbox{2}{}& \bitbox{2}{}& \bitbox{2}{} & \bitbox{2}{}& \bitbox{2}{}& \bitbox {2}{}\\
\end{bytefield}
\end{center}
我有一张带有 \bitbox 的表格,我想从表格中删除垂直线。可以吗,还是我应该使用 \multirow 格式?
答案1
我猜你用bytefield
这个表是因为你想控制列的宽度。这也可以用tabular
s 来实现(见下文)。
但首先:\bitbox
有一个可选参数,用于设置应出现的线条。这l
是左线、r
右线、t
上线和b
下线。默认情况下,它们都已设置([lrtb]
)。通过输入,\bitbox[tb]
只会绘制水平线。不幸的是,这必须为每个框执行,因为它不能全局设置。
在第一个例子中,我随意删除了大部分但不是全部的垂直线。我还调整了位宽,所以10
不再那么拥挤了。我还修正/调整了列数。现在看起来像这样:
在第二个例子中,我删除了所有垂直线并使用了\bitboxes
,这使得输入变得更加容易。
对于第三个示例,我使用了tabular
环境。在序言中,为具有给定宽度的居中列定义了一种新的列类型。并且还为所有必要的\multicolumn
s 提供了快捷方式。它看起来与第二个示例非常相似,但表格顶部和底部的线条稍粗。为此booktabs
使用了包。
以下是所有三个示例的代码:
\documentclass{article}
\usepackage{bytefield}
\usepackage[a4paper,margin=2cm]{geometry}
% packages for tabular example
\usepackage{array}
\usepackage{booktabs}
% fixed width column, centered
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
% save some work typing
\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}
\begin{document}
% example 1
\begin{center}
\begin{bytefield}[bitwidth=1.1em]{43}
\bitbox{11}{\textbf{Made Classification}} &
\bitbox{8}{Water} &
\bitbox{8}{Air} &
\bitbox{16}{Chromium} \\
\bitbox{11}{\textbf{Classification Control}} &
\bitbox[tb]{4}{NNG} & \bitbox[tbr]{4}{On/off} &
\bitbox[tb]{4}{NNG} & \bitbox[tbr]{4}{On/off} &
\bitbox[tb]{8}{NNG} & \bitbox[tbr]{8}{On/off} \\
\bitbox{11}{\textbf{Compressing Interval}} &
\bitbox[tb]{2}{R} & \bitbox[tb]{2}{S} & \bitbox[tb]{2}{R} & \bitbox[tbr]{2}{S} &
\bitbox[tb]{2}{R} & \bitbox[tb]{2}{S} & \bitbox[tb]{2}{R} & \bitbox[tbr]{2}{S} &
\bitbox[tb]{4}{R} & \bitbox[tb]{4}{S} & \bitbox[tb]{4}{R} & \bitbox[tbr]{4}{S} \\
\bitbox{11}{\textbf{Compatibility Fan}} &
\bitbox[tb]{1}{V} & \bitbox[tb]{1}{F} & \bitbox[tb]{1}{V} & \bitbox[tb]{1}{F} & \bitbox[tb]{1}{V} & \bitbox[tb]{1}{F} & \bitbox[tb]{1}{V} & \bitbox[tbr]{1}{F} &
\bitbox[tb]{1}{V} & \bitbox[tb]{1}{F} & \bitbox[tb]{1}{V} & \bitbox[tb]{1}{F} & \bitbox[tb]{1}{V} & \bitbox[tb]{1}{F} & \bitbox[tb]{1}{V} & \bitbox[tbr]{1}{F} &
\bitbox[tb]{2}{V} & \bitbox[tb]{2}{F} & \bitbox[tb]{2}{V} & \bitbox[tb]{2}{F} & \bitbox[tb]{2}{V} & \bitbox[tb]{2}{F} & \bitbox[tb]{2}{V} & \bitbox[tbr]{2}{F} \\
\bitbox{11}{\textbf{Vertical Alignment}} &
\bitbox[tb]{1}{1} & \bitbox[tb]{1}{2} & \bitbox[tb]{1}{3} & \bitbox[tb]{1}{4} & \bitbox[tb]{1}{} & \bitbox[tb]{1}{5} & \bitbox[tb]{1}{} & \bitbox[tbr]{1}{} &
\bitbox[tb]{1}{6} & \bitbox[tb]{1}{7} & \bitbox[tb]{1}{8} & \bitbox[tb]{1}{9} & \bitbox[tb]{1}{} & \bitbox[tb]{1}{10}& \bitbox[tb]{1}{} & \bitbox[tbr]{1}{} &
\bitbox[tb]{2}{11}& \bitbox[tb]{2}{} & \bitbox[tb]{2}{} & \bitbox[tb]{2}{} & \bitbox[tb]{2}{} & \bitbox[tb]{2}{} & \bitbox[tb]{2}{} & \bitbox[tbr]{2}{} \\
\end{bytefield}
\end{center}
% example 2
\begin{center}
\begin{bytefield}[bitwidth=1.1em]{43}
\bitbox[tb]{11}{\textbf{Made Classification}} &
\bitbox[tb]{8}{Water} &
\bitbox[tb]{8}{Air} &
\bitbox[tb]{16}{Chromium} \\
\bitbox[tb]{11}{\textbf{Classification Control}} &
\bitboxes[tb]{4}{{NNG}{On/off}{NNG}{On/off}} & \bitboxes[tb]{8}{{NNG}{On/off}} \\
\bitbox[tb]{11}{\textbf{Compressing Interval}} &
\bitboxes[tb]{2}{RSRSRSRS} & \bitboxes[tb]{4}{RSRS} \\
\bitbox[tb]{11}{\textbf{Compatibility Fan}} &
\bitboxes[tb]{1}{VFVFVFVFVFVFVFVF} & \bitboxes[tb]{2}{VFVFVFVF} \\
\bitbox[tb]{11}{\textbf{Vertical Alignment}} &
\bitboxes[tb]{1}{{1}{2}{3}{4}{}{5}{}{}{6}{7}{8}{9}{}{10}{}{}} & \bitboxes[tb]{2}{{11}{}{}{}{}{}{}{}} \\
\end{bytefield}
\end{center}
% example 3
\begin{center}
\begin{tabular}{>{\bfseries}c@{\hspace{1em}}*{16}{@{}P{1.1em}}*{8}{@{}P{2.2em}}@{}}
\toprule
Made Classification &
\mc{8}{Water} &
\mc{8}{Air} &
\mc{8}{Chromium} \\
\midrule
Classification Control &
\mc{4}{NNG} & \mc{4}{On/off} &
\mc{4}{NNG} & \mc{4}{On/off} &
\mc{4}{NNG} & \mc{4}{On/off} \\
\midrule
Compressing Interval &
\mc{2}{R} & \mc{2}{S} & \mc{2}{R} & \mc{2}{S} &
\mc{2}{R} & \mc{2}{S} & \mc{2}{R} & \mc{2}{S} &
\mc{2}{R} & \mc{2}{S} & \mc{2}{R} & \mc{2}{S} \\
\midrule
Compatibility Fan &
V & F & V & F & V & F & V & F &
V & F & V & F & V & F & V & F &
V & F & V & F & V & F & V & F \\
\midrule
Vertical Alignment &
1 & 2 & 3 & 4 & & 5 & & &
6 & 7 & 8 & 9 & & 10 & & &
11 & & & & & & & \\
\bottomrule
\end{tabular}
\end{center}
\end{document}