我无法增加tblr
环境的宽度:
\begin{table}[h]
\centering
\begin{tblr}{
% Doesn't do anything.
width = 5in,
hlines,
vlines,
cell{1}{1} = {r=1,c=3}{halign=c},
cell{2}{1} = {r=1,c=3}{halign=c},
cell{3}{1} = {r=1,c=2}{halign=c},
cell{3}{3} = {r=3,c=1}{halign=c},
cell{4}{1} = {r=1,c=2}{halign=c},
cell{5}{1} = {r=1,c=2}{halign=c},
cell{6}{1} = {r=1,c=3}{halign=c}
}
\texttt{<header>} & & \\
\texttt{<nav>} & & \\
\texttt{<section>} & & \Mono{<aside>} \\
\texttt{<article>} & & \\
\texttt{<article>} & & \\
\texttt{<footer>} & & \\
\end{tblr}
\caption{HTML Semantics Example}
\label{fig:html_semantics_example}
\end{table}
我期望<section>
和<article>
列的宽度是<aside>
列的两倍,但事实并非如此。我想可以通过增加整个表格的宽度来解决这个问题。
答案1
如果要指定总宽度,则需要选择一些可以扩展的列,例如X
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tblr}{
colspec={X[halign=c,2]X[halign=c]},
width = 4in,
hlines,
vlines,
cell{1}{1} = {c=2}{},
cell{2}{1} = {c=2}{},
cell{Z}{1} = {c=2}{},
cell{3}{2} = {r=3}{},
}
\texttt{<header>} & \\
\texttt{<nav>} & \\
\texttt{<section>} & \texttt{<aside>} \\
\texttt{<article>} & \\
\texttt{<article>} & \\
\texttt{<footer>} & \\
\end{tblr}
\caption{HTML Semantics Example}
\label{fig:html_semantics_example}
\end{table}
\end{document}